npm-pkgbuild 9.0.2 → 10.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/README.md CHANGED
@@ -18,16 +18,23 @@ Create ArchLinux, RPM and Debian packages from npm packages.
18
18
  In a package directory execute
19
19
 
20
20
  ```shell
21
- npm-pkgbuild --rpm --debian --arch --content build
21
+ npm-pkgbuild --rpm --debian --arch --content build --publish /some/directory
22
22
  ```
23
23
 
24
24
  This will create a arch, rpm and a debian package of the build dir.
25
25
 
26
+
27
+ ## upload package
28
+
29
+ ```shell
30
+ npm-pkgbuild --rpm --debian --arch --content build --publish 'https://my.package-service.com/binaries/linux/{{type}}/{{access}}/{{arch}}'
31
+ ```
32
+
26
33
  You can specify the package content in package.json.
27
34
 
28
35
  ```json
29
36
  {
30
- "pkg": {
37
+ "pkgbuild": {
31
38
  "content": {
32
39
  "/some/location" : { "base": "build" },
33
40
  "/etc/myconfig.json" : "sample-config.json",
@@ -77,6 +84,7 @@ options:
77
84
  ### Table of Contents
78
85
 
79
86
  - [usage](#usage)
87
+ - [upload package](#upload-package)
80
88
  - [content providers](#content-providers)
81
89
  - [files (default)](#files-default)
82
90
  - [npm-pack](#npm-pack)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "9.0.2",
3
+ "version": "10.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,7 +40,7 @@
40
40
  "lint:docs": "documentation lint ./src/**/*.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@npmcli/arborist": "^5.1.0",
43
+ "@npmcli/arborist": "^5.1.1",
44
44
  "aggregate-async-iterator": "^1.1.10",
45
45
  "commander": "^9.2.0",
46
46
  "content-entry": "^5.0.0",
@@ -76,7 +76,7 @@ export async function extractFromPackage(json, dir) {
76
76
  let arch = new Set();
77
77
 
78
78
  const processPkg = (json, dir, modulePath) => {
79
- const pkg = json.pkg;
79
+ const pkg = json.pkgbuild;
80
80
 
81
81
  if (pkg) {
82
82
  if (json.cpu) {
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { readFileSync } from "fs";
4
+ import { fileURLToPath } from "url";
4
5
  import { readFile } from "fs/promises";
5
6
  import { join } from "path";
6
7
  import { program } from "commander";
@@ -20,8 +21,10 @@ import {
20
21
  } from "npm-pkgbuild";
21
22
 
22
23
  const { version, description } = JSON.parse(
23
- readFileSync(new URL("../package.json", import.meta.url).pathname),
24
- utf8StreamOptions
24
+ readFileSync(
25
+ fileURLToPath(new URL("../package.json", import.meta.url)),
26
+ utf8StreamOptions
27
+ )
25
28
  );
26
29
 
27
30
  program.description(description).version(version);
@@ -45,13 +48,20 @@ program
45
48
  )
46
49
  .option("-m --meta <dir>", "meta directory", (c, a) => a.concat([c]), [])
47
50
  .addOption(
48
- new program.Option("--publish <url>", "publishing url of the package")
51
+ new program.Option(
52
+ "--publish <url>",
53
+ "publishing url (or directory) of the package"
54
+ )
49
55
  .env("PKGBUILD_PUBLISH")
50
56
  .argParser(value => {
51
57
  let values = value.split(/,/);
52
58
  if (values.length > 1) {
53
59
  values = values.map(v => process.env[v] || v);
54
- return { url: values[0], user: values[1], password: decodePassword(values[2]) };
60
+ return {
61
+ url: values[0],
62
+ user: values[1],
63
+ password: decodePassword(values[2])
64
+ };
55
65
  }
56
66
 
57
67
  return { url: value };
@@ -135,7 +145,7 @@ program
135
145
  }
136
146
  } catch (e) {
137
147
  console.error(e);
138
- if(!options.continue) {
148
+ if (!options.continue) {
139
149
  process.exit(-1);
140
150
  }
141
151
  }
@@ -93,10 +93,13 @@ export class DEBIAN extends Packager {
93
93
  )
94
94
  );
95
95
 
96
- properties.Depends = Object.entries(dependencies).map(
97
- ([name, e]) => `${packageNameMapping[name] ? packageNameMapping[name] : name} (${e})`
98
- );
99
-
96
+ if (Object.keys(dependencies).length > 0) {
97
+ properties.Depends = Object.entries(dependencies).map(
98
+ ([name, e]) =>
99
+ `${packageNameMapping[name] ? packageNameMapping[name] : name} (${e})`
100
+ );
101
+ }
102
+
100
103
  const fp = fieldProvider(properties, fields);
101
104
  const debianControlName = "DEBIAN/control";
102
105