Skip to content

Commit 381582b

Browse files
committed
🔨 Optimize build script
Signed-off-by: kei-g <km.8k6ce+github@gmail.com>
1 parent d4cbec0 commit 381582b

File tree

9 files changed

+25
-19
lines changed

9 files changed

+25
-19
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
**/*.d.ts
2+
**/*.js
13
**/.nyc_output/
24
**/.vscode/
35
**/build/
46
**/coverage/
5-
**/lib/*.js
6-
**/lib/*.ts
7+
**/lib/
78
**/node_modules/
89
**/package-lock.json

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
**/*.ts
21
**/.editorconfig
32
**/.eslintrc.json
43
**/.mocharc.json
54
**/.travis.yml
65
**/CODE_OF_CONDUCT.md
76
**/build/
7+
**/src/
88
**/test/
99
**/tsconfig.json

lib/.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"chai": "^4.3.4",
5252
"eslint": "^7.32.0",
5353
"mocha": "^9.1.1",
54+
"npm-run-all": "^4.1.5",
5455
"nyc": "^15.1.0",
5556
"rimraf": "^3.0.2",
5657
"terser": "^5.7.2",
@@ -68,7 +69,7 @@
6869
"queue"
6970
],
7071
"license": "BSD-3-Clause",
71-
"main": "lib/async-iterable-queue.js",
72+
"main": "index.js",
7273
"name": "async-iterable-queue",
7374
"nyc": {
7475
"branches": 100,
@@ -84,14 +85,17 @@
8485
"url": "https://github.com/kei-g/async-iterable-queue.git"
8586
},
8687
"scripts": {
87-
"build": "npm run lint && tsc && terser build/async-iterable-queue.js -c -m -o lib/async-iterable-queue.js --toplevel",
88-
"clean": "rimraf .nyc_output/ build/ coverage/ lib/*.d.ts lib/*.js",
88+
"build": "npm-run-all -p clean lint -s build:tsc -p build:terse:*",
89+
"build:terse:async-iterable-queue": "terser build/lib/async-iterable-queue.js -c -m -o lib/async-iteable-queue.js --toplevel",
90+
"build:terse:index": "terser build/index.js -c -m -o index.js --toplevel",
91+
"build:tsc": "tsc",
92+
"clean": "rimraf .nyc_output/ build/ coverage/ index.d.ts index.js lib/",
8993
"cover": "nyc --check-coverage -r html -r text _mocha",
90-
"lint": "eslint *.ts",
91-
"prebuild": "rimraf build/ lib/*.d.ts lib/*.js",
92-
"prepublishOnly": "npm run build",
93-
"test": "npm run lint && npm run cover"
94+
"lint": "eslint src/*.ts src/lib/*.ts",
95+
"prebuild": "run-s clean",
96+
"prepublishOnly": "run-s build",
97+
"test": "run-p lint cover"
9498
},
95-
"types": "lib/async-iterable-queue.d.ts",
99+
"types": "index.d.ts",
96100
"version": "1.0.0"
97101
}

src/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!**/lib/

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const name = 'async-iterable-queue'
2+
3+
export * from './lib/async-iterable-queue'
File renamed without changes.

test/async-iterable-queue.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AsyncIterableQueue } from '../async-iterable-queue'
1+
import { AsyncIterableQueue } from '../src'
22
import { describe, it } from 'mocha'
33
import { expect } from 'chai'
44

tsconfig.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"alwaysStrict": true,
44
"charset": "utf8",
55
"declaration": true,
6-
"declarationDir": "lib",
6+
"declarationDir": ".",
77
"downlevelIteration": true,
88
"emitBOM": false,
99
"emitDeclarationOnly": false,
@@ -26,9 +26,7 @@
2626
],
2727
},
2828
"files": [
29-
"async-iterable-queue.ts",
30-
],
31-
"include": [
32-
"async-iterable-queue.ts",
33-
],
29+
"src/index.ts",
30+
"src/lib/async-iterable-queue.ts",
31+
]
3432
}

0 commit comments

Comments
 (0)