workspace-tools
Advanced tools
Comparing version 0.25.4 to 0.26.0
@@ -5,3 +5,40 @@ { | ||
{ | ||
"date": "Thu, 04 Aug 2022 08:01:45 GMT", | ||
"date": "Thu, 04 Aug 2022 21:47:41 GMT", | ||
"tag": "workspace-tools_v0.26.0", | ||
"version": "0.26.0", | ||
"comments": { | ||
"minor": [ | ||
{ | ||
"author": "elcraig@microsoft.com", | ||
"package": "workspace-tools", | ||
"commit": "e74753a50e613d41f62c1e917ceafc2185791e2a", | ||
"comment": "Use ES2019 output (compatible with Node 14)" | ||
} | ||
], | ||
"none": [ | ||
{ | ||
"author": "elcraig@microsoft.com", | ||
"package": "workspace-tools", | ||
"commit": "286b02b981a5bc532560ee17433ef0501f9414ea", | ||
"comment": "Use Node 14 in repo and types" | ||
}, | ||
{ | ||
"author": "renovate@whitesourcesoftware.com", | ||
"package": "workspace-tools", | ||
"commit": "5cba374fac27ef530d5f80530d3b925577f7e193", | ||
"comment": "Lock file maintenance" | ||
} | ||
], | ||
"patch": [ | ||
{ | ||
"author": "boabdelm@microsoft.com", | ||
"package": "workspace-tools", | ||
"commit": "5577a58d537fe41ca2dd8f74ea243da700ca0840", | ||
"comment": "Gracefully handle not having a package.json at git root" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Thu, 04 Aug 2022 08:01:48 GMT", | ||
"tag": "workspace-tools_v0.25.4", | ||
@@ -8,0 +45,0 @@ "version": "0.25.4", |
# Change Log - workspace-tools | ||
This log was last generated on Thu, 04 Aug 2022 08:01:45 GMT and should not be manually modified. | ||
This log was last generated on Thu, 04 Aug 2022 21:47:41 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 0.26.0 | ||
Thu, 04 Aug 2022 21:47:41 GMT | ||
### Minor changes | ||
- Use ES2019 output (compatible with Node 14) (elcraig@microsoft.com) | ||
### Patches | ||
- Gracefully handle not having a package.json at git root (boabdelm@microsoft.com) | ||
## 0.25.4 | ||
Thu, 04 Aug 2022 08:01:45 GMT | ||
Thu, 04 Aug 2022 08:01:48 GMT | ||
@@ -11,0 +23,0 @@ ### Patches |
@@ -29,3 +29,3 @@ "use strict"; | ||
catch (e) { | ||
throw new Error(`Could not read "${packageJsonPath}"`); | ||
logOrThrow(`Could not read "${packageJsonPath}"`); | ||
} | ||
@@ -32,0 +32,0 @@ const { repository } = packageJson; |
@@ -40,3 +40,3 @@ "use strict"; | ||
function git(args, options) { | ||
const results = (0, child_process_1.spawnSync)("git", args, Object.assign({ maxBuffer: defaultMaxBuffer }, options)); | ||
const results = (0, child_process_1.spawnSync)("git", args, { maxBuffer: defaultMaxBuffer, ...options }); | ||
const output = { | ||
@@ -43,0 +43,0 @@ stderr: results.stderr.toString().trimRight(), |
@@ -5,5 +5,9 @@ "use strict"; | ||
function getPackageDependencies(info, packages, options = { withDevDependencies: true }) { | ||
const deps = Object.assign(Object.assign(Object.assign({}, info.dependencies), (options.withDevDependencies && info.devDependencies)), (options.withPeerDependencies && info.peerDependencies)); | ||
const deps = { | ||
...info.dependencies, | ||
...(options.withDevDependencies && info.devDependencies), | ||
...(options.withPeerDependencies && info.peerDependencies), | ||
}; | ||
return Object.keys(packages).filter((pkg) => !!deps[pkg]); | ||
} | ||
exports.getPackageDependencies = getPackageDependencies; |
@@ -75,3 +75,3 @@ "use strict"; | ||
} | ||
fs_extra_1.default.writeFileSync(pkgJsonPath, JSON.stringify(Object.assign(Object.assign({}, oldPackageJson), packageJson), null, 2)); | ||
fs_extra_1.default.writeFileSync(pkgJsonPath, JSON.stringify({ ...oldPackageJson, ...packageJson }, null, 2)); | ||
} | ||
@@ -78,0 +78,0 @@ exports.setupPackageJson = setupPackageJson; |
@@ -5,4 +5,7 @@ "use strict"; | ||
function infoFromPackageJson(packageJson, packageJsonPath) { | ||
return Object.assign({ packageJsonPath }, packageJson); | ||
return { | ||
packageJsonPath, | ||
...packageJson, | ||
}; | ||
} | ||
exports.infoFromPackageJson = infoFromPackageJson; |
@@ -72,3 +72,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
throw new Error("Couldn’t parse package-lock.json."); | ||
@@ -75,0 +75,0 @@ } |
import { ParsedLock, NpmLockFile } from "./types"; | ||
export declare const parseNpmLock: (lock: NpmLockFile) => ParsedLock; | ||
export declare function parseNpmLock(lock: NpmLockFile): ParsedLock; |
@@ -5,14 +5,7 @@ "use strict"; | ||
const nameAtVersion_1 = require("./nameAtVersion"); | ||
/** | ||
* formatNpmLock reformats the dependencies object, so the key includes the version, similarly to yarn.lock. For | ||
* example, `"@microsoft/task-scheduler": { }` will become `"@microsoft/task-scheduler@2.7.1": { }`. | ||
*/ | ||
const formatNpmLock = (previousValue, currentValue) => { | ||
const [key, dependency] = currentValue; | ||
previousValue[(0, nameAtVersion_1.nameAtVersion)(key, dependency.version)] = dependency; | ||
return previousValue; | ||
}; | ||
const parseNpmLock = (lock) => { | ||
function parseNpmLock(lock) { | ||
var _a; | ||
const dependencies = Object.entries((_a = lock.dependencies) !== null && _a !== void 0 ? _a : {}).reduce(formatNpmLock, {}); | ||
// Re-format the dependencies object so that the key includes the version, similarly to yarn.lock. | ||
// For example, `"@microsoft/task-scheduler": { }` will become `"@microsoft/task-scheduler@2.7.1": { }`. | ||
const dependencies = Object.fromEntries(Object.entries((_a = lock.dependencies) !== null && _a !== void 0 ? _a : {}).map(([key, dep]) => [(0, nameAtVersion_1.nameAtVersion)(key, dep.version), dep])); | ||
return { | ||
@@ -22,3 +15,3 @@ object: dependencies, | ||
}; | ||
}; | ||
} | ||
exports.parseNpmLock = parseNpmLock; |
@@ -58,3 +58,3 @@ "use strict"; | ||
} | ||
catch (_a) { } | ||
catch { } | ||
return workspaceRoot || findGitRoot(cwd); | ||
@@ -61,0 +61,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return returnValue; | ||
@@ -28,3 +28,6 @@ } | ||
path: workspacePath, | ||
packageJson: Object.assign(Object.assign({}, packageJson), { packageJsonPath }), | ||
packageJson: { | ||
...packageJson, | ||
packageJsonPath, | ||
}, | ||
}, | ||
@@ -31,0 +34,0 @@ ]; |
@@ -30,3 +30,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return []; | ||
@@ -33,0 +33,0 @@ } |
@@ -47,3 +47,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return []; | ||
@@ -50,0 +50,0 @@ } |
@@ -29,3 +29,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return []; | ||
@@ -32,0 +32,0 @@ } |
@@ -28,3 +28,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return []; | ||
@@ -31,0 +31,0 @@ } |
{ | ||
"name": "workspace-tools", | ||
"version": "0.25.4", | ||
"version": "0.26.0", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "repository": { | ||
"@types/micromatch": "4.0.2", | ||
"@types/node": "13.13.5", | ||
"@types/node": "14.18.23", | ||
"@types/tmp": "0.2.3", | ||
@@ -43,0 +43,0 @@ "@types/yarnpkg__lockfile": "1.1.5", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143430
3434