diff --git a/.travis.yml b/.travis.yml index 1738dab67..ffbe776f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ jobs: - env: "MODE=site" - env: "DEPLOY_MODE=build" - env: "DEPLOY_MODE=build_artifacts" - if: branch = master AND type = push + if: (commit_message !~ /(release\()/ && type = push) or (branch = master) before_install: - export CHROME_BIN=chromium-browser diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b1378917..d15380710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,23 @@ + +# [2.0.0-beta.4](https://github.com/ng-alain/delon/compare/1.4.5...2.0.0-beta.4) (2018-10-07) + + +### Bug Fixes + +* **form:date:** fix invalid default value in flat mode ([#187](https://github.com/ng-alain/delon/issues/187)) ([d2c89ca](https://github.com/ng-alain/delon/commit/d2c89ca)) +* **theme:styles** fix duplicate white spaces ([#193](https://github.com/ng-alain/delon/issues/193)) ([1545178](https://github.com/ng-alain/delon/commit/1545178)) +* **theme:drawer** should be import in forChild ([1545178](https://github.com/ng-alain/delon/commit/09516ea)) + + +### Features + +* **abc:page-header:** add loading & wide properies ([#194](https://github.com/ng-alain/delon/issues/194)) ([299e877](https://github.com/ng-alain/delon/commit/299e877)) +* **form:number:** add prefix & unit properties ([#189](https://github.com/ng-alain/delon/issues/189)) ([4121b90](https://github.com/ng-alain/delon/commit/4121b90)) +* **schematice:** add generate color less ([#196](https://github.com/ng-alain/delon/issues/196)) ([d7f7da6](https://github.com/ng-alain/delon/commit/d7f7da6)) +* **theme:context-menu:** add context menu service ([#191](https://github.com/ng-alain/delon/issues/191)) ([f0e96f6](https://github.com/ng-alain/delon/commit/f0e96f6)) + +### BREAKING CHANGES + +* **abc:** use input instead of ContentChild ([cfd0497](https://github.com/ng-alain/delon/commit/cfd0497)) + diff --git a/docs/changelog.md b/docs/changelog.en-US.md similarity index 68% rename from docs/changelog.md rename to docs/changelog.en-US.md index 33b1c74de..026d9e87b 100644 --- a/docs/changelog.md +++ b/docs/changelog.en-US.md @@ -1,12 +1,33 @@ --- order: 100 -title: - en-US: Changelog - zh-CN: 更新日志 +title: Change Log type: Other --- -### 2.0.0-beta.3 +## 2.0.0-beta.4 + +`2018-10-07` + +### Bug Fixes + +* **form:date:** fix invalid default value in flat mode ([#187](https://github.com/ng-alain/delon/issues/187)) ([d2c89ca](https://github.com/ng-alain/delon/commit/d2c89ca)) +* **theme:styles** fix duplicate white spaces ([#193](https://github.com/ng-alain/delon/issues/193)) ([1545178](https://github.com/ng-alain/delon/commit/1545178)) +* **theme:drawer** should be import in forChild ([1545178](https://github.com/ng-alain/delon/commit/09516ea)) + + +### Features + +* **abc:page-header:** add loading & wide properies ([#194](https://github.com/ng-alain/delon/issues/194)) ([299e877](https://github.com/ng-alain/delon/commit/299e877)) +* **form:number:** add prefix & unit properties ([#189](https://github.com/ng-alain/delon/issues/189)) ([4121b90](https://github.com/ng-alain/delon/commit/4121b90)) +* **schematice:** add generate color less ([#196](https://github.com/ng-alain/delon/issues/196)) ([d7f7da6](https://github.com/ng-alain/delon/commit/d7f7da6)) +* **theme:context-menu:** add context menu service ([#191](https://github.com/ng-alain/delon/issues/191)) ([f0e96f6](https://github.com/ng-alain/delon/commit/f0e96f6)) + +### BREAKING CHANGES + +* **abc:** use input instead of ContentChild ([cfd0497](https://github.com/ng-alain/delon/commit/cfd0497)) + + +## 2.0.0-beta.3 `2018-9-29` @@ -30,7 +51,7 @@ type: Other - cli - 增加[自定义业务页模板](https://ng-alain.com/cli/generate/zh#%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A1%B5)功能 -### 2.0.0-beta.2 +## 2.0.0-beta.2 `2018-9-22` @@ -46,7 +67,7 @@ type: Other - @delon/theme - 增加 `setLayout` 支持对象替换 -### 2.0.0-beta.1 +## 2.0.0-beta.1 `2018-9-16` @@ -67,7 +88,7 @@ type: Other - cli - 修复 `view` 插件使用过期组件 -### 2.0.0-beta.0 +## 2.0.0-beta.0 `2018-9-9` diff --git a/docs/changelog.zh-CN.md b/docs/changelog.zh-CN.md new file mode 100644 index 000000000..6a1b1675d --- /dev/null +++ b/docs/changelog.zh-CN.md @@ -0,0 +1,99 @@ +--- +order: 100 +title: 更新日志 +type: Other +--- + +## 2.0.0-beta.4 + +`2018-10-07` + +### Bug Fixes + +* **form:date:** 修复扁平模式下无效初始值 ([#187](https://github.com/ng-alain/delon/issues/187)) ([d2c89ca](https://github.com/ng-alain/delon/commit/d2c89ca)) +* **theme:styles** 移除重复空白间距代码 ([#193](https://github.com/ng-alain/delon/issues/193)) ([1545178](https://github.com/ng-alain/delon/commit/1545178)) +* **theme:drawer** 应导入至 `forChild` ([1545178](https://github.com/ng-alain/delon/commit/09516ea)) + + +### Features + +* **abc:page-header:** 增加 loading & wide 属性 ([#194](https://github.com/ng-alain/delon/issues/194)) ([299e877](https://github.com/ng-alain/delon/commit/299e877)) +* **form:number:** 增加 prefix & unit 属性 ([#189](https://github.com/ng-alain/delon/issues/189)) ([4121b90](https://github.com/ng-alain/delon/commit/4121b90)) +* **schematice:** 增加 color-less.js 颜色脚本 ([#196](https://github.com/ng-alain/delon/issues/196)) ([d7f7da6](https://github.com/ng-alain/delon/commit/d7f7da6)) +* **theme:context-menu:** 增加右击菜单辅助类 ([#191](https://github.com/ng-alain/delon/issues/191)) ([f0e96f6](https://github.com/ng-alain/delon/commit/f0e96f6)) + +### BREAKING CHANGES + +* **abc:** 所有输入属性都必须指定属性值 ([cfd0497](https://github.com/ng-alain/delon/commit/cfd0497)) + + +## 2.0.0-beta.3 + +`2018-9-29` + +- @delon/theme + - 新增 [DrawerHelper](https://ng-alain.com/theme/drawer/zh) 辅助类 + - 修复 `_HttpClient` 对象 `param` 参数解析不标准,[#694](https://github.com/ng-alain/ng-alain/issues/694) + - 移除一些已过期样式,[#commit](https://github.com/ng-alain/ng-alain/pull/691) + - 使用 `nzBlock` 替代 `.ant-btn__block` + - 使用 `nzCover` 替代 `.ant-card__img` + - 移除多余 `.ant-card__title-img`,antd 已修复 + - 移除 `.nz-carousel__dot-{color}` 由手工自定义 + - 移除 `.box-placeholder` 由手工自定义 +- @delon/abc + - 新增 `st` 按钮类型 `drawer` 打开一个抽屉目标组件 + - 修复 `_HttpClient` 对象 `param` 参数解析不标准,[#694](https://github.com/ng-alain/ng-alain/issues/694) +- @delon/form + - 修复 `cascader` 小部件不支持 `showSearch` 参数,[#695](https://github.com/ng-alain/ng-alain/issues/695) + - 修复 `g2-custom` 默认应该块模型 +- @delon/util + - 修复 `getTimeDistance` 参数 `-today` 应是昨天至今天,[#696](https://github.com/ng-alain/ng-alain/issues/696) +- cli + - 增加[自定义业务页模板](https://ng-alain.com/cli/generate/zh#%E8%87%AA%E5%AE%9A%E4%B9%89%E9%A1%B5)功能 + +## 2.0.0-beta.2 + +`2018-9-22` + +- 同步 `ng-zorro-antd` 至 `1.6.0` + - 新增 skeleton 组件 +- @delon/abc + - 重构 `st` 组件Http请求使用 `_HttpClient`,[#685](https://github.com/ng-alain/ng-alain/issues/685) + - 新增 `global-footer` 支持自定义组件 +- @delon/form + - 修复固定标签宽度时布局被挤兑 + - 修复文本框在 Safari 浏览器下会重复录入,[#651](https://github.com/ng-alain/ng-alain/issues/651) + - 修复单多选框组 `readOnly` 无效问题,[#167](https://github.com/ng-alain/delon/issues/167) +- @delon/theme + - 增加 `setLayout` 支持对象替换 + +## 2.0.0-beta.1 + +`2018-9-16` + +- 重构使用 ng-packagr 打包,支持 `@delon/abc`、`@delon/chart` 次级导入 +- 增加 `DelonLocaleModule` 支持所有 `@delon/*` 模块的[国际化](https://ng-alain.com/theme/locale) +- 脚手架 + - 增加[默认语言](https://ng-alain.com/docs/i18n#默认语言)示例代码,[commit](https://github.com/ng-alain/ng-alain/pull/683) + - 增加个人中心、设置示例页,[commit](https://github.com/ng-alain/ng-alain/pull/682) +- @delon/chart + - **BREAKING CHANGES** 重命名 `g2-chart` 为 `g2-custom` + - 修复部分未导出模块,[#162](https://github.com/ng-alain/delon/issues/162) +- @delon/theme + - 增加 `.ant-tag__plus` 样式 +- @delon/form + - 修复 select 小部件在 Search 模式下不支持 `width` 问题 + - 修复 select 小部件若存在初始值则无法清空,[#674](https://github.com/ng-alain/ng-alain/issues/674) + - 修复 number 类型若存在初始值则无法清空,[#675](https://github.com/ng-alain/ng-alain/issues/675) +- cli + - 修复 `view` 插件使用过期组件 + +## 2.0.0-beta.0 + +`2018-9-9` + +[升级指南](/docs/upgrade-v2) + +### 1.x + +1.x 历史变更日志请至[1.x-doc站](https://ng-alain.github.io/1.x-doc/docs/changelog)。 diff --git a/package.json b/package.json index 9f6439914..ebe9d21e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "delon", - "version": "2.0.0-beta.3", + "version": "2.0.0-beta.4", "typings": "index.d.ts", "description": "Delon is a set of essential modules for ng-alain.", "repository": { @@ -29,6 +29,8 @@ "site:gen": "node scripts/site/main init", "site": "npm run site:gen && ng serve -c=hmr", "site:build": "npm run site:gen && ng build --prod --build-optimizer --base-href /", + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --pkg package.json", + "pre-publish": "node scripts/publish/publish.js && node scripts/publish/publish-scaffold.js", "publish:next": "bash scripts/publish/publish.sh -next" }, "dependencies": { diff --git a/scripts/ci/deploy.sh b/scripts/ci/deploy.sh index 22cb64164..5a4921937 100644 --- a/scripts/ci/deploy.sh +++ b/scripts/ci/deploy.sh @@ -32,6 +32,7 @@ travisFoldStart "publish.dist" commitAuthorName=$(git --no-pager show -s --format='%an' HEAD) commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD) commitMessage=$(git log --oneline -n 1) + commitMessageCheck=$(git log --oneline -n 2) buildVersionName="${buildVersion}-${commitSha}" buildTagName="${branchName}-${commitSha}" @@ -76,7 +77,7 @@ travisFoldStart "publish.dist" fi # 替换版本号 - if [[ $commitMessage =~ "release" ]]; then + if [[ $commitMessageCheck =~ "release(" ]]; then echo "===== Release version does not need to change version =====" else echo "Replace build version..." @@ -102,5 +103,10 @@ travisFoldStart "publish.dist" echo "Published package artifacts for ${packageName}#${buildVersionName} into ${branchName}" travisFoldEnd "publish.dist" +if [[ $commitMessageCheck =~ "release(" ]]; then + echo "Release version does not need to change version =====" + echo "COMMIT SOURCE: ${commitMessageCheck}" +fi + echo "Download link:" echo "https://github.com/ng-alain/delon-builds/archive/${buildTagName}.zip" diff --git a/scripts/publish/publish-scaffold.js b/scripts/publish/publish-scaffold.js new file mode 100644 index 000000000..2fa52ef8d --- /dev/null +++ b/scripts/publish/publish-scaffold.js @@ -0,0 +1,79 @@ +const chalk = require('chalk'); +const fs = require('fs-extra'); +const path = require('path'); + +const nextVersion = fs.readJSONSync(path.join(__dirname, '../../package.json')) + .version; +const root = path.resolve(__dirname, `../../../ng-alain`); + +/* Shortcut methods */ +const execSync = require('child_process').execSync; +const execSyncOptions = { + cwd: root, +}; +const print = console.log; +const log = { + info: msg => { + print(chalk.bgBlue.black('INFO'), chalk.blue(msg)); + }, + warn: msg => { + print(chalk.bgYellow.black('WARN'), chalk.yellow(msg)); + }, + error: msg => { + print(chalk.bgRed.black('ERROR'), chalk.red(msg)); + }, + success: msg => { + print(chalk.bgGreen.black('SUCCESS'), chalk.green(msg)); + }, +}; + +/* The whole process */ +log.info('Starting publishing process...'); + +fetchOlderVersions(); +fixVersion(); +checkout(); +log.success(`Use commit message:`); +log.success(`release(${nextVersion}): release ${nextVersion}`); + +function fixVersion() { + const packagePath = path.join(root, './package.json'); + const json = fs.readJSONSync(packagePath); + json.version = nextVersion; + // [ + // 'abc', + // 'acl', + // 'auth', + // 'chart', + // 'cache', + // 'mock', + // 'form', + // 'theme', + // 'util', + // ].forEach(v => { + // json.dependencies[`@delon/${v}`] = nextVersion; + // }); + // json.devDependencies[`ng-alain`] = nextVersion; + fs.writeJSONSync(packagePath, json, { spaces: 2 }); +} + +function fetchOlderVersions() { + log.info('Fetching older versions...'); + execSync('git checkout master', execSyncOptions); + execSync('git pull upstream master', execSyncOptions); + execSync('git fetch upstream master --prune --tags', execSyncOptions); + log.success('Older versions fetched!'); +} + +function checkout() { + log.info('Checkout and push a new branch for publishing...'); + execSync(`git checkout -b publish-${nextVersion}`, execSyncOptions); + // execSync('git add .', execSyncOptions); + // execSync( + // `git commit -m "release(${nextVersion}): release ${nextVersion}"`, + // execSyncOptions, + // ); + // execSync(`git push origin publish-${nextVersion}`, execSyncOptions); + // log.success('Please go to GitHub and make a pull request.'); + // log.success('Bye!'); +} diff --git a/scripts/publish/publish.js b/scripts/publish/publish.js index a034c323b..1d5c1babc 100644 --- a/scripts/publish/publish.js +++ b/scripts/publish/publish.js @@ -9,18 +9,18 @@ const root = path.resolve(__dirname, `../..`); const execSync = require('child_process').execSync; const print = console.log; const log = { - info : (msg) => { + info: msg => { print(chalk.bgBlue.black('INFO'), chalk.blue(msg)); }, - warn : (msg) => { + warn: msg => { print(chalk.bgYellow.black('WARN'), chalk.yellow(msg)); }, - error : (msg) => { + error: msg => { print(chalk.bgRed.black('ERROR'), chalk.red(msg)); }, - success: (msg) => { + success: msg => { print(chalk.bgGreen.black('SUCCESS'), chalk.green(msg)); - } + }, }; /* The whole process */ @@ -42,13 +42,17 @@ function fetchOlderVersions() { function generatingPublishNote() { log.info('Generating changelog...'); - execSync("conventional-changelog -p angular -i CHANGELOG.md -s --pkg package.json"); + execSync('npm run changelog'); log.success('Changelog generated!'); let completeEditing = false; while (!completeEditing) { - const result = read.question(chalk.bgYellow.black('Please manually update docs/changelog. Press [Y] if you are done:') + ' '); + const result = read.question( + chalk.bgYellow.black( + 'Please manually update docs/changelog. Press [Y] if you are done:', + ) + ' ', + ); if (result.trim().toLowerCase() === 'y') { completeEditing = true; } diff --git a/scripts/publish/publish.sh b/scripts/publish/publish.sh index 639c492ff..ef5054c6a 100644 --- a/scripts/publish/publish.sh +++ b/scripts/publish/publish.sh @@ -18,6 +18,9 @@ for ARG in "$@"; do esac done +VERSION=$(node -p "require('./package.json').version") +echo "Version ${VERSION}" + clone() { rm -rf ${ROOT} mkdir -p ${ROOT} @@ -43,11 +46,10 @@ syncTaobao() { curl -X PUT https://npm.taobao.org/sync/ng-alain?sync_upstream=true } -# clone -node ${thisDir}/publish.js -# if [[ ${NEXT} == true ]]; then -# publishToNext -# else -# publishToMaster -# fi -# syncTaobao +clone +if [[ ${NEXT} == true ]]; then + publishToNext +else + publishToMaster +fi +syncTaobao