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.
Files changed (107) hide show
  1. package/README.md +3 -34
  2. package/package.json +23 -19
  3. package/src/ant.d.ts +19 -0
  4. package/src/ant.js +12 -36
  5. package/src/cert.d.ts +12 -0
  6. package/src/cert.js +87 -148
  7. package/src/clean.d.ts +4 -0
  8. package/src/clean.js +5 -13
  9. package/src/copy.d.ts +7 -0
  10. package/src/copy.js +48 -74
  11. package/src/cp.d.ts +17 -0
  12. package/src/cp.js +81 -165
  13. package/src/docker.container.d.ts +73 -0
  14. package/src/docker.container.js +208 -350
  15. package/src/docker.d.ts +68 -0
  16. package/src/docker.js +163 -339
  17. package/src/docker.network.d.ts +42 -0
  18. package/src/docker.network.js +67 -141
  19. package/src/docker.volume.d.ts +26 -0
  20. package/src/docker.volume.js +50 -124
  21. package/src/dockerCleanup.d.ts +38 -0
  22. package/src/dockerCleanup.js +62 -136
  23. package/src/dockerCompose.d.ts +154 -0
  24. package/src/dockerCompose.js +390 -716
  25. package/src/fs.d.ts +5 -0
  26. package/src/fs.js +33 -91
  27. package/src/git.d.ts +9 -0
  28. package/src/git.js +19 -29
  29. package/src/index.d.ts +20 -0
  30. package/src/index.js +20 -26
  31. package/src/maps.d.ts +33 -0
  32. package/src/maps.js +12 -82
  33. package/src/npm.d.ts +48 -0
  34. package/src/npm.js +128 -131
  35. package/src/pkg.d.ts +38 -0
  36. package/src/pkg.js +27 -74
  37. package/src/publish.d.ts +27 -0
  38. package/src/publish.js +51 -138
  39. package/src/run.d.ts +13 -0
  40. package/src/run.js +39 -84
  41. package/src/tgz.d.ts +13 -0
  42. package/src/tgz.js +54 -88
  43. package/src/version.d.ts +34 -0
  44. package/src/version.js +85 -126
  45. package/src/yarn.d.ts +44 -0
  46. package/src/yarn.js +147 -115
  47. package/ant.js +0 -43
  48. package/ant.js.flow +0 -42
  49. package/artifactory.js +0 -617
  50. package/artifactory.js.flow +0 -616
  51. package/cert.conf +0 -20
  52. package/cert.js +0 -153
  53. package/cert.js.flow +0 -152
  54. package/clean.js +0 -20
  55. package/clean.js.flow +0 -19
  56. package/copy.js +0 -80
  57. package/copy.js.flow +0 -79
  58. package/cp.js +0 -173
  59. package/cp.js.flow +0 -172
  60. package/docker.container.js +0 -390
  61. package/docker.container.js.flow +0 -389
  62. package/docker.js +0 -365
  63. package/docker.js.flow +0 -364
  64. package/docker.network.js +0 -160
  65. package/docker.network.js.flow +0 -159
  66. package/docker.volume.js +0 -136
  67. package/docker.volume.js.flow +0 -136
  68. package/dockerCleanup.js +0 -152
  69. package/dockerCleanup.js.flow +0 -151
  70. package/dockerCompose.js +0 -766
  71. package/dockerCompose.js.flow +0 -765
  72. package/flow.js +0 -21
  73. package/flow.js.flow +0 -20
  74. package/fs.js +0 -95
  75. package/fs.js.flow +0 -96
  76. package/git.js +0 -35
  77. package/git.js.flow +0 -34
  78. package/hg.js +0 -35
  79. package/hg.js.flow +0 -34
  80. package/index.js +0 -27
  81. package/index.js.flow +0 -26
  82. package/inline-resources.js +0 -158
  83. package/inline-resources.js.flow +0 -157
  84. package/maps.js +0 -112
  85. package/maps.js.flow +0 -111
  86. package/npm.js +0 -145
  87. package/npm.js.flow +0 -144
  88. package/pkg.js +0 -81
  89. package/pkg.js.flow +0 -80
  90. package/publish.js +0 -145
  91. package/publish.js.flow +0 -144
  92. package/run.js +0 -90
  93. package/run.js.flow +0 -89
  94. package/src/artifactory.js +0 -616
  95. package/src/cert.conf +0 -20
  96. package/src/flow.js +0 -20
  97. package/src/hg.js +0 -34
  98. package/src/inline-resources.js +0 -157
  99. package/src/test.js +0 -55
  100. package/test.js +0 -56
  101. package/test.js.flow +0 -55
  102. package/tgz.js +0 -102
  103. package/tgz.js.flow +0 -101
  104. package/version.js +0 -143
  105. package/version.js.flow +0 -142
  106. package/yarn.js +0 -124
  107. package/yarn.js.flow +0 -123
