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 CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## npm-pkgbuild
12
12
 
13
- Create ArchLinux, RPM, Debian and Docker packages from npm packages.
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 arch, rpm and a debian package of the build dir.
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
- "arch" : {}
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
- * [allInputs](#allinputs)
92
- * [allOutputs](#alloutputs)
93
- * [npmArchMapping](#npmarchmapping)
94
- * [content2Sources](#content2sources)
95
- * [Parameters](#parameters)
96
- * [PackageDefinition](#packagedefinition)
97
- * [Properties](#properties)
98
- * [extractFromPackage](#extractfrompackage)
99
- * [Parameters](#parameters-1)
100
- * [NPMPackContentProvider](#npmpackcontentprovider)
101
- * [Parameters](#parameters-2)
102
- * [Properties](#properties-1)
103
- * [name](#name)
104
- * [NodeModulesContentProvider](#nodemodulescontentprovider)
105
- * [Parameters](#parameters-3)
106
- * [Properties](#properties-2)
107
- * [asyncIterator](#asynciterator)
108
- * [name](#name-1)
109
- * [FileContentProvider](#filecontentprovider)
110
- * [Parameters](#parameters-4)
111
- * [asyncIterator](#asynciterator-1)
112
- * [name](#name-2)
113
- * [NFTContentProvider](#nftcontentprovider)
114
- * [Parameters](#parameters-5)
115
- * [asyncIterator](#asynciterator-2)
116
- * [name](#name-3)
117
- * [ContentProvider](#contentprovider)
118
- * [Parameters](#parameters-6)
119
- * [Properties](#properties-3)
120
- * [propertiesFor](#propertiesfor)
121
- * [Parameters](#parameters-7)
122
- * [asyncIterator](#asynciterator-3)
123
- * [DEBIAN](#debian)
124
- * [hookMapping](#hookmapping)
125
- * [attributes](#attributes)
126
- * [prepare](#prepare)
127
- * [Parameters](#parameters-8)
128
- * [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
129
- * [attributes](#attributes-1)
130
- * [quoteFile](#quotefile)
131
- * [Parameters](#parameters-9)
132
- * [RPM](#rpm)
133
- * [hookMapping](#hookmapping-1)
134
- * [attributes](#attributes-2)
135
- * [prepare](#prepare-1)
136
- * [Parameters](#parameters-10)
137
- * [OCI](#oci)
138
- * [DOCKER](#docker)
139
- * [attributes](#attributes-3)
140
- * [prepare](#prepare-2)
141
- * [Parameters](#parameters-11)
142
- * [BUILDAH](#buildah)
143
- * [Packager](#packager)
144
- * [Parameters](#parameters-12)
145
- * [packageName](#packagename)
146
- * [Parameters](#parameters-13)
147
- * [hookContent](#hookcontent)
148
- * [dependencyExpression](#dependencyexpression)
149
- * [Parameters](#parameters-14)
150
- * [tmpdir](#tmpdir)
151
- * [prepare](#prepare-3)
152
- * [Parameters](#parameters-15)
153
- * [create](#create)
154
- * [Parameters](#parameters-16)
155
- * [workspaceLayout](#workspacelayout)
156
- * [prepare](#prepare-4)
157
- * [Parameters](#parameters-17)
158
- * [Packager](#packager-1)
159
- * [Parameters](#parameters-18)
160
- * [packageName](#packagename-1)
161
- * [Parameters](#parameters-19)
162
- * [hookContent](#hookcontent-1)
163
- * [dependencyExpression](#dependencyexpression-1)
164
- * [Parameters](#parameters-20)
165
- * [tmpdir](#tmpdir-1)
166
- * [prepare](#prepare-5)
167
- * [Parameters](#parameters-21)
168
- * [create](#create-1)
169
- * [Parameters](#parameters-22)
170
- * [workspaceLayout](#workspacelayout-1)
171
- * [prepare](#prepare-6)
172
- * [Parameters](#parameters-23)
173
- * [Field](#field)
174
- * [Properties](#properties-4)
175
- * [deleteKey](#deletekey)
176
- * [Parameters](#parameters-24)
177
- * [copyNodeModules](#copynodemodules)
178
- * [Parameters](#parameters-25)
179
- * [PublishingDetail](#publishingdetail)
180
- * [Properties](#properties-5)
181
- * [createPublishingDetails](#createpublishingdetails)
182
- * [Parameters](#parameters-26)
183
- * [publish](#publish)
184
- * [Parameters](#parameters-27)
185
- * [utf8StreamOptions](#utf8streamoptions)
186
- * [decodePassword](#decodepassword)
187
- * [Parameters](#parameters-28)
188
- * [FunctionDecl](#functiondecl)
189
- * [Properties](#properties-6)
190
- * [extractFunctions](#extractfunctions)
191
- * [Parameters](#parameters-29)
192
- * [fieldProvider](#fieldprovider)
193
- * [Parameters](#parameters-30)
194
- * [Expander](#expander)
195
- * [Parameters](#parameters-31)
196
- * [copyEntries](#copyentries)
197
- * [Parameters](#parameters-32)
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": "20.9.6",
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 ArchLinux, RPM and Debian packages from npm packages",
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 [pattern, properties] of Object.entries(this.properties)) {
43
- if (pattern === name) {
44
- return properties;
45
- }
46
- if (pattern.endsWith("**/*")) {
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 { ARCH } from "./output/arch.mjs";
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 = [ARCH, RPM, OCI, DOCKER, BUILDAH, DEBIAN];
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 { ARCH } from "./output/arch.mjs";
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 = ARCH.attributes[key];
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 ARCH extends Packager {
69
+ export class ALPM extends Packager {
70
70
  static get alias() {
71
71
  return "alpm";
72
72
  }