prepare-package 1.2.3 → 1.2.4
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/dist/index.js +9 -5
- package/package.json +1 -1
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
|
-
|
|
53
|
-
|
|
54
|
-
|| process.env.npm_lifecycle_event === '
|
|
55
|
-
|
|
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
|
|