package/src/run.js CHANGED
@@ -1,89 +1,44 @@
1
- // @flow
2
- export function format(time?: Date = new Date()): string {
3
- return time.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, '$1');
1
+ export function format(time = new Date()) {
2
+ return time.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, '$1');
4
3
  }
5
-
6
4
  const silenceLogs = process.argv.includes('--silence-buildLog');
7
-
8
- export function buildLog(msg: string, time?: Date) {
9
- if (silenceLogs) {
10
- return;
11
- }
12
- console.info(`[${format(time || new Date())}] ${msg}`);
5
+ export function buildLog(msg, time) {
6
+ if (silenceLogs) {
7
+ return;
8
+ }
9
+ console.info(`[${format(time || new Date())}] ${msg}`);
13
10
  }
14
-
15
- export type RunnableModule<T> =
16
- | (() => Promise<T>)
17
- | { default: () => Promise<T> };
18
-
19
- export async function run<T>(
20
- fn: RunnableModule<T>,
21
- ...options: any[]
22
- ): Promise<T> {
23
- if (fn == null) {
24
- throw new Error(`Invalid argument passed to run(${fn})`);
25
- }
26
- const task = typeof fn === 'function' ? fn : fn.default;
27
- if (typeof task !== 'function') {
28
- throw new Error(
29
- 'First argument to run must be a function or module with default function.',
30
- );
31
- }
32
- const start = new Date();
33
- buildLog(`Starting '${task.name}'...`, start);
34
- const result = await task(...options);
35
- const end = new Date();
36
- const time = end.getTime() - start.getTime();
37
- buildLog(`Finished '${task.name}' after ${time} ms`, end);
38
- return result;
11
+ export async function run(fn, ...options) {
12
+ if (fn == null) {
13
+ throw new Error(`Invalid argument passed to run(${fn})`);
14
+ }
15
+ const task = typeof fn === 'function' ? fn : fn.default;
16
+ if (typeof task !== 'function') {
17
+ throw new Error('First argument to run must be a function or module with default function.');
18
+ }
19
+ const start = new Date();
20
+ buildLog(`Starting '${task.name}'...`, start);
21
+ const result = await task(...options);
22
+ const end = new Date();
23
+ const time = end.getTime() - start.getTime();
24
+ buildLog(`Finished '${task.name}' after ${time} ms`, end);
25
+ return result;
39
26
  }
40
-
41
- export type RunCliOptions<T> = {
42
- resolveFn?: (path: string) => RunnableModule<T>,
43
- defaultAction?: string | RunnableModule<T>,
44
- argv?: string[],
45
- passthroughArgv?: boolean,
46
- };
47
-
48
- export async function runCli<T>({
49
- resolveFn = (path: string) =>
50
- // $FlowFixMe
51
- require(`./${path}`).default, // eslint-disable-line
52
- defaultAction = 'publish',
53
- argv = process.argv,
54
- passthroughArgv = false,
55
- }: RunCliOptions<T> = {}): Promise<T> {
56
- const module =
57
- argv.length > 2
58
- ? resolveFn(argv[2])
59
- : typeof defaultAction === 'string'
60
- ? resolveFn(defaultAction)
61
- : defaultAction;
62
- const args = Array.isArray(passthroughArgv)
63
- ? passthroughArgv.includes(argv[2] || defaultAction)
64
- ? argv.slice(3)
65
- : []
66
- : passthroughArgv
67
- ? argv.slice(3)
68
- : [];
69
- return run(module, ...args).catch((err) => {
70
- console.error((err && err.stack) || err);
71
- process.exit(1);
72
- throw err;
73
- });
27
+ export async function runCli({ resolveFn = async (path) => import(`./${path}.js`), defaultAction = 'build', argv = process.argv, passthroughArgv = false, } = {}) {
28
+ const module = argv.length > 2
29
+ ? await resolveFn(argv[2])
30
+ : typeof defaultAction === 'string'
31
+ ? await resolveFn(defaultAction)
32
+ : defaultAction;
33
+ const args = Array.isArray(passthroughArgv)
34
+ ? passthroughArgv.includes(argv[2] || defaultAction)
35
+ ? argv.slice(3)
36
+ : []
37
+ : passthroughArgv
38
+ ? argv.slice(3)
39
+ : [];
40
+ return run(module, ...args).catch((err) => {
41
+ console.error((err && err.stack) || err);
42
+ process.exit(1);
43
+ });
74
44
  }
75
-
76
- export function handleEntryPoint<T>(
77
- mainModule: typeof module,
78
- mainModuleFilename: string,
79
- cliOptions?: RunCliOptions<T>,
80
- ) {
81
- if (require.main === mainModule) {
82
- delete require.cache[mainModuleFilename]; // eslint-disable-line no-underscore-dangle
83
- runCli(cliOptions);
84
- }
85
- }
86
-
87
- handleEntryPoint(module, __filename);
88
-
89
- export default run;
package/src/tgz.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import { Readable } from 'stream';
3
+ import tar from 'tar';
4
+ export declare type ArtifactInfo = {
5
+ contentType?: string;
6
+ md5: string;
7
+ sha1: string;
8
+ sha512: string;
9
+ size: number;
10
+ };
11
+ export declare const generateFileHash: (filePath: string, type: 'md5' | 'sha1' | 'sha512') => Promise<string>;
12
+ export declare function getArtifactInfo(artifact: string | Readable): Promise<ArtifactInfo>;
13
+ export declare function tgzDir(srcDir: string, outPath: string, options?: tar.CreateOptions): Promise<ArtifactInfo>;
package/src/tgz.js CHANGED
@@ -1,101 +1,67 @@
1
- // @flow
2
- import path from 'path';
3
- import tar from 'tar';
4
- import fs from 'fs';
5
1
  import crypto from 'crypto';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
6
4
  import StreamCounter from 'stream-counter';
7
- import { makeDir } from './fs';
8
- import { buildLog } from './run';
9
-
10
- export type ArtifactInfo = {
11
- md5: string,
12
- sha1: string,
13
- sha512: string,
14
- size: number,
15
- contentType?: string,
16
- };
17
-
18
- const generateHash = async (
19
- stream: stream$Readable,
20
- type: 'md5' | 'sha1' | 'sha512',
21
- ): Promise<string> =>
22
- new Promise((resolve, reject) => {
5
+ import tar from 'tar';
6
+ import { buildLog } from './run.js';
7
+ const generateHash = async (stream, type) => new Promise((resolve, reject) => {
23
8
  stream
24
- .pipe(crypto.createHash(type).setEncoding('hex'))
25
- .on('finish', function () {
9
+ .pipe(crypto.createHash(type).setEncoding('hex'))
10
+ .on('finish', function onFinish() {
26
11
  resolve(this.read());
27
- })
28
- .on('end', function () {
12
+ })
13
+ .on('end', function onEnd() {
29
14
  resolve(this.read());
30
- })
31
- .on('error', (err) => reject(err));
32
- });
33
-
34
- const countBytes = async (stream: stream$Readable): Promise<number> =>
35
- new Promise((resolve, reject) => {
15
+ })
16
+ .on('error', (err) => reject(err));
17
+ });
18
+ export const generateFileHash = async (filePath, type) => generateHash(fs.createReadStream(filePath), type);
19
+ const countBytes = async (stream) => new Promise((resolve, reject) => {
36
20
  const counter = new StreamCounter();
37
21
  stream
38
- .pipe(counter)
39
- .on('finish', () => resolve(counter.bytes))
40
- .on('end', () => resolve(counter.bytes))
41
- .on('error', (err) => reject(err));
42
- });
43
-
44
- const writeStreamToFile = async (stream: stream$Readable, filePath: string) =>
45
- new Promise((resolve, reject) => {
22
+ .pipe(counter)
23
+ .on('finish', () => resolve(counter.bytes))
24
+ .on('end', () => resolve(counter.bytes))
25
+ .on('error', (err) => reject(err));
26
+ });
27
+ const writeStreamToFile = async (stream, filePath) => new Promise((resolve, reject) => {
46
28
  stream
47
- .pipe(fs.createWriteStream(filePath))
48
- .on('finish', () => {
29
+ .pipe(fs.createWriteStream(filePath))
30
+ .on('finish', () => {
49
31
  buildLog(`Successfully wrote file: ${filePath}`);
50
32
  resolve();
51
- })
52
- .on('error', (err) => reject(err));
53
- });
54
-
55
- // Take the given file (path or stream) and compute the info that artifactory needs.
56
- // md5 + sha1 hash, and size in bytes
57
- export async function getArtifactInfo(
58
- artifact: string | stream$Readable,
59
- ): Promise<ArtifactInfo> {
60
- // make it into a stream
61
- const stream: stream$Readable =
62
- typeof artifact === 'string' ? fs.createReadStream(artifact) : artifact;
63
-
64
- const [md5, sha1, sha512, size] = await Promise.all([
65
- generateHash(stream, 'md5'),
66
- generateHash(stream, 'sha1'),
67
- generateHash(stream, 'sha512'),
68
- countBytes(stream),
69
- ]);
70
- return { md5, sha1, sha512, size };
33
+ })
34
+ .on('error', (err) => reject(err));
35
+ });
36
+ // Take the given file (path or stream) and compute metadata for it.
37
+ // md5 + sha hashes, and size in bytes
38
+ export async function getArtifactInfo(artifact) {
39
+ // make it into a stream
40
+ const stream = typeof artifact === 'string' ? fs.createReadStream(artifact) : artifact;
41
+ const [md5, sha1, sha512, size] = await Promise.all([
42
+ generateHash(stream, 'md5'),
43
+ generateHash(stream, 'sha1'),
44
+ generateHash(stream, 'sha512'),
45
+ countBytes(stream),
46
+ ]);
47
+ return { md5, sha1, sha512, size };
71
48
  }
72
-
73
49
  // Creates a gzipped tarball of a directory, returns sha1 + md5 hash and size of resulting file
74
- export async function tgzDir(
75
- srcDir: string,
76
- outPath: string,
77
- options?: ?{ [string]: any },
78
- ): Promise<ArtifactInfo> {
79
- await makeDir(path.dirname(outPath));
80
- const tgzStream = tar.c(
81
- // $FlowFixMe
82
- {
83
- gzip: true,
84
- cwd: srcDir,
85
- portable: true,
86
- // $FlowFixMe
87
- ...options,
88
- },
89
- ['.'],
90
- );
91
-
92
- // write the file to disk (outPath)
93
- const [info] = await Promise.all([
94
- getArtifactInfo(tgzStream),
95
- writeStreamToFile(tgzStream, `${outPath}`),
96
- ]);
97
- return {
98
- ...info,
99
- contentType: 'application/gzip',
100
- };
50
+ export async function tgzDir(srcDir, outPath, options) {
51
+ await fs.ensureDir(path.dirname(outPath));
52
+ const tgzStream = tar.c({
53
+ cwd: srcDir,
54
+ gzip: true,
55
+ portable: true,
56
+ ...options,
57
+ }, ['.']);
58
+ // write the file to disk (outPath)
59
+ const [info] = await Promise.all([
60
+ getArtifactInfo(tgzStream),
61
+ writeStreamToFile(tgzStream, `${outPath}`),
62
+ ]);
63
+ return {
64
+ ...info,
65
+ contentType: 'application/gzip',
66
+ };
101
67
  }
@@ -0,0 +1,34 @@
1
+ export declare function getBuild(): string;
2
+ export declare function getReleaseBranch(): string;
3
+ declare enum RepoType {
4
+ git = "git",
5
+ hg = "hg",
6
+ unknown = "unknown"
7
+ }
8
+ export declare function getRepoType(): Promise<RepoType>;
9
+ declare type RepoInfo = {
10
+ branch: string;
11
+ revision: string;
12
+ };
13
+ export declare function getRepoInfo(): Promise<RepoInfo>;
14
+ export declare function getDevBranch(): Promise<string>;
15
+ export declare function getIsRelease(passedBranch?: null | string, releaseOverride?: null | boolean): Promise<boolean>;
16
+ export declare function useVersionCache(useCache?: boolean): void;
17
+ export interface Version {
18
+ branch: string;
19
+ build: string;
20
+ info: string;
21
+ isRelease: boolean;
22
+ major: string;
23
+ minor: string;
24
+ name: string;
25
+ npm: string;
26
+ patch: string;
27
+ revision: string;
28
+ short: string;
29
+ }
30
+ export declare function getVersion(logIt?: boolean, release?: null | boolean): Promise<Version>;
31
+ export declare function getBanner(): Promise<string>;
32
+ export declare function getVersionCode(): Promise<string>;
33
+ export declare function getUniqueBuildTag(): Promise<string>;
34
+ export {};
package/src/version.js CHANGED
@@ -1,142 +1,101 @@
1
- // @flow
2
1
  import fs from 'fs';
3
- import { gitInfo } from './git';
4
- import { hgInfo } from './hg';
5
- import { getCfg, getPkg } from './pkg';
6
- import { buildLog } from './run';
7
-
8
- export function getBuild(): string {
9
- const arg = process.argv.find((el) => /^--buildNum=\d+$/.test(el));
10
- return (arg && arg.substr(11)) || process.env.BUILD_NUMBER || '0';
2
+ import { gitInfo } from './git.js';
3
+ import { getCfg, getPkg } from './pkg.js';
4
+ import { buildLog } from './run.js';
5
+ export function getBuild() {
6
+ const arg = process.argv.find((el) => /^--buildNum=\d+$/.test(el));
7
+ return (arg && arg.substring(11)) || process.env.BUILD_NUMBER || '0';
11
8
  }
12
-
13
- export function getReleaseBranch(): string {
14
- const { releaseBranch } = getCfg();
15
- return releaseBranch || 'master';
9
+ export function getReleaseBranch() {
10
+ const { releaseBranch } = getCfg();
11
+ return releaseBranch || 'master';
16
12
  }
17
-
18
- type RepoType = 'git' | 'hg' | 'unknown';
19
- export async function getRepoType(): Promise<RepoType> {
20
- const { repoType } = getCfg();
21
-
22
- return (
23
- repoType ||
24
- (fs.existsSync('./.hg')
25
- ? 'hg'
26
- : fs.existsSync('./.git')
27
- ? 'git'
28
- : 'unknown')
29
- );
13
+ var RepoType;
14
+ (function (RepoType) {
15
+ RepoType["git"] = "git";
16
+ RepoType["hg"] = "hg";
17
+ RepoType["unknown"] = "unknown";
18
+ })(RepoType || (RepoType = {}));
19
+ export async function getRepoType() {
20
+ const { repoType } = getCfg();
21
+ return (repoType ||
22
+ (fs.existsSync('./.git')
23
+ ? RepoType.git
24
+ : fs.existsSync('./.hg')
25
+ ? RepoType.hg
26
+ : RepoType.unknown));
30
27
  }
31
-
32
- type RepoInfo = {
33
- branch: string,
34
- revision: string,
35
- };
36
-
37
- export async function getRepoInfo(): Promise<RepoInfo> {
38
- const repoType = await getRepoType();
39
- const { branch, revision } =
40
- repoType === 'git'
41
- ? await gitInfo()
42
- : repoType === 'hg'
43
- ? await hgInfo()
44
- : {};
45
- if (!branch || !revision) {
46
- throw new Error('Failed to parse branch and revision from source repo.');
47
- }
48
- return { branch, revision };
28
+ export async function getRepoInfo() {
29
+ const repoType = await getRepoType();
30
+ if (repoType !== RepoType.git) {
31
+ throw new Error(`Unsupported repo type: ${repoType}`);
32
+ }
33
+ const { branch, revision } = await gitInfo();
34
+ if (!branch || !revision) {
35
+ throw new Error('Failed to parse branch and revision from source repo.');
36
+ }
37
+ return { branch, revision };
49
38
  }
50
-
51
- export async function getDevBranch(): Promise<string> {
52
- const { devBranch } = getCfg();
53
- return devBranch || (await getRepoType()) === 'hg' ? 'default' : 'dev';
39
+ export async function getDevBranch() {
40
+ const { devBranch } = getCfg();
41
+ return devBranch || ((await getRepoType()) === 'hg' ? 'default' : 'dev');
54
42
  }
55
-
56
- export async function getIsRelease(
57
- passedBranch?: ?string = null,
58
- releaseOverride?: ?boolean = null,
59
- ): Promise<boolean> {
60
- const branch = passedBranch || (await getRepoInfo()).branch;
61
- return releaseOverride != null
62
- ? releaseOverride
63
- : process.argv.includes('--force-release-version')
64
- ? true
65
- : branch === getReleaseBranch();
43
+ export async function getIsRelease(passedBranch = null, releaseOverride = null) {
44
+ const branch = passedBranch || (await getRepoInfo()).branch;
45
+ return releaseOverride != null
46
+ ? releaseOverride
47
+ : process.argv.includes('--force-release-version')
48
+ ? true
49
+ : branch === getReleaseBranch();
66
50
  }
67
-
68
51
  let cacheVersion = true;
69
- export function useVersionCache(useCache: boolean = true): void {
70
- cacheVersion = useCache;
52
+ export function useVersionCache(useCache = true) {
53
+ cacheVersion = useCache;
71
54
  }
72
-
73
- export type Version = {|
74
- branch: string,
75
- build: string,
76
- info: string,
77
- isRelease: boolean,
78
- major: string,
79
- minor: string,
80
- name: string,
81
- npm: string,
82
- patch: string,
83
- revision: string,
84
- short: string,
85
- |};
86
-
87
55
  let version = null;
88
- export async function getVersion(
89
- logIt: boolean = true,
90
- release: ?boolean = null,
91
- ): Promise<Version> {
92
- if (!cacheVersion || version == null) {
93
- const { version: pkgVers, name } = getPkg();
94
- const { branch, revision } = await getRepoInfo();
95
- const [, major, minor, patch] =
96
- pkgVers.match(/^(\d+)\.(\d+)\.(\d+)$/) || [];
97
- if (!major || !minor || !patch) {
98
- throw new Error('Invalid version format in package.json');
99
- }
100
- const build = getBuild();
101
- const isRelease = await getIsRelease(branch, release);
102
- const short = `${major}.${minor}.${patch}`;
103
- const npm = `${short}${isRelease ? '' : `-${branch}.${build}`}`;
104
- const info = `${short}${
105
- isRelease ? `+${build}.` : `-${branch}.${build}+`
106
- }${revision}`;
107
- version = {
108
- name,
109
- branch,
110
- revision,
111
- major,
112
- minor,
113
- patch,
114
- build,
115
- short,
116
- isRelease,
117
- npm,
118
- info,
119
- };
120
- if (logIt) {
121
- buildLog(`Building version ${info}`);
56
+ export async function getVersion(logIt = true, release = null) {
57
+ if (!cacheVersion || version == null) {
58
+ const { name, version: pkgVers } = getPkg();
59
+ const { branch, revision } = await getRepoInfo();
60
+ const [, major, minor, patch] = pkgVers.match(/^(\d+)\.(\d+)\.(\d+)$/) || [];
61
+ if (!major || !minor || !patch) {
62
+ throw new Error('Invalid version format in package.json');
63
+ }
64
+ const build = getBuild();
65
+ const isRelease = await getIsRelease(branch, release);
66
+ const short = `${major}.${minor}.${patch}`;
67
+ const npm = `${short}${isRelease ? '' : `-${branch}.${build}`}`;
68
+ const info = `${short}${isRelease ? `+${build}.` : `-${branch}.${build}+`}${revision}`;
69
+ version = {
70
+ branch,
71
+ build,
72
+ info,
73
+ isRelease,
74
+ major,
75
+ minor,
76
+ name,
77
+ npm,
78
+ patch,
79
+ revision,
80
+ short,
81
+ };
82
+ if (logIt) {
83
+ buildLog(`Building version ${info}`);
84
+ }
122
85
  }
123
- }
124
- return version;
86
+ return version;
125
87
  }
126
-
127
- export async function getBanner(): Promise<string> {
128
- const { copyright = '' } = getCfg();
129
- const { info, name } = await getVersion();
130
- const today = new Date();
131
- return `${name} v${info} | (c) ${today.getFullYear()} ${copyright} | built on ${today.toISOString()}`;
88
+ export async function getBanner() {
89
+ const { copyright = '' } = getCfg();
90
+ const { info, name } = await getVersion();
91
+ const today = new Date();
92
+ return `${name} v${info} | (c) ${today.getFullYear()} ${copyright} | built on ${today.toISOString()}`;
132
93
  }
133
-
134
- export async function getVersionCode(): Promise<string> {
135
- return `// This file is auto-generated
94
+ export async function getVersionCode() {
95
+ return `// This file is auto-generated
136
96
  export const version = ${JSON.stringify(await getVersion(), null, 2)}`;
137
97
  }
138
-
139
- export async function getUniqueBuildTag(): Promise<string> {
140
- const { branch, revision, build } = await getVersion();
141
- return `${branch}-${revision}-${build}`;
98
+ export async function getUniqueBuildTag() {
99
+ const { branch, build, revision } = await getVersion();
100
+ return `${branch}-${revision}-${build}`;
142
101
  }
package/src/yarn.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { SpawnOptions, SpawnResult } from './cp.js';
2
+ import { NpmConfig, NpmCreds } from './npm.js';
3
+ export interface YarnOptions {
4
+ args?: string[];
5
+ spawnOptions?: SpawnOptions;
6
+ }
7
+ export declare function yarn({ args, spawnOptions, }?: YarnOptions): Promise<SpawnResult>;
8
+ export declare const yarnFiles: string[];
9
+ export interface YarnInstallOptions {
10
+ force?: boolean;
11
+ hashFilePath?: string;
12
+ nodeModulesPath?: string;
13
+ }
14
+ export declare function yarnInstall({ force, hashFilePath, nodeModulesPath, }?: YarnInstallOptions): Promise<void>;
15
+ export interface YarnUpgradeOptions {
16
+ /**
17
+ * `false` by default
18
+ * we assume any package with an explicit version shouldn't be touched
19
+ */
20
+ all?: boolean;
21
+ /**
22
+ * Use `yarn outdated` to find packages that should be upgraded
23
+ * May include breaking changes (major version changes)
24
+ */
25
+ outdated?: boolean;
26
+ }
27
+ export declare function yarnUpgrade({ all, outdated, }?: YarnUpgradeOptions): Promise<void>;
28
+ export interface YarnPublishOptions {
29
+ npmAuthToken?: string;
30
+ npmConfig?: NpmConfig;
31
+ npmCreds?: NpmCreds;
32
+ npmPath?: string;
33
+ publishPath?: string;
34
+ skipExisting?: boolean;
35
+ tag?: string;
36
+ workDir?: string;
37
+ }
38
+ export declare function yarnPublish({ npmAuthToken, npmConfig, npmCreds, npmPath, publishPath, skipExisting, tag, workDir: passedWorkDir, }?: YarnPublishOptions): Promise<boolean>;
39
+ interface YarnPackOptions {
40
+ destination: string;
41
+ workDir?: string;
42
+ }
43
+ export declare function yarnPack({ destination, workDir, }: YarnPackOptions): Promise<string>;
44
+ export {};