prepare-package 0.0.2 → 0.0.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.
- package/README.md +1 -1
- package/dist/index.js +5 -3
- package/package.json +3 -2
- package/src/index.js +2 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ npm install prepare-package --save-dev
|
|
|
38
38
|
* `{version}` => `package.version`
|
|
39
39
|
|
|
40
40
|
## Example Setup
|
|
41
|
-
After installing via npm, simply put this in your `package.json`
|
|
41
|
+
After installing via npm, simply put this in your `package.json`
|
|
42
42
|
```json
|
|
43
43
|
"main": "dist/index.js",
|
|
44
44
|
"scripts": {
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,8 @@ if (isLivePreparation) {
|
|
|
32
32
|
function _replaceMain() {
|
|
33
33
|
let content = jetpack.read(theirPackageJSON.main)
|
|
34
34
|
// .replace(/{version}/igm, package.version)
|
|
35
|
-
.replace(/{version}/igm,
|
|
35
|
+
.replace(/{version}/igm, theirPackageJSON.version)
|
|
36
|
+
return content;
|
|
36
37
|
}
|
|
37
38
|
jetpack.write(
|
|
38
39
|
theirPackageJSON.main,
|
|
@@ -45,8 +46,9 @@ fetch(`https://purge.jsdelivr.net/npm/${theirPackageJSON.name}@latest`, {
|
|
|
45
46
|
tries: 3,
|
|
46
47
|
})
|
|
47
48
|
.then(result => {
|
|
48
|
-
console.log(chalk.green(`[prepare-package]: Purged... name=${theirPackageJSON.name}`), result);
|
|
49
|
+
// console.log(chalk.green(`[prepare-package]: Purged... name=${theirPackageJSON.name}`), result);
|
|
50
|
+
console.log(chalk.green(`[prepare-package]: Purged... ${theirPackageJSON.name}`));
|
|
49
51
|
})
|
|
50
52
|
.catch(e => {
|
|
51
|
-
console.log(chalk.red(`[prepare-package]: Failed to purge...
|
|
53
|
+
console.log(chalk.red(`[prepare-package]: Failed to purge... ${theirPackageJSON.name}`, e));
|
|
52
54
|
})
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prepare-package",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Prepare a Node.js package before being published",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "./node_modules/mocha/bin/mocha test/ --recursive --timeout=10000",
|
|
8
|
-
"start": "node ./src/index.js"
|
|
8
|
+
"start": "node ./src/index.js",
|
|
9
|
+
"prepare": "node ./src/index.js"
|
|
9
10
|
},
|
|
10
11
|
"preparePackage": {
|
|
11
12
|
"input": "src",
|
package/src/index.js
CHANGED
|
@@ -32,7 +32,8 @@ if (isLivePreparation) {
|
|
|
32
32
|
function _replaceMain() {
|
|
33
33
|
let content = jetpack.read(theirPackageJSON.main)
|
|
34
34
|
// .replace(/{version}/igm, package.version)
|
|
35
|
-
.replace(/{version}/igm,
|
|
35
|
+
.replace(/{version}/igm, theirPackageJSON.version)
|
|
36
|
+
return content;
|
|
36
37
|
}
|
|
37
38
|
jetpack.write(
|
|
38
39
|
theirPackageJSON.main,
|