@vixoniccom/module-packager 2.13.0-test.0 → 2.13.0-test.2

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/dist/main.js CHANGED
@@ -68,7 +68,6 @@ function createElectronArgs(mode) {
68
68
  ];
69
69
  }
70
70
  function spawnElectronProcess(mode) {
71
- console.log('env:', process.env.AQI_TOKEN);
72
71
  const args = createElectronArgs(mode);
73
72
  const nodeEnv = mode === 'run' ? 'production' : 'development';
74
73
  const child = spawn(npxPath, ['electron', ...args], {
@@ -13,9 +13,7 @@ export default (env = {}, argv = {}) => {
13
13
  port: env.port ?? 8080,
14
14
  mode: argv.mode ?? 'production',
15
15
  };
16
- const isDev = options.mode === 'development' ||
17
- argv.watch === true ||
18
- process.env.NODE_ENV === 'development';
16
+ const isDev = options.mode === 'development' || argv.watch === true || process.env.NODE_ENV === 'development';
19
17
  const buildPath = path.resolve(options.build);
20
18
  const controllerHtmlPath = path.resolve(options.src, 'index.html');
21
19
  const controllerStaticPath = path.resolve(path.dirname(controllerHtmlPath), '../static');
@@ -24,20 +22,22 @@ export default (env = {}, argv = {}) => {
24
22
  return {
25
23
  mode: isDev ? 'development' : 'production',
26
24
  target: options.target ?? 'electron-renderer',
27
- entry: isDev ? [
28
- `webpack-dev-server/client?http://localhost:${options.port}/`,
29
- 'webpack/hot/dev-server',
30
- path.resolve(options.src, 'main.ts')
31
- ] : path.resolve(options.src, 'main.ts'),
25
+ entry: isDev
26
+ ? [
27
+ `webpack-dev-server/client?http://localhost:${options.port}/`,
28
+ 'webpack/hot/dev-server',
29
+ path.resolve(options.src, 'main.ts'),
30
+ ]
31
+ : path.resolve(options.src, 'main.ts'),
32
32
  output: {
33
33
  path: buildPath,
34
34
  filename: '[name].js',
35
- publicPath: isDev ? '/' : './'
35
+ publicPath: isDev ? '/' : './',
36
36
  },
37
37
  performance: {
38
38
  maxAssetSize: 2000000, //2MB
39
39
  maxEntrypointSize: 2000000,
40
- hints: isDev ? false : 'warning'
40
+ hints: isDev ? false : 'warning',
41
41
  },
42
42
  externals: {
43
43
  electron: 'commonjs electron',
@@ -46,7 +46,7 @@ export default (env = {}, argv = {}) => {
46
46
  'terser-webpack-plugin': 'commonjs terser-webpack-plugin',
47
47
  esbuild: 'commonjs esbuild',
48
48
  '@swc/core': 'commonjs @swc/core',
49
- '@swc/wasm': 'commonjs @swc/wasm'
49
+ '@swc/wasm': 'commonjs @swc/wasm',
50
50
  },
51
51
  resolve: {
52
52
  extensions: ['.tsx', '.ts', '.js', '.jsx', '.mjs'],
@@ -54,9 +54,9 @@ export default (env = {}, argv = {}) => {
54
54
  fullySpecified: false,
55
55
  fallback: {
56
56
  process: require.resolve('process/browser.js'),
57
- global: require.resolve('global')
57
+ global: require.resolve('global'),
58
58
  },
59
- modules: ['node_modules', 'src', 'static']
59
+ modules: ['node_modules', 'src', 'static'],
60
60
  },
61
61
  module: {
62
62
  rules: [
@@ -66,25 +66,25 @@ export default (env = {}, argv = {}) => {
66
66
  use: {
67
67
  loader: 'ts-loader',
68
68
  options: {
69
- transpileOnly: true
70
- }
71
- }
69
+ transpileOnly: true,
70
+ },
71
+ },
72
72
  },
73
73
  {
74
74
  test: /\.s[ac]ss$/,
75
- use: ['style-loader', 'css-loader', 'sass-loader']
75
+ use: ['style-loader', 'css-loader', 'sass-loader'],
76
76
  },
77
77
  {
78
78
  test: /\.css$/,
79
79
  use: ['style-loader', 'css-loader'],
80
- exclude: /node_modules/
80
+ exclude: /node_modules/,
81
81
  },
82
82
  {
83
83
  test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|mp4)$/,
84
84
  type: 'asset/resource',
85
85
  generator: {
86
- filename: '[name][ext]'
87
- }
86
+ filename: '[name][ext]',
87
+ },
88
88
  },
89
89
  {
90
90
  test: /\.html$/,
@@ -92,32 +92,34 @@ export default (env = {}, argv = {}) => {
92
92
  loader: 'html-loader',
93
93
  options: {
94
94
  sources: false,
95
- }
96
- }
97
- }
98
- ]
95
+ },
96
+ },
97
+ },
98
+ ],
99
99
  },
