Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't include the version of a local env or app in its root directory #7888

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions scopes/workspace/install/install.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ export class InstallMain {
await Promise.all(
envs.map(async (envId) => {
return [
getRootComponentDir(this.workspace.path, envId.toString()),
await this.getRootComponentDirByRootId(this.workspace.path, envId),
{
dependencies: {
...(await this._getEnvDependencies(envId)),
Expand Down Expand Up @@ -576,7 +576,7 @@ export class InstallMain {
if (!appManifest) return null;
const envId = await this.envs.calculateEnvId(app);
return [
getRootComponentDir(this.workspace.path, app.id.toString()),
await this.getRootComponentDirByRootId(this.workspace.path, app.id),
{
...omit(appManifest, ['name', 'version']),
dependencies: {
Expand Down Expand Up @@ -770,10 +770,11 @@ export class InstallMain {

private async _linkAllComponentsToBitRoots(compDirMap: ComponentMap<string>) {
const envs = await this._getAllUsedEnvIds();
const apps = (await this.app.listAppsComponents()).map((component) => component.id.toString());
const apps = (await this.app.listAppsComponents()).map((component) => component.id);
await Promise.all(
[...envs, ...apps].map(async (id) => {
await fs.mkdirp(getRootComponentDir(this.workspace.path, id.toString()));
const dir = await this.getRootComponentDirByRootId(this.workspace.path, id);
await fs.mkdirp(dir);
})
);
await linkPkgsToBitRoots(
Expand All @@ -782,6 +783,15 @@ export class InstallMain {
);
}

private async getRootComponentDirByRootId(workspacePath: string, rootComponentId: ComponentID): Promise<string> {
// Root directories for local envs and apps are created without their version number.
// This is done in order to avoid changes to the lockfile after such components are tagged.
const id = (await this.workspace.hasId(rootComponentId))
? rootComponentId.toStringWithoutVersion()
: rootComponentId.toString();
return getRootComponentDir(workspacePath, id);
}

/**
* Generate a filter to pass to the installer
* This will filter deps which are come from remotes which defined in scope.json
Expand Down