npm-pkgbuild 7.4.4 → 7.5.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/package.json +1 -1
- package/src/npm-pkgbuild-cli.mjs +8 -5
- package/src/util.mjs +8 -2
package/package.json
CHANGED
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -26,7 +26,10 @@ outputs.forEach(o =>
|
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
program
|
|
29
|
-
.option("--
|
|
29
|
+
.option("-D --define <a=b>", "define property", str => {
|
|
30
|
+
const kv = str.split(/=/);
|
|
31
|
+
return Object.fromEntries([kv]);
|
|
32
|
+
})
|
|
30
33
|
.option("-d --destination <dir>", "where to put the package(s)", cwd)
|
|
31
34
|
.option("-s --staging <dir>", "staging directory", "build")
|
|
32
35
|
.option(
|
|
@@ -55,6 +58,8 @@ program
|
|
|
55
58
|
)
|
|
56
59
|
);
|
|
57
60
|
|
|
61
|
+
Object.assign(properties, options.define);
|
|
62
|
+
|
|
58
63
|
sources.push(
|
|
59
64
|
...[...options.content, ...options.meta]
|
|
60
65
|
.filter(x => x)
|
|
@@ -66,15 +71,13 @@ program
|
|
|
66
71
|
)
|
|
67
72
|
);
|
|
68
73
|
|
|
69
|
-
const context = createContext();
|
|
70
|
-
context.properties = properties;
|
|
71
|
-
|
|
74
|
+
const context = createContext({ properties });
|
|
72
75
|
const output = new outputFactory(properties);
|
|
73
76
|
|
|
74
77
|
const fileName = await output.execute(
|
|
75
78
|
aggregateFifo(sources.map(c => c[Symbol.asyncIterator]())),
|
|
76
79
|
options,
|
|
77
|
-
|
|
80
|
+
object => context.expand(object)
|
|
78
81
|
);
|
|
79
82
|
|
|
80
83
|
console.log(fileName);
|
package/src/util.mjs
CHANGED
|
@@ -117,11 +117,17 @@ export async function* transform(source, transformers = [], onlyMatching) {
|
|
|
117
117
|
export async function copyEntries(
|
|
118
118
|
source,
|
|
119
119
|
destinationDirectory,
|
|
120
|
-
expander =
|
|
120
|
+
expander = v => v,
|
|
121
121
|
attributes = []
|
|
122
122
|
) {
|
|
123
123
|
for await (let entry of source) {
|
|
124
|
-
const destName = expander(
|
|
124
|
+
const destName = expander(
|
|
125
|
+
entry.destination === undefined
|
|
126
|
+
? join(destinationDirectory, entry.name)
|
|
127
|
+
: entry.destination.endsWith("/")
|
|
128
|
+
? join(destinationDirectory, entry.destination, entry.name)
|
|
129
|
+
: join(destinationDirectory, entry.destination)
|
|
130
|
+
);
|
|
125
131
|
await mkdir(dirname(destName), { recursive: true });
|
|
126
132
|
|
|
127
133
|
const options = { mode: entry.mode };
|