mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-21 09:51:58 +00:00
Set up a script to automate builds, and support native extensions
This commit is contained in:
parent
7681003512
commit
e8c19df8c9
34
automation/build-bin.ts
Normal file
34
automation/build-bin.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import * as path from 'path';
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import * as FileHound from 'filehound';
|
||||||
|
import { exec as execPkg } from 'pkg';
|
||||||
|
|
||||||
|
const ROOT = path.join(__dirname, '..');
|
||||||
|
|
||||||
|
console.log('Building package...\n');
|
||||||
|
|
||||||
|
execPkg([
|
||||||
|
'--target', 'host',
|
||||||
|
'--output', 'build-bin/resin',
|
||||||
|
'package.json'
|
||||||
|
]).then(() => fs.copy(
|
||||||
|
path.join(ROOT, 'node_modules', 'opn', 'xdg-open'),
|
||||||
|
path.join(ROOT, 'build-bin', 'xdg-open')
|
||||||
|
)).then(() => {
|
||||||
|
return FileHound.create()
|
||||||
|
.paths(path.join(ROOT, 'node_modules'))
|
||||||
|
.ext(['node', 'dll'])
|
||||||
|
.find();
|
||||||
|
}).then((nativeExtensions: string[]) => {
|
||||||
|
console.log(`\nCopying to build-bin:\n${nativeExtensions.join('\n')}`);
|
||||||
|
|
||||||
|
return nativeExtensions.map((extPath) => {
|
||||||
|
return fs.copy(
|
||||||
|
extPath,
|
||||||
|
extPath.replace(
|
||||||
|
path.join(ROOT, 'node_modules'),
|
||||||
|
path.join(ROOT, 'build-bin')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
@ -31,7 +31,7 @@
|
|||||||
"prebuild": "rimraf build/ build-bin/",
|
"prebuild": "rimraf build/ build-bin/",
|
||||||
"build": "npm run build:src && npm run build:bin",
|
"build": "npm run build:src && npm run build:bin",
|
||||||
"build:src": "gulp build && tsc && npm run doc",
|
"build:src": "gulp build && tsc && npm run doc",
|
||||||
"build:bin": "pkg . -t host -o build-bin/resin && cp node_modules/opn/xdg-open build-bin/",
|
"build:bin": "ts-node automation/build-bin.ts",
|
||||||
"pretest": "npm run build",
|
"pretest": "npm run build",
|
||||||
"test": "gulp test",
|
"test": "gulp test",
|
||||||
"ci": "npm run test && catch-uncommitted",
|
"ci": "npm run test && catch-uncommitted",
|
||||||
@ -51,8 +51,11 @@
|
|||||||
"node": ">=6.0"
|
"node": ">=6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/fs-extra": "^5.0.0",
|
||||||
"catch-uncommitted": "^1.0.0",
|
"catch-uncommitted": "^1.0.0",
|
||||||
"ent": "^2.2.0",
|
"ent": "^2.2.0",
|
||||||
|
"filehound": "^1.16.2",
|
||||||
|
"fs-extra": "^5.0.0",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-coffee": "^2.2.0",
|
"gulp-coffee": "^2.2.0",
|
||||||
"gulp-coffeelint": "^0.6.0",
|
"gulp-coffeelint": "^0.6.0",
|
||||||
@ -62,6 +65,7 @@
|
|||||||
"mochainon": "^2.0.0",
|
"mochainon": "^2.0.0",
|
||||||
"pkg": "^4.3.0-beta.1",
|
"pkg": "^4.3.0-beta.1",
|
||||||
"require-npm4-to-publish": "^1.0.0",
|
"require-npm4-to-publish": "^1.0.0",
|
||||||
|
"ts-node": "^4.0.1",
|
||||||
"typescript": "^2.6.1"
|
"typescript": "^2.6.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user