dwkim 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/profile.json +10 -0
- package/package.json +3 -2
- package/script/build.js +14 -0
- package/script/loadProfile.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dwkim",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"devDependencies": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "npm run build && node dist/index.js",
|
|
20
20
|
"build": "node script/build.js",
|
|
21
|
-
"build:watch": "node script/build.js --watch"
|
|
21
|
+
"build:watch": "node script/build.js --watch",
|
|
22
|
+
"prebuild": "node script/loadProfile.js"
|
|
22
23
|
}
|
|
23
24
|
}
|
package/script/build.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
2
3
|
|
|
3
4
|
const config = {
|
|
4
5
|
entryPoints: ['src/index.ts'],
|
|
@@ -12,14 +13,27 @@ const config = {
|
|
|
12
13
|
external: ['chalk', 'boxen'],
|
|
13
14
|
};
|
|
14
15
|
|
|
16
|
+
// JSON 파일 복사 함수
|
|
17
|
+
async function copyJsonFiles() {
|
|
18
|
+
try {
|
|
19
|
+
await fs.mkdir('dist', { recursive: true });
|
|
20
|
+
await fs.copyFile('profile.json', 'dist/profile.json');
|
|
21
|
+
console.log('JSON files copied successfully');
|
|
22
|
+
} catch (err) {
|
|
23
|
+
console.error('Error copying JSON files:', err);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
const args = process.argv.slice(2);
|
|
16
28
|
const watch = args.includes('--watch');
|
|
17
29
|
|
|
18
30
|
if (watch) {
|
|
19
31
|
const ctx = await esbuild.context(config);
|
|
32
|
+
await copyJsonFiles(); // 초기 복사
|
|
20
33
|
await ctx.watch();
|
|
21
34
|
console.log('Watching...');
|
|
22
35
|
} else {
|
|
23
36
|
await esbuild.build(config);
|
|
37
|
+
await copyJsonFiles(); // 빌드 후 복사
|
|
24
38
|
console.log('Built!');
|
|
25
39
|
}
|
package/script/loadProfile.js
CHANGED