Commit 1fd3da59 authored by tom's avatar tom Committed by 言肆

clean 改用ts脚本,兼容 windows 系统

parent a04462e8
...@@ -18,6 +18,7 @@ npm-debug.log* ...@@ -18,6 +18,7 @@ npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
package-lock.json* package-lock.json*
yarn.lock
# IDE # IDE
/.idea /.idea
...@@ -27,11 +28,12 @@ es/ ...@@ -27,11 +28,12 @@ es/
dist/ dist/
build/ build/
.vscode .vscode
.history
# publish # publish
*.tgz *.tgz
/icons /src/icons
/*.js /*.js
/*.d.ts /*.d.ts
!.jest.js !.jest.js
......
...@@ -14,21 +14,22 @@ ...@@ -14,21 +14,22 @@
], ],
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"clean": "./scripts/cleanup.sh", "clean": "cross-env TS_NODE_PROJECT=scripts/tsconfig.json node -r ts-node/register ./scripts/cleanup.ts",
"start": "vc-tools run server", "start": "vc-tools run server",
"lint": "eslint src/ --ext .tsx,.ts", "lint": "eslint src/ --ext .tsx,.ts",
"compile": "vc-tools run compile", "compile": "vc-tools run compile",
"test": "cross-env NODE_ENV=test jest --config .jest.js", "test": "cross-env NODE_ENV=test jest --config .jest.js",
"prepublishOnly": "npm run lint && npm run generate && npm run compile && npm run test", "prepublishOnly": "npm run lint && npm run generate && npm run compile && npm run test",
"generate": "rimraf src/icons && TS_NODE_PROJECT=scripts/tsconfig.json node -r ts-node/register scripts/generate.ts --target=icon", "generate": "rimraf src/icons && cross-env TS_NODE_PROJECT=scripts/tsconfig.json node -r ts-node/register scripts/generate.ts --target=icon",
"postcompile": "npm run clean && TS_NODE_PROJECT=scripts/tsconfig.json node -r ts-node/register scripts/generate.ts --target=entry" "postcompile": "npm run clean && cross-env TS_NODE_PROJECT=scripts/tsconfig.json node -r ts-node/register scripts/generate.ts --target=entry"
}, },
"peerDependencies": { "peerDependencies": {
"vue": ">=3.0.0", "ant-design-vue": ">=2.0.0",
"ant-design-vue": ">=2.0.0" "vue": ">=3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/runtime": "^7.11.2", "@babel/runtime": "^7.11.2",
"@types/fs-extra": "^9.0.2",
"@types/jest": "^24.0.17", "@types/jest": "^24.0.17",
"@types/node": "^13.13.15", "@types/node": "^13.13.15",
"@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/eslint-plugin": "^2.33.0",
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
"eslint-config-prettier": "^6.4.0", "eslint-config-prettier": "^6.4.0",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0-0", "eslint-plugin-vue": "^7.0.0-0",
"fs-extra": "^9.0.1",
"jest": "^25.4.0", "jest": "^25.4.0",
"jest-serializer-vue": "^2.0.2", "jest-serializer-vue": "^2.0.2",
"prettier": "^1.19.1", "prettier": "^1.19.1",
...@@ -77,7 +79,14 @@ ...@@ -77,7 +79,14 @@
"javascriptEnabled": true "javascriptEnabled": true
} }
} }
] ],
"css": {
"loaderOptions": {
"less": {
"javascriptEnabled": true
}
}
}
}, },
"description": "Ant Design Pro Layout of Vue, easy to use pro scaffolding." "description": "Ant Design Pro Layout of Vue, easy to use pro scaffolding."
} }
import * as path from 'path';
import * as fs from 'fs-extra';
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));
}
}
});
}
// 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']);
...@@ -37,7 +37,7 @@ async function generateIcons() { ...@@ -37,7 +37,7 @@ async function generateIcons() {
import { SetupContext } from 'vue'; import { SetupContext } from 'vue';
import <%= svgIdentifier %>Svg from '@ant-design/icons-svg/lib/asn/<%= svgIdentifier %>'; import <%= svgIdentifier %>Svg from '@ant-design/icons-svg/lib/asn/<%= svgIdentifier %>';
import AntdIcon, { AntdIconProps } from '../components/AntdIcon'; import AntdIcon, { AntdIconProps } from '@ant-design/icons-vue/lib/components/AntdIcon';
const <%= svgIdentifier %> = (props: AntdIconProps, context: SetupContext) => { const <%= svgIdentifier %> = (props: AntdIconProps, context: SetupContext) => {
const p = { ...props, ...context.attrs }; const p = { ...props, ...context.attrs };
...@@ -84,11 +84,11 @@ async function generateEntries() { ...@@ -84,11 +84,11 @@ async function generateEntries() {
value: true value: true
}); });
exports.default = void 0; exports.default = void 0;
var _<%= svgIdentifier %> = _interopRequireDefault(require('./lib/icons/<%= svgIdentifier %>')); var _<%= svgIdentifier %> = _interopRequireDefault(require('./lib/icons/<%= svgIdentifier %>'));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _default = _<%= svgIdentifier %>.default || _<%= svgIdentifier %>; var _default = _<%= svgIdentifier %>.default || _<%= svgIdentifier %>;
exports.default = _default; exports.default = _default;
module.exports = _default; module.exports = _default;
......
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