@vixoniccom/module-packager 2.12.1-test.0 → 2.13.0-dev.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 +1 -0
- package/dist/webpack.config.js +61 -53
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -13,6 +13,7 @@ import { Configuration } from '@vixoniccom/modules';
|
|
|
13
13
|
import tsNode from 'ts-node';
|
|
14
14
|
import { createRequire } from 'module';
|
|
15
15
|
import which from 'which';
|
|
16
|
+
import 'dotenv/config';
|
|
16
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
18
|
const __dirname = path.dirname(__filename);
|
|
18
19
|
const electronPath = path.join(__dirname, 'electron.js');
|
package/dist/webpack.config.js
CHANGED
|
@@ -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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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,38 @@ 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 || ''),
|
|
105
|
+
'process.env.PTS_CLIENT_ID': JSON.stringify(process.env.PTS_CLIENT_ID || ''),
|
|
106
|
+
'process.env.PTS_CLIENT_SECRET': JSON.stringify(process.env.PTS_CLIENT_SECRET || ''),
|
|
107
|
+
'process.env.FS_API_KEY': JSON.stringify(process.env.FS_API_KEY || ''),
|
|
108
|
+
'process.env.FS_API_HOST': JSON.stringify(process.env.FS_API_HOST || ''),
|
|
103
109
|
}),
|
|
104
110
|
new webpack.ProvidePlugin({
|
|
105
|
-
process: 'process/browser.js'
|
|
111
|
+
process: 'process/browser.js',
|
|
106
112
|
}),
|
|
107
113
|
new CleanWebpackPlugin(),
|
|
108
114
|
new HtmlWebpackPlugin({
|
|
109
115
|
template: controllerHtmlPath,
|
|
110
116
|
filename: 'index.html',
|
|
111
117
|
inject: 'body',
|
|
112
|
-
chunks: ['main']
|
|
118
|
+
chunks: ['main'],
|
|
113
119
|
}),
|
|
114
120
|
new CopyWebpackPlugin({
|
|
115
121
|
patterns: [
|
|
116
122
|
{ from: controllerStaticPath, to: 'static', noErrorOnMissing: true },
|
|
117
123
|
{ from: controllerFontsPath, to: 'fonts', noErrorOnMissing: true },
|
|
118
|
-
{ from: controllerTestPath, to: 'test', noErrorOnMissing: true }
|
|
119
|
-
]
|
|
120
|
-
})
|
|
124
|
+
{ from: controllerTestPath, to: 'test', noErrorOnMissing: true },
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
121
127
|
],
|
|
122
128
|
optimization: {
|
|
123
129
|
minimize: !isDev,
|
|
@@ -128,31 +134,33 @@ export default (env = {}, argv = {}) => {
|
|
|
128
134
|
ecma: 2020,
|
|
129
135
|
compress: true,
|
|
130
136
|
mangle: true,
|
|
131
|
-
format: { comments: false }
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
]
|
|
137
|
+
format: { comments: false },
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
],
|
|
135
141
|
},
|
|
136
142
|
devtool: isDev ? 'source-map' : false,
|
|
137
|
-
devServer: isDev
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
143
|
+
devServer: isDev
|
|
144
|
+
? {
|
|
145
|
+
static: [
|
|
146
|
+
{
|
|
147
|
+
directory: path.resolve(options.src, 'test'),
|
|
148
|
+
publicPath: '/test',
|
|
149
|
+
watch: true,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
open: false,
|
|
153
|
+
client: {
|
|
154
|
+
overlay: true,
|
|
155
|
+
},
|
|
156
|
+
port: options.port || 8080,
|
|
157
|
+
hot: true,
|
|
158
|
+
historyApiFallback: true,
|
|
159
|
+
devMiddleware: {
|
|
160
|
+
publicPath: '/',
|
|
161
|
+
writeToDisk: false,
|
|
162
|
+
},
|
|
155
163
|
}
|
|
156
|
-
|
|
164
|
+
: undefined,
|
|
157
165
|
};
|
|
158
166
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixoniccom/module-packager",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0-dev.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"copy-webpack-plugin": "^13.0.0",
|
|
35
35
|
"cpy-cli": "^5.0.0",
|
|
36
36
|
"css-loader": "^7.1.2",
|
|
37
|
+
"dotenv": "^17.2.1",
|
|
37
38
|
"electron": "^36.1.0",
|
|
38
39
|
"electron-debug": "^3.2.0",
|
|
39
40
|
"global": "^4.4.0",
|