@companion-module/tools 2.6.0 → 2.7.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.7.0](https://github.com/bitfocus/companion-module-tools/compare/v2.6.1...v2.7.0) (2026-02-22)
4
+
5
+
6
+ ### Features
7
+
8
+ * support module-api 2.0 ([034bbf2](https://github.com/bitfocus/companion-module-tools/commit/034bbf2da1ce34c6499819146d7be71b5233d230))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * refuse to run if yarn pnp is enabled ([91593ba](https://github.com/bitfocus/companion-module-tools/commit/91593bad3e6464e658748a67af2d5caf94b2e405))
14
+ * restrict the allowed versions of api libraries this will build ([bcbeb87](https://github.com/bitfocus/companion-module-tools/commit/bcbeb87b9018146cff0deb9a4411050d63402ec4))
15
+
16
+ ## [2.6.1](https://github.com/bitfocus/companion-module-tools/compare/v2.6.0...v2.6.1) (2026-01-29)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * downgrade find-up for nodejs 18 suppport ([2c35333](https://github.com/bitfocus/companion-module-tools/commit/2c35333b067c30b80e54c9c91e4d3a497dad67b5))
22
+
3
23
  ## [2.6.0](https://github.com/bitfocus/companion-module-tools/compare/v2.5.0...v2.6.0) (2026-01-28)
4
24
 
5
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companion-module/tools",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -28,20 +28,20 @@
28
28
  "webpack.*"
29
29
  ],
30
30
  "dependencies": {
31
- "@eslint/js": "^9.39.2",
31
+ "@eslint/js": "^9.39.3",
32
32
  "eslint-config-prettier": "^10.1.8",
33
- "eslint-plugin-n": "^17.23.2",
33
+ "eslint-plugin-n": "^17.24.0",
34
34
  "eslint-plugin-prettier": "^5.5.5",
35
- "find-up": "^8.0.0",
35
+ "find-up": "^7.0.0",
36
36
  "parse-author": "^2.0.0",
37
- "semver": "^7.7.3",
38
- "tar": "^7.5.7",
39
- "webpack": "^5.104.1",
37
+ "semver": "^7.7.4",
38
+ "tar": "^7.5.9",
39
+ "webpack": "^5.105.2",
40
40
  "webpack-cli": "^6.0.1",
41
41
  "zx": "^8.8.5"
42
42
  },
43
43
  "peerDependencies": {
44
- "@companion-module/base": "^1.12.0",
44
+ "@companion-module/base": "^1.12.0 || ^2.0.0",
45
45
  "@companion-surface/base": "^1.0.0",
46
46
  "eslint": "^9.36.0",
47
47
  "prettier": "^3.6.2",
@@ -66,9 +66,9 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/eslint": "^9.6.1",
69
- "eslint": "^9.39.2",
69
+ "eslint": "^9.39.3",
70
70
  "prettier": "^3.8.1",
71
- "typescript-eslint": "^8.54.0"
71
+ "typescript-eslint": "^8.56.0"
72
72
  },
73
73
  "packageManager": "yarn@4.12.0"
74
74
  }
@@ -17,6 +17,11 @@ if (argv.help) {
17
17
  process.exit(0)
18
18
  }
19
19
 
20
- const { validateManifest } = await import('@companion-module/base')
20
+ let { validateManifest } = await import('@companion-module/base')
21
+ if (!validateManifest) {
22
+ // If a v2.x version of @companion-module/base is being used, it exports the function as a subpath export
23
+ const manifestPkg = await import('@companion-module/base/manifest')
24
+ validateManifest = manifestPkg.validateManifest
25
+ }
21
26
 
22
- await buildPackage('@companion-module/base', validateManifest, 'connection')
27
+ await buildPackage('@companion-module/base', validateManifest, 'connection', '>=1.4.0 <3.0.0')
@@ -19,4 +19,4 @@ if (argv.help) {
19
19
 
20
20
  const { validateSurfaceManifest } = await import('@companion-surface/base')
21
21
 
22
- await buildPackage('@companion-surface/base', validateSurfaceManifest, 'surface')
22
+ await buildPackage('@companion-surface/base', validateSurfaceManifest, 'surface', '>=1.0.0 <2.0.0')
@@ -21,7 +21,7 @@ async function findModuleDir(cwd) {
21
21
  return path.dirname(pkgJsonPath)
22
22
  }
23
23
 
24
- export async function buildPackage(frameworkPackageName, validateManifest, moduleType) {
24
+ export async function buildPackage(frameworkPackageName, validateManifest, moduleType, versionRange) {
25
25
  // const toolsDir = path.join(__dirname, '..')
26
26
  const moduleDir = process.cwd()
27
27
  const toolsDir = await findModuleDir(require.resolve('@companion-module/tools'))
@@ -31,6 +31,26 @@ export async function buildPackage(frameworkPackageName, validateManifest, modul
31
31
  console.log(`Tools path: ${toolsDir}`)
32
32
  console.log(`Framework path: ${frameworkDir}`)
33
33
 
34
+ // Check for Yarn PnP
35
+ const pnpFile = path.join(moduleDir, '.pnp.cjs')
36
+ const pnpFileAlt = path.join(moduleDir, '.pnp.js')
37
+ if ((await fs.pathExists(pnpFile)) || (await fs.pathExists(pnpFileAlt))) {
38
+ console.error("❌ Error: Yarn PnP (Plug'n'Play) is not supported.")
39
+ console.error(' The companion module build process requires a traditional node_modules structure.')
40
+ console.error(' Please add "nodeLinker: node-modules" to your .yarnrc.yml file and run "yarn install".')
41
+ process.exit(1)
42
+ }
43
+
44
+ const srcPackageJson = JSON.parse(await fs.readFile(path.resolve('./package.json')))
45
+ const frameworkPackageJson = JSON.parse(await fs.readFile(path.join(frameworkDir, 'package.json')))
46
+
47
+ // Check framework version if range is specified
48
+ if (versionRange && !semver.satisfies(frameworkPackageJson.version, versionRange)) {
49
+ console.error(`Error: ${frameworkPackageName} version ${frameworkPackageJson.version} is not supported.`)
50
+ console.error(`Required version range: ${versionRange}`)
51
+ process.exit(1)
52
+ }
53
+
34
54
  // clean old
35
55
  await fs.remove('pkg')
36
56
 
@@ -60,9 +80,6 @@ export async function buildPackage(frameworkPackageName, validateManifest, modul
60
80
  // copy in the metadata
61
81
  await fs.copy('companion', path.join(packageBaseDir, 'companion'))
62
82
 
63
- const srcPackageJson = JSON.parse(await fs.readFile(path.resolve('./package.json')))
64
- const frameworkPackageJson = JSON.parse(await fs.readFile(path.join(frameworkDir, 'package.json')))
65
-
66
83
  // Copy the manifest, overriding some properties
67
84
  const manifestJson = JSON.parse(await fs.readFile(path.resolve('./companion/manifest.json')))
68
85
  manifestJson.runtime.entrypoint = '../main.js'