dazscript-framework 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dazscript-framework",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "author": "Freddy Diaz",
5
5
  "license": "MPL-2.0",
6
6
  "description": "",
@@ -12,6 +12,9 @@
12
12
  "dsa",
13
13
  "dse"
14
14
  ],
15
+ "scripts": {
16
+ "dsf-init": "node ./shared/dsf-init.js"
17
+ },
15
18
  "exports": {
16
19
  "./webpack": "./webpack.config.js",
17
20
  "./babel": "./babel/babel.config.js",
@@ -0,0 +1,34 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const packageJsonPath = path.resolve(process.cwd(), 'package.json');
5
+
6
+ const newScripts = {
7
+ build: 'webpack',
8
+ watch: 'webpack --watch',
9
+ icons: 'copyfiles -u 1 src/**/*.png dist/',
10
+ installers:
11
+ 'node ./node_modules/dazscript-framework/shared/install-generator.js -p ./src/scripts -m /My Scripts',
12
+ };
13
+
14
+ fs.readFile(packageJsonPath, 'utf8', (err, data) => {
15
+ if (err) {
16
+ console.error('Error reading package.json', err);
17
+ return;
18
+ }
19
+
20
+ const packageJson = JSON.parse(data);
21
+
22
+ // If scripts already exist, merge them
23
+ packageJson.scripts = packageJson.scripts || {};
24
+ Object.assign(packageJson.scripts, newScripts);
25
+
26
+ // Write the updated package.json back
27
+ fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), (err) => {
28
+ if (err) {
29
+ console.error('Error writing package.json', err);
30
+ } else {
31
+ console.log('Scripts successfully added to package.json');
32
+ }
33
+ });
34
+ });
package/webpack.config.js CHANGED
@@ -22,13 +22,30 @@ module.exports = (env, argv) => {
22
22
  rules: [
23
23
  {
24
24
  test: /\.ts$/,
25
- use: ['babel-loader', 'ts-loader'],
26
- exclude: /node_modules/,
25
+ use: [
26
+ {
27
+ loader: 'babel-loader',
28
+ },
29
+ {
30
+ loader: 'ts-loader',
31
+ options: {
32
+ allowTsInNodeModules: true,
33
+ },
34
+ },
35
+ ],
36
+ exclude: [
37
+ {
38
+ and: [path.resolve(__dirname, 'node_modules')],
39
+ not: [
40
+ path.resolve(__dirname, 'node_modules/dazscript-framework'),
41
+ ],
42
+ },
43
+ ],
27
44
  },
28
45
  ],
29
46
  },
30
47
  resolve: {
31
- extensions: ['.tsx', '.ts', '.js'],
48
+ extensions: ['.ts'],
32
49
  plugins: [new TsconfigPathsPlugin()],
33
50
  },
34
51
  output: {