Skip to content

Commit 5db345b

Browse files
committed
docs: add netlify.toml and update site-dist to _site
1 parent 89c3a56 commit 5db345b

10 files changed

+140
-26
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ node_modules/
55
/components/test/*
66
es/
77
lib/
8-
site-dist/
8+
_site/
99
dist/

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typings/
6262
dist
6363
lib
6464
es
65-
site-dist
65+
_site
6666
yarn.lock
6767
package-lock.json
6868
/coverage

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
package.json
66
es/**
77
lib/**
8-
site-dist/**
8+
_site/**
99
dist/**

components/tree/style/index.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
padding-top: 8px;
190190
}
191191

192-
// Hide additional padding between last child node and next parent node
192+
// Hide additional padding between last child node and next parent node
193193
&:last-child {
194194
padding-bottom: 0;
195195
}

netlify.toml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
[build]
2+
publish = "_site"
3+
command = "npm run site"
4+
5+
[context.production]
6+
command = "echo build"
7+
publish = "."
8+
9+
[[redirects]]
10+
from = "/docs/resource/download"
11+
to = "/docs/spec/download"
12+
status = 301
13+
force = false
14+
15+
[[redirects]]
16+
from = "/docs/resource/download-cn"
17+
to = "/docs/spec/download-cn"
18+
status = 301
19+
force = false
20+
21+
[[redirects]]
22+
from = "/docs/resource/reference"
23+
to = "/docs/spec/reference"
24+
status = 301
25+
force = false
26+
27+
[[redirects]]
28+
from = "/docs/resource/reference-cn"
29+
to = "/docs/spec/reference-cn"
30+
status = 301
31+
force = false
32+
33+
[[redirects]]
34+
from = "/docs/spec/feature"
35+
to = "/docs/spec/values"
36+
status = 301
37+
force = false
38+
39+
[[redirects]]
40+
from = "/docs/spec/feature-cn"
41+
to = "/docs/spec/values-cn"
42+
status = 301
43+
force = false
44+
45+
[[redirects]]
46+
from = "/docs/pattern/advanced-search"
47+
to = "/docs/spec/overview"
48+
status = 301
49+
force = false
50+
51+
[[redirects]]
52+
from = "/docs/pattern/advanced-search-cn"
53+
to = "/docs/spec/overview-cn"
54+
status = 301
55+
force = false
56+
57+
[[redirects]]
58+
from = "/docs/pattern/complex-table"
59+
to = "/docs/spec/overview"
60+
status = 301
61+
force = false
62+
63+
[[redirects]]
64+
from = "/docs/pattern/complex-table-cn"
65+
to = "/docs/spec/overview-cn"
66+
status = 301
67+
force = false
68+
69+
[[redirects]]
70+
from = "/docs/pattern/form"
71+
to = "/docs/spec/overview"
72+
status = 301
73+
force = false
74+
75+
[[redirects]]
76+
from = "/docs/pattern/form-cn"
77+
to = "/docs/spec/overview-cn"
78+
status = 301
79+
force = false
80+
81+
[[redirects]]
82+
from = "/docs/pattern/list"
83+
to = "/docs/spec/overview"
84+
status = 301
85+
force = false
86+
87+
[[redirects]]
88+
from = "/docs/pattern/list-cn"
89+
to = "/docs/spec/overview-cn"
90+
status = 301
91+
force = false
92+
93+
[[redirects]]
94+
from = "/docs/pattern/navigation"
95+
to = "/docs/spec/overview"
96+
status = 301
97+
force = false
98+
99+
[[redirects]]
100+
from = "/docs/pattern/navigation-cn"
101+
to = "/docs/spec/overview-cn"
102+
status = 301
103+
force = false
104+
105+
[[redirects]]
106+
from = "/docs/pattern/table"
107+
to = "/docs/spec/overview"
108+
status = 301
109+
force = false
110+
111+
[[redirects]]
112+
from = "/docs/pattern/table-cn"
113+
to = "/docs/spec/overview-cn"
114+
status = 301
115+
force = false

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"dev": "cross-env NODE_ENV=development ENTRY_INDEX=dev ./node_modules/.bin/webpack-dev-server --open --hot --port 3001",
2929
"start": "cross-env NODE_ENV=development ./node_modules/.bin/webpack-dev-server --open --hot",
3030
"test": "cross-env NODE_ENV=test jest --config .jest.js",
31-
"site": "node scripts/run.js site-dist",
31+
"site": "node scripts/run.js _site",
3232
"copy": "node scripts/run.js copy-html",
3333
"compile": "node antd-tools/cli/run.js compile",
3434
"pub": "node antd-tools/cli/run.js pub",

scripts/deploy-to-gh-pages.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TR
99

1010
echo "Starting to update gh-pages\n"
1111

12-
rm -rf site-dist
13-
mkdir site-dist
12+
rm -rf _site
13+
mkdir _site
1414

1515
git config --global user.email "[email protected]"
1616
git config --global user.name "Travis"
1717

1818
npm run site
1919

20-
cd site-dist
20+
cd _site
2121
git init
2222
git add -f .
2323
git commit -m "Travis build"

scripts/gulpfile.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const mkdirp = require('mkdirp');
1212
const cwd = process.cwd();
1313

1414
function dist(done) {
15-
rimraf.sync(path.join(cwd, 'site-dist'));
15+
rimraf.sync(path.join(cwd, '_site'));
1616
process.env.RUN_ENV = 'PRODUCTION';
1717
const webpackConfig = require(path.join(cwd, 'webpack.site.config.js'));
1818
webpack(webpackConfig, (err, stats) => {
@@ -53,30 +53,30 @@ function copyHtml() {
5353
input: fs.createReadStream(path.join(cwd, 'site/demoRoutes.js')),
5454
});
5555
fs.writeFileSync(
56-
path.join(cwd, 'site-dist/404.html'),
56+
path.join(cwd, '_site/404.html'),
5757
fs.readFileSync(path.join(cwd, 'site/404.html')),
5858
);
5959
fs.writeFileSync(
60-
path.join(cwd, 'site-dist/index-cn.html'),
61-
fs.readFileSync(path.join(cwd, 'site-dist/index.html')),
60+
path.join(cwd, '_site/index-cn.html'),
61+
fs.readFileSync(path.join(cwd, '_site/index.html')),
6262
);
63-
fs.writeFileSync(path.join(cwd, 'site-dist/CNAME'), 'vue.ant.design');
63+
fs.writeFileSync(path.join(cwd, '_site/CNAME'), 'vue.ant.design');
6464
rl.on('line', line => {
6565
if (line.indexOf('path:') > -1) {
6666
const name = line.split("'")[1].split("'")[0];
6767
console.log('create path:', name);
6868
const toPaths = [
69-
`site-dist/components/${name}`,
70-
// `site-dist/components/${name}-cn`,
71-
`site-dist/iframe/${name}`,
72-
// `site-dist/iframe/${name}-cn`,
69+
`_site/components/${name}`,
70+
// `_site/components/${name}-cn`,
71+
`_site/iframe/${name}`,
72+
// `_site/iframe/${name}-cn`,
7373
];
7474
toPaths.forEach(toPath => {
7575
rimraf.sync(path.join(cwd, toPath));
7676
mkdirp(path.join(cwd, toPath), function() {
7777
fs.writeFileSync(
7878
path.join(cwd, `${toPath}/index.html`),
79-
fs.readFileSync(path.join(cwd, 'site-dist/index.html')),
79+
fs.readFileSync(path.join(cwd, '_site/index.html')),
8080
);
8181
});
8282
});
@@ -92,16 +92,16 @@ function copyHtml() {
9292
const paths = file.path.split('/');
9393
const name = paths[paths.length - 1].split('.')[0].toLowerCase();
9494
const toPaths = [
95-
'site-dist/docs',
96-
'site-dist/docs/vue',
97-
`site-dist/docs/vue/${name}`,
98-
`site-dist/docs/vue/${name}-cn`,
95+
'_site/docs',
96+
'_site/docs/vue',
97+
`_site/docs/vue/${name}`,
98+
`_site/docs/vue/${name}-cn`,
9999
];
100100
toPaths.forEach(toPath => {
101101
mkdirp(path.join(cwd, toPath), function() {
102102
fs.writeFileSync(
103103
path.join(cwd, `${toPath}/index.html`),
104-
fs.readFileSync(path.join(cwd, 'site-dist/index.html')),
104+
fs.readFileSync(path.join(cwd, '_site/index.html')),
105105
);
106106
});
107107
});
@@ -110,7 +110,7 @@ function copyHtml() {
110110
);
111111
}
112112

113-
gulp.task('site-dist', done => {
113+
gulp.task('_site', done => {
114114
dist(() => {
115115
copyHtml();
116116
});

scripts/prettier.js

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const ignoreFiles = [
2222
'es/**',
2323
'lib/**',
2424
'dist/**',
25-
'site-dist/**',
2625
'**/**.snap',
2726
'**/**.map',
2827
'**/components/style/color/**',

webpack.site.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const baseWebpackConfig = require('./webpack.base.config');
77

88
module.exports = merge(baseWebpackConfig, {
99
output: {
10-
path: path.resolve(__dirname, './site-dist'),
10+
path: path.resolve(__dirname, './_site'),
1111
publicPath: '/',
1212
filename: '[name].[contenthash:8].js',
1313
chunkFilename: '[contenthash:8].async.js',

0 commit comments

Comments
 (0)