Commit 53e37e08 authored by 邓晓峰's avatar 邓晓峰

docs: test docs

parents 461a8ed8 88defe7c
......@@ -19,7 +19,7 @@ const alias = pkgList.reduce((pre, pkg) => {
console.log(`🌼 alias list \n${chalk.blue(Object.keys(alias).join('\n'))}`);
const tailPkgList = pkgList
.map((path) => [join('packages', path, 'src')])
.map((path) => [join('packages', path, 'src'), join('packages', path, 'src', 'components')])
.reduce((acc, val) => acc.concat(val), []);
const isProduction = process.env.NODE_ENV === 'production';
......@@ -53,6 +53,9 @@ export default {
}
: false,
hash: true,
ssr: {
devServerRender: false,
},
dynamicImport: {
loading: '@ant-design/pro-skeleton',
},
......@@ -72,6 +75,9 @@ export default {
edge: false,
ios: false,
},
theme: {
'@s-site-menu-width': '258px',
},
links:
process.env.NODE_ENV === 'development'
? ['https://gw.alipayobjects.com/os/lib/antd/4.6.6/dist/antd.css']
......@@ -85,4 +91,24 @@ export default {
'https://gw.alipayobjects.com/os/lib/antd/4.6.6/dist/antd-with-locales.js',
]
: [],
menus: {
'/components': [
{
title: '布局',
children: ['card'],
},
{
title: '通用',
children: ['card'],
},
{
title: '数据录入',
children: ['card'],
},
{
title: '数据展示',
children: ['card'],
},
],
},
};
[ViewState]
Mode=
Vid=
FolderType=Generic
......@@ -3,7 +3,7 @@
"npmClient": "npm",
"useWorkspaces": true,
"changelog": {
"repo": "panda/winsdom-components",
"repo": "wisdom-components",
"cacheDir": ".changelog"
},
"ignoreChanges": ["**/*.md", "**/*.test.js", "**/*.e2e.js", "**/fixtures/**", "**/test/**"]
......
......@@ -7,12 +7,14 @@
"scripts": {
"bootstrap": "node ./scripts/bootstrap.js",
"build": "father-build && webpack",
"changelog": "pro-changelog",
"createRelease": "node ./scripts/createRelease.js",
"deploy": "npm run site && gh-pages -d ./dist",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./packages && npm run lint:prettier",
"lint:prettier": "npm run prettier && git diff && prettier --version && prettier --check \"packages/**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"prettier": "prettier --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"release": "node ./scripts/release.js",
"size": "npm run build && size-limit",
"size:build": "cross-env PRO_COMPONENTS_CI='CI' webpack",
"start": "dumi dev",
"site": "dumi build",
"tsc:duplicate": "tsc -p ./tests/tsconfig.duplicate.json",
......@@ -53,12 +55,13 @@
"chalk": "^4.1.0",
"cross-env": "^7.0.0",
"css-loader": "^3.4.2",
"dumi": "1.1.0-beta.24",
"dumi": "next",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.4.3",
"eslint": "^7.2.0",
"father-build": "^1.18.1",
"gh-pages": "^3.1.0",
"github": "^9.2.0",
"glob": "^7.1.6",
"html-webpack-plugin": "^4.5.0",
"jest": "^26.2.2",
......@@ -79,6 +82,7 @@
"pify": "^5.0.0",
"prettier": "^2.1.2",
"pretty-quick": "^2.0.1",
"pro-changelog": "^1.0.0",
"progress-bar-webpack-plugin": "^2.1.0",
"query-string": "^6.11.1",
"react": "^16.11.0",
......
......@@ -2,6 +2,38 @@
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.0.0-beta.10](https://g.civnet.cn:8443/test/winsdom-components/compare/@wisdom-components/pro-card@1.0.0-beta.9...@wisdom-components/pro-card@1.0.0-beta.10) (2021-01-22)
**Note:** Version bump only for package @wisdom-components/pro-card
# [1.0.0-beta.9](https://g.civnet.cn:8443/test/winsdom-components/compare/@wisdom-components/pro-card@1.0.0-beta.8...@wisdom-components/pro-card@1.0.0-beta.9) (2021-01-22)
**Note:** Version bump only for package @wisdom-components/pro-card
# [1.0.0-beta.8](https://g.civnet.cn:8443/test/winsdom-components/compare/@wisdom-components/pro-card@1.0.0-beta.7...@wisdom-components/pro-card@1.0.0-beta.8) (2021-01-22)
**Note:** Version bump only for package @wisdom-components/pro-card
# [1.0.0-beta.7](https://g.civnet.cn:8443/test/winsdom-components/compare/@wisdom-components/pro-card@1.0.0-beta.5...@wisdom-components/pro-card@1.0.0-beta.7) (2021-01-22)
### Bug Fixes
- a ([8cac226](https://g.civnet.cn:8443/test/winsdom-components/commits/8cac2265bad699c7b5349fbf90dd976ca1fc6c0d))
### Features
- add list ([26122d0](https://g.civnet.cn:8443/test/winsdom-components/commits/26122d06c571c7c763f1ee89ad77d7aaf262198c))
# [1.0.0-beta.6](https://g.civnet.cn:8443/test/winsdom-components/compare/@wisdom-components/pro-card@1.0.0-beta.5...@wisdom-components/pro-card@1.0.0-beta.6) (2021-01-22)
### Bug Fixes
- a ([8cac226](https://g.civnet.cn:8443/test/winsdom-components/commits/8cac2265bad699c7b5349fbf90dd976ca1fc6c0d))
### Features
- add list ([26122d0](https://g.civnet.cn:8443/test/winsdom-components/commits/26122d06c571c7c763f1ee89ad77d7aaf262198c))
# [1.0.0-beta.5](https://g.civnet.cn:8443/test/winsdom-components/compare/@wisdom-components/pro-card@1.0.0-beta.4...@wisdom-components/pro-card@1.0.0-beta.5) (2020-10-26)
### Bug Fixes
......
{
"name": "@wisdom-components/pro-card",
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.10",
"description": "@wisdom-components/pro-card",
"module": "es/index.js",
"main": "lib/index.js",
......
......@@ -25,14 +25,14 @@ const { yParser } = require('@umijs/utils');
files: ['lib', 'src', 'dist', 'es'],
repository: {
type: 'git',
url: 'https://g.civnet.cn:8443/ReactWeb5/wisdom-components',
url: 'https://g.civnet.cn:8443/ReactWeb5/winsdom-components',
},
browserslist: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 11'],
keywords: ['antd', 'admin', 'ant-design', 'ant-design-pro'],
authors: ['dengxiaofeng'],
license: 'MIT',
bugs: 'https://g.civnet.cn:8443/ReactWeb5/wisdom-components/plugins/issues',
homepage: `https://g.civnet.cn:8443/ReactWeb5/wisdom-components/tree/master/packages/${shortName}#readme`,
bugs: 'https://g.civnet.cn:8443/ReactWeb5/winsdom-components/plugins/issues',
homepage: `https://g.civnet.cn:8443/ReactWeb5/winsdom-components/tree/master/packages/${shortName}#readme`,
peerDependencies: {
umi: '3.x',
},
......@@ -41,6 +41,7 @@ const { yParser } = require('@umijs/utils');
},
};
if (pkgJSONExists) {
// eslint-disable-next-line global-require,import/no-dynamic-require
const pkg = require(pkgJSONPath);
[
'dependencies',
......
const GitHub = require('github');
const exec = require('child_process').execSync;
const fs = require('fs');
const path = require('path');
const github = new GitHub({
debug: process.env.NODE_ENV === 'development',
});
github.authenticate({
type: 'token',
token: process.env.GITHUB_TOKEN || process.env.GITHUB_AUTH,
});
const getChangelog = (content, version) => {
const lines = content.split('\n');
const changeLog = [];
const startPattern = new RegExp(`^## ${version}`);
const stopPattern = /^## /; // 前一个版本
const skipPattern = /^`/; // 日期
let begin = false;
for (let i = 0; i < lines.length; i += 1) {
const line = lines[i];
if (begin && stopPattern.test(line)) {
break;
}
if (begin && line && !skipPattern.test(line)) {
changeLog.push(line);
}
if (!begin) {
begin = startPattern.test(line);
}
}
return changeLog.join('\n');
};
const getMds = (allVersion = false) => {
const docDir = path.join(__dirname, '..', 'docs');
const mdFils = fs.readdirSync(docDir).filter((name) => name.includes('changelog.md'));
// eslint-disable-next-line array-callback-return
mdFils.map((mdFile) => {
const pkg = mdFile.replace('pro-', '').replace('.changelog.md', '');
const content = fs.readFileSync(path.join(docDir, mdFile)).toString();
let versions = [
// eslint-disable-next-line global-require,import/no-dynamic-require
require(path.join(path.join(__dirname, '..', 'packages', pkg, 'package.json'))).version,
];
if (allVersion) {
versions = exec('git tag')
.toString()
.split('\n')
.filter((tag) => tag.includes(pkg))
.map((tag) => tag.split('@').pop());
}
console.log(versions);
// eslint-disable-next-line array-callback-return
versions.map((version) => {
const versionPkg = `@wisdom-components/pro-${pkg}@${version}`;
const changeLog = getChangelog(content, versionPkg);
if (!changeLog) {
return;
}
github.repos
.createRelease({
owner: 'wisdom-components',
repo: 'wisdom-components',
tag_name: versionPkg,
name: versionPkg,
body: changeLog,
})
.catch((e) => {
console.log(e);
});
});
});
};
getMds();
......@@ -6,6 +6,7 @@ process.setMaxListeners(Infinity);
module.exports = (publishPkgList) => {
const pkgList = (publishPkgList || getPackages()).map((name) => {
// eslint-disable-next-line global-require,import/no-dynamic-require
return require(join(__dirname, '../packages', name, 'package.json')).name;
});
const commands = pkgList.map((pkg) => {
......
const { spawn } = require('child_process');
const spawnWin = require('cross-spawn');
module.exports = function exec(command, args, opts) {
return new Promise((resolve, reject) => {
const child =
process.platform === 'win32'
? spawnWin(command, args, Object.assign({ stdio: 'inherit', env: process.env }, opts))
: spawn(command, args, Object.assign({ stdio: 'inherit', env: process.env }, opts));
? spawnWin(command, args, { stdio: 'inherit', env: process.env, ...opts })
: spawn(command, args, { stdio: 'inherit', env: process.env, ...opts });
child.once('error', (err) => {
console.log(err);
reject(err);
......
......@@ -9,6 +9,21 @@ const tailPkgs = readdirSync(path.join(__dirname, 'packages')).filter(
(pkg) => pkg.charAt(0) !== '.',
);
const isCI = process.env.PRO_COMPONENTS_CI === 'CI';
const externals = isCI
? tailPkgs.reduce((pre, value) => {
return {
...pre,
[`@ant-design/pro-${value}`]: `Pro${value
.toLowerCase()
.replace(/( |^)[a-z]/g, (L) => L.toUpperCase())}`,
};
}, {})
: {};
console.log(externals);
const webPackConfigList = [];
tailPkgs.forEach((pkg) => {
......@@ -29,17 +44,19 @@ tailPkgs.forEach((pkg) => {
resolve: {
extensions: ['.json', '.css', '.js', '.less'],
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min\.js$/,
}),
new OptimizeCSSAssetsPlugin({
include: /\.min\.js$/,
}),
],
},
optimization: isCI
? {
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min\.js$/,
}),
new OptimizeCSSAssetsPlugin({
include: /\.min\.js$/,
}),
],
}
: undefined,
module: {
rules: [
{
......@@ -134,6 +151,7 @@ tailPkgs.forEach((pkg) => {
'react-dom': 'ReactDOM',
antd: 'antd',
moment: 'moment',
...externals,
},
],
plugins: [
......
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