prepare-package 1.1.6 → 1.1.8
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 -4
- package/package.json +2 -2
- package/src/index.js +9 -4
package/dist/index.js
CHANGED
|
@@ -50,20 +50,25 @@ module.exports = async function (options) {
|
|
|
50
50
|
const outputPath = path.resolve(options.cwd, theirPackageJSON.preparePackage.output);
|
|
51
51
|
const inputPath = path.resolve(options.cwd, theirPackageJSON.preparePackage.input);
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
|
|
53
|
+
// Check if paths exist
|
|
54
|
+
const mainPathExists = jetpack.exists(mainPath);
|
|
55
|
+
const outputPathExists = jetpack.exists(outputPath);
|
|
56
|
+
const inputPathExists = jetpack.exists(inputPath);
|
|
57
|
+
|
|
58
|
+
// Remove the output folder if it exists (input must exist too)
|
|
59
|
+
if (outputPathExists && inputPathExists) {
|
|
55
60
|
jetpack.remove(outputPath);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
// Copy the input folder to the output folder if it exists
|
|
59
|
-
if (
|
|
64
|
+
if (inputPathExists) {
|
|
60
65
|
jetpack.copy(inputPath, outputPath);
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
// Only do this part on the actual package that is using THIS package because we dont't want to replace THIS {version}
|
|
64
69
|
if (isLivePreparation) {
|
|
65
70
|
// Replace the main file
|
|
66
|
-
if (
|
|
71
|
+
if (mainPathExists) {
|
|
67
72
|
jetpack.write(
|
|
68
73
|
mainPath,
|
|
69
74
|
jetpack.read(mainPath)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prepare-package",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Prepare a Node.js package before being published",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"mocha": "^8.4.0"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
package/src/index.js
CHANGED
|
@@ -50,20 +50,25 @@ module.exports = async function (options) {
|
|
|
50
50
|
const outputPath = path.resolve(options.cwd, theirPackageJSON.preparePackage.output);
|
|
51
51
|
const inputPath = path.resolve(options.cwd, theirPackageJSON.preparePackage.input);
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
|
|
53
|
+
// Check if paths exist
|
|
54
|
+
const mainPathExists = jetpack.exists(mainPath);
|
|
55
|
+
const outputPathExists = jetpack.exists(outputPath);
|
|
56
|
+
const inputPathExists = jetpack.exists(inputPath);
|
|
57
|
+
|
|
58
|
+
// Remove the output folder if it exists (input must exist too)
|
|
59
|
+
if (outputPathExists && inputPathExists) {
|
|
55
60
|
jetpack.remove(outputPath);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
// Copy the input folder to the output folder if it exists
|
|
59
|
-
if (
|
|
64
|
+
if (inputPathExists) {
|
|
60
65
|
jetpack.copy(inputPath, outputPath);
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
// Only do this part on the actual package that is using THIS package because we dont't want to replace THIS {version}
|
|
64
69
|
if (isLivePreparation) {
|
|
65
70
|
// Replace the main file
|
|
66
|
-
if (
|
|
71
|
+
if (mainPathExists) {
|
|
67
72
|
jetpack.write(
|
|
68
73
|
mainPath,
|
|
69
74
|
jetpack.read(mainPath)
|