@cas-smartdesign/license-generator 1.7.0 → 1.8.0

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.
@@ -1 +1 @@
1
- var V=Object.create;var O=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var Q=(e,n)=>{for(var i in n)O(e,i,{get:n[i],enumerable:!0})},J=(e,n,i,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Y(n))!z.call(e,t)&&t!==i&&O(e,t,{get:()=>n[t],enumerable:!(s=W(n,t))||s.enumerable});return e};var k=(e,n,i)=>(i=e!=null?V(_(e)):{},J(n||!e||!e.__esModule?O(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>J(O({},"__esModule",{value:!0}),e);var ne={};Q(ne,{run:()=>ee});module.exports=X(ne);var $=k(require("path"));var w=k(require("fs")),P=k(require("path")),Z=require("resolve-pkg"),m=(e,n,i,s=!1)=>{let t=Z(n,{cwd:e}),o=[],c=f=>{o.push(f);try{return JSON.parse(w.readFileSync(f,{encoding:"utf8"}))}catch{}},a=null;return t!=null&&(a=c(P.join(e,t,i))),a==null&&(t=P.join(e,"node_modules",n),a=c(P.join(t,i))),a==null?(s||(console.error(`Failed to resolve module content from '${e}', module: ${n}, in-module path: ${i}!`),console.error("Attempts:",o)),null):{resolvedPath:t,json:a}};var x=k(require("fs")),E=k(require("path")),D=e=>x.readdirSync(e.resolvedPath,{encoding:"utf8"}).filter(s=>{let t=E.resolve(e.resolvedPath,s);if(!x.lstatSync(t).isFile())return!1;let o=s.toUpperCase();return o.indexOf("LICENSE")>-1||o.indexOf("LICENCE")>-1||o.indexOf("COPYING")>-1})[0];var L=e=>(e=e.replace("github:",""),e=e.replace("git+ssh://git@","git://"),e=e.replace("git+https://github.com","https://github.com"),e=e.replace("git://github.com","https://github.com"),e=e.replace("git@github.com:","https://github.com/"),e=e.replace(".git",""),e.indexOf("://")==-1&&(e="https://github.com/"+e),e);var F=(e,n,i)=>{let s=e.json,t=i(e),o;typeof s.repository=="object"&&s.repository.url?o=L(s.repository.url):typeof s.repository=="string"&&(o=L(s.repository)),o&&(o=o.replace("git://","https://"));let c;o&&t&&(c=o+"/raw/HEAD/"+t),!c&&s.homepage&&(c=s.homepage),c||(c=o);let a="UNKNOWN";return typeof s.license=="object"&&s.license.url?(a=s.license.type,c=L(s.license.url)):typeof s.license=="string"&&(a=s.license),{licenses:a,repository:o,licenseUrl:c,parents:[n]}};var T=(e,n,i,s)=>{let t;if(i?t=m(e,i,"package.json",!0):t={resolvedPath:e,json:require($.join(e,"package.json"))},i&&!t)return;let o=t.json;n==null&&(n=o.name);let c=o.name+"@"+o.version;if(s[c]){s[c].parents.push(n);return}s[c]=F(t,n,D);let a={...o.devDependencies||{},...o.dependencies||{}};Object.keys(a).forEach(f=>{T(e,o.name,f,s)})},y=async function(e){let n={};return T(e,void 0,void 0,n),n};var b=require("path"),B=require("fs"),d=process.cwd(),M=(e,n,i)=>{let s=JSON.parse(JSON.stringify({...n,...e}));return Object.keys(n).forEach(t=>{s[t]&&(i?s[t].parents=[...n[t].parents]:s[t].parents=Array.from(new Set(s[t].parents.concat(n[t].parents))))}),Object.keys(s).forEach(t=>{s[t].parents.sort()}),s};async function q(e){let n=b.resolve(e.root?e.root:d),i=e.excludeShared!=null,s=e.transitiveScopes||[],t=e.includeParents!=null,o=r=>["@cas-smartdesign","@smartdesign",...s].some(p=>r.indexOf(p)==0);console.warn(`Extracting licenses in ${d}`);let c=await(n==d?{}:y(n)),a=await y(d),f=M(c,a,i),h={};Object.keys(f).map(r=>{let g=/(.*)@(.*)/.exec(r),l=g[1],v=g[2];h[l]=h[l]||{},h[l][v]=f[r]});let A=(r,p)=>m(r,p,"package.json")||(n!=d?m(n,p,"package.json"):null),C=(r,p)=>m(r,p,"npm-third-party-licenses.json")?.json,N=r=>{console.log(`Resolving dependencies for ${r}`);let p=require(b.resolve(r,"package.json")),g={...p.devDependencies||{},...p.dependencies||{}},l={};return Object.keys(g).forEach(v=>{let I=A(r,v);if(I==null)return;let u=I.json,j=h[u.name];if(j==null||j[u.version]==null)console.warn(`Missing license for package ${u.name}@${u.version}`);else if(o(v)){let R=C(r,v);R&&(l={...l,...R})}else l[`${u.name}@${u.version}`]={...j[u.version]}}),l},K=n==d?[]:N(n),G=N(d);function H(r){return Object.keys(r).sort().reduce((p,g)=>{let l=r[g];return p[g]=l,p},{})}let S={...i?[]:K,...G};t||Object.keys(S).forEach(r=>{S[r].parents=void 0}),B.writeFileSync(b.resolve(d,"npm-third-party-licenses.json"),JSON.stringify(H(S),null,4))}var U=require("yargs");async function ee(){let e=U().option("root",{alias:"r",description:"Directory in which the crawling process should be started in",type:"string"}).option("transitiveScopes",{alias:"ts",description:"Inherit licenses transitively from the given scopes",type:"array"}).option("excludeShared",{alias:"es",description:"Exclude shared dependencies, inherited from the workspace",type:"boolean"}).option("includeParents",{description:"Include parents property in the generated license file",type:"boolean"}).help().alias("help","h").parse(process.argv.slice(2));q(e)}0&&(module.exports={run});
1
+ var W=Object.create;var O=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var Q=(e,n)=>{for(var o in n)O(e,o,{get:n[o],enumerable:!0})},J=(e,n,o,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of _(n))!H.call(e,t)&&t!==o&&O(e,t,{get:()=>n[t],enumerable:!(s=Y(n,t))||s.enumerable});return e};var k=(e,n,o)=>(o=e!=null?W(z(e)):{},J(n||!e||!e.__esModule?O(o,"default",{value:e,enumerable:!0}):o,e)),X=e=>J(O({},"__esModule",{value:!0}),e);var ne={};Q(ne,{run:()=>ee});module.exports=X(ne);var D=k(require("path"));var w=k(require("fs")),P=k(require("path")),Z=require("resolve-pkg"),m=(e,n,o,s=!1)=>{let t=Z(n,{cwd:e}),i=[],c=p=>{i.push(p);try{return JSON.parse(w.readFileSync(p,{encoding:"utf8"}))}catch{}},l=null;return t!=null&&(l=c(P.join(e,t,o))),l==null&&(t=P.join(e,"node_modules",n),l=c(P.join(t,o))),l==null?(s||(console.error(`Failed to resolve module content from '${e}', module: ${n}, in-module path: ${o}!`),console.error("Attempts:",i)),null):{resolvedPath:t,json:l}};var x=k(require("fs")),$=k(require("path")),E=e=>x.readdirSync(e.resolvedPath,{encoding:"utf8"}).filter(s=>{let t=$.resolve(e.resolvedPath,s);if(!x.lstatSync(t).isFile())return!1;let i=s.toUpperCase();return i.indexOf("LICENSE")>-1||i.indexOf("LICENCE")>-1||i.indexOf("COPYING")>-1})[0];var L=e=>(e=e.replace("github:",""),e=e.replace("git+ssh://git@","git://"),e=e.replace("git+https://github.com","https://github.com"),e=e.replace("git://github.com","https://github.com"),e=e.replace("git@github.com:","https://github.com/"),e=e.replace(".git",""),e.indexOf("://")==-1&&(e="https://github.com/"+e),e);var F=(e,n,o)=>{let s=e.json,t;typeof s.repository=="object"&&s.repository.url?t=L(s.repository.url):typeof s.repository=="string"&&(t=L(s.repository)),t&&(t=t.replace("git://","https://"));let i="UNKNOWN",c;if(typeof s.license=="object"&&s.license.url?(i=s.license.type,c=L(s.license.url)):typeof s.license=="string"&&(i=s.license),!c){let p=o(e);p&&(c=`https://unpkg.com/${s.name}@${s.version}/${p}`)}return!c&&s.homepage&&(c=s.homepage),c||(c=t),{licenses:i,repository:t,licenseUrl:c,parents:[n]}};var T=(e,n,o,s)=>{let t;if(o?t=m(e,o,"package.json",!0):t={resolvedPath:e,json:require(D.join(e,"package.json"))},o&&!t)return;let i=t.json;n==null&&(n=i.name);let c=i.name+"@"+i.version;if(s[c]){s[c].parents.push(n);return}s[c]=F(t,n,E);let l={...i.devDependencies||{},...i.dependencies||{}};Object.keys(l).forEach(p=>{T(e,i.name,p,s)})},y=async function(e){let n={};return T(e,void 0,void 0,n),n};var b=require("path"),B=require("fs"),d=process.cwd(),M=(e,n,o)=>{let s=JSON.parse(JSON.stringify({...n,...e}));return Object.keys(n).forEach(t=>{s[t]&&(o?s[t].parents=[...n[t].parents]:s[t].parents=Array.from(new Set(s[t].parents.concat(n[t].parents))))}),Object.keys(s).forEach(t=>{s[t].parents.sort()}),s};async function q(e){let n=b.resolve(e.root?e.root:d),o=e.excludeShared!=null,s=e.transitiveScopes||[],t=e.includeParents!=null,i=r=>["@cas-smartdesign","@smartdesign",...s].some(a=>r.indexOf(a)==0);console.warn(`Extracting licenses in ${d}`);let c=await(n==d?{}:y(n)),l=await y(d),p=M(c,l,o),h={};Object.keys(p).map(r=>{let g=/(.*)@(.*)/.exec(r),f=g[1],v=g[2];h[f]=h[f]||{},h[f][v]=p[r]});let C=(r,a)=>m(r,a,"package.json")||(n!=d?m(n,a,"package.json"):null),A=(r,a)=>m(r,a,"npm-third-party-licenses.json")?.json,N=r=>{console.log(`Resolving dependencies for ${r}`);let a=require(b.resolve(r,"package.json")),g={...a.devDependencies||{},...a.dependencies||{}},f={};return Object.keys(g).forEach(v=>{let I=C(r,v);if(I==null)return;let u=I.json,j=h[u.name];if(j==null||j[u.version]==null)console.warn(`Missing license for package ${u.name}@${u.version}`);else if(i(v)){let R=A(r,v);R&&(f={...f,...R})}else f[`${u.name}@${u.version}`]={...j[u.version]}}),f},K=n==d?[]:N(n),G=N(d);function V(r){return Object.keys(r).sort().reduce((a,g)=>{let f=r[g];return a[g]=f,a},{})}let S={...o?[]:K,...G};t||Object.keys(S).forEach(r=>{S[r].parents=void 0}),B.writeFileSync(b.resolve(d,"npm-third-party-licenses.json"),JSON.stringify(V(S),null,4))}var U=require("yargs");async function ee(){let e=U().option("root",{alias:"r",description:"Directory in which the crawling process should be started in",type:"string"}).option("transitiveScopes",{alias:"ts",description:"Inherit licenses transitively from the given scopes",type:"array"}).option("excludeShared",{alias:"es",description:"Exclude shared dependencies, inherited from the workspace",type:"boolean"}).option("includeParents",{description:"Include parents property in the generated license file",type:"boolean"}).help().alias("help","h").parse(process.argv.slice(2));q(e)}0&&(module.exports={run});
@@ -2,36 +2,36 @@
2
2
  "@vitest/coverage-v8@3.2.4": {
3
3
  "licenses": "MIT",
4
4
  "repository": "https://github.com/vitest-dev/vitest",
5
- "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
5
+ "licenseUrl": "https://unpkg.com/@vitest/coverage-v8@3.2.4/LICENSE"
6
6
  },
7
7
  "@vitest/ui@3.2.4": {
8
8
  "licenses": "MIT",
9
9
  "repository": "https://github.com/vitest-dev/vitest",
10
- "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
10
+ "licenseUrl": "https://unpkg.com/@vitest/ui@3.2.4/LICENSE"
11
11
  },
12
12
  "resolve-pkg@2.0.0": {
13
13
  "licenses": "MIT",
14
14
  "repository": "https://github.com/sindresorhus/resolve-pkg",
15
- "licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
15
+ "licenseUrl": "https://unpkg.com/resolve-pkg@2.0.0/license"
16
16
  },
17
17
  "tsup@8.5.0": {
18
18
  "licenses": "MIT",
19
19
  "repository": "https://github.com/egoist/tsup",
20
- "licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
20
+ "licenseUrl": "https://unpkg.com/tsup@8.5.0/LICENSE"
21
21
  },
22
22
  "typescript@5.9.2": {
23
23
  "licenses": "Apache-2.0",
24
24
  "repository": "https://github.com/microsoft/TypeScript",
25
- "licenseUrl": "https://github.com/microsoft/TypeScript/raw/HEAD/LICENSE.txt"
25
+ "licenseUrl": "https://unpkg.com/typescript@5.9.2/LICENSE.txt"
26
26
  },
27
27
  "vitest@3.2.4": {
28
28
  "licenses": "MIT",
29
29
  "repository": "https://github.com/vitest-dev/vitest",
30
- "licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
30
+ "licenseUrl": "https://unpkg.com/vitest@3.2.4/LICENSE.md"
31
31
  },
32
32
  "yargs@18.0.0": {
33
33
  "licenses": "MIT",
34
34
  "repository": "https://github.com/yargs/yargs",
35
- "licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
35
+ "licenseUrl": "https://unpkg.com/yargs@18.0.0/LICENSE"
36
36
  }
37
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cas-smartdesign/license-generator",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "A CLI tool to collect licenses from third party libraries",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "bin": {