Skip to content

Commit

Permalink
chore: initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tplooker committed Sep 23, 2020
0 parents commit 12af100
Show file tree
Hide file tree
Showing 82 changed files with 13,306 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "node"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"node/no-extraneous-import": "error"
}
}
30 changes: 30 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!---
Provide a general summary of your changes in the Title above
-->

## Description

<!--- Describe your changes in detail -->

- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] The commit message(s) follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [ ] Changes follow the **[contributing](../CONTRIBUTING.md)** document.

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## Does this PR introduce a breaking change?

- [ ] Yes
- [ ] No

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->

## Which merge strategy will you use?

<!-- This indicates to reviewers whether they need to check your commits are ready to be rebased on master or not. -->

- [ ] Squash
- [ ] Rebase (REVIEW COMMITS)
26 changes: 26 additions & 0 deletions .github/workflows/any.pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: any-pr

on: [pull_request]

jobs:
build_test:
name: Build test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn format
- run: yarn lint
- run: yarn build
- run: yarn test --coverage
- uses: romeovs/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: ./coverage/lcov.info
36 changes: 36 additions & 0 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: push-master

on:
push:
branches:
- master

jobs:
build_test_publish:
name: Build, test, and publish unstable release
if: "! contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn build
- run: yarn test --coverage
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc 2> /dev/null
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- run: git config user.name "Mattr CI"
- run: git config user.email "[email protected]"
- run: yarn publish:unstable
- name: Report Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/push-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: push-release

on:
push:
branches:
- master

jobs:
build_test_publish:
name: Build, test, and publish unstable release
if: "! contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn build
- run: yarn test --coverage
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc 2> /dev/null
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- run: git config user.name "Mattr CI"
- run: git config user.email "[email protected]"
- run: yarn publish:release
- name: Report Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
######################
# Project Specific
######################
lib/
jest_results/
node_modules/
.npmrc
out/
.vscode-test/

######################
# Visual Studio Code
######################
.vscode/

######################
# Windows
######################
# Windows image file caches
Thumbs.db

# Folder config file
Desktop.ini

######################
# Mac OSX
######################
.DS_Store

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

######################
# Logs
######################
*.log*

######################
# Others
######################
*.*~
*~
.merge_file*
*.swp
*.swo
**/bin
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# jsonld-lint

TODO
17 changes: 17 additions & 0 deletions config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": ["es6"],
"sourceMap": true,
"allowJs": false,
"moduleResolution": "node",
"strict": true,
"declaration": true,
"downlevelIteration": true,
"types": ["node", "jest"],
"typeRoots": ["../node_modules/@types"],
"baseUrl": ".",
"resolveJsonModule": true
}
}
84 changes: 84 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Contributing

We use several pieces of technology in this repository to streamline the release process whilst maintaining high code
quality.

## Pre pull request checklist

Below is a brief checklist prior to submitting or updating a pull request

1. Running `yarn pre-pr` passes.
2. Commit messages conform to the below conventions.
3. The pull request description fills in the relevant fields provided by the template.

## Commit messages

A well formed commit message communicates context about a change. A diff will tell you what changed. A well cared for
commit log is a beautiful and useful thing.

What may be a hassle at first soon becomes habit, and eventually a source of pride and productivity for all
involved. From reviews to maintenance it's a powerful tool. Understanding why something happened months or years ago
becomes not only possible but efficient.

We rely on consistent commit messages as we use
[conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) which automatically generates
the changelog diff based on the commit messages

We enforce well formed commit messages with pre-commit hooks using [husky](https://github.com/typicode/husky).

The following guidelines are based on the angular
team's [contribution guide](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines).
Checkout [commitizen](https://www.npmjs.com/package/commitizen) and [commitlint.io](https://commitlint.io/) for
assistance.

```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```

### Type

Must be one of the following:

- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- **docs**: Documentation only changes
- **feat**: A new feature
- **fix**: A bug fix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- **test**: Adding missing tests or correcting existing tests

### Scope

The scope should be the name of the module/package/area affected (as perceived by the person reading the commit
message).

### Subject

The subject contains a succinct description of the change.

- use the imperative, present tense: "change" not "changed" nor "changes" (this convention matches up with commit
messages generated by commands like git merge and git revert)
- don't capitalise the first letter
- no dot (.) at the end

### Body

The body contains more detailed explanatory text, if necessary.

- must have blank line between subject and body (unless you omit the body)
- wrap at 72 chars
- use the imperative, present tense: "change" not "changed" nor "changes" (this convention matches up with commit
messages generated by commands like git merge and git revert)
- should include the motivation for the change and contrast this with previous behaviour
- paragraphs come after blank lines
- use of markdown is encourage i.e. links, bullet points

### Footer

The footer contains references to issues the commit closes or addresses.
35 changes: 35 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stable Releases

// TODO

To create a stable release follow the following steps

1. Checkout the head of master `git checkout master && git pull`
2. Create a new release branch from master e.g `release`
3. Ensure the package is clean from previous branches/builds `yarn clean`
4. Install the dependencies `yarn install --frozen-lockfile`
5. Build the package `yarn build`
6. Test the package `yarn test`
7. Run `yarn version:release`, note by default this will do a minor package release as we are pre the `1.0.0` release
8. Observe the correctly incremented change to the `package.json` and the new entry in `CHANGELOG.md` along with the
newly created commit
9. Push the release branch including the newly created tags `git push origin release --tags`
10. Open a pull request for the release, once approvals have been sought, merge the pull request using squash,
preserving the commit message as `chore(release): publish [skip ci]`
11. Observe the triggering of the `/.github/workflows/push-release.yaml`

The resulting release will publish the new package to NPM and the resulting binaries to github packages.

# Unstable Releases

An unstable release is triggered on every commit to master, where the `/.github/workflows/push-master.yaml` is run.

The releases have the following version syntax
`<current package version + patch version>-unstable.<current git commit reference>`

**Note** Unstable releases include the un-compiled rust required to build the project and hence require rust to install.

**Note** The `/.github/workflows/push-master.yaml` will skip if the commit message includes `[skip ci]`

**Note** To skip the automatic release of a new unstable version append `[skip ci]` to the end of the commit message
that is merged into master.
17 changes: 17 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": ["packages/*"],
"command": {
"publish": {
"allowBranch": ["master"],
"conventionalCommits": true
},
"version": {
"allowBranch": ["master"],
"conventionalCommits": true,
"message": "chore(release): publish [skip ci]"
}
}
}
Loading

0 comments on commit 12af100

Please sign in to comment.