dwkim 0.0.3 → 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/index.js +29 -0
- package/dist/profile.json +10 -0
- package/package.json +15 -17
- package/profile.json +10 -0
- package/script/build.js +39 -0
- package/script/loadProfile.js +10 -0
- package/src/index.ts +21 -26
- package/src/profile.json +10 -0
- package/tsconfig.json +7 -9
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -30
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import boxen from "boxen";
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
var profile = JSON.parse(
|
|
9
|
+
fs.readFileSync(path.join(process.cwd(), "./profile.json"), "utf8")
|
|
10
|
+
);
|
|
11
|
+
var boxenOptions = {
|
|
12
|
+
padding: 1,
|
|
13
|
+
margin: 0,
|
|
14
|
+
borderStyle: "round",
|
|
15
|
+
borderColor: "green",
|
|
16
|
+
fullscreen: (width, height) => [width, height - 10]
|
|
17
|
+
};
|
|
18
|
+
var cardContent = [
|
|
19
|
+
chalk.white.bold(profile.name),
|
|
20
|
+
chalk.white(profile.title),
|
|
21
|
+
chalk.white(profile.bio),
|
|
22
|
+
"",
|
|
23
|
+
chalk.gray.bgWhite("Email: ") + chalk.white(profile.email),
|
|
24
|
+
chalk.gray.bgWhite("GitHub: ") + chalk.white(profile.github),
|
|
25
|
+
chalk.gray.bgWhite("Website: ") + chalk.white(profile.website),
|
|
26
|
+
"",
|
|
27
|
+
chalk.white("Out of box, pay it forward \u{1F44B}")
|
|
28
|
+
].join("\n");
|
|
29
|
+
console.log(boxen(cardContent, boxenOptions));
|
package/package.json
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dwkim",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "0.0.4",
|
|
6
4
|
"type": "module",
|
|
7
|
-
"bin": "./dist/
|
|
8
|
-
"keywords": [],
|
|
9
|
-
"author": "",
|
|
10
|
-
"license": "ISC",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"boxen": "^8.0.1",
|
|
13
|
-
"chalk": "^5.4.1",
|
|
14
|
-
"ts-node": "^10.9.2"
|
|
15
|
-
},
|
|
5
|
+
"bin": "./dist/index.js",
|
|
16
6
|
"devDependencies": {
|
|
17
|
-
"
|
|
7
|
+
"@types/node": "^20.11.24",
|
|
8
|
+
"esbuild": "^0.24.2",
|
|
9
|
+
"ts-node": "^10.9.2",
|
|
10
|
+
"typescript": "~5.6.2",
|
|
18
11
|
"@repo/database": "1.0.0",
|
|
19
|
-
"@repo/typescript-config": "0.0.0"
|
|
20
|
-
|
|
12
|
+
"@repo/typescript-config": "0.0.0"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"boxen": "^8.0.1",
|
|
16
|
+
"chalk": "^5.4.1"
|
|
21
17
|
},
|
|
22
18
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"build": "
|
|
19
|
+
"start": "npm run build && node dist/index.js",
|
|
20
|
+
"build": "node script/build.js",
|
|
21
|
+
"build:watch": "node script/build.js --watch",
|
|
22
|
+
"prebuild": "node script/loadProfile.js"
|
|
25
23
|
}
|
|
26
24
|
}
|
package/profile.json
ADDED
package/script/build.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
|
|
4
|
+
const config = {
|
|
5
|
+
entryPoints: ['src/index.ts'],
|
|
6
|
+
bundle: true,
|
|
7
|
+
platform: 'node',
|
|
8
|
+
format: 'esm',
|
|
9
|
+
outfile: 'dist/index.js',
|
|
10
|
+
banner: {
|
|
11
|
+
js: '#!/usr/bin/env node',
|
|
12
|
+
},
|
|
13
|
+
external: ['chalk', 'boxen'],
|
|
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
|
+
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
const watch = args.includes('--watch');
|
|
29
|
+
|
|
30
|
+
if (watch) {
|
|
31
|
+
const ctx = await esbuild.context(config);
|
|
32
|
+
await copyJsonFiles(); // 초기 복사
|
|
33
|
+
await ctx.watch();
|
|
34
|
+
console.log('Watching...');
|
|
35
|
+
} else {
|
|
36
|
+
await esbuild.build(config);
|
|
37
|
+
await copyJsonFiles(); // 빌드 후 복사
|
|
38
|
+
console.log('Built!');
|
|
39
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
1
|
import chalk from 'chalk';
|
|
4
2
|
import boxen, { type Options } from 'boxen';
|
|
5
|
-
import
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
const profile = JSON.parse(
|
|
7
|
+
fs.readFileSync(path.join(process.cwd(), './profile.json'), 'utf8')
|
|
8
|
+
);
|
|
6
9
|
|
|
7
|
-
// 명함 스타일 설정
|
|
8
10
|
const boxenOptions: Options = {
|
|
9
11
|
padding: 1,
|
|
10
|
-
margin:
|
|
12
|
+
margin: 0,
|
|
11
13
|
borderStyle: 'round',
|
|
12
14
|
borderColor: 'green',
|
|
15
|
+
fullscreen: (width, height) => [width, height - 10],
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'',
|
|
27
|
-
chalk.gray('Email: ') + chalk.white(cardData.email),
|
|
28
|
-
chalk.gray('GitHub: ') + chalk.white(cardData.github),
|
|
29
|
-
chalk.gray('Website: ') + chalk.white(cardData.website),
|
|
30
|
-
].join('\n');
|
|
31
|
-
|
|
32
|
-
// 명함 출력
|
|
33
|
-
console.log(boxen(cardContent, boxenOptions));
|
|
34
|
-
};
|
|
18
|
+
const cardContent = [
|
|
19
|
+
chalk.white.bold(profile.name),
|
|
20
|
+
chalk.white(profile.title),
|
|
21
|
+
chalk.white(profile.bio),
|
|
22
|
+
'',
|
|
23
|
+
chalk.gray.bgWhite('Email: ') + chalk.white(profile.email),
|
|
24
|
+
chalk.gray.bgWhite('GitHub: ') + chalk.white(profile.github),
|
|
25
|
+
chalk.gray.bgWhite('Website: ') + chalk.white(profile.website),
|
|
26
|
+
'',
|
|
27
|
+
chalk.white('Out of box, pay it forward 👋'),
|
|
28
|
+
].join('\n');
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
// 명함 출력
|
|
31
|
+
console.log(boxen(cardContent, boxenOptions));
|
package/src/profile.json
ADDED
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@repo/typescript-config/base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"target": "
|
|
5
|
-
"module": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"strict": true,
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"module": "NodeNext",
|
|
6
|
+
"moduleResolution": "NodeNext",
|
|
7
|
+
"resolveJsonModule": true,
|
|
9
8
|
"esModuleInterop": true,
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"incremental": false
|
|
9
|
+
"outDir": "./dist",
|
|
10
|
+
"types": ["node"]
|
|
13
11
|
},
|
|
14
|
-
"include": ["**/*.ts"],
|
|
12
|
+
"include": ["**/*.ts", "script/loadProfile.js", "src/index.ts"],
|
|
15
13
|
"exclude": ["node_modules", "dist"]
|
|
16
14
|
}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
package/dist/src/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import boxen from 'boxen';
|
|
4
|
-
import { prisma } from '@repo/database';
|
|
5
|
-
// 명함 스타일 설정
|
|
6
|
-
const boxenOptions = {
|
|
7
|
-
padding: 1,
|
|
8
|
-
margin: 1,
|
|
9
|
-
borderStyle: 'round',
|
|
10
|
-
borderColor: 'green',
|
|
11
|
-
};
|
|
12
|
-
const main = async () => {
|
|
13
|
-
const cardData = await prisma.user.findFirst();
|
|
14
|
-
if (!cardData) {
|
|
15
|
-
console.error('No card data found');
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const cardContent = [
|
|
19
|
-
chalk.white.bold(cardData.name),
|
|
20
|
-
chalk.white(cardData.title),
|
|
21
|
-
chalk.white(cardData.bio),
|
|
22
|
-
'',
|
|
23
|
-
chalk.gray('Email: ') + chalk.white(cardData.email),
|
|
24
|
-
chalk.gray('GitHub: ') + chalk.white(cardData.github),
|
|
25
|
-
chalk.gray('Website: ') + chalk.white(cardData.website),
|
|
26
|
-
].join('\n');
|
|
27
|
-
// 명함 출력
|
|
28
|
-
console.log(boxen(cardContent, boxenOptions));
|
|
29
|
-
};
|
|
30
|
-
main();
|