fix: init
This commit is contained in:
commit
2f32a62490
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
dist
|
21
build.config.ts
Normal file
21
build.config.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { defineBuildConfig } from 'unbuild'
|
||||
|
||||
export default defineBuildConfig([
|
||||
{
|
||||
// 入口
|
||||
entries: ['src/index'],
|
||||
clean: true,
|
||||
// Generates .d.ts declaration file
|
||||
declaration: true,
|
||||
// Change outDir, default is 'dist'
|
||||
outDir: "dist",
|
||||
|
||||
rollup: {
|
||||
emitCJS: true,
|
||||
inlineDependencies: true,
|
||||
esbuild: {
|
||||
minify: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
28
package.json
Normal file
28
package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "my-package",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.8.4",
|
||||
"typescript": "^5.2.2",
|
||||
"unbuild": "^2.0.0"
|
||||
}
|
||||
}
|
5
src/index.ts
Normal file
5
src/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export * from './math'
|
||||
|
||||
export function add(num1: number, num2: number) {
|
||||
return num1 + num2;
|
||||
}
|
3
src/math.ts
Normal file
3
src/math.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function getRandomNumber() {
|
||||
return Math.random();
|
||||
}
|
23
tsconfig.json
Normal file
23
tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"jsx": "preserve",
|
||||
"lib": ["DOM", "ESNext"],
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
"resolveJsonModule": true,
|
||||
"types": ["node"],
|
||||
"strict": true,
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user