adm-build
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
var argv = process.argv.slice(2); | ||
var argv = process.argv; | ||
var $0 = process.env.CMD ? process.env.CMD : path.basename(argv[1]); | ||
@@ -16,2 +16,4 @@ var app = $0.split(' ')[0]; | ||
argv = argv.slice(2); | ||
var build = require('..'); | ||
@@ -18,0 +20,0 @@ yargs(argv) |
@@ -10,5 +10,5 @@ 'use strict'; | ||
'PATH=' + options.contHome + '/node/bin:' + options.contToolsPath + ':$PATH', | ||
'npm rebuild;' | ||
'npm rebuild --production --unsafe-perm;' | ||
].join(' ') | ||
]); | ||
}; |
@@ -34,3 +34,3 @@ 'use strict'; | ||
var packageDir = '.'; | ||
var category = '.'; | ||
var type = options.type; | ||
@@ -48,6 +48,6 @@ if (type === 'auto') { | ||
case 'driver': | ||
packageDir = 'drivers'; | ||
category = 'drivers'; | ||
break; | ||
case 'app': | ||
packageDir = 'apps'; | ||
category = 'apps'; | ||
break; | ||
@@ -57,13 +57,14 @@ } | ||
var root = options.root || DEFAULT_ROOT; | ||
console.log('install root', root); | ||
// Copy built files to dist path | ||
var targetPath = path.join(hostDist, root, packageDir, pkg.name); | ||
fs.ensureDirSync(targetPath); | ||
fs.copySync(hostBuildPath, targetPath); | ||
var hostAppPath = path.join(hostDist, root, category, pkg.name); | ||
var contAppPath = path.join(contDist, root, category, pkg.name); | ||
fs.ensureDirSync(hostAppPath); | ||
fs.copySync(hostBuildPath, hostAppPath); | ||
// Prepare template context | ||
var tplctx = { | ||
basePath: root, // installation path | ||
packageDir: packageDir, // package dir | ||
apphome: path.join(root, category, pkg.name), | ||
basepath: root, // installation path | ||
category: category, // package dir | ||
name: pkg.name // module name | ||
@@ -75,18 +76,26 @@ }; | ||
// Post Install | ||
// After Install | ||
// try load custom postinstall script or using template to generate a postinstall script | ||
var hostPostInstallPath = path.join(ctx.hostDistRoot, 'postinstall-deb-' + arch); | ||
var contPostInstallPath = path.join(ctx.contDistRoot, 'postinstall-deb-' + arch); | ||
var customPostInstallPath = path.join(customPackConf, 'postinstall-deb'); | ||
var hostAfterInstallPath, contAfterInstallPath; | ||
var customAfterInstallPath = path.join(customPackConf, 'after-install-deb'); | ||
if (fs.existsSync(customPostInstallPath)) { | ||
log.debug('pack-deb', 'Copying custom post install script form "%s" to "%s"', customPostInstallPath, hostPostInstallPath); | ||
fs.copySync(customPostInstallPath, hostPostInstallPath); | ||
} else { | ||
log.debug('pack-deb', 'Generating default post install script to "%s"', hostPostInstallPath); | ||
var source = fs.readFileSync(path.resolve(__dirname, '../templates/postinstall.hbs'), "utf-8"); | ||
var template = Handlebars.compile(source); | ||
var data = template(tplctx); | ||
fs.writeFileSync(hostPostInstallPath, data); | ||
var source, template, data; | ||
if (fs.existsSync(customAfterInstallPath)) { | ||
hostAfterInstallPath = path.join(ctx.hostDistRoot, 'after-install-deb-' + arch); | ||
contAfterInstallPath = path.join(ctx.contDistRoot, 'after-install-deb-' + arch); | ||
log.debug('pack-deb', 'Generating post install script according "%s" to "%s"', customAfterInstallPath, hostAfterInstallPath); | ||
source = fs.readFileSync(customAfterInstallPath, "utf-8"); | ||
template = Handlebars.compile(source); | ||
data = template(tplctx); | ||
fs.writeFileSync(hostAfterInstallPath, data); | ||
} | ||
// else { | ||
// log.debug('pack-deb', 'Generating default post install script to "%s"', hostAfterInstallPath); | ||
// source = fs.readFileSync(path.resolve(__dirname, '../templates/after-install.hbs'), "utf-8"); | ||
// template = Handlebars.compile(source); | ||
// data = template(tplctx); | ||
// fs.writeFileSync(hostAfterInstallPath, data); | ||
// } | ||
@@ -112,11 +121,15 @@ // Packing | ||
'-f', | ||
'-p', utils.quote(path.join(ctx.contDistRoot, packageFileName)), | ||
'--after-install', utils.quote(contPostInstallPath), | ||
'.' | ||
].join(' '); | ||
'-p', utils.quote(path.join(ctx.contDistRoot, packageFileName)) | ||
]; | ||
if (contAfterInstallPath) { | ||
cmd = cmd.concat(['--after-install', utils.quote(contAfterInstallPath)]); | ||
} | ||
cmd.push('.'); | ||
log.info('deb', 'Packing %s for architecture %s in formatting %s to %s', pkg.name, arch, 'deb', packageFilePath); | ||
return docker.runNativeDockerCommand(ctx.mountArgs, cmd).then(function () { | ||
// fs.removeSync(hostDist); | ||
return docker.runNativeDockerCommand(ctx.mountArgs, cmd.join(' ')).then(function () { | ||
}); | ||
}; |
{ | ||
"name": "adm-build", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Build nodejs application to arm or amd64 package", | ||
@@ -18,3 +18,3 @@ "homepage": "", | ||
}, | ||
"main": "lib/index.js", | ||
"main": "lib/build.js", | ||
"keywords": [ | ||
@@ -34,3 +34,3 @@ "adm", | ||
"async": "^1.5.2", | ||
"bluebird": "^3.3.3", | ||
"bluebird": "^3.3.4", | ||
"chalk": "^1.1.1", | ||
@@ -40,4 +40,4 @@ "debug": "^2.2.0", | ||
"handlebars": "^4.0.5", | ||
"ignore": "^2.2.19", | ||
"lodash": "^4.5.1", | ||
"ignore": "^3.0.5", | ||
"lodash": "^4.6.1", | ||
"ncp": "^2.0.0", | ||
@@ -47,8 +47,8 @@ "needs": "^1.0.2", | ||
"tmp": "0.0.28", | ||
"yargs": "^4.1.0" | ||
"yargs": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^2.1.0", | ||
"eslint-config-xo-space": "^0.10.0", | ||
"gulp": "^3.9.0", | ||
"eslint": "^2.3.0", | ||
"eslint-config-xo-space": "^0.11.0", | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^2.0.0", | ||
@@ -58,6 +58,6 @@ "gulp-exclude-gitignore": "^1.0.0", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-mocha": "^2.0.0", | ||
"gulp-plumber": "^1.0.0", | ||
"gulp-nsp": "^2.1.0", | ||
"gulp-coveralls": "^0.1.0" | ||
"gulp-mocha": "^2.2.0", | ||
"gulp-plumber": "^1.1.0", | ||
"gulp-nsp": "^2.3.0", | ||
"gulp-coveralls": "^0.1.4" | ||
}, | ||
@@ -64,0 +64,0 @@ "eslintConfig": { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
29803
30
539
2
10
+ Addedignore@3.3.10(transitive)
- Removedignore@2.2.19(transitive)
Updatedbluebird@^3.3.4
Updatedignore@^3.0.5
Updatedlodash@^4.6.1
Updatedyargs@^4.2.0