@gregoriusrippenstein/node-red-contrib-nodedev 0.3.8 → 0.4.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.
@@ -66,6 +66,7 @@
66
66
  githubauthor: { value: ""},
67
67
  githubauthoremail: { value: "" },
68
68
  githubmessage: { value: "" },
69
+ githubgettar: { value: false },
69
70
 
70
71
  npmpublish: { value: false },
71
72
  npmunpublish: { value: false },
@@ -124,6 +125,16 @@
124
125
  }
125
126
  });
126
127
 
128
+ $('#node-input-githubgettar').on('change', () => {
129
+ if ( $('#node-input-githubgettar').is(":checked") ) {
130
+ $("#github-options").animate({opacity: 'show', height: 'show'}, 450);
131
+ } else {
132
+ if ( !$('#node-input-gitcheckforchange').is(":checked") && !$('#node-input-gitcommit').is(":checked") ) {
133
+ $("#github-options").animate({opacity: 'hide', height: 'hide'}, 450);
134
+ }
135
+ }
136
+ });
137
+
127
138
  $('#node-input-npmpublish').on('change', () => {
128
139
  if ( $('#node-input-npmpublish').is(":checked") ) {
129
140
  $("#npmpublish-options").animate({opacity: 'show', height: 'show'}, 450);
@@ -279,12 +290,17 @@
279
290
  <span>GitHub: Commit?</span>
280
291
  </label>
281
292
  <input type="checkbox" id="node-input-gitcommit" style="display:inline-block; width:15px; vertical-align:baseline;">
293
+
282
294
  <label for="node-input-gitcheckforchange" style="margin-left: 30px; min-width: 100px;">
283
295
  <span>What changed?</span>
284
296
  </label>
285
297
  <input type="checkbox" id="node-input-gitcheckforchange" style="display:inline-block; width:15px; vertical-align:baseline;">
286
- </div>
287
298
 
299
+ <label for="node-input-githubgettar" style="margin-left: 15px; min-width: 100px;">
300
+ <span>Get Repo?</span>
301
+ </label>
302
+ <input type="checkbox" id="node-input-githubgettar" style="display:inline-block; width:15px; vertical-align:baseline;">
303
+ </div>
288
304
 
289
305
  <div id="github-options">
290
306
  <div class="form-row">
@@ -4,6 +4,7 @@ module.exports = (function () {
4
4
  var streamx = require('streamx');
5
5
  var pakoGzip = require('pako');
6
6
  let pathUtil = require('path')
7
+ const buffer = require('buffer')
7
8
 
8
9
  /*
9
10
  * there is no indication in a tar file of whether a file is binary or textual.
@@ -98,10 +99,34 @@ module.exports = (function () {
98
99
  })
99
100
 
100
101
  extract.on('error', onError );
101
- var stream = streamx.Readable.from(Buffer.from(pakoGzip.inflate(new Uint8Array(tgzData))))
102
- stream.pipe(extract);
103
- }
104
102
 
103
+ try {
104
+ if (buffer.Buffer.isBuffer(tgzData)) {
105
+ import('file-type').then(module => {
106
+ module.fileTypeFromBuffer(tgzData).then(filetype => {
107
+ if ( filetype && filetype.ext == "tar") {
108
+ var stream = streamx.Readable.from(tgzData)
109
+ stream.pipe(extract);
110
+ } else {
111
+ var stream = streamx.Readable.from(Buffer.from(pakoGzip.inflate(new Uint8Array(tgzData))))
112
+ stream.pipe(extract);
113
+ }
114
+ }).catch(err => {
115
+ var stream = streamx.Readable.from(Buffer.from(pakoGzip.inflate(new Uint8Array(tgzData))))
116
+ stream.pipe(extract);
117
+ })
118
+ }).catch( e => {
119
+ var stream = streamx.Readable.from(Buffer.from(pakoGzip.inflate(new Uint8Array(tgzData))))
120
+ stream.pipe(extract);
121
+ })
122
+ } else {
123
+ var stream = streamx.Readable.from(Buffer.from(pakoGzip.inflate(new Uint8Array(tgzData))))
124
+ stream.pipe(extract);
125
+ }
126
+ } catch (ex) {
127
+ onError(ex)
128
+ }
129
+ }
105
130
 
106
131
  let exports = {
107
132
  computeFormat: computeFormat,
@@ -2,6 +2,64 @@ module.exports = function (RED) {
2
2
  let pacote = require('pacote');
3
3
  let tarHelpers = require('./lib/tarhelpers.js');
4
4
 
5
+ let dirGrpColours = (dirname) => {
6
+
7
+ dirname = (dirname.startsWith("dist/") || dirname == "dist") ? "dist" : dirname
8
+ dirname = (dirname.startsWith("nodes/locales/") || dirname == "nodes/locales" ) ? "nodes/locales" : dirname
9
+ dirname = (dirname.startsWith("locales/") || dirname == "locales") ? "nodes/locales" : dirname
10
+ dirname = (dirname.startsWith("samples/") || dirname == "samples") ? "examples" : dirname
11
+ dirname = (dirname != "." && dirname.startsWith(".")) ? ".dir" : dirname
12
+
13
+ let lookup = {
14
+ ".dir": {
15
+ "stroke": "#dbcbe7",
16
+ "fill": "#dbcbe7",
17
+ },
18
+ ".": {
19
+ "stroke": "#ffefbf",
20
+ "fill": "#ffefbf",
21
+ },
22
+ "examples": {
23
+ "stroke": "#addb7b",
24
+ "fill": "#addb7b",
25
+ },
26
+ "nodes": {
27
+ "stroke": "#c8e7a7",
28
+ "fill": "#c8e7a7",
29
+ },
30
+ "plugins": {
31
+ "stroke": "#92d04f",
32
+ "fill": "#92d04f",
33
+ },
34
+ "nodes/lib": {
35
+ "stroke": "#e3f3d3",
36
+ "fill": "#e3f3d3",
37
+ },
38
+ "assets": {
39
+ "stroke": "#0070c0",
40
+ "fill": "#0070c0",
41
+ },
42
+ "icons": {
43
+ "stroke": "#3f93cf",
44
+ "fill": "#3f93cf",
45
+ },
46
+ "nodes/icons": {
47
+ "stroke": "#3f93cf",
48
+ "fill": "#3f93cf",
49
+ },
50
+ "dist": {
51
+ "stroke": "#ffbfbf",
52
+ "fill": "#ffbfbf"
53
+ },
54
+ "nodes/locales": {
55
+ "stroke": "#bfdbef",
56
+ "fill": "#bfdbef",
57
+ }
58
+ }
59
+
60
+ return lookup[dirname] || {}
61
+ }
62
+
5
63
  function ConfigNodeFactorySidebarFunctionality(config) {
6
64
  RED.nodes.createNode(this, config)
7
65
  }
@@ -67,14 +125,18 @@ module.exports = function (RED) {
67
125
  }
68
126
 
69
127
  function createGroupForDirectory(dirname, allIds) {
128
+ // no label position means that the label goes top-left.
70
129
  return {
71
130
  "id": RED.util.generateId(),
72
131
  "type": "group",
73
132
  "name": `Dir: ${dirname}`,
74
133
  "style": {
75
134
  "label": true,
76
- "label-position": "ne",
77
- "color": "#001f60"
135
+ // "label-position": "ne",
136
+ "color": "#001f60",
137
+ "stroke-opacity": "0.75",
138
+ "fill-opacity": "0.5",
139
+ ...dirGrpColours(dirname)
78
140
  },
79
141
  "nodes": allIds
80
142
  }
@@ -170,7 +232,6 @@ module.exports = function (RED) {
170
232
 
171
233
  lastNode.wires[0].push(tarballNode.id)
172
234
 
173
-
174
235
  /* group by dirname */
175
236
  let groupByDirectory = {}
176
237
  let dirGroups = []
@@ -190,9 +251,7 @@ module.exports = function (RED) {
190
251
 
191
252
  allFiles = [
192
253
  createGroup(msg.pkgname, nodeDevOp.pversion || msg.pkgversion, dirGroups.concat(nodeDevNodes))
193
- // @ts-ignore
194
- ].concat(dirGroups).concat(nodeDevNodes).concat(allFiles);
195
-
254
+ ].concat(dirGroups).concat(nodeDevNodes).concat(allFiles)
196
255
 
197
256
  RED.comms.publish(
198
257
  "nodedev:perform-autoimport-nodes",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "@gregoriusrippenstein/node-red-contrib-nodedev",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "dependencies": {
5
5
  "pako": "^2.1.0",
6
6
  "tar-stream": "^3.1.6",
@@ -9,7 +9,8 @@
9
9
  "streamx": "^2.15.5",
10
10
  "got": "^13",
11
11
  "pacote": "^17.0.4",
12
- "otpauth": "^5.0.8"
12
+ "otpauth": "^5.0.8",
13
+ "file-type": ">=18.7.0"
13
14
  },
14
15
 
15
16
  "keywords": [