Skip to content

Commit

Permalink
chore: add test step that makes sure no external/builtin dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tjenkinson committed May 5, 2023
1 parent 09c69e2 commit f4d4f86
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@
!/SECURITY.md
!/tap-snapshots/
!/test/
!/rollup.config.js
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "The semantic version parser used by npm.",
"main": "index.js",
"scripts": {
"test": "tap",
"test": "tap && npm run check-self-contained",
"snap": "tap",
"check-self-contained": "rollup -c --silent > /dev/null",
"lint": "eslint \"**/*.js\"",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
Expand All @@ -15,6 +16,8 @@
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.14.1",
"@rollup/plugin-commonjs": "^24.1.0",
"rollup": "^3.21.5",
"tap": "^16.0.0"
},
"license": "ISC",
Expand Down
22 changes: 22 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fs = require("fs");
const commonjs = require("@rollup/plugin-commonjs");

const pkgJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"));

module.exports = {
input: pkgJson.main,
plugins: [
commonjs({
strictRequires: true,
ignoreTryCatch: true,
}),
],
external: Object.keys(pkgJson.dependencies),
onwarn: (e) => {
if (e.code === "CIRCULAR_DEPENDENCY") {
return;
}

throw new Error(e);
},
};
1 change: 1 addition & 0 deletions test/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ignore = [
'tap-snapshots',
'test',
'fixtures',
'rollup.config.js',
]

const { statSync, readdirSync } = require('fs')
Expand Down

0 comments on commit f4d4f86

Please sign in to comment.