Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implement --excludeScopes=@scope1;@scope2 option #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChrisHubinger
Copy link

This option makes the license-checker ignore all packages that are in
one of the semicolon-separated list of scopes.

This option makes the license-checker ignore all packages that are in
one of the semicolon-separated list of scopes.
@szymn
Copy link

szymn commented Nov 19, 2019

Any chance to get this merged? This is very useful.

@kenhuang
Copy link

Yes, we need this.

@DennisKae
Copy link

@davglass it would be really great to have this feature merged. Can you accept this merge please?

@b-zurg
Copy link

b-zurg commented Jun 7, 2020

@davglass this would be very helpful. Are you able to look at PRs these days?

@b-zurg
Copy link

b-zurg commented Aug 8, 2020

In the meantime I'm using the license checker with my own custom typescript script and wrote this little set of helper functions that does basically what I needed:

const formatDependencyList = (packages: Record<string, string>, orgPrefix: string) =>
  Object.entries(packages)
    .filter(([name]) => name.startsWith(orgPrefix))
    .map(([name, version]) => `${name}@${version}`, []);

const extractOrgPackageExclusion = (prefix: string) =>
  [
    ...formatDependencyList(packageJson.dependencies, prefix),
    ...formatDependencyList(packageJson.devDependencies, prefix),
  ].join(";");

const excludePackages = extractOrgPackageExclusion("@myorganization");

Then you simply pass in excludePackages as one of the checker options and it does the trick. Pretty nifty!

The major benefit of this approach is that it's resilient to version number changes or any package addition and simply looks for a scope. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants