@travetto/manifest 3.0.0-rc.4 → 3.0.0-rc.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/package.ts +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/manifest",
3
- "version": "3.0.0-rc.4",
3
+ "version": "3.0.0-rc.6",
4
4
  "description": "Manifest support",
5
5
  "keywords": [
6
6
  "path",
package/src/package.ts CHANGED
@@ -54,11 +54,12 @@ export class PackageUtil {
54
54
  static getAllDependencies<T = unknown>(modulePath: string, rootPath: string): PackageVisitReq<T>[] {
55
55
  const pkg = this.readPackage(modulePath);
56
56
  const children: Record<string, PackageVisitReq<T>> = {};
57
+ const local = modulePath === rootPath && !modulePath.includes('node_modules');
57
58
  for (const [deps, rel] of [
58
59
  [pkg.dependencies, 'prod'],
59
60
  [pkg.peerDependencies, 'peer'],
60
61
  [pkg.optionalDependencies, 'opt'],
61
- ...(modulePath === rootPath ? [[pkg.devDependencies, 'dev'] as const] : []),
62
+ ...(local ? [[pkg.devDependencies, 'dev'] as const] : []),
62
63
  ] as const) {
63
64
  for (const [name, version] of Object.entries(deps ?? {})) {
64
65
  try {
@@ -78,7 +79,10 @@ export class PackageUtil {
78
79
  /**
79
80
  * Read a package.json from a given folder
80
81
  */
81
- static readPackage(modulePath: string): Package {
82
+ static readPackage(modulePath: string, forceRead = false): Package {
83
+ if (forceRead) {
84
+ delete this.#cache[modulePath];
85
+ }
82
86
  return this.#cache[modulePath] ??= JSON.parse(readFileSync(
83
87
  modulePath.endsWith('.json') ? modulePath : path.resolve(modulePath, 'package.json'),
84
88
  'utf8'
@@ -174,7 +178,7 @@ export class PackageUtil {
174
178
  */
175
179
  static async syncVersions(folders: string[], versionMapping: Record<string, string> = {}): Promise<void> {
176
180
  const packages = folders.map(folder => {
177
- const pkg = this.readPackage(folder);
181
+ const pkg = this.readPackage(folder, true);
178
182
  versionMapping[pkg.name] = `^${pkg.version}`;
179
183
  return { folder, pkg };
180
184
  });