@balena/compose-parser 0.0.5 → 0.0.6
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/README.md +7 -2
- package/dist/compose.js +2 -2
- package/package.json +5 -5
- package/scripts/rename-binary.js +4 -5
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# balena-compose-
|
|
1
|
+
# balena-compose-parser
|
|
2
2
|
|
|
3
3
|
A TypeScript wrapper around [compose-go](https://github.com/compose-spec/compose-go) that parses and validates Docker Compose files for balena applications.
|
|
4
4
|
|
|
@@ -16,6 +16,11 @@ This project provides a Node.js library that uses a Go binary (built from compos
|
|
|
16
16
|
- Node.js 20+
|
|
17
17
|
- Go 1.25+ (for local builds)
|
|
18
18
|
|
|
19
|
+
## Installation
|
|
20
|
+
```
|
|
21
|
+
npm i @balena/compose-parser
|
|
22
|
+
```
|
|
23
|
+
|
|
19
24
|
## Architecture
|
|
20
25
|
|
|
21
26
|
The project consists of two main components:
|
|
@@ -66,7 +71,7 @@ npm run lint-fix
|
|
|
66
71
|
### Basic Usage
|
|
67
72
|
|
|
68
73
|
```typescript
|
|
69
|
-
import { parse, defaultComposition, toImageDescriptors } from 'balena
|
|
74
|
+
import { parse, defaultComposition, toImageDescriptors } from '@balena/compose-parser';
|
|
70
75
|
|
|
71
76
|
// Parse a compose file
|
|
72
77
|
const composition = await parse('docker-compose.yml');
|
package/dist/compose.js
CHANGED
|
@@ -20,8 +20,8 @@ async function parse(composeFilePaths) {
|
|
|
20
20
|
const projectName = (0, crypto_1.randomUUID)();
|
|
21
21
|
const fileFlags = filePaths.map((filePath) => `-f ${filePath}`).join(' ');
|
|
22
22
|
const binaryName = process.platform === 'win32'
|
|
23
|
-
? '
|
|
24
|
-
: '
|
|
23
|
+
? 'balena_compose_go.exe'
|
|
24
|
+
: 'balena_compose_go';
|
|
25
25
|
const binaryPath = path.join(__dirname, '..', 'bin', binaryName);
|
|
26
26
|
const result = await exec(`${binaryPath} ${fileFlags} ${projectName}`, {
|
|
27
27
|
env: process.env,
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/compose-parser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Wraps compose-go to parse balena-compatible docker-compose.yml files",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist",
|
|
7
7
|
"lint": "balena-lint lib/ test/ && tsc --noEmit",
|
|
8
8
|
"lint-fix": "balena-lint --fix lib/ test/",
|
|
9
9
|
"build": "npm run clean && tsc --project tsconfig.release.json",
|
|
10
|
-
"build:go": "CGO_ENABLED=0 go build -C lib -ldflags='-s -w' -o \"../bin/
|
|
10
|
+
"build:go": "CGO_ENABLED=0 go build -C lib -ldflags='-s -w' -o \"../bin/balena_compose_go$(go env GOEXE)\"",
|
|
11
11
|
"test": "npm run lint && npm run test:unit",
|
|
12
12
|
"test:unit": "ts-mocha 'test/**/*unit.spec.ts'",
|
|
13
13
|
"test:integration": "ts-mocha 'test/**/*.spec.ts'",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"main": "dist/index.js",
|
|
40
40
|
"types": "dist/index.d.ts",
|
|
41
41
|
"binary": {
|
|
42
|
-
"module_name": "
|
|
43
|
-
"module_path": "
|
|
42
|
+
"module_name": "balena_compose_go",
|
|
43
|
+
"module_path": "bin/",
|
|
44
44
|
"remote_path": "v{version}",
|
|
45
45
|
"package_name": "balena-compose-go-{platform}-{arch}.tar.gz",
|
|
46
46
|
"host": "https://github.com/balena-io-experimental/balena-compose-go/releases/download/"
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"typed-error": "^3.2.2"
|
|
70
70
|
},
|
|
71
71
|
"versionist": {
|
|
72
|
-
"publishedAt": "2025-09-16T22:
|
|
72
|
+
"publishedAt": "2025-09-16T22:33:11.738Z"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/scripts/rename-binary.js
CHANGED
|
@@ -9,21 +9,20 @@ if (!fs.existsSync(binDir)) {
|
|
|
9
9
|
process.exit(0);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
// Find
|
|
13
|
-
const files = fs.readdirSync(binDir).filter(f => f.match(/^
|
|
12
|
+
// Find file matching balena_compose_go.node
|
|
13
|
+
const files = fs.readdirSync(binDir).filter(f => f.match(/^balena_compose_go\.node$/));
|
|
14
14
|
|
|
15
15
|
if (files.length === 0) {
|
|
16
16
|
process.exit(0);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const sourceFile = path.join(binDir, files[0]);
|
|
20
|
-
const targetFile = path.join(binDir, `
|
|
20
|
+
const targetFile = path.join(binDir, `balena_compose_go${process.platform === 'win32' ? '.exe' : ''}`);
|
|
21
21
|
|
|
22
22
|
// Rename the file
|
|
23
23
|
try {
|
|
24
24
|
fs.renameSync(sourceFile, targetFile);
|
|
25
|
-
console.log(`Renamed ${files[0]} to ${path.basename(targetFile)}`);
|
|
26
25
|
} catch (err) {
|
|
27
|
-
console.error(`Failed to rename file: ${err.message}`);
|
|
26
|
+
console.error(`Failed to rename binary file: ${err.message}`);
|
|
28
27
|
process.exit(1);
|
|
29
28
|
}
|