Skip to content

Commit

Permalink
feat(codemod): upgrade refactor
Browse files Browse the repository at this point in the history
fix commands
  • Loading branch information
tknickman committed Jun 13, 2023
1 parent 608c0c9 commit 7066c2e
Show file tree
Hide file tree
Showing 43 changed files with 1,472 additions and 1,380 deletions.
15 changes: 3 additions & 12 deletions packages/create-turbo/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,9 @@ describe("create-turbo", () => {
const mockAvailablePackageManagers = jest
.spyOn(turboUtils, "getAvailablePackageManagers")
.mockResolvedValue({
npm: {
available: true,
version: "8.19.2",
},
yarn: {
available: true,
version: "1.22.10",
},
pnpm: {
available: true,
version: "7.22.2",
},
npm: "8.19.2",
yarn: "1.22.10",
pnpm: "7.22.2",
});

const mockCreateProject = jest
Expand Down
6 changes: 5 additions & 1 deletion packages/create-turbo/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ module.exports = {
testEnvironment: "node",
testPathIgnorePatterns: ["/__fixtures__/", "/__tests__/test-utils.ts"],
coveragePathIgnorePatterns: ["/__fixtures__/", "/__tests__/test-utils.ts"],
transformIgnorePatterns: ["/node_modules/(?!(ansi-regex)/)"],
transformIgnorePatterns: [
"node_modules/*",
"packages/turbo-utils/*",
"packages/turbo-workspaces/*",
],
modulePathIgnorePatterns: ["<rootDir>/node_modules", "<rootDir>/dist"],
collectCoverage: true,
verbose: process.env.RUNNER_DEBUG === "1",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-turbo/src/commands/create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export async function create(
skipTransforms || !selectedPackageManagerDetails
? {
name: project.packageManager,
version: availablePackageManagers[project.packageManager].version,
version: availablePackageManagers[project.packageManager],
}
: selectedPackageManagerDetails;

Expand Down Expand Up @@ -173,7 +173,7 @@ export async function create(
// before we attempt an install
if (
opts.skipTransforms &&
!availablePackageManagers[project.packageManager].available
!availablePackageManagers[project.packageManager]
) {
warn(
`Unable to install dependencies - "${exampleName}" uses "${project.packageManager}" which could not be found.`
Expand Down
6 changes: 3 additions & 3 deletions packages/create-turbo/src/commands/create/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export async function packageManager({
// prompt for package manager if it wasn't provided as an argument, or if it was
// provided, but isn't available (always allow npm)
!packageManager ||
!availablePackageManagers?.[packageManager as PackageManager]?.available,
!availablePackageManagers?.[packageManager as PackageManager],
choices: ["npm", "pnpm", "yarn"].map((p) => ({
name: p,
value: p,
disabled: availablePackageManagers?.[p as PackageManager]?.available
disabled: availablePackageManagers?.[p as PackageManager]
? false
: `not installed`,
})),
Expand All @@ -72,6 +72,6 @@ export async function packageManager({

return {
name: selectedPackageManager,
version: availablePackageManagers[selectedPackageManager].version,
version: availablePackageManagers[selectedPackageManager],
};
}
Loading

0 comments on commit 7066c2e

Please sign in to comment.