Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
chore: initial scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Negin-Ulster committed May 13, 2021
1 parent 02a621b commit bc2ab42
Show file tree
Hide file tree
Showing 42 changed files with 12,727 additions and 77 deletions.
15 changes: 15 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"projectName": "yarn-plugin-semver-up",
"projectOwner": "tophat",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": false,
"commitConvention": "none",
"contributors": [],
"contributorsPerLine": 7,
"skipCi": true
}
17 changes: 0 additions & 17 deletions .dependabot/config.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
max_line_length = off

[*.yml]
indent_size = 2

[{CHANGELOG.md,package.json,yarn.lock}]
indent_size = false
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage
website/node_modules
!.eslintrc.js
node_modules
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'plugin:@typescript-eslint/recommended',
'@tophat/eslint-config/base',
'@tophat/eslint-config/jest',
'prettier',
],
rules: {
'no-empty': 'off',
'no-unused-vars': 'off', // covered by typescript eslint
'import/named': 'off',
'import/order': [
'error',
{
alphabetize: { order: 'asc' },
'newlines-between': 'always',
groups: [
'unknown',
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
},
],
},
ignorePatterns: ['.*', '**/*.js', 'lib'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.js'],
},
'import/resolver': {
typescript: './tsconfig.json',
},
},
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.yarn/releases/** binary
/.yarn/sdks/** binary
/bundles/@yarnpkg/** binary
24 changes: 16 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@ about: Create a report to help us improve
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
<!-- A clear and concise description of what the bug is. -->

**To reproduce**

<!--
Steps to reproduce the behavior:
1. Setup '...'
2. Run command '....'
3. See error
-->

**Expected behavior**
A clear and concise description of what you expected to happen.

<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Version [e.g. 1.0]
<!-- If applicable, add screenshots to help explain your problem. -->

**Environment (please complete the following information):**

- OS: [e.g. Ubuntu 20.04, Mac OSX 10.14]
- Plugin Version: [e.g. 1.0]
- Node Version: [e.g. 12.16.1]

**Additional context**
Add any other context about the problem here.

<!-- Add any other context about the problem here. -->
12 changes: 8 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ about: Suggest an idea for this project
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
Add any other context or screenshots about the feature request here.

<!-- Add any other context or screenshots about the feature request here. -->
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Question
about: Have a question about the plugin?

---

**What's your question?**

<!-- Please read the documentation before asking your question. -->
26 changes: 26 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Description

<!-- Provide a description of what your PR introduces or changes. -->

e.g. This PR refactors the X logic, applying Y's algorithm to improve Z by K percent.

## Related Issues

<!-- Does this PR directly address an existing GitHub issue? If not, you may want to consider creating an issue first. -->

- Closes #0, a short description of the linked issue.

## Checklist

<!-- Please mark items as completed where appropriate. e.g. [x]. -->

- [ ] I agree to abide by the [Code of Conduct](https://github.com/tophat/yarn-plugin-licenses/blob/master/CODE_OF_CONDUCT.md).
- [ ] This PR has sufficient documentation.
- [ ] This PR has sufficient test coverage.
- [ ] This PR title satisfies semantic [convention](https://www.conventionalcommits.org/en/v1.0.0/#summary).

## Additional Comments

<!-- Feel free to add any additional comments related to this PR. -->

No additional comments.
11 changes: 11 additions & 0 deletions .github/actions/detect-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: detect-env
description: Sets node and yarn version from nvmrc and yvmrc files.
runs:
using: "composite"
steps:
- name: Determine Node Version
run: echo NODE_VERSION=$(cat .nvmrc | tr -d '\n') >> $GITHUB_ENV
shell: bash
- name: Determine Yarn Version
run: echo YARN_VERSION=$(cat .yvmrc | tr -d '\n') >> $GITHUB_ENV
shell: bash
14 changes: 14 additions & 0 deletions .github/codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# From https://github.com/decidim/decidim (AGPL-3.0)

EVENT_PAYLOAD_FILE=$1

PR_ID=`jq ".number // .check_run.pull_requests[0].number" $EVENT_PAYLOAD_FILE`
GIT_SHA=`jq -r ".pull_request.head.sha // .check_run.head_sha // .after" $EVENT_PAYLOAD_FILE`

if [ $PR_ID = "null" ]; then
bash <(curl -s https://codecov.io/bash) -C $GIT_SHA -s $ARTIFACT_DIR
else
bash <(curl -s https://codecov.io/bash) -C $GIT_SHA -P $PR_ID -s $ARTIFACT_DIR
fi
116 changes: 116 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Continuous Integration

on:
push:
branches:
- master
pull_request:

env:
CI: 1
ARTIFACT_DIR: ./artifacts

jobs:
commit-watch:
name: Run Commit Watch
runs-on: ubuntu-20.04
if: "github.event_name == 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Run Commit Watch
env:
COMMIT_WATCH_OUTPUT_DIR: ${{ env.ARTIFACT_DIR }}/
COMMITWATCH_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CI_REPO_OWNER: ${{ github.repository_owner }}
CI_REPO_NAME: ${{ github.event.repository.name }}
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
CI_BASE_BRANCH: origin/${{ github.base_ref }}
run: yarn dlx commit-watch
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: commit-watch-artifacts
path: ${{ env.ARTIFACT_DIR }}
tests:
name: Lint & Tests
runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v2
with:
path: |
./.yarn
./.pnp.*
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable
- name: Linting
run: yarn lint:ci
- name: Set GitHub user for tests
run: |
git config --global user.email "[email protected]"
git config --global user.name "Top Hat Open Source"
- name: Tests
run: yarn test:ci
- name: Upload Coverage Report
run: ./.github/codecov.sh $GITHUB_EVENT_PATH
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: report-artifacts
path: ${{ env.ARTIFACT_DIR }}
build:
name: Build
runs-on: ubuntu-20.04
needs: [tests]
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v2
with:
path: |
./.yarn
./.pnp.*
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: ${{ env.ARTIFACT_DIR }}
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release

on:
push:
tags:
- "v*"

env:
CI: 1
ARTIFACT_DIR: ./artifacts

jobs:
release:
name: Publish Yarn Semver Up Plugin
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v2
with:
path: |
./.yarn
./.pnp.*
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable
- name: Build Package
run: yarn build
- name: Publish Package
run: echo "No publish capability at the moment."
- name: Upload Artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: reports-and-build-artifacts
path: |
${{ env.ARTIFACT_DIR }}
Loading

0 comments on commit bc2ab42

Please sign in to comment.