-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Caporal v2 BREAKING CHANGE: Caporal v2 is not backward compatible with 1.x. v2 is a full rewrite with Typescript which brings a lot of features and fixes to v1.
- Loading branch information
Showing
229 changed files
with
56,081 additions
and
13,292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.js] | ||
indent_size = 2 | ||
continuation_indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
es6: true, | ||
jest: true, | ||
}, | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module", | ||
}, | ||
extends: ["eslint:recommended", "plugin:prettier/recommended"], | ||
overrides: [ | ||
{ | ||
files: ["**/*.ts"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:jest/recommended", | ||
], | ||
plugins: ["@typescript-eslint", "jest"], | ||
rules: { | ||
"@typescript-eslint/explicit-function-return-type": [ | ||
"warn", | ||
{ | ||
allowExpressions: true, | ||
}, | ||
], | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"no-console": "error", | ||
// nededed for mixins to avoid unecessary warnings | ||
"@typescript-eslint/no-empty-interface": "off", | ||
}, | ||
}, | ||
], | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: "Continous integration" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
node: ["10", "12", "14"] | ||
os: ["macos-latest", "ubuntu-latest", "windows-latest"] | ||
|
||
name: "node ${{ matrix.node }} / ${{ matrix.os }}" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get npm cache directory | ||
id: npm-cache | ||
run: | | ||
echo "::set-output name=dir::$(npm config get cache)" | ||
# See https://github.com/actions/cache/blob/master/examples.md#node---npm | ||
- name: Cache node modules | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ${{ steps.npm-cache.outputs.dir }} | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Setup Node.js v${{ matrix.node }} on ${{ matrix.os }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
# build before testing as some tests actually test the build | ||
- name: Build | ||
run: npm run build | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Run dist tests | ||
run: npm run test:dist | ||
|
||
- name: Jest Annotations & Coverage | ||
if: ${{ matrix.node == '12' && matrix.os == 'ubuntu-latest' }} | ||
uses: mattallty/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
deploy-preview: | ||
name: "Deploy preview website" | ||
runs-on: ubuntu-latest | ||
needs: run-tests | ||
continue-on-error: true | ||
if: ${{ github.event_name == 'pull_request' || github.ref != 'master' }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: amondnet/now-deployment@v2 | ||
id: now-deploy | ||
with: | ||
github-comment: false | ||
zeit-token: ${{ secrets.ZEIT_TOKEN }} | ||
now-args: "" | ||
now-org-id: ${{ secrets.ZEIT_ORG_ID}} | ||
now-project-id: ${{ secrets.ZEIT_PROJECT_ID}} | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Alias | ||
id: caporal-preview | ||
env: | ||
NOW_ORG_ID: ${{ secrets.ZEIT_ORG_ID}} | ||
NOW_PROJECT_ID: ${{ secrets.ZEIT_PROJECT_ID}} | ||
run: | | ||
clean_url=$(echo "${{ steps.now-deploy.outputs.preview-url }}" | cut -c9-) | ||
clean_ref=$(basename "${{ github.head_ref }}") | ||
clean_sha=$(echo "${{ github.sha }}" | cut -c1-7) | ||
npm run now -- alias -A now.preview.json --token ${{ secrets.ZEIT_TOKEN }} set $clean_url ${clean_ref}.caporal.run | ||
npm run now -- alias -A now.preview.json --token ${{ secrets.ZEIT_TOKEN }} set $clean_url ${clean_sha}.caporal.run | ||
echo "::set-output name=url_ref::https://${clean_ref}.caporal.run" | ||
echo "::set-output name=url_sha::https://${clean_sha}.caporal.run" | ||
- uses: chrnorm/deployment-action@releases/v1 | ||
name: Create GitHub deployment for commit | ||
id: commit-deployment | ||
if: ${{ success() }} | ||
with: | ||
initial_status: success | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
target_url: ${{ steps.caporal-preview.outputs.url_sha }} | ||
environment: Commit-preview | ||
|
||
- uses: chrnorm/deployment-action@releases/v1 | ||
name: Create GitHub deployment for branch | ||
id: branch-deployment | ||
if: ${{ success() }} | ||
with: | ||
initial_status: success | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
target_url: ${{ steps.caporal-preview.outputs.url_ref }} | ||
environment: Branch-preview | ||
|
||
- name: comment PR | ||
uses: unsplash/comment-on-pr@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
msg: ":rocket: Caporal website preview available at: ${{ steps.caporal-preview.outputs.url_ref }}" | ||
check_for_duplicate_msg: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: "Cleanup Duplicate CI workflows" | ||
on: | ||
schedule: | ||
- cron: "*/15 * * * *" | ||
|
||
jobs: | ||
cancel-runs: | ||
# Prevent forks from running this to be nice | ||
if: ${{ github.repository == 'mattallty/Caporal.js' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: n1hility/cancel-previous-runs@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: ci.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- beta | ||
- alpha | ||
- next | ||
- next-major | ||
- 1.x | ||
- 1.4.x | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: run-tests | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
|
||
- name: Get npm cache directory | ||
id: npm-cache | ||
run: | | ||
echo "::set-output name=dir::$(npm config get cache)" | ||
# See https://github.com/actions/cache/blob/master/examples.md#node---npm | ||
- name: Cache node modules | ||
uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ${{ steps.npm-cache.outputs.dir }} | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Test | ||
run: npm run test | ||
|
||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
examples/hello.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
trailingComma: "all", | ||
tabWidth: 2, | ||
semi: false, | ||
printWidth: 90, | ||
} |
Oops, something went wrong.