npm-pkgbuild 20.9.6 → 21.0.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/README.md +121 -110
- package/package.json +4 -2
- package/src/content/content-provider.mjs +13 -17
- package/src/extract-from-package.mjs +2 -2
- package/src/module.mjs +1 -1
- package/src/output/{arch.mjs → alpm.mjs} +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
## npm-pkgbuild
|
|
12
12
|
|
|
13
|
-
Create
|
|
13
|
+
Create ALPM, RPM, Debian and Docker packages from npm packages.
|
|
14
14
|
|
|
15
15
|
# usage
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ In a package directory execute
|
|
|
20
20
|
npm-pkgbuild --rpm --debian --arch --content /destination:build --publish /some/directory
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
This will create a
|
|
23
|
+
This will create a alpm, rpm and a debian package of the build dir.
|
|
24
24
|
|
|
25
25
|
## upload package
|
|
26
26
|
|
|
@@ -51,7 +51,7 @@ You can specify the package content in package.json.
|
|
|
51
51
|
"output": {
|
|
52
52
|
"debian" : {},
|
|
53
53
|
"rpm" : {},
|
|
54
|
-
"
|
|
54
|
+
"alpm" : {}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": { "nginx" : ">=1.12" }
|
|
57
57
|
}
|
|
@@ -88,113 +88,124 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
88
88
|
|
|
89
89
|
### Table of Contents
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
91
|
+
- [usage](#usage)
|
|
92
|
+
- [upload package](#upload-package)
|
|
93
|
+
- [content providers](#content-providers)
|
|
94
|
+
- [files (default)](#files-default)
|
|
95
|
+
- [npm-pack](#npm-pack)
|
|
96
|
+
- [node-modules](#node-modules)
|
|
97
|
+
- [shared configuration](#shared-configuration)
|
|
98
|
+
- [API](#api)
|
|
99
|
+
- [Table of Contents](#table-of-contents)
|
|
100
|
+
- [allInputs](#allinputs)
|
|
101
|
+
- [allOutputs](#alloutputs)
|
|
102
|
+
- [npmArchMapping](#npmarchmapping)
|
|
103
|
+
- [content2Sources](#content2sources)
|
|
104
|
+
- [Parameters](#parameters)
|
|
105
|
+
- [PackageDefinition](#packagedefinition)
|
|
106
|
+
- [Properties](#properties)
|
|
107
|
+
- [extractFromPackage](#extractfrompackage)
|
|
108
|
+
- [Parameters](#parameters-1)
|
|
109
|
+
- [NPMPackContentProvider](#npmpackcontentprovider)
|
|
110
|
+
- [Parameters](#parameters-2)
|
|
111
|
+
- [Properties](#properties-1)
|
|
112
|
+
- [name](#name)
|
|
113
|
+
- [NodeModulesContentProvider](#nodemodulescontentprovider)
|
|
114
|
+
- [Parameters](#parameters-3)
|
|
115
|
+
- [Properties](#properties-2)
|
|
116
|
+
- [asyncIterator](#asynciterator)
|
|
117
|
+
- [name](#name-1)
|
|
118
|
+
- [FileContentProvider](#filecontentprovider)
|
|
119
|
+
- [Parameters](#parameters-4)
|
|
120
|
+
- [asyncIterator](#asynciterator-1)
|
|
121
|
+
- [name](#name-2)
|
|
122
|
+
- [NFTContentProvider](#nftcontentprovider)
|
|
123
|
+
- [Parameters](#parameters-5)
|
|
124
|
+
- [asyncIterator](#asynciterator-2)
|
|
125
|
+
- [name](#name-3)
|
|
126
|
+
- [ContentProvider](#contentprovider)
|
|
127
|
+
- [Parameters](#parameters-6)
|
|
128
|
+
- [Properties](#properties-3)
|
|
129
|
+
- [propertiesFor](#propertiesfor)
|
|
130
|
+
- [Parameters](#parameters-7)
|
|
131
|
+
- [asyncIterator](#asynciterator-3)
|
|
132
|
+
- [DEBIAN](#debian)
|
|
133
|
+
- [hookMapping](#hookmapping)
|
|
134
|
+
- [attributes](#attributes)
|
|
135
|
+
- [prepare](#prepare)
|
|
136
|
+
- [Parameters](#parameters-8)
|
|
137
|
+
- [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
138
|
+
- [attributes](#attributes-1)
|
|
139
|
+
- [quoteFile](#quotefile)
|
|
140
|
+
- [Parameters](#parameters-9)
|
|
141
|
+
- [RPM](#rpm)
|
|
142
|
+
- [hookMapping](#hookmapping-1)
|
|
143
|
+
- [attributes](#attributes-2)
|
|
144
|
+
- [prepare](#prepare-1)
|
|
145
|
+
- [Parameters](#parameters-10)
|
|
146
|
+
- [OCI](#oci)
|
|
147
|
+
- [DOCKER](#docker)
|
|
148
|
+
- [attributes](#attributes-3)
|
|
149
|
+
- [prepare](#prepare-2)
|
|
150
|
+
- [Parameters](#parameters-11)
|
|
151
|
+
- [BUILDAH](#buildah)
|
|
152
|
+
- [Packager](#packager)
|
|
153
|
+
- [Parameters](#parameters-12)
|
|
154
|
+
- [packageName](#packagename)
|
|
155
|
+
- [Parameters](#parameters-13)
|
|
156
|
+
- [hookContent](#hookcontent)
|
|
157
|
+
- [dependencyExpression](#dependencyexpression)
|
|
158
|
+
- [Parameters](#parameters-14)
|
|
159
|
+
- [tmpdir](#tmpdir)
|
|
160
|
+
- [prepare](#prepare-3)
|
|
161
|
+
- [Parameters](#parameters-15)
|
|
162
|
+
- [create](#create)
|
|
163
|
+
- [Parameters](#parameters-16)
|
|
164
|
+
- [workspaceLayout](#workspacelayout)
|
|
165
|
+
- [prepare](#prepare-4)
|
|
166
|
+
- [Parameters](#parameters-17)
|
|
167
|
+
- [Packager](#packager-1)
|
|
168
|
+
- [Parameters](#parameters-18)
|
|
169
|
+
- [packageName](#packagename-1)
|
|
170
|
+
- [Parameters](#parameters-19)
|
|
171
|
+
- [hookContent](#hookcontent-1)
|
|
172
|
+
- [dependencyExpression](#dependencyexpression-1)
|
|
173
|
+
- [Parameters](#parameters-20)
|
|
174
|
+
- [tmpdir](#tmpdir-1)
|
|
175
|
+
- [prepare](#prepare-5)
|
|
176
|
+
- [Parameters](#parameters-21)
|
|
177
|
+
- [create](#create-1)
|
|
178
|
+
- [Parameters](#parameters-22)
|
|
179
|
+
- [workspaceLayout](#workspacelayout-1)
|
|
180
|
+
- [prepare](#prepare-6)
|
|
181
|
+
- [Parameters](#parameters-23)
|
|
182
|
+
- [Field](#field)
|
|
183
|
+
- [Properties](#properties-4)
|
|
184
|
+
- [deleteKey](#deletekey)
|
|
185
|
+
- [Parameters](#parameters-24)
|
|
186
|
+
- [copyNodeModules](#copynodemodules)
|
|
187
|
+
- [Parameters](#parameters-25)
|
|
188
|
+
- [PublishingDetail](#publishingdetail)
|
|
189
|
+
- [Properties](#properties-5)
|
|
190
|
+
- [createPublishingDetails](#createpublishingdetails)
|
|
191
|
+
- [Parameters](#parameters-26)
|
|
192
|
+
- [publish](#publish)
|
|
193
|
+
- [Parameters](#parameters-27)
|
|
194
|
+
- [utf8StreamOptions](#utf8streamoptions)
|
|
195
|
+
- [decodePassword](#decodepassword)
|
|
196
|
+
- [Parameters](#parameters-28)
|
|
197
|
+
- [FunctionDecl](#functiondecl)
|
|
198
|
+
- [Properties](#properties-6)
|
|
199
|
+
- [extractFunctions](#extractfunctions)
|
|
200
|
+
- [Parameters](#parameters-29)
|
|
201
|
+
- [fieldProvider](#fieldprovider)
|
|
202
|
+
- [Parameters](#parameters-30)
|
|
203
|
+
- [Expander](#expander)
|
|
204
|
+
- [Parameters](#parameters-31)
|
|
205
|
+
- [copyEntries](#copyentries)
|
|
206
|
+
- [Parameters](#parameters-32)
|
|
207
|
+
- [install](#install)
|
|
208
|
+
- [license](#license)
|
|
198
209
|
|
|
199
210
|
## allInputs
|
|
200
211
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npm-pkgbuild",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
"default": "./src/module.mjs"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"description": "create
|
|
14
|
+
"description": "create ALPM, RPM and Debian packages from npm packages",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"ArchLinux",
|
|
17
17
|
"arch-linux",
|
|
18
|
+
"alpm",
|
|
18
19
|
"aur",
|
|
19
20
|
"buildah",
|
|
20
21
|
"deb",
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
"pacc": "^11.6.0",
|
|
64
65
|
"package-directory": "^8.2.0",
|
|
65
66
|
"pacote": "^22.0.0",
|
|
67
|
+
"picomatch": "^4.0.7",
|
|
66
68
|
"tar-stream": "^3.1.7",
|
|
67
69
|
"uti": "^8.11.3"
|
|
68
70
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import picomatch from "picomatch";
|
|
1
2
|
import { ContentEntry, CollectionEntry } from "content-entry";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -30,6 +31,13 @@ export class ContentProvider {
|
|
|
30
31
|
destination: this.entryProperties?.destination
|
|
31
32
|
};
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
this.permissions = new Map(
|
|
36
|
+
Object.entries(this.properties).map(([pattern, properties]) => [
|
|
37
|
+
picomatch(pattern),
|
|
38
|
+
properties
|
|
39
|
+
])
|
|
40
|
+
);
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
/**
|
|
@@ -39,23 +47,11 @@ export class ContentProvider {
|
|
|
39
47
|
* @returns {Object|undefined}
|
|
40
48
|
*/
|
|
41
49
|
propertiesFor(name, isCollection) {
|
|
42
|
-
for (const [
|
|
43
|
-
if (
|
|
44
|
-
return properties
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const prefix = pattern.substring(0, pattern.length - 4);
|
|
48
|
-
if (name.startsWith(prefix)) {
|
|
49
|
-
return properties;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (pattern.endsWith("*")) {
|
|
53
|
-
const prefix = pattern.substring(0, pattern.length - 1);
|
|
54
|
-
if (name.startsWith(prefix)) {
|
|
55
|
-
if (name.substring(prefix.length).indexOf("/") < 0) {
|
|
56
|
-
return properties;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
50
|
+
for (const [matcher, properties] of this.permissions) {
|
|
51
|
+
if (matcher(name)) {
|
|
52
|
+
return isCollection && properties.collection
|
|
53
|
+
? properties.collection
|
|
54
|
+
: properties;
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
|
|
@@ -10,7 +10,7 @@ import { FileContentProvider } from "./content/file-content-provider.mjs";
|
|
|
10
10
|
import { NFTContentProvider } from "./content/nft-content-provider.mjs";
|
|
11
11
|
import { ContentProvider } from "./content/content-provider.mjs";
|
|
12
12
|
import { DEBIAN } from "./output/debian.mjs";
|
|
13
|
-
import {
|
|
13
|
+
import { ALPM } from "./output/alpm.mjs";
|
|
14
14
|
import { RPM } from "./output/rpm.mjs";
|
|
15
15
|
import { OCI } from "./output/oci.mjs";
|
|
16
16
|
import { DOCKER } from "./output/docker.mjs";
|
|
@@ -29,7 +29,7 @@ export const allInputs = [
|
|
|
29
29
|
/**
|
|
30
30
|
* All output formats
|
|
31
31
|
*/
|
|
32
|
-
export const allOutputs = [
|
|
32
|
+
export const allOutputs = [ALPM, RPM, OCI, DOCKER, BUILDAH, DEBIAN];
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Node architecture name to os native arch name mapping
|
package/src/module.mjs
CHANGED
|
@@ -13,7 +13,7 @@ export { NPMPackContentProvider } from "./content/npm-pack-content-provider.mjs"
|
|
|
13
13
|
export { NFTContentProvider } from "./content/nft-content-provider.mjs";
|
|
14
14
|
export { DEBIAN } from "./output/debian.mjs";
|
|
15
15
|
export { RPM } from "./output/rpm.mjs";
|
|
16
|
-
export {
|
|
16
|
+
export { ALPM } from "./output/alpm.mjs";
|
|
17
17
|
export { OCI } from "./output/oci.mjs";
|
|
18
18
|
export { DOCKER } from "./output/docker.mjs";
|
|
19
19
|
export { Packager } from "./output/packager.mjs";
|
|
@@ -56,7 +56,7 @@ export const pkgKeyValuePairOptions = {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
function keyPrefix(key) {
|
|
59
|
-
const f =
|
|
59
|
+
const f = ALPM.attributes[key];
|
|
60
60
|
return f?.prefix ? f.prefix + key : key;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -66,7 +66,7 @@ let _ext = ".pkg.tar.xz";
|
|
|
66
66
|
let _prepared;
|
|
67
67
|
let _architecture = "aarch64";
|
|
68
68
|
|
|
69
|
-
export class
|
|
69
|
+
export class ALPM extends Packager {
|
|
70
70
|
static get alias() {
|
|
71
71
|
return "alpm";
|
|
72
72
|
}
|