@companion-module/tools 0.0.1-0 → 0.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ## [0.0.2](https://github.com/bitfocus/companion-module-tools/compare/v0.0.1...v0.0.2) (2022-07-10)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * missing webpack config ([a039dee](https://github.com/bitfocus/companion-module-tools/commit/a039deeb7c1736ce87f3bba8759c230de7ad883d))
9
+
10
+ ## 0.0.1 (2022-07-10)
11
+
12
+
13
+ ### Features
14
+
15
+ * initial commit ([c07d9af](https://github.com/bitfocus/companion-module-tools/commit/c07d9af14b2f950ac93095ed1b6e37d0a206ef99))
16
+
17
+
18
+ ### Miscellaneous Chores
19
+
20
+ * update readme ([8a240c5](https://github.com/bitfocus/companion-module-tools/commit/8a240c5bd6ebc14d9f978fd0e14dba41986626da))
package/README.md CHANGED
@@ -7,3 +7,7 @@ This is a collection of tools, used for developing and verifying Companion modul
7
7
  ### companion-module-build
8
8
 
9
9
  When used, this will build a module ready for distibution
10
+
11
+ ### companion-generate-manifest
12
+
13
+ Generate the new format manifest from an old package.json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companion-module/tools",
3
- "version": "0.0.1-0",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -14,7 +14,8 @@
14
14
  "tsconfig",
15
15
  ".prettierrc.json",
16
16
  "index.js",
17
- "CHANGELOG.md"
17
+ "CHANGELOG.md",
18
+ "webpack.*"
18
19
  ],
19
20
  "dependencies": {
20
21
  "@typescript-eslint/eslint-plugin": "^5.30.5",
@@ -0,0 +1,57 @@
1
+ const path = require('path')
2
+
3
+ const frameworkDir = path.relative(process.cwd(), path.resolve('@companion-module/base'))
4
+ const pkgJson = require(path.join(process.cwd(), 'package.json'))
5
+
6
+ if (!pkgJson.main) throw new Error(`Missing main in package.json`)
7
+
8
+ let webpackExt = {}
9
+ try {
10
+ webpackExt = require(path.join(process.cwd(), 'webpack-ext.cjs'))
11
+
12
+ console.log('Found additional webpack configuration')
13
+ } catch (e) {
14
+ // Ignore
15
+ }
16
+
17
+ let externalsExt = []
18
+ if (Array.isArray(webpackExt.externals)) externalsExt = webpackExt.externals
19
+ else if (webpackExt.externals) externalsExt = [webpackExt.externals]
20
+
21
+ module.exports = {
22
+ entry: {
23
+ main: './' + pkgJson.main, // path.join(frameworkDir, 'dist/entrypoint.js'),
24
+ // Allow for custom entrypoints
25
+ ...webpackExt.entry,
26
+ },
27
+ mode: 'production',
28
+ // devtool: 'source-map', // TODO - this would be nice, but I think the files have to be uploaded directly to sentry which is problematic...
29
+ // mode: 'development',
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,
38
+ ],
39
+ experiments: {
40
+ topLevelAwait: true,
41
+ },
42
+ module: {
43
+ rules: [
44
+ {
45
+ test: /\.json$/,
46
+ type: 'asset/inline',
47
+ },
48
+ // {
49
+ // test: /BUILD$/,
50
+ // type: 'asset/resource',
51
+ // generator: {
52
+ // filename: 'BUILD',
53
+ // },
54
+ // },
55
+ ],
56
+ },
57
+ }