@callstack/licenses 0.3.1 → 0.3.3
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.
package/build/node/common.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.generateAboutLibrariesNPMOutput = generateAboutLibrariesNPMOutput;
|
|
|
10
10
|
exports.writeAboutLibrariesNPMOutput = writeAboutLibrariesNPMOutput;
|
|
11
11
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
12
|
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
-
const glob_1 =
|
|
13
|
+
const glob_1 = require("glob");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
15
|
const utils_2 = require("./utils");
|
|
16
16
|
/**
|
|
@@ -46,7 +46,7 @@ function scanPackage(packageName, requiredVersion, processedPackages, result, sc
|
|
|
46
46
|
}
|
|
47
47
|
const localPackageJson = require(node_path_1.default.resolve(localPackageJsonPath));
|
|
48
48
|
if (localPackageJson.private !== true) {
|
|
49
|
-
const licenseFiles = glob_1.
|
|
49
|
+
const licenseFiles = glob_1.glob.sync('LICEN{S,C}E{.md,}', {
|
|
50
50
|
cwd: node_path_1.default.dirname(localPackageJsonPath),
|
|
51
51
|
absolute: true,
|
|
52
52
|
nocase: true,
|
|
@@ -197,7 +197,7 @@ function generateLicensePlistNPMOutput(licenses, iosProjectPath) {
|
|
|
197
197
|
if (!localPackageJsonPath) {
|
|
198
198
|
return acc;
|
|
199
199
|
}
|
|
200
|
-
const podspecFiles = glob_1.
|
|
200
|
+
const podspecFiles = glob_1.glob.sync('**.podspec', {
|
|
201
201
|
cwd: node_path_1.default.dirname(localPackageJsonPath),
|
|
202
202
|
absolute: true,
|
|
203
203
|
nocase: true,
|
|
@@ -62,7 +62,13 @@ function prepareAboutLibrariesLicenseField(license) {
|
|
|
62
62
|
if (!license.type) {
|
|
63
63
|
return '';
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
// The returned value is used as a filename under `android/config/licenses/`.
|
|
66
|
+
// Legacy/compound SPDX expressions like `MIT/X11` or `(MIT OR Apache-2.0)` would
|
|
67
|
+
// otherwise produce paths containing `/`, `(` or spaces, which causes the writer
|
|
68
|
+
// to either fail with ENOENT (when a `/` is interpreted as a subdirectory) or
|
|
69
|
+
// to produce names that are invalid on some filesystems.
|
|
70
|
+
const sanitizedType = license.type.replace(/[^A-Za-z0-9._-]/g, '_');
|
|
71
|
+
return `${sanitizedType}_${(0, miscUtils_1.sha512)(license.content ?? sanitizedType)}`;
|
|
66
72
|
}
|
|
67
73
|
function parseAuthorField(json) {
|
|
68
74
|
if (typeof json.author === 'object' && typeof json.author.name === 'string') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/licenses",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "API package that exposes functionalities for programmatic scanning of licenses in Node.js projects.",
|
|
5
5
|
"browser": "./build/index.js",
|
|
6
6
|
"main": "./build/node/index.js",
|
|
@@ -64,13 +64,12 @@
|
|
|
64
64
|
"registry": "https://registry.npmjs.org/"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"glob": "^
|
|
67
|
+
"glob": "^13.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@babel/core": "7.
|
|
71
|
-
"@babel/preset-env": "7.
|
|
72
|
-
"@babel/preset-typescript": "7.
|
|
73
|
-
"@types/glob": "^8.1.0",
|
|
70
|
+
"@babel/core": "^7.29.7",
|
|
71
|
+
"@babel/preset-env": "^7.29.7",
|
|
72
|
+
"@babel/preset-typescript": "^7.29.7",
|
|
74
73
|
"@types/jest": "^29.5.5",
|
|
75
74
|
"babel-jest": "^29.7.0",
|
|
76
75
|
"jest": "^29.7.0",
|
package/src/node/common.ts
CHANGED
|
@@ -59,7 +59,14 @@ export function prepareAboutLibrariesLicenseField(license: License) {
|
|
|
59
59
|
return '';
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
// The returned value is used as a filename under `android/config/licenses/`.
|
|
63
|
+
// Legacy/compound SPDX expressions like `MIT/X11` or `(MIT OR Apache-2.0)` would
|
|
64
|
+
// otherwise produce paths containing `/`, `(` or spaces, which causes the writer
|
|
65
|
+
// to either fail with ENOENT (when a `/` is interpreted as a subdirectory) or
|
|
66
|
+
// to produce names that are invalid on some filesystems.
|
|
67
|
+
const sanitizedType = license.type.replace(/[^A-Za-z0-9._-]/g, '_');
|
|
68
|
+
|
|
69
|
+
return `${sanitizedType}_${sha512(license.content ?? sanitizedType)}`;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
export function parseAuthorField(json: { author: string | { name: string } }) {
|