npm-pkgbuild 7.14.0 → 7.14.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "7.14.0",
3
+ "version": "7.14.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,9 +35,7 @@ export class FileContentProvider extends ContentProvider {
35
35
  for (const name of await globby(definitions.pattern, {
36
36
  cwd: base
37
37
  })) {
38
- const entry = new FileSystemEntry(name, base);
39
- Object.assign(entry, this.entryProperties);
40
- yield entry;
38
+ yield Object.assign(new FileSystemEntry(name, base), this.entryProperties);
41
39
  }
42
40
  }
43
41
  }
@@ -1,3 +1,6 @@
1
+ import { join } from "path";
2
+ import { globby } from "globby";
3
+ import { FileSystemEntry } from "content-entry-filesystem";
1
4
  import { ContentProvider } from "./content-provider.mjs";
2
5
 
3
6
  /**
@@ -11,9 +14,119 @@ export class NodeModulesContentProvider extends ContentProvider {
11
14
  return "node-modules";
12
15
  }
13
16
 
14
- static get description()
15
- {
16
- return "use node-modules as source";
17
+ static get description() {
18
+ return "use node_modules as source";
19
+ }
20
+
21
+ constructor(definitions, entryProperties) {
22
+ super();
23
+ Object.assign(this, definitions);
24
+ this.entryProperties = entryProperties;
17
25
  }
18
26
 
27
+ async *[Symbol.asyncIterator]() {
28
+ const cwd = this.dir;
29
+ for (const name of await globby("node_modules/**/*", {
30
+ cwd
31
+ })) {
32
+ yield Object.assign(new FileSystemEntry(name, cwd),this.entryProperties);
33
+ }
34
+ }
19
35
  }
36
+
37
+ const toBeIgnored = [
38
+ {
39
+ options: { filesOnly: true },
40
+ pattern: [".git*", ".npm*", "rollup.config.*", ".travis.yml"]
41
+ },
42
+ {
43
+ options: { filesOnly: true },
44
+ pattern: [
45
+ "*~",
46
+ "*.bak",
47
+ "*.mk",
48
+ "*.bat",
49
+ "*.tmp",
50
+ "*.log",
51
+ "*.orig",
52
+ "*.d.ts*",
53
+ "*.1",
54
+ "*.2",
55
+ "*.3",
56
+ "*.4",
57
+ "*.5",
58
+ "*.6",
59
+ "*.7",
60
+ "*.8",
61
+ "*.9",
62
+ "*.patch",
63
+ "*.cc",
64
+ "*.c",
65
+ "*.h",
66
+ "*.h.in",
67
+ "*.cmake",
68
+ "*.gyp",
69
+ ".jshintrc*",
70
+ ".esl*",
71
+ ".zuul.yml",
72
+ ".doclets.yml",
73
+ ".editorconfig",
74
+ ".tern-project",
75
+ ".dockerignore",
76
+ ".dir-locals.el",
77
+ "appveyor.yml",
78
+ "yarn.lock",
79
+ "gulpfile.js",
80
+ "jsdoc.json",
81
+ "Gruntfile.js",
82
+ "karma.conf.js",
83
+ "verb.md",
84
+ ".nvmrc",
85
+ "config.gypi",
86
+ "bower.json",
87
+ "*.bash_completion.*",
88
+ ".coveralls.yml",
89
+ ".istanbul.yml",
90
+ ".babelrc.*",
91
+ ".nycrc",
92
+ ".DS_Store",
93
+ ".env",
94
+ "x-package.json5",
95
+ "component.json",
96
+ "tsconfig.json",
97
+ "cypress.json",
98
+ ".airtap.yml",
99
+ ".jscs.json",
100
+ "sauce-labs.svg"
101
+ ]
102
+ },
103
+ {
104
+ options: { ignoreCase: true },
105
+ pattern: [
106
+ "*Makefile*",
107
+ "CONTRIBUTING*",
108
+ "Contributors*",
109
+ "CHANGES*",
110
+ "PATENTS*",
111
+ "readme*.md",
112
+ "AUTHORS*",
113
+ "NOTICE*",
114
+ "HISTORY*",
115
+ "SUMMARY.md",
116
+ "MIGRAT*.md",
117
+ "UPGRAD*.md",
118
+ "PULL_REQUEST_TEMPLATE.md",
119
+ "PATTERNS.md",
120
+ "REFERENCE.md",
121
+ "SECURITY.md",
122
+ "SFTPStream.md",
123
+ "LIMITS.md",
124
+ "GOVERNANCE.md",
125
+ "Porting-Buffer.md",
126
+ "chains and topics.md",
127
+ "CODE_OF_CONDUCT*",
128
+ "CODEOWNERS",
129
+ "LICENSE.DOCS*"
130
+ ]
131
+ }
132
+ ];
@@ -20,9 +20,10 @@ export class NPMPackContentProvider extends ContentProvider {
20
20
  return "use npm pack as source";
21
21
  }
