Skip to content

Commit 47843fd

Browse files
committed
chore: build with typescript
1 parent 240363b commit 47843fd

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
*.tsbuildinfo
2+
lib
13
node_modules

package.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,21 @@
1717
},
1818
"license": "MIT",
1919
"author": "yeikos",
20-
"main": "lib/src/index.js",
20+
"main": "lib/index.js",
2121
"files": [
22-
"lib/src/index.d.ts"
22+
"lib/index.d.ts"
2323
],
2424
"scripts": {
25-
"build": "npm run build:ts && npm run build:wp",
26-
"build:ts": "./node_modules/.bin/tsc -p tsconfig.json",
27-
"build:wp": "./node_modules/.bin/webpack --config webpack.config.js",
28-
"dev": "./node_modules/.bin/concurrently --kill-others \"npm run dev:ts\" \"npm run dev:wp\"",
29-
"dev:ts": "./node_modules/.bin/tsc -p tsconfig.json -w",
30-
"dev:wp": "./node_modules/.bin/webpack --config webpack.config.js -w",
25+
"build": "tsc --build tsconfig.build.json",
26+
"dev": "tsc --build tsconfig.build.json -w",
3127
"format": "prettier --cache -w .",
3228
"test": "vitest run"
3329
},
3430
"devDependencies": {
35-
"@types/node": "^14.14.7",
36-
"concurrently": "^5.3.0",
3731
"prettier": "^2.8.8",
3832
"prettier-plugin-packagejson": "^2.4.3",
3933
"prettier-plugin-sort-json": "^1.0.0",
4034
"typescript": "^5.0.4",
41-
"vitest": "^0.31.0",
42-
"webpack": "^5.4.0",
43-
"webpack-cli": "^4.2.0"
35+
"vitest": "^0.31.0"
4436
}
4537
}

src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module.exports = exports = main;
2-
31
export default main;
42

53
export function main(clone: boolean, ...items: any[]): any;
@@ -35,7 +33,7 @@ export function clone<T>(input: T): T {
3533
} else if (isPlainObject(input)) {
3634
const output: any = {};
3735

38-
for (let index in input) output[index] = clone(input[index]);
36+
for (let index in input) output[index] = clone((input as any)[index]);
3937

4038
return output as any;
4139
} else {

tsconfig.build.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"rootDir": "src",
4+
"declaration": true,
5+
"outDir": "./lib",
6+
"incremental": true,
7+
"typeRoots": []
8+
},
9+
"extends": "./tsconfig.json",
10+
"include": ["src"]
11+
}

tsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"target": "es5",
44
"lib": ["es2015", "es2016"],
55
"module": "commonjs",
6-
"declaration": true,
7-
"outDir": "./lib",
86
"strict": true
9-
},
10-
"include": ["src/index.ts", "test/index.ts"]
7+
}
118
}

0 commit comments

Comments
 (0)