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

ci(examples): test every package manager in Support Policy on basic #9593

Merged
merged 38 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5b2839c
examples(ci): test every package manager in Support Policy on basic
anthonyshew Dec 8, 2024
d245065
WIP
anthonyshew Dec 8, 2024
1ca349f
WIP
anthonyshew Dec 8, 2024
ca0d5e6
WIP
anthonyshew Dec 8, 2024
572a6b8
WIP
anthonyshew Dec 8, 2024
485b447
WIP
anthonyshew Dec 8, 2024
3ff4958
WIP
anthonyshew Dec 8, 2024
d7aad1d
WIP
anthonyshew Dec 8, 2024
94a4d12
Updated package manager to npm
anthonyshew Dec 9, 2024
75db8a0
Updated package manager to npm
anthonyshew Dec 9, 2024
905cedc
WIP
anthonyshew Dec 9, 2024
1b1ab1c
WIP
anthonyshew Dec 9, 2024
07fb663
WIP
anthonyshew Dec 9, 2024
3502613
WIP
anthonyshew Dec 9, 2024
003b568
WIP
anthonyshew Dec 9, 2024
29c4b91
WIP
anthonyshew Dec 9, 2024
243b72b
WIP
anthonyshew Dec 12, 2024
eb83086
WIP
anthonyshew Dec 12, 2024
1317200
WIP
anthonyshew Dec 12, 2024
2774612
WIP
anthonyshew Dec 12, 2024
3a2ec06
WIP
anthonyshew Dec 12, 2024
ff25852
WIP
anthonyshew Dec 12, 2024
5dab8fb
WIP
anthonyshew Dec 12, 2024
b1ef37f
WIP
anthonyshew Dec 12, 2024
2d59b22
WIP
anthonyshew Dec 12, 2024
cc9a26e
WIP
anthonyshew Dec 12, 2024
7a1a776
WIP
anthonyshew Dec 12, 2024
b69ec29
WIP
anthonyshew Dec 12, 2024
18c14ac
WIP
anthonyshew Dec 12, 2024
161ab34
WIP
anthonyshew Dec 12, 2024
10f81d6
WIP
anthonyshew Dec 13, 2024
5d263aa
WIP
anthonyshew Dec 13, 2024
52699df
WIP
anthonyshew Dec 13, 2024
61d848c
WIP
anthonyshew Dec 13, 2024
05d23e1
WIP
anthonyshew Dec 13, 2024
5533e5f
WIP
anthonyshew Dec 13, 2024
31b8900
WIP
anthonyshew Dec 13, 2024
8f7461d
fix: throwing stuff at the wall
chris-olszewski Dec 13, 2024
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
3 changes: 2 additions & 1 deletion packages/turbo-types/scripts/generate-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import { writeFileSync } from "node:fs";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { createGenerator } from "ts-json-schema-generator";

const __dirname = new URL(".", import.meta.url).pathname;
const __dirname = fileURLToPath(new URL(".", import.meta.url));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity, this fixes a bug in generating types in @turbo/types on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const packageRoot = join(__dirname, "..", "src");

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/turbo-workspaces/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ workspacesCli
"Do not run a package manager install after conversion",
false
)
.option(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to make sure I was always getting a successful exit code for my scripts. This seemed like a reasonable flag to add, even beyond my specific use case.

"--ignore-unchanged-package-manager",
"Prevent script failure if the package manager is unchanged",
false
)
.option("--dry", "Dry run (no changes are made to files)", false)
.option(
"--force",
Expand Down
45 changes: 25 additions & 20 deletions packages/turbo-workspaces/src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,38 @@ export async function convertProject({
`Converting project from ${project.packageManager} to ${convertTo.name}.`
);

if (project.packageManager === convertTo.name) {
throw new ConvertError("You are already using this package manager", {
type: "package_manager-already_in_use",
});
}
if (!options?.ignoreUnchangedPackageManager) {
if (project.packageManager === convertTo.name) {
throw new ConvertError("You are already using this package manager", {
type: "package_manager-already_in_use",
});
}

if (!convertTo.version) {
throw new ConvertError(
`${convertTo.name} is not installed, or could not be located`,
{
type: "package_manager-could_not_be_found",
}
);
if (!convertTo.version) {
throw new ConvertError(
`${convertTo.name} is not installed, or could not be located`,
{
type: "package_manager-could_not_be_found",
}
);
}
}

// this cast is safe since we've just verified that the version exists above
const to = convertTo as AvailablePackageManagerDetails;

// remove old workspace data
await MANAGERS[project.packageManager].remove({
project,
to,
logger,
options,
});
if (!options?.ignoreUnchangedPackageManager) {
await MANAGERS[project.packageManager].remove({
project,
to,
logger,
options,
});
}

// create new workspace data
await MANAGERS[to.name].create({ project, to, logger, options });

logger.mainStep("Installing dependencies");
if (!options?.skipInstall) {
await MANAGERS[to.name].convertLock({ project, to, logger, options });
Expand All @@ -74,5 +77,7 @@ export async function convertProject({
}

logger.mainStep(`Cleaning up ${project.packageManager} workspaces`);
await MANAGERS[project.packageManager].clean({ project, logger });
if (project.packageManager !== convertTo.name) {
await MANAGERS[project.packageManager].clean({ project, logger });
}
}
1 change: 1 addition & 0 deletions packages/turbo-workspaces/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export interface Options {
dry?: boolean;
skipInstall?: boolean;
interactive?: boolean;
ignoreUnchangedPackageManager?: boolean;
}

export interface PackageManagerInstallDetails {
Expand Down
Loading
Loading