100
100
  plugins: [
101
101
  new webpack.DefinePlugin({
102
- global: 'globalThis'
102
+ global: 'globalThis',
103
+ // env variables
104
+ 'process.env.AQI_TOKEN': JSON.stringify(process.env.AQI_TOKEN || ''),
103
105
  }),
104
106
  new webpack.ProvidePlugin({
105
- process: 'process/browser.js'
107
+ process: 'process/browser.js',
106
108
  }),
107
109
  new CleanWebpackPlugin(),
108
110
  new HtmlWebpackPlugin({
109
111
  template: controllerHtmlPath,
110
112
  filename: 'index.html',
111
113
  inject: 'body',
112
- chunks: ['main']
114
+ chunks: ['main'],
113
115
  }),
114
116
  new CopyWebpackPlugin({
115
117
  patterns: [
116
118
  { from: controllerStaticPath, to: 'static', noErrorOnMissing: true },
117
119
  { from: controllerFontsPath, to: 'fonts', noErrorOnMissing: true },
118
- { from: controllerTestPath, to: 'test', noErrorOnMissing: true }
119
- ]
120
- })
120
+ { from: controllerTestPath, to: 'test', noErrorOnMissing: true },
121
+ ],
122
+ }),
121
123
  ],
122
124
  optimization: {
123
125
  minimize: !isDev,
@@ -128,31 +130,33 @@ export default (env = {}, argv = {}) => {
128
130
  ecma: 2020,
129
131
  compress: true,
130
132
  mangle: true,
131
- format: { comments: false }
132
- }
133
- })
134
- ]
133
+ format: { comments: false },
134
+ },
135
+ }),
136
+ ],
135
137
  },
136
138
  devtool: isDev ? 'source-map' : false,
137
- devServer: isDev ? {
138
- static: [
139
- {
140
- directory: path.resolve(options.src, 'test'),
141
- publicPath: '/test',
142
- watch: true,
143
- }
144
- ],
145
- open: false,
146
- client: {
147
- overlay: true
148
- },
149
- port: options.port || 8080,
150
- hot: true,
151
- historyApiFallback: true,
152
- devMiddleware: {
153
- publicPath: '/',
154
- writeToDisk: false
139
+ devServer: isDev
140
+ ? {
141
+ static: [
142
+ {
143
+ directory: path.resolve(options.src, 'test'),
144
+ publicPath: '/test',
145
+ watch: true,
146
+ },
147
+ ],
148
+ open: false,
149
+ client: {
150
+ overlay: true,
151
+ },
152
+ port: options.port || 8080,
153
+ hot: true,
154
+ historyApiFallback: true,
155
+ devMiddleware: {
156
+ publicPath: '/',
157
+ writeToDisk: false,
158
+ },
155
159
  }
156
- } : undefined
160
+ : undefined,
157
161
  };
158
162
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vixoniccom/module-packager",
3
- "version": "2.13.0-test.0",
3
+ "version": "2.13.0-test.2",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "bin": {