prepare-package 1.2.3 → 1.2.5

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/dist/index.js +10 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -49,10 +49,11 @@ module.exports = async function (options) {
49
49
  options.singleFile = options.singleFile || null; // For watch mode - single file to process
50
50
 
51
51
  // Detect if running via npm publish
52
- const isPublishing = process.env.npm_lifecycle_event === 'prepublishOnly'
53
- || process.env.npm_lifecycle_event === 'prepublish'
54
- || process.env.npm_lifecycle_event === 'publish';
55
- const isManualPrepare = process.env.npm_lifecycle_event === 'prepare';
52
+ // When npm publish runs, it sets npm_command to 'publish' even though lifecycle_event is 'prepare'
53
+ const isPublishing = process.env.npm_command === 'publish'
54
+ || process.env.npm_lifecycle_event === 'prepublishOnly'
55
+ || process.env.npm_lifecycle_event === 'prepublish';
56
+ const isManualPrepare = process.env.npm_lifecycle_event === 'prepare' && !isPublishing;
56
57
 
57
58
  // Set the paths
58
59
  const theirPackageJSONPath = path.resolve(options.cwd, 'package.json');
@@ -63,6 +64,7 @@ module.exports = async function (options) {
63
64
  const theirPackageJSON = theirPackageJSONExists ? require(theirPackageJSONPath) : {};
64
65
  const isLivePreparation = theirPackageJSON.name !== 'prepare-package';
65
66
 
67
+
66
68
  // Check for local dependencies when publishing
67
69
  if (isPublishing) {
68
70
  const hasLocalDeps = checkForLocalDependencies(theirPackageJSON);
@@ -108,8 +110,10 @@ module.exports = async function (options) {
108
110
  input: theirPackageJSON.preparePackage.input,
109
111
  output: theirPackageJSON.preparePackage.output,
110
112
  main: theirPackageJSON.main,
113
+
114
+ // lifecycle: process.env.npm_lifecycle_event,
115
+ // command: process.env.npm_command,
111
116
  isPublishing: isPublishing,
112
- lifecycle: process.env.npm_lifecycle_event,
113
117
  });
114
118
  }
115
119
 
@@ -196,7 +200,7 @@ module.exports = async function (options) {
196
200
  })
197
201
  .then((r) => {
198
202
  // console.log(chalk.green(`[prepare-package]: Purged ${theirPackageJSON.name}`));
199
- logger.log(chalk.green(`Purged ${theirPackageJSON.name}!`));
203
+ logger.log(chalk.green(`Purged ${theirPackageJSON.name}: status=${r.status}, id=${r.id}, timestamp=${r.timestamp}`));
200
204
  })
201
205
  .catch((e) => {
202
206
  // console.log(chalk.red(`[prepare-package]: Failed to purge ${theirPackageJSON.name}`, e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prepare-package",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Prepare a Node.js package before being published",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -42,9 +42,9 @@
42
42
  "chalk": "^4.1.2",
43
43
  "chokidar": "^4.0.3",
44
44
  "fs-jetpack": "^5.1.0",
45
- "wonderful-fetch": "^1.3.3"
45
+ "wonderful-fetch": "^1.3.4"
46
46
  },
47
47
  "devDependencies": {
48
48
  "mocha": "^8.4.0"
49
49
  }
50
- }
50
+ }