Skip to content

Commit d42b81c

Browse files
authored
Fix: invalid versions for workspace package (#4131)
**Summary** When resolving workspace packages, we were always using the version `0.0.0` instead of the version defined in that package. This patch fixes it to use the correct version available from the package.json file inside. **Test plan** Existing tests.
1 parent 5cfb241 commit d42b81c

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/fetchers/workspace-fetcher.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class WorkspaceFetcher {
99
this.config = config;
1010
this.dest = dest;
1111
this.registry = remote.registry;
12-
this.workspaceDir = remote.reference;
12+
this.workspaceDir = remote.reference || '.';
1313
}
1414

1515
config: Config;
@@ -21,27 +21,18 @@ export default class WorkspaceFetcher {
2121
return Promise.resolve();
2222
}
2323

24-
async fetch(defaultManifest: ?Object): Promise<FetchedMetadata> {
25-
let pkg = defaultManifest;
26-
// load the manifest from the workspace directory or return the default
27-
try {
28-
pkg = await this.config.readManifest(this.workspaceDir, this.registry);
29-
} catch (e) {
30-
if (e.code !== 'ENOENT' || !defaultManifest) {
31-
throw e;
32-
}
33-
}
24+
async fetch(): Promise<FetchedMetadata> {
25+
const pkg = await this.config.readManifest(this.workspaceDir, this.registry);
3426

35-
return Promise.resolve({
27+
return {
3628
resolved: null,
3729
hash: '',
3830
cached: false,
3931
dest: this.dest,
4032
package: {
4133
...pkg,
42-
_uid: '',
43-
version: '0.0.0',
34+
_uid: pkg.version,
4435
},
45-
});
36+
};
4637
}
4738
}

0 commit comments

Comments
 (0)