site update & icons update

pull/948/head
tanjinzhou 2019-07-04 18:28:27 +08:00
commit 57a9eafcc6
9 changed files with 180 additions and 114 deletions

2
.github/FUNDING.yml vendored
View File

@ -1,8 +1,8 @@
# These are supported funding model platforms
github: # [tangjinzhou]
patreon: # Replace with a single Patreon username
open_collective: ant-design-vue
patreon: tangjinzhou
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL

View File

@ -13,6 +13,28 @@ program.on('--help', () => {
program.parse(process.argv);
function runTask(toRun) {
const metadata = { task: toRun };
// Gulp >= 4.0.0 (doesn't support events)
const taskInstance = gulp.task(toRun);
if (taskInstance === undefined) {
gulp.emit('task_not_found', metadata);
return;
}
const start = process.hrtime();
gulp.emit('task_start', metadata);
try {
taskInstance.apply(gulp);
metadata.hrDuration = process.hrtime(start);
gulp.emit('task_stop', metadata);
gulp.emit('stop');
} catch (err) {
err.hrDuration = process.hrtime(start);
err.task = metadata.task;
gulp.emit('task_err', err);
}
}
const task = program.args[0];
if (!task) {
@ -22,5 +44,5 @@ if (!task) {
require('../gulpfile');
gulp.start(task);
runTask(task);
}

View File

@ -145,14 +145,10 @@ function tag() {
execSync(`git config --global user.name ${process.env.GITHUB_USER_NAME}`);
execSync(`git tag ${version}`);
execSync(
`git push https://${
process.env.GITHUB_TOKEN
}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`,
`git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`,
);
execSync(
`git push https://${
process.env.GITHUB_TOKEN
}@github.com/vueComponent/ant-design-vue.git master:master`,
`git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git master:master`,
);
console.log('tagged');
}
@ -204,24 +200,30 @@ function githubRelease(done) {
});
}
gulp.task('tag', done => {
tag();
githubRelease(done);
});
gulp.task(
'tag',
gulp.series(done => {
tag();
githubRelease(done);
}),
);
gulp.task('check-git', done => {
runCmd('git', ['status', '--porcelain'], (code, result) => {
if (/^\?\?/m.test(result)) {
return done(`There are untracked files in the working tree.\n${result}
gulp.task(
'check-git',
gulp.series(done => {
runCmd('git', ['status', '--porcelain'], (code, result) => {
if (/^\?\?/m.test(result)) {
return done(`There are untracked files in the working tree.\n${result}
`);
}
if (/^([ADRM]| [ADRM])/m.test(result)) {
return done(`There are uncommitted changes in the working tree.\n${result}
}
if (/^([ADRM]| [ADRM])/m.test(result)) {
return done(`There are uncommitted changes in the working tree.\n${result}
`);
}
return done();
});
});
}
return done();
});
}),
);
function publish(tagString, done) {
let args = ['publish', '--with-antd-tools'];
@ -265,86 +267,105 @@ function pub(done) {
});
}
gulp.task('dist', ['compile'], done => {
dist(done);
});
gulp.task('compile', ['compile-with-es'], done => {
compile().on('finish', function() {
done();
});
});
gulp.task('compile-with-es', done => {
compile(false).on('finish', function() {
done();
});
});
gulp.task('pub', ['check-git', 'compile'], done => {
if (!process.env.GITHUB_TOKEN) {
console.log('no GitHub token found, skip');
} else {
pub(done);
}
});
gulp.task('pub-with-ci', done => {
if (!process.env.NPM_TOKEN) {
console.log('no NPM token found, skip');
} else {
const github = new GitHub();
github.authenticate({
type: 'oauth',
token: process.env.GITHUB_TOKEN,
gulp.task(
'compile-with-es',
gulp.series(done => {
compile(false).on('finish', function() {
done();
});
const [_, owner, repo] = execSync('git remote get-url origin') // eslint-disable-line
.toString()
.match(/github.com[:/](.+)\/(.+)\.git/);
const getLatestRelease = github.repos.getLatestRelease({
owner,
repo,
});
const getCommits = github.repos.getCommits({
owner,
repo,
per_page: 1,
});
Promise.all([getLatestRelease, getCommits]).then(([latestRelease, commits]) => {
const preVersion = latestRelease.data.tag_name;
const { version } = packageJson;
const [_, newVersion] = commits.data[0].commit.message.trim().match(/bump (.+)/) || []; // eslint-disable-line
if (
compareVersions(version, preVersion) === 1 &&
newVersion &&
newVersion.trim() === version
) {
gulp.run('pub', err => {
err && console.log('err', err);
done();
});
} else {
console.log('donot need publish' + version);
}
});
}
});
}),
);
function reportError() {
console.log(chalk.bgRed('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'));
console.log(chalk.bgRed('!! `npm publish` is forbidden for this package. !!'));
console.log(chalk.bgRed('!! Use `npm run pub` instead. !!'));
console.log(chalk.bgRed('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'));
}
gulp.task(
'compile',
gulp.series('compile-with-es', done => {
compile().on('finish', function() {
done();
});
}),
);
gulp.task('guard', done => {
const npmArgs = getNpmArgs();
if (npmArgs) {
for (let arg = npmArgs.shift(); arg; arg = npmArgs.shift()) {
if (/^pu(b(l(i(sh?)?)?)?)?$/.test(arg) && npmArgs.indexOf('--with-antd-tools') < 0) {
reportError();
done(1);
return;
gulp.task(
'dist',
gulp.series('compile', done => {
dist(done);
}),
);
gulp.task(
'pub',
gulp.series('check-git', 'compile', done => {
if (!process.env.GITHUB_TOKEN) {
console.log('no GitHub token found, skip');
} else {
pub(done);
}
}),
);
gulp.task(
'pub-with-ci',
gulp.series(done => {
if (!process.env.NPM_TOKEN) {
console.log('no NPM token found, skip');
} else {
const github = new GitHub();
github.authenticate({
type: 'oauth',
token: process.env.GITHUB_TOKEN,
});
const [_, owner, repo] = execSync('git remote get-url origin') // eslint-disable-line
.toString()
.match(/github.com[:/](.+)\/(.+)\.git/);
const getLatestRelease = github.repos.getLatestRelease({
owner,
repo,
});
const getCommits = github.repos.getCommits({
owner,
repo,
per_page: 1,
});
Promise.all([getLatestRelease, getCommits]).then(([latestRelease, commits]) => {
const preVersion = latestRelease.data.tag_name;
const { version } = packageJson;
const [_, newVersion] = commits.data[0].commit.message.trim().match(/bump (.+)/) || []; // eslint-disable-line
if (
compareVersions(version, preVersion) === 1 &&
newVersion &&
newVersion.trim() === version
) {
gulp.run('pub', err => {
err && console.log('err', err);
done();
});
} else {
console.log('donot need publish' + version);
}
});
}
}),
);
gulp.task(
'guard',
gulp.series(done => {
function reportError() {
console.log(chalk.bgRed('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'));
console.log(chalk.bgRed('!! `npm publish` is forbidden for this package. !!'));
console.log(chalk.bgRed('!! Use `npm run pub` instead. !!'));
console.log(chalk.bgRed('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'));
}
const npmArgs = getNpmArgs();
if (npmArgs) {
for (let arg = npmArgs.shift(); arg; arg = npmArgs.shift()) {
if (/^pu(b(l(i(sh?)?)?)?)?$/.test(arg) && npmArgs.indexOf('--with-antd-tools') < 0) {
reportError();
done(1);
return;
}
}
}
}
done();
});
done();
}),
);

View File

@ -161,6 +161,8 @@
&,
.@{dropdown-prefix-cls}-menu-submenu-arrow-icon {
color: @disabled-color;
background-color: @component-background;
cursor: not-allowed;
}
}
}

View File

@ -40,7 +40,8 @@
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"commitmsg": "commitlint -x @commitlint/config-conventional -e $GIT_PARAMS",
"codecov": "codecov",
"prettier": "node ./scripts/prettier.js"
"prettier": "node ./scripts/prettier.js",
"postinstall": "node scripts/postinstall || echo \"ignore\""
},
"repository": {
"type": "git",
@ -109,7 +110,7 @@
"fetch-jsonp": "^1.1.3",
"fs-extra": "^7.0.0",
"glob": "^7.1.2",
"gulp": "^3.9.1",
"gulp": "^4.0.1",
"gulp-babel": "^7.0.0",
"gulp-strip-code": "^0.1.4",
"highlight.js": "^9.12.0",
@ -132,6 +133,7 @@
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"mockdate": "^2.0.2",
"node-emoji": "^1.10.0",
"nprogress": "^0.2.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss": "^7.0.6",
@ -172,7 +174,7 @@
"webpackbar": "^3.1.5"
},
"dependencies": {
"@ant-design/icons": "^1.1.15",
"@ant-design/icons": "^2.1.0",
"@ant-design/icons-vue": "^1.0.1",
"add-dom-event-listener": "^1.0.2",
"array-tree-filter": "^2.1.0",

View File

@ -1,29 +1,46 @@
<template>
<div id="geektime">
<div id="geektime" v-show="visible">
<a
href="https://time.geekbang.org/course/intro/163?code=KHKYcoBU6vZa8nMglg7AWfDxxi3BWrz9INAzAY3umPk%3D"
target="_blank"
>
<img
width="150"
width="170"
alt="Vue 实战教程"
src="https://cdn.nlark.com/yuque/0/2019/jpeg/87084/1554903088531-assets/web-upload/c496a156-aabc-4a9b-8cb6-a7a6617706ce.jpeg"
src="https://cdn.nlark.com/yuque/0/2019/jpeg/87084/1562230861353-assets/web-upload/2fab2df7-5cc9-4791-b344-a97da29eb400.jpeg"
>
</a>
</div>
<div v-if="isMobile" class="close" @click="visible=false">
<a-icon type="close"></a-icon>
</div>
</div>
</template>
<script>
export default {
props: ['isMobile'],
data() {
return {
visible: true
}
}
};
</script>
<style lang="less">
<style lang="less" scoped>
#geektime {
position: fixed;
bottom: 15px;
right: 15px;
.close {
position: absolute;
text-align: center;
top: -8px;
right: -8px;
font-size: 16px;
padding: 15px;
color: #6e3041;
}
}
</style>

View File

@ -304,7 +304,7 @@ export default {
</div>
</a-locale-provider>
{ name.indexOf('back-top') === -1 ? <a-back-top /> : null }
{ isCN && <Geektime /> }
{ isCN && <Geektime isMobile={isMobile} /> }
</div>
);
},

View File

@ -12,7 +12,7 @@ import Api from './components/api';
import './components';
import demoBox from './components/demoBox';
import demoContainer from './components/demoContainer';
import Test from '../components/form/demo/index.vue';
import Test from '../components/date-picker/demo/index.vue';
import zhCN from './theme/zh-CN';
import enUS from './theme/en-US';
Vue.use(Vuex);

View File

@ -41,8 +41,9 @@
<!-- Hotjar Tracking Code for http://vue.ant.design -->
<script>
(function(h, o, t, j, a, r) {
if(location.href.indexOf('iframe') === -1 && (location.host === 'ant-design-vue.gitee.io' || location.host === 'vue.ant.design')) {
h.hj = h.hj || function() {
(h.hj.q = h.hj.q || []).push(arguments)
(h.hj.q = h.hj.q || []).push(arguments)
};
h._hjSettings = {
hjid: 1359441,
@ -53,8 +54,9 @@
r.async = 1;
r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
a.appendChild(r);
}
})(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
</script>
</body>
</html>
</html>