npm-pkgbuild 19.2.1 → 20.0.1
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 +2 -2
- package/src/content/content-provider.mjs +0 -4
- package/src/content/file-content-provider.mjs +11 -14
- package/src/content/nft-content-provider.mjs +1 -2
- package/src/extract-from-package.mjs +2 -2
- package/src/npm-pkgbuild-cli.mjs +4 -4
- package/types/content/content-provider.d.mts +0 -4
- package/types/content/file-content-provider.d.mts +1 -2
- package/types/content/nft-content-provider.d.mts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"compare-versions": "^6.1.1",
|
|
60
60
|
"content-entry": "^14.2.7",
|
|
61
61
|
"content-entry-filesystem": "^9.0.14",
|
|
62
|
-
"content-entry-transform": "^1.5.
|
|
62
|
+
"content-entry-transform": "^1.5.18",
|
|
63
63
|
"execa": "^9.6.0",
|
|
64
64
|
"expression-expander": "^7.2.8",
|
|
65
65
|
"ini": "^6.0.0",
|
|
@@ -3,10 +3,8 @@ import { ContentEntry, CollectionEntry } from "content-entry";
|
|
|
3
3
|
/**
|
|
4
4
|
* Source of package content.
|
|
5
5
|
* @property {string} dir
|
|
6
|
-
* @property {Transformer[]} transformers
|
|
7
6
|
*/
|
|
8
7
|
export class ContentProvider {
|
|
9
|
-
transformers;
|
|
10
8
|
entryProperties;
|
|
11
9
|
directoryProperties;
|
|
12
10
|
dir;
|
|
@@ -14,14 +12,12 @@ export class ContentProvider {
|
|
|
14
12
|
/**
|
|
15
13
|
*
|
|
16
14
|
* @param {Object} definitions
|
|
17
|
-
* @param {Array<Transformer>} [definitions.transformers]
|
|
18
15
|
* @param {string} [definitions.dir]
|
|
19
16
|
* @param {Object} [entryProperties]
|
|
20
17
|
* @param {string} [entryProperties.destination]
|
|
21
18
|
* @param {Object} [directoryProperties]
|
|
22
19
|
*/
|
|
23
20
|
constructor(definitions, entryProperties, directoryProperties) {
|
|
24
|
-
this.transformers = definitions.transformers || [];
|
|
25
21
|
this.dir = definitions.dir;
|
|
26
22
|
this.entryProperties = entryProperties;
|
|
27
23
|
this.directoryProperties = directoryProperties;
|
|
@@ -23,35 +23,34 @@ export class FileContentProvider extends ContentProvider {
|
|
|
23
23
|
return "use plain files source";
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
base;
|
|
27
26
|
pattern = DEFAULT_PATTERN;
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Content provided form the file system.
|
|
31
30
|
* @param {Object|string} definitions
|
|
32
31
|
* @param {string|string[]} [definitions.pattern]
|
|
33
|
-
* @param {string} [definitions.
|
|
32
|
+
* @param {string} [definitions.dir] base directory where to find the files
|
|
34
33
|
*/
|
|
35
34
|
constructor(definitions, entryProperties, directoryProperties) {
|
|
36
35
|
super(definitions, entryProperties, directoryProperties);
|
|
37
36
|
|
|
38
37
|
if (typeof definitions === "string") {
|
|
39
38
|
if (definitions.endsWith("/")) {
|
|
40
|
-
this.
|
|
39
|
+
this.dir = definitions.substring(0, definitions.length - 1);
|
|
41
40
|
this.pattern = DEFAULT_PATTERN;
|
|
42
41
|
} else {
|
|
43
|
-
const
|
|
44
|
-
this.
|
|
45
|
-
this.pattern = [definitions.substring(
|
|
42
|
+
const dir = dirname(definitions);
|
|
43
|
+
this.dir = dir;
|
|
44
|
+
this.pattern = [definitions.substring(dir.length + 1)];
|
|
46
45
|
}
|
|
47
46
|
} else {
|
|
48
|
-
this.
|
|
49
|
-
if(definitions.pattern) {
|
|
47
|
+
this.dir = definitions.dir;
|
|
48
|
+
if (definitions.pattern) {
|
|
50
49
|
this.pattern = asArray(definitions.pattern);
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
this.
|
|
53
|
+
this.dir = resolve(cwd(), this.dir);
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
get isPatternMatch() {
|
|
@@ -59,14 +58,14 @@ export class FileContentProvider extends ContentProvider {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
toString() {
|
|
62
|
-
return `${this.constructor.name}: ${this.
|
|
61
|
+
return `${this.constructor.name}: ${this.dir}, ${this.pattern} -> ${this.entryProperties?.destination}`;
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
/**
|
|
66
65
|
* @return {AsyncIterable<ContentEntry|CollectionEntry>} all entries
|
|
67
66
|
*/
|
|
68
67
|
async *[Symbol.asyncIterator]() {
|
|
69
|
-
const baseDir = this.
|
|
68
|
+
const baseDir = this.dir;
|
|
70
69
|
const startPos = baseDir.length + 1;
|
|
71
70
|
|
|
72
71
|
let count = 0;
|
|
@@ -90,9 +89,7 @@ export class FileContentProvider extends ContentProvider {
|
|
|
90
89
|
|
|
91
90
|
if (!this.isPatternMatch && count < 1) {
|
|
92
91
|
const file = join(baseDir, this.pattern[0]);
|
|
93
|
-
|
|
94
|
-
error.file = file;
|
|
95
|
-
throw error;
|
|
92
|
+
throw new Error(`File not found ${file}`, { cause: file });
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
95
|
}
|
|
@@ -23,7 +23,6 @@ export class NFTContentProvider extends ContentProvider {
|
|
|
23
23
|
* Content provided form the file system.
|
|
24
24
|
* @param {Object|string} definitions
|
|
25
25
|
* @param {string} definitions.start base directory where to find the files
|
|
26
|
-
* @param {Array<Transformer>} [definitions.transformers]
|
|
27
26
|
* @param {string} [definitions.dir]
|
|
28
27
|
* @param {Object} [entryProperties]
|
|
29
28
|
* @param {string} [entryProperties.destination]
|
|
@@ -47,7 +46,7 @@ export class NFTContentProvider extends ContentProvider {
|
|
|
47
46
|
* @return {AsyncIterable<ContentEntry>} all entries
|
|
48
47
|
*/
|
|
49
48
|
async *[Symbol.asyncIterator]() {
|
|
50
|
-
const baseDir = this.
|
|
49
|
+
const baseDir = this.dir || process.cwd();
|
|
51
50
|
const { fileList } = await nodeFileTrace(this.start);
|
|
52
51
|
|
|
53
52
|
for (const name of fileList) {
|
|
@@ -90,8 +90,8 @@ function* content2Sources(content, dir) {
|
|
|
90
90
|
} else {
|
|
91
91
|
switch (typeof definition) {
|
|
92
92
|
case "object":
|
|
93
|
-
definition.
|
|
94
|
-
? join(dir, definition.
|
|
93
|
+
definition.dir = definition.dir
|
|
94
|
+
? join(dir, definition.dir)
|
|
95
95
|
: dir;
|
|
96
96
|
break;
|
|
97
97
|
case "string":
|
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -92,15 +92,15 @@ program
|
|
|
92
92
|
...[...options.content, ...options.meta]
|
|
93
93
|
.filter(x => x)
|
|
94
94
|
.map(source => {
|
|
95
|
-
let [destination,
|
|
96
|
-
if (!
|
|
95
|
+
let [destination, dir] = source.split(/:/);
|
|
96
|
+
if (!dir) {
|
|
97
97
|
destination = "/";
|
|
98
|
-
|
|
98
|
+
dir = source;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
return new FileContentProvider(
|
|
102
102
|
{
|
|
103
|
-
|
|
103
|
+
dir
|
|
104
104
|
},
|
|
105
105
|
{ destination }
|
|
106
106
|
);
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Source of package content.
|
|
3
3
|
* @property {string} dir
|
|
4
|
-
* @property {Transformer[]} transformers
|
|
5
4
|
*/
|
|
6
5
|
export class ContentProvider {
|
|
7
6
|
/**
|
|
8
7
|
*
|
|
9
8
|
* @param {Object} definitions
|
|
10
|
-
* @param {Array<Transformer>} [definitions.transformers]
|
|
11
9
|
* @param {string} [definitions.dir]
|
|
12
10
|
* @param {Object} [entryProperties]
|
|
13
11
|
* @param {string} [entryProperties.destination]
|
|
14
12
|
* @param {Object} [directoryProperties]
|
|
15
13
|
*/
|
|
16
14
|
constructor(definitions: {
|
|
17
|
-
transformers?: Array<Transformer>;
|
|
18
15
|
dir?: string;
|
|
19
16
|
}, entryProperties?: {
|
|
20
17
|
destination?: string;
|
|
21
18
|
}, directoryProperties?: any);
|
|
22
|
-
transformers: Transformer<any, any>[];
|
|
23
19
|
entryProperties: {
|
|
24
20
|
destination?: string;
|
|
25
21
|
};
|
|
@@ -7,10 +7,9 @@ export class FileContentProvider extends ContentProvider {
|
|
|
7
7
|
* Content provided form the file system.
|
|
8
8
|
* @param {Object|string} definitions
|
|
9
9
|
* @param {string|string[]} [definitions.pattern]
|
|
10
|
-
* @param {string} [definitions.
|
|
10
|
+
* @param {string} [definitions.dir] base directory where to find the files
|
|
11
11
|
*/
|
|
12
12
|
constructor(definitions: any | string, entryProperties: any, directoryProperties: any);
|
|
13
|
-
base: string;
|
|
14
13
|
pattern: string[];
|
|
15
14
|
get isPatternMatch(): string;
|
|
16
15
|
}
|
|
@@ -7,7 +7,6 @@ export class NFTContentProvider extends ContentProvider {
|
|
|
7
7
|
* Content provided form the file system.
|
|
8
8
|
* @param {Object|string} definitions
|
|
9
9
|
* @param {string} definitions.start base directory where to find the files
|
|
10
|
-
* @param {Array<Transformer>} [definitions.transformers]
|
|
11
10
|
* @param {string} [definitions.dir]
|
|
12
11
|
* @param {Object} [entryProperties]
|
|
13
12
|
* @param {string} [entryProperties.destination]
|