Skip to content

Commit

Permalink
fix typecheck issues, allow bun as cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentezw committed Nov 15, 2023
1 parent 883fef0 commit 9258916
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 5 deletions.
9 changes: 8 additions & 1 deletion packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"name": "force",
"type": "boolean",
"char": "f",
"description": "Allows a deployment to proceed if there are uncommited changes in the Git repository.",
"description": "Forces a deployment to proceed if there are uncommited changes in its Git repository.",
"required": false,
"allowNo": false
},
Expand All @@ -199,6 +199,13 @@
"required": false,
"allowNo": false
},
"no-json-output": {
"name": "no-json-output",
"type": "boolean",
"description": "Prevents the command from creating a JSON file containing the deployment URL (in CI environments).",
"required": false,
"allowNo": false
},
"token": {
"name": "token",
"type": "option",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/hydrogen/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ async function runDev({
type: 0,
message:
'MiniOxygen cannot start because the server bundle has not been generated.',
skipOclifErrorHandling: true,
tryMessage:
'This is likely due to an error in your app and Remix is unable to compile. Try fixing the app and MiniOxygen will start.',
});
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/hydrogen/shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function runCreateShortcut() {
name: 'error',
type: 0,
message: 'No supported shell found.',
skipOclifErrorHandling: true,
tryMessage: 'Please create a shortcut manually.',
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/check-lockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function missingLockfileWarning(shouldExit: boolean) {

function multipleLockfilesWarning(lockfiles: Lockfile[], shouldExit: boolean) {
const packageManagers = {
'bun.lockb': 'bun',
'yarn.lock': 'yarn',
'package-lock.json': 'npm',
'pnpm-lock.yaml': 'pnpm',
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export function spawnCodegenProcess({
type: 0,
name: 'CodegenError',
message: `Codegen process exited with code ${code}`,
skipOclifErrorHandling: true,
tryMessage: 'Try restarting the dev server.',
});

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/lib/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ export function createRemixLogger() {
name: 'error',
type: 0,
message: buildMessageBody(message, options?.details),
skipOclifErrorHandling: true,
tryMessage: '',
});
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/onboarding/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ export async function commitAll(directory: string, message: string) {

export type SetupSummary = {
language?: Language;
packageManager: 'npm' | 'pnpm' | 'yarn' | 'unknown';
packageManager: 'npm' | 'pnpm' | 'yarn' | 'bun' | 'unknown';
cssStrategy?: CssStrategy;
hasCreatedShortcut: boolean;
depsInstalled: boolean;
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/lib/render-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function renderMissingStorefront({
message: outputContent`${outputToken.errorText(
'Couldn’t find Hydrogen storefront.',
)}`.value,
skipOclifErrorHandling: true,
tryMessage: outputContent`Couldn’t find ${storefront.title} (ID: ${parseGid(
storefront.id,
)}) on ${
Expand All @@ -45,6 +46,7 @@ export function renderMissingLink({session, cliCommand}: MissingLink) {
name: 'NoLinkedStorefrontError',
type: 0,
message: `No linked Hydrogen storefront on ${session.storeFqdn}`,
skipOclifErrorHandling: true,
tryMessage: [
'To pull environment variables or to deploy to Oxygen, link this project to a Hydrogen storefront. To select a storefront to link, run',
{command: `${cliCommand} link`},
Expand Down
7 changes: 4 additions & 3 deletions packages/cli/src/lib/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,18 @@ async function createShortcutsForWindows() {

export async function getCliCommand(
directory = process.cwd(),
forcePkgManager?: 'npm' | 'pnpm' | 'yarn' | 'unknown',
forcePkgManager?: 'npm' | 'pnpm' | 'yarn' | 'bun' | 'unknown',
) {
if (!forcePkgManager && (await hasCliAlias())) {
return ALIAS_NAME;
}

let cli: 'npx' | 'pnpm' | 'yarn' = 'npx';
let cli: 'bun' | 'npx' | 'pnpm' | 'yarn' = 'npx';
const pkgManager =
forcePkgManager ?? (await getPackageManager(directory).catch(() => null));

if (pkgManager === 'pnpm' || pkgManager === 'yarn') cli = pkgManager;
if (pkgManager === 'bun' || pkgManager === 'pnpm' || pkgManager === 'yarn')
cli = pkgManager;

return `${cli} shopify hydrogen` as const;
}
Expand Down

0 comments on commit 9258916

Please sign in to comment.