Skip to content

Commit

Permalink
ci: smarter (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Oct 3, 2018
1 parent f0e96f6 commit a0caa81
Show file tree
Hide file tree
Showing 41 changed files with 564 additions and 308 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ yarn.lock
*.iml
dist
coverage
src/app/routes/gen
publish
.idea
debug.log

src/app/routes/gen
/scaffold
/_scaffold
/ng-alain
37 changes: 21 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
sudo: required
dist: trusty
language: node_js

node_js:
- '8.11'
- '8.12.0'

addons:
apt:
Expand All @@ -14,26 +16,29 @@ addons:
git:
depth: 1

cache:
yarn: true
directories:
- ./node_modules
jobs:
include:
- env: "MODE=lib_test"
- env: "MODE=cli_test"
- env: "MODE=lint"
- env: "MODE=site"
- env: "DEPLOY_MODE=build"
- env: "DEPLOY_MODE=build_artifacts"
if: branch = master AND type = push

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

env:
- TASK=release:ci
- TASK=test
- TASK=test:schematics
- TASK=lint
- TASK=site:build
install:
- chmod +x -R scripts
- yarn

script:
- npm run $TASK
- |
if [ "$TASK" = "test" ]; then
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
fi
- ./scripts/ci/travis-script.sh

cache:
yarn: true
directories:
- ./node_modules/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

68 changes: 68 additions & 0 deletions docs/contributing.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
order: 40
title: Contributing
type: Other
---

The following is a set of guidelines for contributing to ng-alain. Please spend several minutes in reading these guidelines before you create an issue or pull request.

## Code of Conduct

We have adopted a [Code of Conduct](https://github.com/ng-alain/delon/blob/master/CODE_OF_CONDUCT.md) that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

## Open Development

All work on [ng-alain](https://github.com/ng-alain/ng-alain)[delon](https://github.com/ng-alain/delon) happens directly. Both core team members and external contributors send pull requests which go through the same review process.

## Bugs

We are using [GitHub Issues](https://github.com/ng-alain/ng-alain/issues) for bug tracing. The best way to get your bug fixed via [GitHub Issues](https://github.com/ng-alain/ng-alain/issues) and provide a reprduction with this [template](https://stackblitz.com/edit/ng-alain-setup).

Before you reporting a bug, please make sure you've searched exists issues, and read our [FAQ](https://ng-alain.com/).

## Proposing a Change

If you intend to change the public API or introduce new feature that via [GitHub Issues](https://github.com/ng-alain/ng-alain/issues).

## Your First Pull Request

Working on your first Pull Request? You can learn how from this free video series:

[How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)

To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first issues](https://github.com/ng-alain/ng-alain/labels/good%20first%20issues) that contain bugs or small features that have a relatively limited scope. This is a great place to get started.

If you decide to fix an issue, please be sure to check the comment thread in case somebody is already working on a fix. If nobody is working on it at the moment, please leave a comment stating that you intend to work on it so other people don’t accidentally duplicate your effort.

If somebody claims an issue but doesn’t follow up for more than two weeks, it’s fine to take over it but you should still leave a comment.

## Sending a Pull Request

The core team is monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.

**Before submitting a pull request**, please make sure the following is done:

1. Run `yarn` in the repository root.
2. If you’ve fixed a bug or added code that should be tested, add tests!
3. Ensure the test suite passes (`npm run test`).
4. Make sure your code lints (`npm run lint`). Tip: Lint runs automatically when you `git commit`.
5. Make sure rebase your code to keep the history clean.
6. Make sure your commit message meet the [guidelines](https://github.com/ng-alain/delon/blob/master/CONTRIBUTING.md#-commit-message-guidelines)

## Development Workflow

After cloning `ng-alain` or `delon`, run `yarn` to fetch its dependencies. Then, you can run several commands:

### delon

1. `npm run site` runs ng-alain.com website locally
2. `npm run lint` checks the code style
3. `npm run test` runs the complete test suite
5. `npm run release` build packages relases

### ng-alain

1. `npm run site` runs [demo site](https://ng-alain.github.io/ng-alain/) website locally
2. `npm run lint` checks the code style
3. `npm test` runs test suite
5. `npm run build` creates build of [demo site](https://ng-alain.github.io/ng-alain/)
27 changes: 12 additions & 15 deletions docs/contributing.md → docs/contributing.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
order: 40
title:
en-US: Contributing
zh-CN: 贡献指南
title: 贡献指南
type: Other
---

Expand All @@ -18,7 +16,7 @@ type: Other

## Bugs

我们使用 [GitHub Issues](https://github.com/ng-alain/ng-alain/issues) 来做 bug 追踪。 如果你想要你发现的 bug 被快速解决,最好的办法就是按照 issues 呈现的模板认真填写每一项;并且能使用这个 [模板](https://stackblitz.com/edit/ng-alain-setup) 来提供重现。
我们使用 [GitHub Issues](https://github.com/ng-alain/ng-alain/issues) 来做 bug 追踪。如果你想要你发现的 bug 被快速解决,最好的办法就是按照 issues 呈现的模板认真填写每一项;并且能使用这个 [模板](https://stackblitz.com/edit/ng-alain-setup) 来提供重现。

在你报告一个 bug 之前,请先确保已经搜索过已有的 issue 和阅读了 [文档站](https://ng-alain.com/)

Expand All @@ -32,7 +30,7 @@ type: Other

[如何优雅地在 GitHub 上贡献代码](https://segmentfault.com/a/1190000000736629)

为了能帮助你开始你的第一次尝试,我们用 [good first issues](https://github.com/ng-alain/ng-alain/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) 标记了一些比较比较容易修复的 bug 和小功能。这些 issue 可以很好地做为你的首次尝试。
为了能帮助你开始你的第一次尝试,我们用 [good first issues](https://github.com/ng-alain/ng-alain/labels/good%20first%20issues) 标记了一些比较比较容易修复的 bug 和小功能。这些 issue 可以很好地做为你的首次尝试。

如果你打算开始处理一个 issue,请先检查一下 issue 下面的留言以确保没有别人正在处理这个 issue。如果当前没有人在处理的话你可以留言告知其他人你将会处理这个 issue,以免别人重复劳动。

Expand All @@ -44,7 +42,7 @@ Ng Alain 会关注所有的 pull request,我们会 review 以及合并你的

**在你发送 Pull Request 之前**,请确认你是按照下面的步骤来做的:

1. 在项目根目录下运行了 `npm install``yarn`
1. 在项目根目录下运行了 `yarn`
2. 如果你修复了一个 bug 或者新增了一个功能,请确保写了相应的测试,这很重要。
3. 确认所有的测试都是通过的 `npm run test`
4. 确保你的代码通过了 lint 检查 `npm run lint`。小贴士: Lint 会在你 `git commit` 的时候自动运行。
Expand All @@ -57,15 +55,14 @@ Ng Alain 会关注所有的 pull request,我们会 review 以及合并你的

### delon 基建类库

1. `ng serve` 在本地运行测试网站。
2. `ng serve site` 在本地运行 ng-alain.com 网站。
3. `npm run lint` 检查 packages 代码风格。
4. `npm test` 运行 packages 所有类库测试。
5. `npm run release` 构建 packages 发布包。
1. `npm run site` 在本地运行 ng-alain.com 网站
2. `npm run lint` 检查 packages 代码风格
3. `npm run test` 运行 packages 所有类库测试
4. `npm run release` 构建 packages 发布包

### ng-alain 脚手架

1. `npm start` 在本地运行脚手架。
2. `npm run lint` 检查代码风格
3. `npm test` 运行测试
4. `npm run build` 构建生产环境网站
1. `npm start` 在本地运行[脚手架](https://ng-alain.github.io/ng-alain/)
2. `npm run lint` 检查代码风格
3. `npm test` 运行测试
4. `npm run build` 构建生产环境网站
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,15 @@
"homepage": "https://ng-alain.com",
"scripts": {
"precommit": "npm run lint-staged",
"prepush": "npm run lint",
"analyze": "ng build --prod --build-optimizer --stats-json",
"lint": "npm run lint:ts && npm run lint:style",
"lint:ts": "tslint -p tsconfig.json -c tslint.json 'packages/**/*.ts'",
"lint:style": "stylelint \"{packages}/**/*.less\" --syntax less",
"tslint-check": "tslint-config-prettier-check ./tslint.json",
"prepush": "bash scripts/ci/lint.sh",
"lint-staged": "lint-staged",
"test": "ng test --code-coverage --watch=false",
"test:schematics": "bash build-schematics.sh -b -t -travis",
"lint": "bash scripts/ci/lint.sh",
"test": "ng test --code-coverage --watch=false && bash scripts/ci/build-schematics.sh -b -t",
"release": "bash scripts/ci/build-lib.sh && bash scripts/ci/build-schematics.sh -b",
"site:gen": "node scripts/site/main init",
"site:build": "npm run site:gen && ng build --prod --build-optimizer --base-href /",
"site": "npm run site:gen && ng serve -c=hmr",
"release": "bash ./build.sh && bash build-schematics.sh -b",
"release:ci": "bash ./build.sh && bash build-schematics.sh -b -travis",
"publish:next": "npm run release && bash ./scripts/release/publish-next && bash ./scripts/release/sync-taobao",
"scaffold:gh": "bash ./scaffold.sh -c -b && cd dist/scaffold && yarn && ng build --prod --build-optimizer --base-href /ng-alain/ && bash ../../scaffold.sh -d"
"site:build": "npm run site:gen && ng build --prod --build-optimizer --base-href /",
"publish:next": "bash scripts/publish/publish.sh -next"
},
"dependencies": {
"@angular/animations": "^6.1.0",
Expand Down Expand Up @@ -98,6 +91,7 @@
"chalk": "^1.1.3",
"codecov": "^3.1.0",
"codelyzer": "~4.3.0",
"conventional-changelog-cli": "^2.0.5",
"domhandler": "^2.4.2",
"editorconfig-tools": "^0.1.1",
"fs-extra": "^7.0.0",
Expand All @@ -123,6 +117,7 @@
"prettier": "^1.14.1",
"prettier-stylelint": "^0.4.2",
"protractor": "~5.4.0",
"readline-sync": "^1.4.9",
"rollup": "^0.58.2",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
Expand All @@ -144,8 +139,12 @@
"editorconfig-tools fix",
"git add"
],
"packages/**/*.less": [
"bash scripts/ci/lint.sh -t less",
"git add"
],
"packages/**/*.ts": [
"npm run lint:ts",
"bash scripts/ci/lint.sh -t ts",
"git add"
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/abc/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/abc",
"dest": "../../dist/@delon/abc",
"lib": {
"flatModuleFile": "abc",
"entryFile": "public_api.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"baseUrl": ".",
"rootDir": ".",
"paths": {
"@delon/abc/*": ["../../dist/packages-dist/abc/*"],
"@delon/*": ["../../dist/packages-dist/*"]
"@delon/abc/*": ["../../dist/@delon/abc/*"],
"@delon/*": ["../../dist/@delon/*"]
}
},
"files": ["public_api.ts", "../typings.d.ts"],
Expand Down
2 changes: 1 addition & 1 deletion packages/acl/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/acl",
"dest": "../../dist/@delon/acl",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "acl",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/auth",
"dest": "../../dist/@delon/auth",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "auth",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": ".",
"rootDir": ".",
"paths": {
"@delon/*": ["../../dist/packages-dist/*"]
"@delon/*": ["../../dist/@delon/*"]
}
},
"angularCompilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/cache",
"dest": "../../dist/@delon/cache",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "cache",
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/chart",
"dest": "../../dist/@delon/chart",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "chart",
Expand Down
4 changes: 2 additions & 2 deletions packages/chart/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"baseUrl": ".",
"rootDir": ".",
"paths": {
"@delon/chart/*": ["../../dist/packages-dist/chart/*"],
"@delon/*": ["../../dist/packages-dist/*"]
"@delon/chart/*": ["../../dist/@delon/chart/*"],
"@delon/*": ["../../dist/@delon/*"]
}
},
"files": ["public_api.ts", "../typings.d.ts"],
Expand Down
2 changes: 1 addition & 1 deletion packages/form/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/form",
"dest": "../../dist/@delon/form",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "form",
Expand Down
2 changes: 1 addition & 1 deletion packages/form/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": ".",
"rootDir": ".",
"paths": {
"@delon/*": ["../../dist/packages-dist/*"]
"@delon/*": ["../../dist/@delon/*"]
}
},
"angularCompilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mock/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/mock",
"dest": "../../dist/@delon/mock",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "mock",
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"lib": ["es2017", "dom"],
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/packages-dist/schematics",
"outDir": "../../dist/ng-alain",
"noEmitOnError": false,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/theme",
"dest": "../../dist/@delon/theme",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "theme",
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": ".",
"rootDir": ".",
"paths": {
"@delon/acl": ["../../dist/packages-dist/acl"]
"@delon/acl": ["../../dist/@delon/acl"]
}
},
"angularCompilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/ng-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages-dist/util",
"dest": "../../dist/@delon/util",
"deleteDestPath": true,
"lib": {
"flatModuleFile": "util",
Expand Down
Loading

0 comments on commit a0caa81

Please sign in to comment.