22
22
 
23
- constructor(definitions) {
23
+ constructor(definitions, entryProperties) {
24
24
  super();
25
25
  Object.assign(this, definitions);
26
+ this.entryProperties = entryProperties;
26
27
  }
27
28
 
28
29
  async *[Symbol.asyncIterator]() {
@@ -45,9 +46,12 @@ export class NPMPackContentProvider extends ContentProvider {
45
46
  console.log(header.name.substring);
46
47
 
47
48
  entries.push(
48
- new BufferContentEntry(
49
- header.name.substring(8),
50
- Buffer.concat(chunks)
49
+ Object.assign(
50
+ new BufferContentEntry(
51
+ header.name.substring(8),
52
+ Buffer.concat(chunks)
53
+ ),
54
+ this.entryProperties
51
55
  )
52
56
  );
53
57
 
@@ -51,7 +51,7 @@ export async function extractFromPackage(pkg, dir) {
51
51
  let sources = [];
52
52
  let output = {};
53
53
 
54
- const processPkg = (pkg,dir) => {
54
+ const processPkg = (pkg, dir) => {
55
55
  if (pkg.pkg) {
56
56
  const pkgbuild = pkg.pkg;
57
57
 
@@ -65,19 +65,23 @@ export async function extractFromPackage(pkg, dir) {
65
65
  Object.entries(pkgbuild.content).forEach(
66
66
  ([destination, definitions]) => {
67
67
  for (const definition of asArray(definitions)) {
68
- if(definition.type) {
69
- const type = allInputs.find(i => i.name === definition.type);
70
- if(type) {
71
- delete definition.type;
72
- sources.push(new type({ ...definition, dir}, { destination }));
73
- }
74
- else {
75
- console.error("Unknown type '${type}'");
76
- }
77
- }
78
- else {
79
- sources.push(new FileContentProvider(definition, { destination }));
68
+ const entryProperties = { destination };
69
+
70
+ if (definition.type) {
71
+ const type = allInputs.find(i => i.name === definition.type);
72
+ if (type) {
73
+ delete definition.type;
74
+ sources.push(
75
+ new type({ ...definition, dir }, entryProperties)
76
+ );
77
+ } else {
78
+ console.error("Unknown type '${type}'");
80
79
  }
80
+ } else {
81
+ sources.push(
82
+ new FileContentProvider(definition, entryProperties)
83
+ );
84
+ }
81
85
  }
82
86
  }
83
87
  );
@@ -88,7 +92,7 @@ export async function extractFromPackage(pkg, dir) {
88
92
  };
89
93
 
90
94
  await packageWalker(async (pkg, base, modulePath) => {
91
- processPkg(pkg,base);
95
+ processPkg(pkg, base);
92
96
  return true;
93
97
  }, dir);
94
98
 
@@ -72,7 +72,6 @@ program
72
72
  for (const inputFactory of allInputs.filter(
73
73
  inputFactory => options[inputFactory.name] === true
74
74
  )) {
75
- console.log("ADD", inputFactory);
76
75
  sources.push(new inputFactory());
77
76
  }
78
77