@companion-module/tools 2.0.0 → 2.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 +14 -0
- package/README.md +12 -10
- package/package.json +5 -2
- package/scripts/build.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.2](https://github.com/bitfocus/companion-module-tools/compare/v2.0.1...v2.0.2) (2024-09-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* build script bad webpack path for some projects ([a35529b](https://github.com/bitfocus/companion-module-tools/commit/a35529b042ff0a93dc281da2a85ef77ff002b503))
|
|
9
|
+
|
|
10
|
+
## [2.0.1](https://github.com/bitfocus/companion-module-tools/compare/v2.0.0...v2.0.1) (2024-09-08)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* avoid `yarn` calls inside build script ([d8086c0](https://github.com/bitfocus/companion-module-tools/commit/d8086c0dda9907a387a3eb57690077f0af4459da))
|
|
16
|
+
|
|
3
17
|
## [2.0.0](https://github.com/bitfocus/companion-module-tools/compare/v1.5.1...v2.0.0) (2024-08-25)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
# @companion-module/tools
|
|
2
2
|
|
|
3
|
-
This is a collection of tools
|
|
3
|
+
This is a collection of tools used for developing and verifying Companion modules.
|
|
4
4
|
|
|
5
5
|
## Scripts
|
|
6
6
|
|
|
7
7
|
### companion-module-build
|
|
8
8
|
|
|
9
|
-
When used, this will build a module ready for
|
|
9
|
+
When used, this will build a module ready for distribution.
|
|
10
10
|
|
|
11
|
-
More information on this command is available [on the wiki](https://github.com/bitfocus/companion-module-base/wiki/Module-packaging)
|
|
11
|
+
More information on this command is available [on the wiki](https://github.com/bitfocus/companion-module-base/wiki/Module-packaging).
|
|
12
12
|
|
|
13
13
|
### companion-generate-manifest
|
|
14
14
|
|
|
15
|
-
Generate the new format manifest from an old package.json
|
|
15
|
+
Generate the new format manifest from an old `package.json`.
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
## Upgrading from v1.x to v2.0
|
|
19
19
|
|
|
20
|
-
v2.0 of this library includes some breaking changes to how eslint and prettier handled.
|
|
21
|
-
Instead of it being installed as a dependency, and being directly usable by modules it has to be explicitly installed by modules.
|
|
20
|
+
v2.0 of this library includes some breaking changes to how eslint and prettier handled. Instead of it being installed as a dependency and being directly usable by modules, it has to be explicitly installed by modules.
|
|
22
21
|
|
|
23
22
|
This change was done for two reasons:
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
1) Very few modules use eslint, making this extra weight for them for no gain.
|
|
25
25
|
2) Recent versions of yarn do not expose these binaries in a way which is easily callable by modules, requiring tricks to be able to execute them.
|
|
26
26
|
|
|
27
27
|
To resolve this, you will need to do a `yarn add --dev eslint prettier` in your modules to install the dependencies, and update any scripts to remove the invocation hacks.
|
|
28
28
|
|
|
29
|
-
This also allows for eslint to be updated to v9, which requires a new config format. This
|
|
29
|
+
This also allows for eslint to be updated to v9, which requires a new config format. This unfortunately means that your config file needs to be replaced.
|
|
30
|
+
|
|
31
|
+
A new basic config should be called `eslint.config.mjs` (remove any existing `.eslintrc.json` or `.eslintrc.cjs`) and could contain:
|
|
30
32
|
|
|
31
|
-
A new basic config should be called `eslint.config.mjs` (remove any existing `.eslintrc.json` or `.eslintrc.cjs`), and could contain:
|
|
32
33
|
```js
|
|
33
34
|
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
|
|
34
35
|
|
|
35
36
|
export default generateEslintConfig({})
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
If using
|
|
39
|
+
If using TypeScript, you should specify a `typescriptRoot`:
|
|
39
40
|
|
|
40
41
|
```js
|
|
41
42
|
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
|
|
@@ -46,6 +47,7 @@ export default generateEslintConfig({
|
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
You can easily override rules in this setup with:
|
|
50
|
+
|
|
49
51
|
```js
|
|
50
52
|
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
|
|
51
53
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companion-module/tools",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/bitfocus/companion-module-tools.git"
|
|
10
|
+
},
|
|
8
11
|
"bin": {
|
|
9
12
|
"companion-generate-manifest": "scripts/generate-manifest.js",
|
|
10
13
|
"companion-module-build": "scripts/build.js",
|
package/scripts/build.js
CHANGED
|
@@ -44,7 +44,11 @@ for (const [k, v] of Object.entries(webpackArgs)) {
|
|
|
44
44
|
// build the code
|
|
45
45
|
$.cwd = toolsDir
|
|
46
46
|
const webpackConfig = path.join(toolsDir, 'webpack.config.cjs').replace(/\\/g, '/') // Fix slashes because windows is a pain
|
|
47
|
-
|
|
47
|
+
let webpackPath = path.join(toolsDir, 'node_modules', '.bin', 'webpack').replace(/\\/g, '/') // Fix slashes because windows is a pain
|
|
48
|
+
// Try the level above too
|
|
49
|
+
if (!fs.existsSync(webpackPath)) webpackPath = path.join(toolsDir, '../../.bin/webpack').replace(/\\/g, '/') // Fix slashes because windows is a pain
|
|
50
|
+
// Use a manual path to the webpack binary to avoid issues with yarn versions
|
|
51
|
+
await $`${webpackPath} -c ${webpackConfig} ${webpackArgsArray}`
|
|
48
52
|
$.cwd = undefined
|
|
49
53
|
|
|
50
54
|
// copy in the metadata
|