ump 3.5.7 → 4.0.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/lib/commands.js CHANGED
@@ -164,28 +164,33 @@ const commands = {
164
164
  throw new Error('Skipping execution');
165
165
  }
166
166
 
167
- // if (lines.length) {
168
- // console.log(lines);
169
- // utils.error(`Git working directory not clean:\n\t${lines.join('\n\t')}`);
170
- // }
167
+ if (lines.length) {
168
+ console.log(lines);
169
+ utils.error(`Git working directory not clean:\n\t${lines.join('\n\t')}`);
170
+ }
171
171
 
172
172
  try {
173
- const ret = await peach(releaseSteps.slice(-1), (command) => {
173
+ const ret = await peach(releaseSteps, (command) => {
174
174
  return exec(command)
175
175
  .then(() => {
176
176
  log.color(`Executed ${command}`, 'cyan');
177
177
  })
178
178
  .catch(async(err) => {
179
- console.log('npm publish?', command.includes('npm publish'));
180
- console.log('npm error code EOTP?', err.message.includes('npm error code EOTP'));
181
- console.log('has1PasswordVars?', has1PasswordVars());
179
+ if (command.includes('npm publish') && err.message.includes('npm error code EOTP')) {
180
+ if (has1PasswordVars()) {
181
+ const flags = getFlags(opts.publishFlags);
182
+ const oneTimePassword = await getTotp();
183
+
184
+ log.color('npm publish command failed with EOTP error', 'red');
185
+ log.color('Trying again with one-time password', 'cyan');
182
186
 
183
- if (command.includes('npm publish') && err.message.includes('npm error code EOTP') && has1PasswordVars()) {
184
- const flags = getFlags(opts.publishFlags);
185
- const oneTimePassword = await getTotp();
187
+ return exec(`npm publish${flags} --otp=${oneTimePassword}`);
188
+ }
186
189
 
187
- return exec(`npm publish${flags} --otp=${oneTimePassword}`);
190
+ log.color('One-time password is not set', 'red');
191
+ log.color('Try using the --otp option to provide a one-time password', 'cyan');
188
192
  }
193
+
189
194
  utils.error(err);
190
195
  });
191
196
  });
package/lib/log.js CHANGED
@@ -1,8 +1,8 @@
1
- import chalk from 'chalk';
1
+ import {styleText} from 'node:util';
2
2
 
3
3
  const log = {
4
4
  color: function(str, color) {
5
- const txt = color ? chalk[color](str) : str;
5
+ const txt = color ? styleText(color, str) : str;
6
6
 
7
7
  console.log(txt);
8
8
  },
@@ -10,9 +10,9 @@ const log = {
10
10
  const files = opts.files.join(', ');
11
11
 
12
12
  console.log('');
13
- console.log(chalk.bold('SET FILES:\t'), chalk.yellow(files));
14
- console.log(chalk.bold('OLD VERSION:\t'), chalk.yellow(opts.version));
15
- console.log(chalk.bold('NEW VERSION:\t'), chalk.yellow(opts.newVersion));
13
+ console.log(styleText('bold', 'SET FILES:\t'), styleText('yellow', files));
14
+ console.log(styleText('bold', 'OLD VERSION:\t'), styleText('yellow', opts.version));
15
+ console.log(styleText('bold', 'NEW VERSION:\t'), styleText('yellow', opts.newVersion));
16
16
  },
17
17
  tasks: function(tasks) {
18
18
  console.log('\nAbout to execute the following:');
@@ -21,7 +21,7 @@ const log = {
21
21
  });
22
22
  },
23
23
  keyValue: function(key, value) {
24
- console.log(chalk.dim(key), value);
24
+ console.log(styleText('dim', key), value);
25
25
  },
26
26
  };
27
27
 
package/lib/utils.js CHANGED
@@ -4,7 +4,7 @@ import path from 'path';
4
4
  import fs from 'fs';
5
5
  import util from 'util';
6
6
  import {globSync} from 'glob';
7
- import chalk from 'chalk';
7
+ import {styleText} from 'node:util';
8
8
  import rc from 'rc';
9
9
  import semver from 'semver';
10
10
  import {config} from './config.js';
@@ -118,10 +118,10 @@ const utils = {
118
118
 
119
119
  // Special case for no releaseType (user just types "ump")
120
120
  if (isErr === 'noRelease') {
121
- console.log(chalk.yellow(chalk.bold('\nCURRENT VERSION:'), opts.version));
121
+ console.log(styleText(['yellow', 'bold'], '\nCURRENT VERSION:'));
122
122
  } else if (isErr) {
123
123
  // All other errors
124
- console.log(chalk.red(`\n${config.messages[isErr]}` || config.messages[def]));
124
+ console.log(styleText('red', `\n${config.messages[isErr]}` || config.messages[def]));
125
125
 
126
126
  ['releaseType', 'sourceFile', 'version'].forEach((item) => {
127
127
  log.keyValue(item, opts[item]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ump",
3
3
  "title": "ump",
4
- "version": "3.5.7",
4
+ "version": "4.0.0",
5
5
  "description": "Bump without the B",
6
6
  "scripts": {
7
7
  "test": "npm run test:clean && npm run test:pre && npm run test:run",
@@ -25,18 +25,17 @@
25
25
  "url": "https://karlswedberg.com/"
26
26
  },
27
27
  "engines": {
28
- "node": ">=14"
28
+ "node": ">=20.12.0"
29
29
  },
30
30
  "dependencies": {
31
31
  "@1password/sdk": "^0.3.1",
32
- "@inquirer/confirm": "^6.0.3",
33
- "@inquirer/select": "^5.0.3",
34
- "chalk": "^5.6.2",
32
+ "@inquirer/confirm": "^6.0.4",
33
+ "@inquirer/select": "^5.0.4",
35
34
  "fs-extra": "^11.3.2",
36
35
  "git-config": "^0.0.7",
37
- "glob": "^13.0.0",
36
+ "glob": "^13.0.1",
38
37
  "rc": "^1.2.8",
39
- "semver": "^7.7.3",
38
+ "semver": "^7.7.4",
40
39
  "update-notifier": "^7.3.1",
41
40
  "yargs": "^18.0.0"
42
41
  },
@@ -44,7 +43,7 @@
44
43
  "@types/mocha": "^10.0.10",
45
44
  "chai": "^6.2.1",
46
45
  "eslint": "^9.39.2",
47
- "eslint-config-kswedberg": "^7.2.2",
46
+ "eslint-config-kswedberg": "^7.2.3",
48
47
  "mocha": "^11.7.5"
49
48
  },
50
49
  "license": "MIT"