dwkim 0.0.17 → 0.0.18
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/README.md +58 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +43 -0
- package/dist/index.mjs +18 -0
- package/package.json +8 -1
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/workflows/main.yml +0 -21
- package/.github/workflows/publish.yml +0 -36
- package/CHANGELOG.md +0 -14
- package/src/index.ts +0 -14
- package/tsconfig.json +0 -32
package/README.md
CHANGED
|
@@ -249,6 +249,64 @@ jobs:
|
|
|
249
249
|
|
|
250
250
|
---
|
|
251
251
|
|
|
252
|
+
## 11. NPM 배포 시 꼭 알아야 할 실무 팁
|
|
253
|
+
|
|
254
|
+
### 1. dist만 NPM에 포함시키기
|
|
255
|
+
|
|
256
|
+
- `package.json`에 아래처럼 **files 필드**를 추가하면, NPM 배포 시 dist 폴더만 포함됩니다.
|
|
257
|
+
|
|
258
|
+
```json
|
|
259
|
+
"files": [
|
|
260
|
+
"dist"
|
|
261
|
+
]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
- 또는, `.npmignore` 파일을 만들어 불필요한 파일/폴더를 명시적으로 제외할 수 있습니다.
|
|
265
|
+
(단, files 필드가 있으면 files가 우선 적용됨)
|
|
266
|
+
|
|
267
|
+
예시:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
src/
|
|
271
|
+
test/
|
|
272
|
+
.github/
|
|
273
|
+
.vscode/
|
|
274
|
+
*.ts
|
|
275
|
+
*.md
|
|
276
|
+
!dist/
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### 2. bin 필드와 shebang
|
|
280
|
+
|
|
281
|
+
- CLI로 실행하려면 `package.json`에 아래처럼 **bin 필드**를 추가해야 합니다.
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
"bin": {
|
|
285
|
+
"dwkim": "dist/index.js"
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
- 그리고 `src/index.ts`의 맨 위에 아래와 같이 **shebang**을 추가해야 합니다.
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
#!/usr/bin/env node
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
- 빌드 후(`dist/index.js`)에도 이 줄이 남아 있어야 하며, 실행 권한도 확인하세요.
|
|
296
|
+
|
|
297
|
+
### 3. 빌드 후 배포
|
|
298
|
+
|
|
299
|
+
- 반드시 `pnpm run build`로 dist 폴더가 생성된 후에 배포해야 합니다.
|
|
300
|
+
- release 스크립트에 build가 포함되어 있는지 확인하세요.
|
|
301
|
+
|
|
302
|
+
### 4. .gitignore vs .npmignore
|
|
303
|
+
|
|
304
|
+
- `.gitignore`: git에 포함하지 않을 파일
|
|
305
|
+
- `.npmignore`: npm publish 시 포함하지 않을 파일 (없으면 .gitignore를 참고)
|
|
306
|
+
- **files 필드가 있으면 files가 최우선 적용**
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
252
310
|
## 참고
|
|
253
311
|
|
|
254
312
|
- [예제 저장소 ↗]
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
identitiy: () => identitiy,
|
|
25
|
+
multiply: () => multiply
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
function multiply(a, b) {
|
|
29
|
+
return a * b;
|
|
30
|
+
}
|
|
31
|
+
function identitiy(arg) {
|
|
32
|
+
return arg;
|
|
33
|
+
}
|
|
34
|
+
function main() {
|
|
35
|
+
console.log("multiply 1 2", multiply(1, 2));
|
|
36
|
+
console.log("identitiy 1", identitiy("1"));
|
|
37
|
+
}
|
|
38
|
+
main();
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
identitiy,
|
|
42
|
+
multiply
|
|
43
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
function multiply(a, b) {
|
|
5
|
+
return a * b;
|
|
6
|
+
}
|
|
7
|
+
function identitiy(arg) {
|
|
8
|
+
return arg;
|
|
9
|
+
}
|
|
10
|
+
function main() {
|
|
11
|
+
console.log("multiply 1 2", multiply(1, 2));
|
|
12
|
+
console.log("identitiy 1", identitiy("1"));
|
|
13
|
+
}
|
|
14
|
+
main();
|
|
15
|
+
export {
|
|
16
|
+
identitiy,
|
|
17
|
+
multiply
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dwkim",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "this",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dannyworks102@gmail.com",
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.mjs",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
|
+
"bin": {
|
|
12
|
+
"dwkim": "dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"package.json"
|
|
17
|
+
],
|
|
11
18
|
"dependencies": {
|
|
12
19
|
"typescript": "^5.8.3"
|
|
13
20
|
},
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "public",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: CI - lint & build
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- '**'
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: pnpm/action-setup@v2
|
|
13
|
-
with:
|
|
14
|
-
version: 9
|
|
15
|
-
- uses: actions/setup-node@v4
|
|
16
|
-
with:
|
|
17
|
-
node-version: 20
|
|
18
|
-
cache: 'pnpm'
|
|
19
|
-
|
|
20
|
-
- run: pnpm install --frozen-lockfile
|
|
21
|
-
- run: pnpm run lint && pnpm run build
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: Publish
|
|
2
|
-
on:
|
|
3
|
-
workflow_run:
|
|
4
|
-
workflows: [CI - lint & build]
|
|
5
|
-
branches: [main]
|
|
6
|
-
types: [completed]
|
|
7
|
-
|
|
8
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
-
|
|
10
|
-
permissions:
|
|
11
|
-
contents: write
|
|
12
|
-
pull-requests: write
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
publish:
|
|
16
|
-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v3
|
|
20
|
-
- uses: pnpm/action-setup@v2
|
|
21
|
-
with:
|
|
22
|
-
version: 9
|
|
23
|
-
- uses: actions/setup-node@v3
|
|
24
|
-
with:
|
|
25
|
-
node-version: 20.x
|
|
26
|
-
cache: 'pnpm'
|
|
27
|
-
|
|
28
|
-
- run: pnpm install --frozen-lockfile
|
|
29
|
-
- name: Create Release Pull Request or Publish
|
|
30
|
-
id: changesets
|
|
31
|
-
uses: changesets/action@v1
|
|
32
|
-
with:
|
|
33
|
-
publish: pnpm publish --no-git-checks
|
|
34
|
-
env:
|
|
35
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
36
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/CHANGELOG.md
DELETED
package/src/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function multiply(a: number, b: number): number {
|
|
2
|
-
return a * b;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function identitiy<T>(arg: T): T {
|
|
6
|
-
return arg;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function main() {
|
|
10
|
-
console.log('multiply 1 2', multiply(1, 2));
|
|
11
|
-
console.log('identitiy 1', identitiy('1'));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
main();
|
package/tsconfig.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
/* Language and Environment */
|
|
5
|
-
"target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
6
|
-
"moduleDetection": "force" /* Control what method is used to detect module-format JS files. */,
|
|
7
|
-
"verbatimModuleSyntax": true,
|
|
8
|
-
"moduleResolution": "Bundler", // gonna use tsup
|
|
9
|
-
"module": "ESNext",
|
|
10
|
-
|
|
11
|
-
"lib": ["es2022", "dom", "dom.iterable"],
|
|
12
|
-
|
|
13
|
-
/* Modules */
|
|
14
|
-
"resolveJsonModule": true /* Enable importing .json files. */,
|
|
15
|
-
|
|
16
|
-
/* JavaScript Support */
|
|
17
|
-
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
|
|
18
|
-
|
|
19
|
-
/* Emit */
|
|
20
|
-
"noEmit": true /* Disable emitting files from a compilation. */,
|
|
21
|
-
|
|
22
|
-
/* Interop Constraints */
|
|
23
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
24
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
25
|
-
|
|
26
|
-
/* Type Checking */
|
|
27
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
28
|
-
|
|
29
|
-
/* Completeness */
|
|
30
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
31
|
-
}
|
|
32
|
-
}
|