diff --git a/package.json b/package.json index cf8ae412..0df846df 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "build:dist": "rm -rf dist && rollup -c", "build:doc": "npm run doc", "doc": "rm -rf docs && jsdoc -c conf.json", - "open:doc": "open ./docs/index.html", + "doc:open": "open ./docs/index.html", "prettier": "prettier --write 'src/**/*.js' && prettier --write 'test/**/*.js'", "lint-staged": "lint-staged", "lint-staged:js": "eslint --ext .js", @@ -28,7 +28,7 @@ "lint:fix": "eslint src --ext .js --fix", "commit": "cz", "prepublishOnly": "npm test && npm run build", - "types": "tsc" + "types": "rm -rf types && tsc" }, "repository": { "type": "git", @@ -99,4 +99,4 @@ "dependencies": { "@babel/runtime": "^7.14.0" } -} +} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index 6e3b3fae..fab959e3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -15,6 +15,8 @@ function toCamel(str) { const globalVarName = toCamel(pkg.name); +// TODO cjs/es/types 使用 rollup 构建 + export default { input: './src/index.js', output: [ diff --git a/src/utils/config.js b/src/utils/config.js index 1aa32f33..9125f240 100644 --- a/src/utils/config.js +++ b/src/utils/config.js @@ -1,3 +1,4 @@ +// @ts-ignore import { version } from '../../package.json'; const config = { diff --git a/tsconfig.json b/tsconfig.json index 35087d7a..7b0d5107 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,7 @@ // "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "./types", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */