Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndesi committed Mar 2, 2024
1 parent a419b6d commit 605177a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 36 deletions.
4 changes: 3 additions & 1 deletion src/EmberNexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import 'reflect-metadata';
import { Container } from 'typedi';

import GetElementEndpoint from '~/Endpoint/Element/GetElementEndpoint';
import { Logger } from '~/Service/Logger';
import { WebSdkConfiguration } from '~/Service/WebSdkConfiguration';
import { Node } from '~/Type/Definition/Node';
import { Relation } from '~/Type/Definition/Relation';
import { Uuid } from '~/Type/Definition/Uuid';

Expand All @@ -13,4 +15,4 @@ class EmberNexus {
}
}

export { EmberNexus, Container, WebSdkConfiguration };
export { EmberNexus, Container, WebSdkConfiguration, Logger };
49 changes: 38 additions & 11 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,53 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
<script src="./dist/bundle.js"></script>
<script src="./dist/bundle.js" type="module"></script>
</head>
<body>

<p>Test</p>

<script>
const emberNexusWebSDK = new this.EmberNexusWebSDK.EmberNexus();
let configuration = this.EmberNexusWebSDK.Container.get(this.EmberNexusWebSDK.WebSdkConfiguration);
configuration.setApiHost("http://localhost:80");
<script type="module">
import { EmberNexus, Container, WebSdkConfiguration, Logger } from './dist/bundle.js';

let res = emberNexusWebSDK.test("9edb178e-1b4a-4518-a9d3-0fa97e6d1007");
res.then((node) => {
console.log(node);
})
console.log("hi :D");
console.log(EmberNexus);

let res2 = emberNexusWebSDK.test("9edb178e-1b4a-4518-a9d3-0fa97e6d1008");
res2.catch(() => {})
let configuration = Container.get(WebSdkConfiguration);
configuration.setApiHost("http://localhost:80");

// const newLogger = new class NewLogger {
//
// debug(...args) {
// // console.log("debug", args);
// }
//
// error(...args) {
// console.log("error", args);
// }
//
// info(...args) {
// console.log("info", args);
// }
//
// warn(...args) {
// console.log("warn", args);
// }
// };
//
// Container.set(Logger, newLogger);

let emberNexus = new EmberNexus();

let res = emberNexus.test("9edb178e-1b4a-4518-a9d3-0fa97e6d1007");
res
.then((node) => {console.log(node)})
.catch((error) => {console.log("error", error)});

let res2 = emberNexus.test("9edb178e-1b4a-4518-a9d3-0fa97e6d1008");
res2
.then((node) => {console.log(node)})
.catch((error) => {console.log("error", error)});
</script>

</body>
Expand Down
51 changes: 27 additions & 24 deletions webpack.release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ const TerserPlugin = require("terser-webpack-plugin");

module.exports = {
entry: './src/EmberNexus.ts',
mode: "production",
mode: "production",
module: {
rules: [
{
test: /\.ts?$/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.release.json'
}
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.release.json'
}
}
],
exclude: /node_modules/
},
Expand All @@ -26,30 +26,33 @@ module.exports = {
'~': path.resolve(__dirname, 'src/'),
}
},
experiments: {
outputModule: true,
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
library: 'EmberNexusWebSDK',
libraryTarget: 'umd',
umdNamedDefine: true
library: {
type: 'module'
}
},
performance: {
hints: false
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
keep_classnames: true,
keep_fnames: true,
},
extractComments: false,
}),
],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
format: {
comments: false,
},
keep_classnames: true,
keep_fnames: true,
},
extractComments: false,
}),
],
},
};

0 comments on commit 605177a

Please sign in to comment.