Commit b837158f authored by Sendya's avatar Sendya

fix: script & tsconfig

parent 31db5a3f
......@@ -18,7 +18,7 @@
"start": "vc-tools run server",
"lint": "eslint src/ -c .eslintrc.js --ext .tsx,.ts",
"lint-fix": "eslint --fix src/ -c .eslintrc.js --ext .tsx,.ts",
"compile": "vc-tools run compile",
"compile": "cross-env TS_NODE_PROJECT=scripts/tsconfig.json vc-tools run compile",
"test": "cross-env NODE_ENV=test jest --config .jest.js",
"prepublishOnly": "npm run lint && npm run compile && npm run test",
"postcompile": "npm run clean"
......@@ -33,6 +33,7 @@
"@types/fs-extra": "^9.0.2",
"@types/jest": "^24.0.17",
"@types/node": "^13.13.15",
"@types/rimraf": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/babel-plugin-jsx": "^1.0.0-rc.3",
......@@ -53,6 +54,7 @@
"jest": "^25.4.0",
"jest-serializer-vue": "^2.0.2",
"prettier": "^1.19.1",
"rimraf": "^3.0.2",
"ts-node": "^8.10.2",
"typescript": "~3.9.3",
"vue": "^3.0.0-0",
......
#!/bin/sh
ls | grep -v .jest.js | grep -v .eslintrc.js | grep -e '.d.ts' -e '.js$' | xargs rm
# keep one d.ts to make vscode auto import working with corrcet path
rm ./es/icons/*.d.ts || echo
rm ./es || echo
rm ./lib || echo
import * as path from 'path';
import * as fs from 'fs-extra';
const rimraf = require('rimraf');
const path = require('path');
function rm(distName: string, suffix?: string[], ignores?: string[]) {
const distPath = path.join(__dirname, '../', distName);
if (!fs.existsSync(distPath)) {
return;
}
const files = fs.readdirSync(distPath);
files.forEach(name => {
if (Array.isArray(ignores)) {
if (ignores.includes(name)) {
return;
}
}
if (Array.isArray(suffix)) {
if (suffix.find(s => name.endsWith(s))) {
fs.removeSync(path.join(distPath, name));
}
}
});
const errorHandler = (err) => {
console.error('err', err);
}
// ls | grep -v .jest.js | grep -v .eslintrc.js | grep -e '.d.ts' -e '.js$' | xargs rm
rm('./', ['.d.ts', '.js'], ['.eslintrc.js', '.jest.js', 'postcss.config.js']);
// rm ./es/icons/*.d.ts
rm('./es/icons/', ['.d.ts']);
rimraf(path.resolve(__dirname, 'es'), errorHandler);
rimraf(path.resolve(__dirname, 'lib'), errorHandler);
{
"compilerOptions": {
"module": "commonJS",
}
}
\ No newline at end of file
"allowSyntheticDefaultImports": true,
"declaration": true,
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
"jsx": "preserve",
"esModuleInterop": true
},
"include": ["./src", "./typings/"],
"typings": "./typings/index.d.ts",
"exclude": [
"node_modules",
"build",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"src/setupTests.ts",
"tslint:latest",
"tslint-config-prettier"
]
}
......@@ -3,10 +3,17 @@
"allowSyntheticDefaultImports": true,
"declaration": true,
"module": "esnext",
"target": "esnext",
"target": "ES2018",
"moduleResolution": "node",
"jsx": "preserve",
"esModuleInterop": true
"esModuleInterop": true,
"lib": [
"DOM",
"DOM.Iterable",
"ES6",
"ES2020.Symbol.WellKnown",
"ESNext.Symbol"
]
},
"include": ["./src", "./typings/"],
"typings": "./typings/index.d.ts",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment