@vixoniccom/module-packager 2.13.0-dev.1 → 2.13.0-test.0

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