@changke/staticnext-build 0.2.3 → 0.3.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/CHANGELOG.md +18 -3
- package/lib/config.mjs +18 -0
- package/lib/tasks/copy.mjs +1 -7
- package/lib/typedefs.mjs +10 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,17 +4,32 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 0.3.0
|
|
8
|
+
2023-07-09
|
|
9
|
+
### Added
|
|
10
|
+
- Support additional "source/target" pairs in `copy` task
|
|
11
|
+
|
|
12
|
+
## 0.2.4
|
|
13
|
+
2023-07-01
|
|
14
|
+
### Changed
|
|
15
|
+
- Updated `esbuild` to v0.18.11
|
|
16
|
+
|
|
17
|
+
## 0.2.3
|
|
18
|
+
2023-06-30
|
|
19
|
+
### Changed
|
|
20
|
+
- Code refactoring; Typedefs in external file
|
|
21
|
+
|
|
22
|
+
## 0.2.2
|
|
8
23
|
2023-06-28
|
|
9
24
|
### Changed
|
|
10
25
|
- Updated `esbuild` to v0.18.10
|
|
11
26
|
|
|
12
|
-
|
|
27
|
+
## 0.2.1
|
|
13
28
|
2023-06-25
|
|
14
29
|
### Changed
|
|
15
30
|
- Updated `esbuild` to v0.18.9
|
|
16
31
|
|
|
17
|
-
|
|
32
|
+
## 0.2.0
|
|
18
33
|
2023-06-24
|
|
19
34
|
### Changed
|
|
20
35
|
- Better merging object supports nested object values
|
package/lib/config.mjs
CHANGED
|
@@ -78,6 +78,24 @@ class Config {
|
|
|
78
78
|
});
|
|
79
79
|
return [mainEntryPath].concat(moduleEntryFiles);
|
|
80
80
|
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Build (additional) copy pairs
|
|
84
|
+
*
|
|
85
|
+
* @param {STPair[]} copyPairs
|
|
86
|
+
* @param {string} sourceRoot
|
|
87
|
+
* @param {string} targetRoot
|
|
88
|
+
* @param {boolean} appendSourcePath
|
|
89
|
+
*/
|
|
90
|
+
getCopyPairs = (copyPairs, sourceRoot, targetRoot, appendSourcePath = false) => {
|
|
91
|
+
return copyPairs.map(pr => {
|
|
92
|
+
if (appendSourcePath) {
|
|
93
|
+
pr.sources = `${appendSourcePath}${pr.sources}`;
|
|
94
|
+
}
|
|
95
|
+
pr.target = `${targetRoot}${pr.target}`;
|
|
96
|
+
return pr;
|
|
97
|
+
});
|
|
98
|
+
};
|
|
81
99
|
}
|
|
82
100
|
|
|
83
101
|
const config = new Config();
|
package/lib/tasks/copy.mjs
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import cpy from 'cpy';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} STPair
|
|
5
|
-
* @property {(string|string[])} sources
|
|
6
|
-
* @property {string} target
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
3
|
/**
|
|
10
4
|
* Copy (different) assets
|
|
11
5
|
*
|
|
@@ -14,7 +8,7 @@ import cpy from 'cpy';
|
|
|
14
8
|
*/
|
|
15
9
|
const copy = (sourceTargetPairs) => {
|
|
16
10
|
console.log('=> copy');
|
|
17
|
-
return Promise.all(sourceTargetPairs.map(pair => cpy(pair.sources, pair.target)));
|
|
11
|
+
return Promise.all(sourceTargetPairs.map(pair => cpy(pair.sources, pair.target, pair.opts)));
|
|
18
12
|
};
|
|
19
13
|
|
|
20
14
|
export {copy};
|
package/lib/typedefs.mjs
CHANGED
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
* @property {string=} markdown Path for markdown files
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Source/Target pairs for "copy" task
|
|
19
|
+
*
|
|
20
|
+
* @typedef {Object} STPair
|
|
21
|
+
* @property {(string|string[])} sources
|
|
22
|
+
* @property {string} target
|
|
23
|
+
* @property {Object=} opts
|
|
24
|
+
*/
|
|
25
|
+
|
|
17
26
|
/**
|
|
18
27
|
* Helper to create an array with input source TS files for esbuild
|
|
19
28
|
*
|
|
@@ -48,6 +57,7 @@
|
|
|
48
57
|
* @property {string} assetsUrlPath Path of assets used in URL for resource loading etc.
|
|
49
58
|
* @property {boolean} markdownEnabled Enable markdown feature or not
|
|
50
59
|
* @property {Object} njkGlobals Global variables assigned to Nunjucks compiler
|
|
60
|
+
* @property {STPair[]=} copyPairs Additional pairs for copy task
|
|
51
61
|
*/
|
|
52
62
|
|
|
53
63
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@changke/staticnext-build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Build scripts extracted from StaticNext seed project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"eslint": "^8.
|
|
22
|
+
"eslint": "^8.44.0",
|
|
23
23
|
"mocha": "^10.2.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"cpy": "^10.1.0",
|
|
27
27
|
"del": "^7.0.0",
|
|
28
|
-
"esbuild": "^0.18.
|
|
29
|
-
"globby": "^13.2.
|
|
28
|
+
"esbuild": "^0.18.11",
|
|
29
|
+
"globby": "^13.2.2",
|
|
30
30
|
"highlight.js": "^11.8.0",
|
|
31
|
-
"marked": "^5.1.
|
|
31
|
+
"marked": "^5.1.1",
|
|
32
32
|
"marked-highlight": "^2.0.1",
|
|
33
33
|
"marked-xhtml": "^1.0.1",
|
|
34
34
|
"nunjucks": "^3.2.4"
|