Skip to content

Commit 1cdea5d

Browse files
committed
build: update dist script file
1 parent a8d7801 commit 1cdea5d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

scripts/dist.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bun
2+
import path from 'node:path';
23
import { Chalk } from 'chalk';
34
import esbuild from 'esbuild';
45
import tscAlias from 'tsc-alias';
@@ -71,7 +72,7 @@ const buildJs = async (
7172
for (const out of result.outputFiles) {
7273
await Bun.write(out.path, out.contents);
7374
list.push({
74-
filePath: out.path,
75+
filePath: path.resolve(out.path),
7576
fileContents: out.text
7677
});
7778
}
@@ -101,11 +102,12 @@ const buildDts = (ext?: BuildOutput['extension']) => {
101102
}
102103
);
103104
const host = ts.createCompilerHost(config.options);
104-
host.writeFile = async (...arg) => {
105+
const writeFile = host.writeFile;
106+
host.writeFile = (...arg) => {
107+
writeFile(...arg);
105108
const [filePath, fileContents] = arg;
106-
await Bun.write(filePath, fileContents);
107109
list.push({
108-
filePath,
110+
filePath: path.resolve(filePath),
109111
fileContents
110112
});
111113
};
@@ -151,17 +153,15 @@ const build = async (
151153
}
152154
}
153155

156+
await resolveAlias(result);
157+
154158
return result;
155159
};
156160

157161
const main = async () => {
158162
console.info('build dist files...');
159163
const startTime = performance.now();
160-
const [esm, dts] = await Promise.all([
161-
build('esm', '.js'),
162-
build('dts', '.d.ts')
163-
]);
164-
await Promise.all([resolveAlias(esm), resolveAlias(dts)]);
164+
await Promise.all([build('esm', '.js'), build('dts', '.d.ts')]);
165165
const endTime = performance.now();
166166

167167
console.info(

0 commit comments

Comments
 (0)