@hubspot/npm-scripts 0.0.4-beta.0 → 0.0.4-experimental.1
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/package.json +2 -2
- package/src/release.js +9 -2
- package/src/types.d.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/npm-scripts",
|
|
3
|
-
"version": "0.0.4-
|
|
3
|
+
"version": "0.0.4-experimental.1",
|
|
4
4
|
"description": "Scripts for working with npm packages in the HubSpot ecosystem",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"eslint-plugin-import": "^2.32.0",
|
|
39
39
|
"globals": "^16.4.0",
|
|
40
40
|
"husky": "^4.3.8",
|
|
41
|
-
"lint-staged": "^
|
|
41
|
+
"lint-staged": "^15.2.10",
|
|
42
42
|
"prettier": "^3.6.2",
|
|
43
43
|
"tsx": "^4.20.5",
|
|
44
44
|
"typescript": "^5.6.2"
|
package/src/release.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { exec as _exec } from 'node:child_process';
|
|
1
|
+
import { exec as _exec, execSync } from 'node:child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import semver from 'semver';
|
|
@@ -90,6 +90,12 @@ function buildHandler({ build, postLatestRelease, packageName, localVersion, reg
|
|
|
90
90
|
}
|
|
91
91
|
let otp = '';
|
|
92
92
|
if (!isDryRun) {
|
|
93
|
+
try {
|
|
94
|
+
await exec(`npm whoami --registry ${registry}`);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
execSync(`npm adduser --registry ${registry}`, { stdio: 'inherit' });
|
|
98
|
+
}
|
|
93
99
|
otp = await input({
|
|
94
100
|
message: 'Enter your NPM one-time password:',
|
|
95
101
|
});
|
|
@@ -140,7 +146,7 @@ function buildHandler({ build, postLatestRelease, packageName, localVersion, reg
|
|
|
140
146
|
logger.log(`\nRemember to create a new release on Github!`);
|
|
141
147
|
await open(`${repositoryUrl}/releases/new`);
|
|
142
148
|
if (postLatestRelease && typeof postLatestRelease === 'function') {
|
|
143
|
-
await postLatestRelease();
|
|
149
|
+
await postLatestRelease({ newVersion, dryRun });
|
|
144
150
|
}
|
|
145
151
|
}
|
|
146
152
|
};
|
|
@@ -162,6 +168,7 @@ async function builder(yargs) {
|
|
|
162
168
|
dryRun: {
|
|
163
169
|
alias: 'd',
|
|
164
170
|
describe: 'Run through the publish process without actually publishing',
|
|
171
|
+
default: false,
|
|
165
172
|
type: 'boolean',
|
|
166
173
|
},
|
|
167
174
|
});
|
package/src/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { TAG, TAG_OPTIONS, VERSION_INCREMENT_OPTIONS } from './constants/release
|
|
|
2
2
|
export type ReleaseArguments = {
|
|
3
3
|
versionIncrement: (typeof VERSION_INCREMENT_OPTIONS)[number];
|
|
4
4
|
tag: (typeof TAG_OPTIONS)[number];
|
|
5
|
-
dryRun
|
|
5
|
+
dryRun: boolean;
|
|
6
6
|
};
|
|
7
7
|
export type DistTags = {
|
|
8
8
|
[TAG.LATEST]: string;
|
|
@@ -12,7 +12,10 @@ export type DistTags = {
|
|
|
12
12
|
export type Tag = (typeof TAG_OPTIONS)[number];
|
|
13
13
|
export interface BuildReleaseScriptBase {
|
|
14
14
|
build?: () => Promise<void> | void;
|
|
15
|
-
postLatestRelease?: (
|
|
15
|
+
postLatestRelease?: ({ newVersion, dryRun, }: {
|
|
16
|
+
newVersion: string;
|
|
17
|
+
dryRun: boolean;
|
|
18
|
+
}) => Promise<void> | void;
|
|
16
19
|
repositoryUrl: string;
|
|
17
20
|
mainBranch?: string;
|
|
18
21
|
}
|