@gregoriusrippenstein/node-red-contrib-nodedev 0.3.2 → 0.3.3

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.
@@ -13,6 +13,12 @@
13
13
  action: {
14
14
  value: "publish"
15
15
  },
16
+ access: {
17
+ value: "public"
18
+ },
19
+ registry: {
20
+ value: "registry.npmjs.org"
21
+ },
16
22
  authToken: {
17
23
  value: "NPM_AUTH_TOKEN",
18
24
  },
@@ -25,7 +31,7 @@
25
31
  outputs: 1,
26
32
 
27
33
  label: function() {
28
- return (this.name || this._def.paletteLabel);
34
+ return (this.name || (this.action == "publish" ? "NpmPublish" : "NpmUnpublish" )|| this._def.paletteLabel);
29
35
  },
30
36
 
31
37
  labelStyle: function() {
@@ -67,10 +73,20 @@
67
73
  <input type="text" id="node-input-name" placeholder="Name">
68
74
  </div>
69
75
 
76
+ <div class="form-row">
77
+ <label for="node-input-registry"><i class="fa fa-database"></i> Registry</label>
78
+ <input type="text" id="node-input-registry" placeholder="Registry">
79
+ </div>
80
+
81
+ <div class="form-row">
82
+ <label for="node-input-access"><i class="fa fa-user-secret"></i> Access</label>
83
+ <input type="text" id="node-input-access" placeholder="Access">
84
+ </div>
85
+
70
86
  <div class="form-row">
71
87
  <label for="node-input-authToken">
72
88
  <i class="fa fa-tag"></i>
73
- NPM Auth Token
89
+ Auth Token
74
90
  </label>
75
91
  <input type="text" id="node-input-authToken">
76
92
  <input type="hidden" id="node-input-authTokenType">
@@ -28,20 +28,22 @@ module.exports = function (RED) {
28
28
  var auth_token = result;
29
29
  var tarball = Buffer.from(msg.payload)
30
30
 
31
- var manifest = JSON.parse(msg.contents.filter((d) => {
31
+ let registry = msg.npmregistry || cfg.registry || 'registry.npmjs.org'
32
+
33
+ let manifest = JSON.parse(msg.contents.filter((d) => {
32
34
  return d.name == "package.json"
33
35
  })[0].contents);
34
36
 
35
37
  var opts = {
36
- npmVersion: "node-red-contrib-nodedev@0.1.5",
37
- access: "public",
38
+ npmVersion: "node-red-contrib-nodedev@0.3.2",
39
+ access: msg.npmaccess || cfg.access || "public",
38
40
  otp: msg.npmotp || cfg.otp,
39
41
  authToken: auth_token,
40
- '//registry.npmjs.org/:_authToken': auth_token,
41
42
  };
43
+ opts[`//${registry}/:_authToken`] = auth_token
42
44
 
43
45
  var userscope = manifest.name.split("/")[0];
44
- opts[userscope + ":registry"] = "https://registry.npmjs.org"
46
+ opts[userscope + ":registry"] = `https://${registry}`
45
47
 
46
48
  if (msg.npmpublish || cfg.action == "publish") {
47
49
 
@@ -65,20 +67,18 @@ module.exports = function (RED) {
65
67
  msg.error = exp;
66
68
  done("publish failed", msg)
67
69
  })
68
- } else {
69
- if (msg.npmunpublish || cfg.action == "unpublish") {
70
- libpub.unpublish(
71
- manifest.name, opts
72
- ).then((data) => {
73
- msg.payload = JSON.stringify(data);
74
- send(msg)
75
- done()
76
- }).catch((exp) => {
77
- msg.error = exp;
78
- done("unpublish failed", msg)
79
- })
80
- }
81
- }
70
+ } else if (msg.npmunpublish || cfg.action == "unpublish") {
71
+ libpub.unpublish(
72
+ manifest.name, opts
73
+ ).then((data) => {
74
+ msg.payload = JSON.stringify(data);
75
+ send(msg)
76
+ done()
77
+ }).catch((exp) => {
78
+ msg.error = exp;
79
+ done("unpublish failed", msg)
80
+ })
81
+ }
82
82
  })
83
83
  });
84
84
  }
@@ -67,7 +67,7 @@ module.exports = (function () {
67
67
  name: header.name.split("/").at(-1),
68
68
  filename: header.name.replace(/^package\//, ''),
69
69
  template: Buffer.concat(buffer).toString(frmt == "base64" ? 'base64' : 'utf8'),
70
- syntax: "plain", // not mustache templates, these are files.
70
+ syntax: header.name.replace(/^package\//, '') == "package.json" ? "mustache" : "plain",
71
71
  format: frmt,
72
72
  output: "str",
73
73
  x: 250 * Math.floor(allFiles.length / 40),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "@gregoriusrippenstein/node-red-contrib-nodedev",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "dependencies": {
5
5
  "pako": "^2.1.0",
6
6
  "tar-stream": "^3.1.6",