@companion-module/tools 1.0.1 → 1.1.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/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/scripts/build.js +5 -2
- package/webpack.config.cjs +40 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.0](https://github.com/bitfocus/companion-module-tools/compare/v1.0.2...v1.1.0) (2023-02-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add `--dev` parameter to produce a `development` webpack build ([ffb36bc](https://github.com/bitfocus/companion-module-tools/commit/ffb36bcd9cb5109eed0bbb05da22b4ea00745b34))
|
|
9
|
+
* allow modules to specify additional webpack plugins ([3dc1f5f](https://github.com/bitfocus/companion-module-tools/commit/3dc1f5f0da879c31dab0395ac6d012ad810ad4ad))
|
|
10
|
+
|
|
11
|
+
## [1.0.2](https://github.com/bitfocus/companion-module-tools/compare/v1.0.1...v1.0.2) (2023-02-19)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* paths on windows in bash ([85f5438](https://github.com/bitfocus/companion-module-tools/commit/85f5438a57caf0328beb26b18ef55fcab2115665))
|
|
17
|
+
|
|
3
18
|
## [1.0.1](https://github.com/bitfocus/companion-module-tools/compare/v1.0.0...v1.0.1) (2023-02-17)
|
|
4
19
|
|
|
5
20
|
|
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -30,9 +30,12 @@ console.log(`Framework path: ${frameworkDir}`)
|
|
|
30
30
|
// clean old
|
|
31
31
|
await fs.remove('pkg')
|
|
32
32
|
|
|
33
|
+
const webpackArgs = []
|
|
34
|
+
if (argv.dev) webpackArgs.push('--env', 'dev')
|
|
35
|
+
|
|
33
36
|
// build the code
|
|
34
|
-
const webpackConfig = path.join(toolsDir, 'webpack.config.cjs')
|
|
35
|
-
await $`yarn webpack -c ${webpackConfig}`
|
|
37
|
+
const webpackConfig = path.join(toolsDir, 'webpack.config.cjs').replace(/\\/g, '/') // Fix slashes because windows is a pain
|
|
38
|
+
await $`yarn webpack -c ${webpackConfig} ${webpackArgs}`
|
|
36
39
|
|
|
37
40
|
// copy in the metadata
|
|
38
41
|
await fs.copy('companion', 'pkg/companion')
|
package/webpack.config.cjs
CHANGED
|
@@ -18,40 +18,45 @@ let externalsExt = []
|
|
|
18
18
|
if (Array.isArray(webpackExt.externals)) externalsExt = webpackExt.externals
|
|
19
19
|
else if (webpackExt.externals) externalsExt = [webpackExt.externals]
|
|
20
20
|
|
|
21
|
-
module.exports = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
],
|
|
39
|
-
experiments: {
|
|
40
|
-
topLevelAwait: true,
|
|
41
|
-
},
|
|
42
|
-
module: {
|
|
43
|
-
rules: [
|
|
44
|
-
// {
|
|
45
|
-
// test: /\.json$/,
|
|
46
|
-
// type: 'asset/source',
|
|
47
|
-
// },
|
|
48
|
-
// {
|
|
49
|
-
// test: /BUILD$/,
|
|
50
|
-
// type: 'asset/resource',
|
|
51
|
-
// generator: {
|
|
52
|
-
// filename: 'BUILD',
|
|
53
|
-
// },
|
|
54
|
-
// },
|
|
21
|
+
module.exports = async (env) => {
|
|
22
|
+
return {
|
|
23
|
+
entry: {
|
|
24
|
+
main: './' + pkgJson.main, // path.join(frameworkDir, 'dist/entrypoint.js'),
|
|
25
|
+
// Allow for custom entrypoints
|
|
26
|
+
...webpackExt.entry,
|
|
27
|
+
},
|
|
28
|
+
mode: env.dev ? 'development' : 'production',
|
|
29
|
+
// devtool: env.dev ? undefined : 'source-map', // TODO - this would be nice, but I think the files have to be uploaded directly to sentry which is problematic...
|
|
30
|
+
output: {
|
|
31
|
+
path: path.resolve(process.cwd(), 'pkg'),
|
|
32
|
+
},
|
|
33
|
+
context: path.resolve(process.cwd(), '.'),
|
|
34
|
+
target: 'node',
|
|
35
|
+
externals: [
|
|
36
|
+
// Allow for custom externals
|
|
37
|
+
...externalsExt,
|
|
55
38
|
],
|
|
56
|
-
|
|
39
|
+
experiments: {
|
|
40
|
+
topLevelAwait: true,
|
|
41
|
+
},
|
|
42
|
+
module: {
|
|
43
|
+
rules: [
|
|
44
|
+
// {
|
|
45
|
+
// test: /\.json$/,
|
|
46
|
+
// type: 'asset/source',
|
|
47
|
+
// },
|
|
48
|
+
// {
|
|
49
|
+
// test: /BUILD$/,
|
|
50
|
+
// type: 'asset/resource',
|
|
51
|
+
// generator: {
|
|
52
|
+
// filename: 'BUILD',
|
|
53
|
+
// },
|
|
54
|
+
// },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
plugins: [
|
|
58
|
+
// Let modules define additional plugins. Hopefully this won't conflict with anything we add
|
|
59
|
+
...(webpackExt.plugins || []),
|
|
60
|
+
],
|
|
61
|
+
}
|
|
57
62
|
}
|