@hubspot/npm-scripts 0.0.5 → 0.0.6

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/release.js +14 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/npm-scripts",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Scripts for working with npm packages in the HubSpot ecosystem",
5
5
  "author": "",
6
6
  "license": "Apache-2.0",
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,18 @@ 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
+ try {
98
+ execSync(`npm adduser --registry ${registry}`, { stdio: 'inherit' });
99
+ }
100
+ catch (authErr) {
101
+ logger.error('Failed to authenticate with npm');
102
+ process.exit(EXIT_CODES.ERROR);
103
+ }
104
+ }
93
105
  otp = await input({
94
106
  message: 'Enter your NPM one-time password:',
95
107
  });
@@ -134,7 +146,7 @@ function buildHandler({ build, postLatestRelease, packageName, localVersion, reg
134
146
  logger.log(`Changes pushed successfully`);
135
147
  await open(`${repositoryUrl}/compare/${mainBranch}...${tempBranch}`);
136
148
  }
137
- logger.success(`HubSpot CLI version ${newVersion} published successfully`);
149
+ logger.success(`${packageName} version ${newVersion} published successfully`);
138
150
  logger.log(`https://www.npmjs.com/package/${packageName}?activeTab=versions`);
139
151
  if (tag === TAG.LATEST) {
140
152
  logger.log(`\nRemember to create a new release on Github!`);