Skip to content

Commit

Permalink
fix(wb): avoid 'bun --bun run bun --bun run'
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Aug 16, 2024
1 parent f01e6ca commit c8dbac6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/wb/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { memoizeFactory } from 'at-decorators';
import { globby } from 'globby';
import type { PackageJson } from 'type-fest';

import { isRunningOnBun } from './utils/runtime.js';

const memoize = memoizeFactory({ maxCachedThisSize: Number.MAX_SAFE_INTEGER, maxCachedArgsSize: 1 });

export class Project {
Expand All @@ -35,11 +33,9 @@ export class Project {

@memoize
get buildCommand(): string {
return isRunningOnBun
? 'true'
: this.packageJson.scripts?.build?.includes('buildIfNeeded')
? 'yarn build'
: `YARN wb buildIfNeeded ${this.argv.verbose ? '--verbose' : ''}`;
return this.packageJson.scripts?.build?.includes('buildIfNeeded')
? 'YARN build'
: `YARN wb buildIfNeeded ${this.argv.verbose ? '--verbose' : ''}`;
}

get dirPath(): string {
Expand Down
1 change: 1 addition & 0 deletions packages/wb/src/scripts/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function normalizeScript(script: string, project: Project): [string, string] {
if (isRunningOnBun) {
newScript = newScript
.replaceAll('build-ts run', 'bun --bun run')
.replaceAll('bun --bun run bun --bun run', 'bun --bun run')
.replaceAll('dist/index.js', 'src/index.ts')
.replaceAll(/(YARN )?vitest run/g, 'bun test')
.replaceAll(' --color --passWithNoTests --allowOnly', '');
Expand Down

0 comments on commit c8dbac6

Please sign in to comment.