@companion-module/tools 0.5.1 → 1.0.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 +19 -0
- package/package.json +8 -8
- package/scripts/build.js +25 -7
- package/scripts/check.js +3 -1
- package/scripts/generate-manifest.js +3 -1
- package/webpack.config.cjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.0](https://github.com/bitfocus/companion-module-tools/compare/v0.5.2...v1.0.0) (2023-02-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* rename webpack-ext.cjs to build-config.cjs
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* rename webpack-ext.cjs to build-config.cjs ([c8864cd](https://github.com/bitfocus/companion-module-tools/commit/c8864cd55306a4ae60c6602cf7c73bf81eb585be))
|
|
13
|
+
* support including 'extraFiles' in the built pkg ([b130f57](https://github.com/bitfocus/companion-module-tools/commit/b130f572a13ddef49596ba0a4103d18d22b8a231))
|
|
14
|
+
|
|
15
|
+
## [0.5.2](https://github.com/bitfocus/companion-module-tools/compare/v0.5.1...v0.5.2) (2023-01-10)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* scripts unable to resolve dependencies ([312caf3](https://github.com/bitfocus/companion-module-tools/commit/312caf36f42bb17965fc010e80bd2184c4bf8a62))
|
|
21
|
+
|
|
3
22
|
## [0.5.1](https://github.com/bitfocus/companion-module-tools/compare/v0.5.0...v0.5.1) (2022-12-01)
|
|
4
23
|
|
|
5
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companion-module/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"webpack.*"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
27
|
-
"@typescript-eslint/parser": "^5.
|
|
28
|
-
"eslint": "^8.
|
|
29
|
-
"eslint-config-prettier": "^8.
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
27
|
+
"@typescript-eslint/parser": "^5.50.0",
|
|
28
|
+
"eslint": "^8.33.0",
|
|
29
|
+
"eslint-config-prettier": "^8.6.0",
|
|
30
30
|
"eslint-plugin-node": "^11.1.0",
|
|
31
31
|
"eslint-plugin-prettier": "^4.2.1",
|
|
32
32
|
"find-up": "^6.3.0",
|
|
33
33
|
"parse-author": "^2.0.0",
|
|
34
|
-
"prettier": "^2.8.
|
|
35
|
-
"tar": "^6.1.
|
|
34
|
+
"prettier": "^2.8.3",
|
|
35
|
+
"tar": "^6.1.13",
|
|
36
36
|
"webpack": "^5.75.0",
|
|
37
|
-
"webpack-cli": "^5.0.
|
|
37
|
+
"webpack-cli": "^5.0.1",
|
|
38
38
|
"zx": "^7.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/scripts/build.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The zx shebang doesn't resolve dependencies correctly
|
|
3
|
+
import 'zx/globals'
|
|
2
4
|
|
|
3
5
|
import path from 'path'
|
|
4
6
|
import { fs } from 'zx'
|
|
5
7
|
import { findUp } from 'find-up'
|
|
6
8
|
import * as tar from 'tar'
|
|
7
9
|
import { validateManifest } from '@companion-module/base'
|
|
10
|
+
import { createRequire } from 'module'
|
|
11
|
+
|
|
12
|
+
const require = createRequire(import.meta.url)
|
|
8
13
|
|
|
9
14
|
async function findModuleDir(cwd) {
|
|
10
15
|
const stat = await fs.stat(cwd)
|
|
@@ -35,6 +40,7 @@ await fs.copy('companion', 'pkg/companion')
|
|
|
35
40
|
const srcPackageJson = JSON.parse(await fs.readFile(path.resolve('./package.json')))
|
|
36
41
|
const frameworkPackageJson = JSON.parse(await fs.readFile(path.join(frameworkDir, 'package.json')))
|
|
37
42
|
|
|
43
|
+
// Copy the manifest, overriding some properties
|
|
38
44
|
const manifestJson = JSON.parse(await fs.readFile(path.resolve('./companion/manifest.json')))
|
|
39
45
|
manifestJson.runtime.entrypoint = '../main.js'
|
|
40
46
|
manifestJson.version = srcPackageJson.version
|
|
@@ -61,9 +67,11 @@ const packageJson = {
|
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
// Ensure that any externals are added as dependencies
|
|
64
|
-
const webpackExtPath = path.resolve('
|
|
70
|
+
const webpackExtPath = path.resolve('build-config.cjs')
|
|
65
71
|
if (fs.existsSync(webpackExtPath)) {
|
|
66
72
|
const webpackExt = require(webpackExtPath)
|
|
73
|
+
|
|
74
|
+
// Add any external dependencies, with versions matching what is currntly installed
|
|
67
75
|
if (webpackExt.externals) {
|
|
68
76
|
const extArray = Array.isArray(webpackExt.externals) ? webpackExt.externals : [webpackExt.externals]
|
|
69
77
|
for (const extGroup of extArray) {
|
|
@@ -79,6 +87,7 @@ if (fs.existsSync(webpackExtPath)) {
|
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
89
|
|
|
90
|
+
// Copy across any prebuilds that can be loaded corectly
|
|
82
91
|
if (webpackExt.prebuilds) {
|
|
83
92
|
await fs.mkdir('pkg/prebuilds')
|
|
84
93
|
|
|
@@ -90,22 +99,31 @@ if (fs.existsSync(webpackExtPath)) {
|
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
}
|
|
102
|
+
|
|
103
|
+
// copy extra files
|
|
104
|
+
if (Array.isArray(webpackExt.extraFiles)) {
|
|
105
|
+
const files = await globby(webpackExt.extraFiles)
|
|
106
|
+
for (const file of files) {
|
|
107
|
+
await fs.copy(file, path.join('pkg', file), {
|
|
108
|
+
recursive: true,
|
|
109
|
+
overwrite: false,
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
}
|
|
93
113
|
}
|
|
94
114
|
|
|
95
115
|
// Write the package.json
|
|
96
116
|
// packageJson.bundleDependencies = Object.keys(packageJson.dependencies)
|
|
97
117
|
await fs.writeFile('pkg/package.json', JSON.stringify(packageJson))
|
|
98
118
|
|
|
119
|
+
// If we found any depenendencies for the pkg, install them
|
|
99
120
|
if (Object.keys(packageJson.dependencies).length) {
|
|
100
|
-
await $`yarn --cwd pkg`
|
|
121
|
+
await $`yarn --cwd pkg install`
|
|
101
122
|
}
|
|
102
123
|
|
|
103
124
|
// Create tgz of the build
|
|
104
|
-
// await $`yarn --cwd pkg pack --filename pkg/package.tgz`
|
|
105
|
-
|
|
106
125
|
await tar
|
|
107
|
-
.
|
|
108
|
-
// or tar.create
|
|
126
|
+
.create(
|
|
109
127
|
{
|
|
110
128
|
gzip: true,
|
|
111
129
|
},
|
package/scripts/check.js
CHANGED
package/webpack.config.cjs
CHANGED
|
@@ -7,7 +7,7 @@ if (!pkgJson.main) throw new Error(`Missing main in package.json`)
|
|
|
7
7
|
|
|
8
8
|
let webpackExt = {}
|
|
9
9
|
try {
|
|
10
|
-
webpackExt = require(path.join(process.cwd(), '
|
|
10
|
+
webpackExt = require(path.join(process.cwd(), 'build-config.cjs'))
|
|
11
11
|
|
|
12
12
|
console.log('Found additional webpack configuration')
|
|
13
13
|
} catch (e) {
|