Skip to content

Commit

Permalink
feat: migrate from bun.lockb to bun.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Jan 18, 2025
1 parent bc6832e commit 2f4b615
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
* text=auto

*.lockb binary diff=lockb
bun.lock linguist-language=json
bun.lockb binary diff=lockb

*.vcproj text eol=crlf

*.cjs text eol=lf
Expand Down
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from 'node:fs/promises';
import fs from 'node:fs';
import path from 'node:path';

import { ignoreErrorAsync } from '@willbooster/shared-lib';
Expand Down Expand Up @@ -80,7 +80,7 @@ async function main(): Promise<void> {

for (const rootDirPath of argv.paths as string[]) {
const packagesDirPath = path.join(rootDirPath, 'packages');
const dirents = (await ignoreErrorAsync(() => fs.readdir(packagesDirPath, { withFileTypes: true }))) ?? [];
const dirents = (await ignoreErrorAsync(() => fs.promises.readdir(packagesDirPath, { withFileTypes: true }))) ?? [];
const subDirPaths = dirents.filter((d) => d.isDirectory()).map((d) => path.join(packagesDirPath, d.name));

await fixTestDirectoriesUpdatingPackageJson([rootDirPath, ...subDirPaths]);
Expand Down Expand Up @@ -186,6 +186,14 @@ async function main(): Promise<void> {
// corresponding to the contents of dependant sub-package in monorepo
if (rootConfig.isBun) {
spawnSync(packageManager, ['update'], rootDirPath);
// TODO: Remove the following line after there is no bun.lockb
if (fs.existsSync(path.join(rootDirPath, 'bun.lockb'))) {
spawnSync(
packageManager,
['install', '--save-text-lockfile', '--frozen-lockfile', '--lockfile-only'],
rootDirPath
);
}
} else {
spawnSync(packageManager, ['install'], rootDirPath);
}
Expand Down

0 comments on commit 2f4b615

Please sign in to comment.