build-strap 4.0.0-dev.46 → 4.0.0-dev.54
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 +3 -34
- package/package.json +23 -19
- package/src/ant.d.ts +19 -0
- package/src/ant.js +12 -36
- package/src/cert.d.ts +12 -0
- package/src/cert.js +87 -148
- package/src/clean.d.ts +4 -0
- package/src/clean.js +5 -13
- package/src/copy.d.ts +7 -0
- package/src/copy.js +48 -74
- package/src/cp.d.ts +17 -0
- package/src/cp.js +81 -165
- package/src/docker.container.d.ts +73 -0
- package/src/docker.container.js +208 -350
- package/src/docker.d.ts +68 -0
- package/src/docker.js +163 -339
- package/src/docker.network.d.ts +42 -0
- package/src/docker.network.js +67 -141
- package/src/docker.volume.d.ts +26 -0
- package/src/docker.volume.js +50 -124
- package/src/dockerCleanup.d.ts +38 -0
- package/src/dockerCleanup.js +62 -136
- package/src/dockerCompose.d.ts +154 -0
- package/src/dockerCompose.js +390 -716
- package/src/fs.d.ts +5 -0
- package/src/fs.js +33 -91
- package/src/git.d.ts +9 -0
- package/src/git.js +19 -29
- package/src/index.d.ts +20 -0
- package/src/index.js +20 -26
- package/src/maps.d.ts +33 -0
- package/src/maps.js +12 -82
- package/src/npm.d.ts +48 -0
- package/src/npm.js +128 -131
- package/src/pkg.d.ts +38 -0
- package/src/pkg.js +27 -74
- package/src/publish.d.ts +27 -0
- package/src/publish.js +51 -138
- package/src/run.d.ts +13 -0
- package/src/run.js +39 -84
- package/src/tgz.d.ts +13 -0
- package/src/tgz.js +54 -88
- package/src/version.d.ts +34 -0
- package/src/version.js +85 -126
- package/src/yarn.d.ts +44 -0
- package/src/yarn.js +147 -115
- package/ant.js +0 -43
- package/ant.js.flow +0 -42
- package/artifactory.js +0 -617
- package/artifactory.js.flow +0 -616
- package/cert.conf +0 -20
- package/cert.js +0 -153
- package/cert.js.flow +0 -152
- package/clean.js +0 -20
- package/clean.js.flow +0 -19
- package/copy.js +0 -80
- package/copy.js.flow +0 -79
- package/cp.js +0 -173
- package/cp.js.flow +0 -172
- package/docker.container.js +0 -390
- package/docker.container.js.flow +0 -389
- package/docker.js +0 -365
- package/docker.js.flow +0 -364
- package/docker.network.js +0 -160
- package/docker.network.js.flow +0 -159
- package/docker.volume.js +0 -136
- package/docker.volume.js.flow +0 -136
- package/dockerCleanup.js +0 -152
- package/dockerCleanup.js.flow +0 -151
- package/dockerCompose.js +0 -766
- package/dockerCompose.js.flow +0 -765
- package/flow.js +0 -21
- package/flow.js.flow +0 -20
- package/fs.js +0 -95
- package/fs.js.flow +0 -96
- package/git.js +0 -35
- package/git.js.flow +0 -34
- package/hg.js +0 -35
- package/hg.js.flow +0 -34
- package/index.js +0 -27
- package/index.js.flow +0 -26
- package/inline-resources.js +0 -158
- package/inline-resources.js.flow +0 -157
- package/maps.js +0 -112
- package/maps.js.flow +0 -111
- package/npm.js +0 -145
- package/npm.js.flow +0 -144
- package/pkg.js +0 -81
- package/pkg.js.flow +0 -80
- package/publish.js +0 -145
- package/publish.js.flow +0 -144
- package/run.js +0 -90
- package/run.js.flow +0 -89
- package/src/artifactory.js +0 -616
- package/src/cert.conf +0 -20
- package/src/flow.js +0 -20
- package/src/hg.js +0 -34
- package/src/inline-resources.js +0 -157
- package/src/test.js +0 -55
- package/test.js +0 -56
- package/test.js.flow +0 -55
- package/tgz.js +0 -102
- package/tgz.js.flow +0 -101
- package/version.js +0 -143
- package/version.js.flow +0 -142
- package/yarn.js +0 -124
- package/yarn.js.flow +0 -123
package/src/yarn.js
CHANGED
|
@@ -1,123 +1,155 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import md5File from 'md5-file';
|
|
3
1
|
import fs from 'fs-extra';
|
|
4
2
|
import path from 'path';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
shell: true,
|
|
26
|
-
env: process.env,
|
|
27
|
-
...spawnOptions,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (await fs.exists(localYarn))
|
|
31
|
-
? // prefer to use local copy of yarn
|
|
32
|
-
spawnAdv(process.execPath, [localYarn, ...args], spawnOpts)
|
|
33
|
-
: // fall back to globally installed yarn
|
|
34
|
-
spawnAdv('yarn', args, spawnOpts);
|
|
3
|
+
import { spawn } from './cp.js';
|
|
4
|
+
import { readDir } from './fs.js';
|
|
5
|
+
import { envNpmCreds, getNpmConfig, npmGetVersions, npmWriteRc, } from './npm.js';
|
|
6
|
+
import { getPkg, getPkgName } from './pkg.js';
|
|
7
|
+
import { buildLog } from './run.js';
|
|
8
|
+
import { generateFileHash } from './tgz.js';
|
|
9
|
+
import { getDevBranch, getVersion } from './version.js';
|
|
10
|
+
export async function yarn({ args = [], spawnOptions, } = {}) {
|
|
11
|
+
const localYarn = path.join(path.dirname(process.execPath), '/node_modules/yarn/bin/yarn.js');
|
|
12
|
+
const spawnOpts = {
|
|
13
|
+
env: process.env,
|
|
14
|
+
shell: true,
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
...spawnOptions,
|
|
17
|
+
};
|
|
18
|
+
return (await fs.pathExists(localYarn))
|
|
19
|
+
? // prefer to use local copy of yarn
|
|
20
|
+
spawn(process.execPath, [localYarn, ...args], spawnOpts)
|
|
21
|
+
: // fall back to globally installed yarn
|
|
22
|
+
spawn('yarn', args, spawnOpts);
|
|
35
23
|
}
|
|
36
|
-
|
|
37
|
-
export async function yarn(opts?: YarnOptions): Promise<string> {
|
|
38
|
-
const { args = [], spawnOptions } = opts || {};
|
|
39
|
-
return yarnAdv({
|
|
40
|
-
args,
|
|
41
|
-
spawnOptions: { rejectOnErrorCode: true, ...spawnOptions },
|
|
42
|
-
}).then((r) => r.output);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
24
|
export const yarnFiles = ['./package.json', './yarn.lock'];
|
|
46
|
-
|
|
47
|
-
export type YarnInstallOptions = {|
|
|
48
|
-
nodeModulesPath?: string,
|
|
49
|
-
hashFilePath?: string,
|
|
50
|
-
force?: boolean,
|
|
51
|
-
|};
|
|
52
|
-
|
|
53
25
|
// Smart yarn invocation, only if package changed
|
|
54
|
-
export async function yarnInstall(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} else {
|
|
75
|
-
buildLog('node packages unchanged since last build, skipping yarn.');
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
await yarn();
|
|
79
|
-
await fs.writeFile(hashFilePath, currentHash);
|
|
26
|
+
export async function yarnInstall({ force = false, hashFilePath = './download/buildHash_yarn.md5', nodeModulesPath = './node_modules', } = {}) {
|
|
27
|
+
await fs.ensureDir(nodeModulesPath);
|
|
28
|
+
const currentHash = (await Promise.all(yarnFiles.map(async (f) => generateFileHash(f, 'md5')))).join('|');
|
|
29
|
+
await fs.ensureFile(hashFilePath);
|
|
30
|
+
const prevHash = await fs.readFile(hashFilePath, 'utf8');
|
|
31
|
+
if (currentHash !== prevHash) {
|
|
32
|
+
buildLog('node package definition changed since last build, invoking yarn.');
|
|
33
|
+
}
|
|
34
|
+
else if (!(await readDir(`${nodeModulesPath}/**/*.js`)).length) {
|
|
35
|
+
buildLog('node packages missing, invoking yarn.');
|
|
36
|
+
}
|
|
37
|
+
else if (force) {
|
|
38
|
+
buildLog('node packages unchanged, but yarn forced on command line...');
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
buildLog('node packages unchanged since last build, skipping yarn.');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
await yarn();
|
|
45
|
+
await fs.writeFile(hashFilePath, currentHash);
|
|
80
46
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
buildLog('
|
|
119
|
-
|
|
47
|
+
export async function yarnUpgrade({ all = false, outdated = false, } = {}) {
|
|
48
|
+
if (outdated) {
|
|
49
|
+
const { code, stdout } = await yarn({
|
|
50
|
+
args: ['outdated'],
|
|
51
|
+
spawnOptions: {
|
|
52
|
+
captureOutput: true,
|
|
53
|
+
rejectOnErrorCode: false,
|
|
54
|
+
stdio: 'pipe',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
if (code === 0) {
|
|
58
|
+
buildLog('No outdated packages.');
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const { dependencies = {}, devDependencies = {} } = getPkg();
|
|
62
|
+
const packages = stdout
|
|
63
|
+
.split('\n')
|
|
64
|
+
.slice(5, -1)
|
|
65
|
+
.map((l) => l.split(/\s+/)[0])
|
|
66
|
+
.filter((p) => all || !/^\d/.test(dependencies[p] || devDependencies[p] || ''));
|
|
67
|
+
if (packages.length) {
|
|
68
|
+
await yarn({ args: ['add', ...packages] });
|
|
69
|
+
buildLog(`Upgraded: ${packages.join(', ')}`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
buildLog('No eligible outdated packages');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
await yarn({ args: ['upgrade'] });
|
|
77
|
+
}
|
|
78
|
+
export async function yarnPublish({ npmAuthToken, npmConfig, npmCreds, npmPath, publishPath = '.', skipExisting = false, tag, workDir: passedWorkDir, } = {}) {
|
|
79
|
+
const creds = npmCreds || envNpmCreds;
|
|
80
|
+
const authToken = npmAuthToken || process.env.NPM_TOKEN;
|
|
81
|
+
const name = getPkgName();
|
|
82
|
+
const { access, publish, registry } = npmConfig || getNpmConfig();
|
|
83
|
+
if (!publish) {
|
|
84
|
+
buildLog('npm publish info missing from package.json, skipping npm publish');
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const resolvedPath = path.resolve(publishPath);
|
|
88
|
+
const workDir = passedWorkDir ||
|
|
89
|
+
((await fs.stat(resolvedPath)).isDirectory()
|
|
90
|
+
? resolvedPath
|
|
91
|
+
: path.dirname(resolvedPath));
|
|
92
|
+
if (!(await fs.pathExists(path.join(workDir, 'package.json')))) {
|
|
93
|
+
buildLog(`warning: no package.json found in ${workDir}, skipping npm publish`);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (creds || registry || authToken) {
|
|
97
|
+
// Write out .npmrc with credentials
|
|
98
|
+
await npmWriteRc({
|
|
99
|
+
authToken: authToken ? `\${NPM_TOKEN}` : undefined,
|
|
100
|
+
creds,
|
|
101
|
+
outPath: path.join(workDir, '.npmrc'),
|
|
102
|
+
registry,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const existing = await npmGetVersions(name, npmPath);
|
|
106
|
+
const { branch, isRelease, npm: npmVersion } = await getVersion();
|
|
107
|
+
if (existing.includes(npmVersion)) {
|
|
108
|
+
if (skipExisting) {
|
|
109
|
+
buildLog('npm package with this same version already exists. Skipping publish...');
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
throw new Error('Failed to publish npm package, this version already exists!');
|
|
120
113
|
}
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
await yarn({
|
|
115
|
+
args: [
|
|
116
|
+
'publish',
|
|
117
|
+
resolvedPath,
|
|
118
|
+
'--new-version',
|
|
119
|
+
npmVersion,
|
|
120
|
+
'--tag',
|
|
121
|
+
tag ||
|
|
122
|
+
(isRelease
|
|
123
|
+
? 'latest'
|
|
124
|
+
: branch === (await getDevBranch())
|
|
125
|
+
? 'next'
|
|
126
|
+
: 'branch'),
|
|
127
|
+
...(access ? ['--access', access] : []),
|
|
128
|
+
],
|
|
129
|
+
spawnOptions: {
|
|
130
|
+
cwd: workDir,
|
|
131
|
+
env: {
|
|
132
|
+
...process.env,
|
|
133
|
+
FORCE_COLOR: 'true',
|
|
134
|
+
NPM_TOKEN: authToken,
|
|
135
|
+
},
|
|
136
|
+
shell: true,
|
|
137
|
+
stdio: 'inherit',
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
export async function yarnPack({ destination, workDir = '.', }) {
|
|
143
|
+
await fs.ensureDir(destination);
|
|
144
|
+
const version = await getVersion();
|
|
145
|
+
const name = getPkgName();
|
|
146
|
+
const filename = path.resolve(destination, `${name}-${version.npm}.tgz`);
|
|
147
|
+
await yarn({
|
|
148
|
+
args: ['pack', ...(destination ? ['--filename', filename] : [])],
|
|
149
|
+
spawnOptions: {
|
|
150
|
+
cwd: path.resolve(workDir),
|
|
151
|
+
pipeOutput: true,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
return filename;
|
|
123
155
|
}
|
package/ant.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.ant = ant;
|
|
2
|
-
var _cp = require("./cp");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Executes the given ant command
|
|
21
|
-
* @param {string} target the ant target to invoke
|
|
22
|
-
* @param {AntSpawnOptions} options
|
|
23
|
-
*/
|
|
24
|
-
async function ant(target, opts) {
|
|
25
|
-
const { properties = [], args = [], spawnOptions } = opts || {};
|
|
26
|
-
|
|
27
|
-
const execOptions = {
|
|
28
|
-
stdio: 'inherit',
|
|
29
|
-
pipeOutput: true,
|
|
30
|
-
...spawnOptions };
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
await (0, _cp.spawn)(
|
|
34
|
-
'ant',
|
|
35
|
-
[
|
|
36
|
-
target,
|
|
37
|
-
...args,
|
|
38
|
-
...properties.map(({ name, value }) => `-D${name}=${value}`)],
|
|
39
|
-
|
|
40
|
-
execOptions);
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hbnQuanMiXSwibmFtZXMiOlsiYW50IiwidGFyZ2V0Iiwib3B0cyIsInByb3BlcnRpZXMiLCJhcmdzIiwic3Bhd25PcHRpb25zIiwiZXhlY09wdGlvbnMiLCJzdGRpbyIsInBpcGVPdXRwdXQiLCJtYXAiLCJuYW1lIiwidmFsdWUiXSwibWFwcGluZ3MiOiI7QUFDQTs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFpQkE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNPLGVBQWVBLEdBQWYsQ0FBbUJDLE1BQW5CLEVBQW1DQyxJQUFuQyxFQUEyRDtBQUNoRSxRQUFNLEVBQUVDLFVBQVUsR0FBRyxFQUFmLEVBQW1CQyxJQUFJLEdBQUcsRUFBMUIsRUFBOEJDLFlBQTlCLEtBQStDSCxJQUFJLElBQUksRUFBN0Q7O0FBRUEsUUFBTUksV0FBVyxHQUFHO0FBQ2xCQyxJQUFBQSxLQUFLLEVBQUUsU0FEVztBQUVsQkMsSUFBQUEsVUFBVSxFQUFFLElBRk07QUFHbEIsT0FBR0gsWUFIZSxFQUFwQjs7O0FBTUEsUUFBTTtBQUNKLE9BREk7QUFFSjtBQUNFSixFQUFBQSxNQURGO0FBRUUsS0FBR0csSUFGTDtBQUdFLEtBQUdELFVBQVUsQ0FBQ00sR0FBWCxDQUFlLENBQUMsRUFBRUMsSUFBRixFQUFRQyxLQUFSLEVBQUQsS0FBc0IsS0FBSUQsSUFBSyxJQUFHQyxLQUFNLEVBQXZELENBSEwsQ0FGSTs7QUFPSkwsRUFBQUEsV0FQSSxDQUFOOztBQVNEIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQGZsb3dcbmltcG9ydCB7IHNwYXduIH0gZnJvbSAnLi9jcCc7XG5pbXBvcnQgdHlwZSB7IFNwYXduT3B0aW9ucyB9IGZyb20gJy4vY3AnO1xuXG4vKipcbiAqIE5hbWVkIHZhbHVlIHBhaXIgdG8gdXNlIHdoZW4gY29uZmlndXJpbmcgYW4gQW50IGJ1aWxkIHByb3BlcnR5XG4gKi9cbmV4cG9ydCB0eXBlIEFudFByb3BlcnR5Q29uZmlndXJhdGlvbiA9IHt8XG4gIG5hbWU6IHN0cmluZyxcbiAgdmFsdWU6IHN0cmluZyxcbnx9O1xuXG5leHBvcnQgdHlwZSBBbnRTcGF3bk9wdGlvbnMgPSB7fFxuICBwcm9wZXJ0aWVzPzogQW50UHJvcGVydHlDb25maWd1cmF0aW9uW10sIC8vIEFudCBwcm9wZXJ0eSB2YWx1ZXMgdG8gY29uZmlndXJlXG4gIGFyZ3M/OiBzdHJpbmdbXSwgLy8gQW55IGFkZGl0aW9uYWwgY29tbWFuZCBsaW5lIGFyZ3VtZW50cyB0byBwYXNzXG4gIHNwYXduT3B0aW9ucz86IFNwYXduT3B0aW9ucywgLy8gT3B0aW9uYWwgc3Bhd24gY29uZmlndXJhdGlvbi4gRGVmYXVsdHMgdG8gcnVuIHRoZSBwcm9qZWN0IHJvb3QgZGlyZWN0b3J5XG58fTtcblxuLyoqXG4gKiBFeGVjdXRlcyB0aGUgZ2l2ZW4gYW50IGNvbW1hbmRcbiAqIEBwYXJhbSB7c3RyaW5nfSB0YXJnZXQgdGhlIGFudCB0YXJnZXQgdG8gaW52b2tlXG4gKiBAcGFyYW0ge0FudFNwYXduT3B0aW9uc30gb3B0aW9uc1xuICovXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gYW50KHRhcmdldDogc3RyaW5nLCBvcHRzPzogQW50U3Bhd25PcHRpb25zKSB7XG4gIGNvbnN0IHsgcHJvcGVydGllcyA9IFtdLCBhcmdzID0gW10sIHNwYXduT3B0aW9ucyB9ID0gb3B0cyB8fCB7fTtcblxuICBjb25zdCBleGVjT3B0aW9ucyA9IHtcbiAgICBzdGRpbzogJ2luaGVyaXQnLFxuICAgIHBpcGVPdXRwdXQ6IHRydWUsXG4gICAgLi4uc3Bhd25PcHRpb25zLFxuICB9O1xuXG4gIGF3YWl0IHNwYXduKFxuICAgICdhbnQnLFxuICAgIFtcbiAgICAgIHRhcmdldCxcbiAgICAgIC4uLmFyZ3MsXG4gICAgICAuLi5wcm9wZXJ0aWVzLm1hcCgoeyBuYW1lLCB2YWx1ZSB9KSA9PiBgLUQke25hbWV9PSR7dmFsdWV9YCksXG4gICAgXSxcbiAgICBleGVjT3B0aW9ucyxcbiAgKTtcbn1cbiJdfQ==
|
package/ant.js.flow
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import { spawn } from './cp';
|
|
3
|
-
import type { SpawnOptions } from './cp';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Named value pair to use when configuring an Ant build property
|
|
7
|
-
*/
|
|
8
|
-
export type AntPropertyConfiguration = {|
|
|
9
|
-
name: string,
|
|
10
|
-
value: string,
|
|
11
|
-
|};
|
|
12
|
-
|
|
13
|
-
export type AntSpawnOptions = {|
|
|
14
|
-
properties?: AntPropertyConfiguration[], // Ant property values to configure
|
|
15
|
-
args?: string[], // Any additional command line arguments to pass
|
|
16
|
-
spawnOptions?: SpawnOptions, // Optional spawn configuration. Defaults to run the project root directory
|
|
17
|
-
|};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Executes the given ant command
|
|
21
|
-
* @param {string} target the ant target to invoke
|
|
22
|
-
* @param {AntSpawnOptions} options
|
|
23
|
-
*/
|
|
24
|
-
export async function ant(target: string, opts?: AntSpawnOptions) {
|
|
25
|
-
const { properties = [], args = [], spawnOptions } = opts || {};
|
|
26
|
-
|
|
27
|
-
const execOptions = {
|
|
28
|
-
stdio: 'inherit',
|
|
29
|
-
pipeOutput: true,
|
|
30
|
-
...spawnOptions,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
await spawn(
|
|
34
|
-
'ant',
|
|
35
|
-
[
|
|
36
|
-
target,
|
|
37
|
-
...args,
|
|
38
|
-
...properties.map(({ name, value }) => `-D${name}=${value}`),
|
|
39
|
-
],
|
|
40
|
-
execOptions,
|
|
41
|
-
);
|
|
42
|
-
}
|