Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
license audit
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed May 24, 2022
1 parent 836db19 commit 6ad811a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 182 deletions.
177 changes: 5 additions & 172 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"bluebird": "^3.7.2",
"compression": "^1.7.4",
"cors": "^2.8.5",
"dockerode": "^3.3.1",
"dotenv": "^8.2.0",
"eslint": "*",
"eslint-config-prettier": "^8.3.0",
Expand Down
18 changes: 11 additions & 7 deletions license.audit.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
const backendPackageJSON = require('./backend/package.json');
// const frontendPackageJSON = require('./frontend/package.json');
/**
* Run this script from the root of the repo you want to inspect. It's assumed
* that there's a `./node_modules` and `./package.json` where this script runs.
*/

const module = `backend`; // or frontend

const packageJSON = require(`./${module}/package.json`);

// Get all the top-level dependencies for the current project.
const dependencies = {
...backendPackageJSON.dependencies,
...backendPackageJSON.devDependencies
// ...frontendPackageJSON.dependencies,
// ...frontendPackageJSON.devDependencies
...packageJSON.dependencies,
...packageJSON.devDependencies
};

// Get the names of every dependency.
const dependencyNames = Object.keys(dependencies);

// Create a key => value of depenencyName => { license, whateverElse };
const licenses = dependencyNames.reduce((memo, dependencyName) => {
const dependencyDirectory = `./backend/node_modules/${dependencyName}`;
const dependencyDirectory = `./${module}/${dependencyName}`;
const dependencyPackageJSON = require(`${dependencyDirectory}/package.json`);
const license = dependencyPackageJSON.license;

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
},
"dependencies": {},
"license": "BSD-3-Clause"
}
}

0 comments on commit 6ad811a

Please sign in to comment.