diff --git a/.eslintignore b/.eslintignore index d7bf0786f..5484d7a9c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -5,5 +5,5 @@ node_modules/ /components/test/* es/ lib/ -site-dist/ +_site/ dist/ diff --git a/.gitignore b/.gitignore index d58ce6544..a19e6084c 100644 --- a/.gitignore +++ b/.gitignore @@ -62,7 +62,7 @@ typings/ dist lib es -site-dist +_site yarn.lock package-lock.json /coverage diff --git a/.prettierignore b/.prettierignore index 35c5c6de0..70cf1bc89 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,5 +5,5 @@ package.json es/** lib/** -site-dist/** +_site/** dist/** \ No newline at end of file diff --git a/components/tree/style/index.less b/components/tree/style/index.less index 5dcc38e04..2aa770bba 100644 --- a/components/tree/style/index.less +++ b/components/tree/style/index.less @@ -189,7 +189,7 @@ padding-top: 8px; } - // Hide additional padding between last child node and next parent node + // Hide additional padding between last child node and next parent node &:last-child { padding-bottom: 0; } diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 000000000..cda97fb24 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,115 @@ +[build] + publish = "_site" + command = "npm run site" + +[context.production] + command = "echo build" + publish = "." + +[[redirects]] + from = "/docs/resource/download" + to = "/docs/spec/download" + status = 301 + force = false + +[[redirects]] + from = "/docs/resource/download-cn" + to = "/docs/spec/download-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/resource/reference" + to = "/docs/spec/reference" + status = 301 + force = false + +[[redirects]] + from = "/docs/resource/reference-cn" + to = "/docs/spec/reference-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/spec/feature" + to = "/docs/spec/values" + status = 301 + force = false + +[[redirects]] + from = "/docs/spec/feature-cn" + to = "/docs/spec/values-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/advanced-search" + to = "/docs/spec/overview" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/advanced-search-cn" + to = "/docs/spec/overview-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/complex-table" + to = "/docs/spec/overview" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/complex-table-cn" + to = "/docs/spec/overview-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/form" + to = "/docs/spec/overview" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/form-cn" + to = "/docs/spec/overview-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/list" + to = "/docs/spec/overview" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/list-cn" + to = "/docs/spec/overview-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/navigation" + to = "/docs/spec/overview" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/navigation-cn" + to = "/docs/spec/overview-cn" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/table" + to = "/docs/spec/overview" + status = 301 + force = false + +[[redirects]] + from = "/docs/pattern/table-cn" + to = "/docs/spec/overview-cn" + status = 301 + force = false \ No newline at end of file diff --git a/package.json b/package.json index 74781d0c3..ddfb8a0f7 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "dev": "cross-env NODE_ENV=development ENTRY_INDEX=dev ./node_modules/.bin/webpack-dev-server --open --hot --port 3001", "start": "cross-env NODE_ENV=development ./node_modules/.bin/webpack-dev-server --open --hot", "test": "cross-env NODE_ENV=test jest --config .jest.js", - "site": "node scripts/run.js site-dist", + "site": "node scripts/run.js _site", "copy": "node scripts/run.js copy-html", "compile": "node antd-tools/cli/run.js compile", "pub": "node antd-tools/cli/run.js pub", diff --git a/scripts/deploy-to-gh-pages.sh b/scripts/deploy-to-gh-pages.sh index 00af71643..22dcaebbe 100644 --- a/scripts/deploy-to-gh-pages.sh +++ b/scripts/deploy-to-gh-pages.sh @@ -9,15 +9,15 @@ if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TR echo "Starting to update gh-pages\n" -rm -rf site-dist -mkdir site-dist +rm -rf _site +mkdir _site git config --global user.email "travis@travis-ci.org" git config --global user.name "Travis" npm run site -cd site-dist +cd _site git init git add -f . git commit -m "Travis build" diff --git a/scripts/gulpfile.js b/scripts/gulpfile.js index b0a4c63f8..f51688eed 100644 --- a/scripts/gulpfile.js +++ b/scripts/gulpfile.js @@ -12,7 +12,7 @@ const mkdirp = require('mkdirp'); const cwd = process.cwd(); function dist(done) { - rimraf.sync(path.join(cwd, 'site-dist')); + rimraf.sync(path.join(cwd, '_site')); process.env.RUN_ENV = 'PRODUCTION'; const webpackConfig = require(path.join(cwd, 'webpack.site.config.js')); webpack(webpackConfig, (err, stats) => { @@ -53,30 +53,30 @@ function copyHtml() { input: fs.createReadStream(path.join(cwd, 'site/demoRoutes.js')), }); fs.writeFileSync( - path.join(cwd, 'site-dist/404.html'), + path.join(cwd, '_site/404.html'), fs.readFileSync(path.join(cwd, 'site/404.html')), ); fs.writeFileSync( - path.join(cwd, 'site-dist/index-cn.html'), - fs.readFileSync(path.join(cwd, 'site-dist/index.html')), + path.join(cwd, '_site/index-cn.html'), + fs.readFileSync(path.join(cwd, '_site/index.html')), ); - fs.writeFileSync(path.join(cwd, 'site-dist/CNAME'), 'vue.ant.design'); + fs.writeFileSync(path.join(cwd, '_site/CNAME'), 'vue.ant.design'); rl.on('line', line => { if (line.indexOf('path:') > -1) { const name = line.split("'")[1].split("'")[0]; console.log('create path:', name); const toPaths = [ - `site-dist/components/${name}`, - // `site-dist/components/${name}-cn`, - `site-dist/iframe/${name}`, - // `site-dist/iframe/${name}-cn`, + `_site/components/${name}`, + // `_site/components/${name}-cn`, + `_site/iframe/${name}`, + // `_site/iframe/${name}-cn`, ]; toPaths.forEach(toPath => { rimraf.sync(path.join(cwd, toPath)); mkdirp(path.join(cwd, toPath), function() { fs.writeFileSync( path.join(cwd, `${toPath}/index.html`), - fs.readFileSync(path.join(cwd, 'site-dist/index.html')), + fs.readFileSync(path.join(cwd, '_site/index.html')), ); }); }); @@ -92,16 +92,16 @@ function copyHtml() { const paths = file.path.split('/'); const name = paths[paths.length - 1].split('.')[0].toLowerCase(); const toPaths = [ - 'site-dist/docs', - 'site-dist/docs/vue', - `site-dist/docs/vue/${name}`, - `site-dist/docs/vue/${name}-cn`, + '_site/docs', + '_site/docs/vue', + `_site/docs/vue/${name}`, + `_site/docs/vue/${name}-cn`, ]; toPaths.forEach(toPath => { mkdirp(path.join(cwd, toPath), function() { fs.writeFileSync( path.join(cwd, `${toPath}/index.html`), - fs.readFileSync(path.join(cwd, 'site-dist/index.html')), + fs.readFileSync(path.join(cwd, '_site/index.html')), ); }); }); @@ -110,7 +110,7 @@ function copyHtml() { ); } -gulp.task('site-dist', done => { +gulp.task('_site', done => { dist(() => { copyHtml(); }); diff --git a/scripts/prettier.js b/scripts/prettier.js index 1f7f0f098..48951a72b 100644 --- a/scripts/prettier.js +++ b/scripts/prettier.js @@ -22,7 +22,6 @@ const ignoreFiles = [ 'es/**', 'lib/**', 'dist/**', - 'site-dist/**', '**/**.snap', '**/**.map', '**/components/style/color/**', diff --git a/webpack.site.config.js b/webpack.site.config.js index 2c0e711f7..ce69d81b2 100644 --- a/webpack.site.config.js +++ b/webpack.site.config.js @@ -7,7 +7,7 @@ const baseWebpackConfig = require('./webpack.base.config'); module.exports = merge(baseWebpackConfig, { output: { - path: path.resolve(__dirname, './site-dist'), + path: path.resolve(__dirname, './_site'), publicPath: '/', filename: '[name].[contenthash:8].js', chunkFilename: '[contenthash:8].async.js',