@hubspot/npm-scripts 0.0.6 → 0.0.7-experimental.0
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 +72 -2
- package/package.json +8 -4
- package/src/__tests__/release.test.d.ts +1 -0
- package/src/__tests__/release.test.js +494 -0
- package/src/constants/release.d.ts +2 -1
- package/src/constants/release.js +7 -1
- package/src/constants/repo-sync.d.ts +5 -0
- package/src/constants/repo-sync.js +5 -0
- package/src/release/__tests__/steps.test.d.ts +1 -0
- package/src/release/__tests__/steps.test.js +382 -0
- package/src/release/__tests__/validate.test.d.ts +1 -0
- package/src/release/__tests__/validate.test.js +148 -0
- package/src/release/__tests__/version.test.d.ts +1 -0
- package/src/release/__tests__/version.test.js +104 -0
- package/src/release/errors.d.ts +4 -0
- package/src/release/errors.js +9 -0
- package/src/release/steps.d.ts +11 -0
- package/src/release/steps.js +159 -0
- package/src/release/types.d.ts +80 -0
- package/src/release/types.js +1 -0
- package/src/release/validate.d.ts +6 -0
- package/src/release/validate.js +33 -0
- package/src/release/version.d.ts +2 -0
- package/src/release/version.js +23 -0
- package/src/release.d.ts +1 -1
- package/src/release.js +112 -146
- package/src/repo-sync.d.ts +5 -0
- package/src/repo-sync.js +141 -0
- package/src/types.d.ts +18 -0
- package/src/utils/__tests__/filesystem.test.d.ts +1 -0
- package/src/utils/__tests__/filesystem.test.js +154 -0
- package/src/utils/__tests__/git.test.d.ts +1 -0
- package/src/utils/__tests__/git.test.js +292 -0
- package/src/utils/__tests__/logging.test.d.ts +1 -0
- package/src/utils/__tests__/logging.test.js +64 -0
- package/src/utils/__tests__/npm.test.d.ts +1 -0
- package/src/utils/__tests__/npm.test.js +246 -0
- package/src/utils/__tests__/process.test.d.ts +1 -0
- package/src/utils/__tests__/process.test.js +12 -0
- package/src/utils/__tests__/prompting.test.d.ts +1 -0
- package/src/utils/__tests__/prompting.test.js +100 -0
- package/src/utils/filesystem.d.ts +1 -0
- package/src/utils/filesystem.js +72 -0
- package/src/utils/git.d.ts +7 -1
- package/src/utils/git.js +112 -3
- package/src/utils/logging.js +2 -2
- package/src/utils/npm.d.ts +4 -2
- package/src/utils/npm.js +18 -19
package/src/utils/npm.js
CHANGED
|
@@ -9,22 +9,17 @@ export async function getDistTags(packageName) {
|
|
|
9
9
|
const distTags = stdout.trim();
|
|
10
10
|
return JSON.parse(distTags);
|
|
11
11
|
}
|
|
12
|
-
export async function publish(tag,
|
|
12
|
+
export async function publish(tag, isDryRun, ignoreScripts, registry) {
|
|
13
13
|
logger.log(`\nPublishing to ${tag}...`);
|
|
14
14
|
logger.log('-'.repeat(50));
|
|
15
15
|
logger.log('\n');
|
|
16
|
-
const commandArgs = [
|
|
17
|
-
'publish',
|
|
18
|
-
'--tag',
|
|
19
|
-
tag,
|
|
20
|
-
'--registry',
|
|
21
|
-
registry,
|
|
22
|
-
'--otp',
|
|
23
|
-
otp,
|
|
24
|
-
];
|
|
16
|
+
const commandArgs = ['publish', '--tag', tag, '--registry', registry];
|
|
25
17
|
if (isDryRun) {
|
|
26
18
|
commandArgs.push('--dry-run');
|
|
27
19
|
}
|
|
20
|
+
if (ignoreScripts) {
|
|
21
|
+
commandArgs.push('--ignore-scripts');
|
|
22
|
+
}
|
|
28
23
|
return new Promise((resolve, reject) => {
|
|
29
24
|
const childProcess = spawn('npm', commandArgs, {
|
|
30
25
|
stdio: 'inherit',
|
|
@@ -32,7 +27,7 @@ export async function publish(tag, otp, isDryRun, registry) {
|
|
|
32
27
|
});
|
|
33
28
|
childProcess.on('close', code => {
|
|
34
29
|
if (code !== EXIT_CODES.SUCCESS) {
|
|
35
|
-
reject();
|
|
30
|
+
reject(new Error(`npm publish failed with exit code ${code}`));
|
|
36
31
|
}
|
|
37
32
|
else {
|
|
38
33
|
resolve();
|
|
@@ -40,18 +35,16 @@ export async function publish(tag, otp, isDryRun, registry) {
|
|
|
40
35
|
});
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
|
-
export async function
|
|
38
|
+
export async function updateDistTag(packageName, version, tag, isDryRun, registry) {
|
|
44
39
|
logger.log();
|
|
45
|
-
logger.log(`Updating ${
|
|
40
|
+
logger.log(`Updating ${tag} tag to ${version}...`);
|
|
46
41
|
const commandArgs = [
|
|
47
42
|
'dist-tag',
|
|
48
43
|
'add',
|
|
49
|
-
`${packageName}@${
|
|
50
|
-
|
|
44
|
+
`${packageName}@${version}`,
|
|
45
|
+
tag,
|
|
51
46
|
'--registry',
|
|
52
47
|
registry,
|
|
53
|
-
'--otp',
|
|
54
|
-
otp,
|
|
55
48
|
];
|
|
56
49
|
return new Promise((resolve, reject) => {
|
|
57
50
|
if (isDryRun) {
|
|
@@ -63,13 +56,19 @@ export async function updateNextTag(packageName, newVersion, otp, isDryRun, regi
|
|
|
63
56
|
const childProcess = spawn('npm', commandArgs, { stdio: 'inherit' });
|
|
64
57
|
childProcess.on('close', code => {
|
|
65
58
|
if (code !== EXIT_CODES.SUCCESS) {
|
|
66
|
-
reject();
|
|
59
|
+
reject(new Error(`npm dist-tag add failed with exit code ${code}`));
|
|
67
60
|
}
|
|
68
61
|
else {
|
|
69
|
-
logger.success(`${
|
|
62
|
+
logger.success(`${tag} tag updated successfully`);
|
|
70
63
|
resolve();
|
|
71
64
|
}
|
|
72
65
|
});
|
|
73
66
|
}
|
|
74
67
|
});
|
|
75
68
|
}
|
|
69
|
+
export async function updateNextTag(packageName, newVersion, isDryRun, registry) {
|
|
70
|
+
return updateDistTag(packageName, newVersion, TAG.NEXT, isDryRun, registry);
|
|
71
|
+
}
|
|
72
|
+
export async function updatePreviousTag(packageName, oldLatestVersion, isDryRun, registry) {
|
|
73
|
+
return updateDistTag(packageName, oldLatestVersion, TAG.PREVIOUS, isDryRun, registry);
|
|
74
|
+
}
|