aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-10-13 13:14:58 +0200
committerIgor Pashev <pashev.igor@gmail.com>2019-10-13 13:14:58 +0200
commitd7004f856a3d2ec0c9220ee6ca945fe0441e5676 (patch)
tree37bcb5e48812c8f770a095bfa93defa2e5d4ad3e /lib
parent48b45733f27179964bc0fc9580f11a77300feda1 (diff)
downloadnpm4nix-d7004f856a3d2ec0c9220ee6ca945fe0441e5676.tar.gz
Allow drop some dev. dependencies
Diffstat (limited to 'lib')
-rw-r--r--lib/template.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/template.js b/lib/template.js
index 9664d88..991f441 100644
--- a/lib/template.js
+++ b/lib/template.js
@@ -1,3 +1,16 @@
+// XXX We will never use in our builds.
+// XXX Original names, e. g. "@foo/bar".
+const devDepsBlackList = [
+ "better-npm-run",
+ "doctoc",
+ "eslint",
+ "husky",
+ "lint-staged",
+ "live-server",
+ "npm-run-all",
+ "watch",
+];
+
function normalize(name) {
return name.replace('/', '-').replace('@', '').replace('.', '-');
}
@@ -35,6 +48,16 @@ function render({
}) {
const deps = pkg.dependencies || {};
const devDeps = pkg.devDependencies || {};
+
+ var dropDevDependencies = [];
+
+ devDepsBlackList.forEach((d) => {
+ if (devDeps[d]) {
+ delete devDeps[d];
+ dropDevDependencies.push(d);
+ }
+ });
+
const npmInputs = Object.keys({...deps,
...devDeps
}).sort().map(normalize);
@@ -85,8 +108,12 @@ ${source}
npmInputs = [
${fmt(npmInputs, 80, ' ', '\n ')}
];
+
+ dropDevDependencies = [
+ ${fmt(dropDevDependencies.sort().map(d => `"${d}"`), 80, ' ', '\n ')}
+ ];
}
`;
}
-module.exports = render; \ No newline at end of file
+module.exports = render;