Skip to content

Commit

Permalink
feat(root): sets up dev configuration, ci/cd pipelines, and tools
Browse files Browse the repository at this point in the history
  • Loading branch information
rockchalkwushock committed Apr 23, 2021
1 parent 52c134c commit ddb843a
Show file tree
Hide file tree
Showing 14 changed files with 6,866 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: '/'
open-pull-requests-limit: 10
schedule:
day: 'sunday'
interval: 'weekly'
time: '22:00'
timezone: 'America/Bogota'
target-branch: 'staging'

- package-ecosystem: 'npm'
directory: '/'
open-pull-requests-limit: 10
schedule:
day: 'sunday'
interval: 'weekly'
time: '22:00'
timezone: 'America/Bogota'
target-branch: 'staging'
57 changes: 57 additions & 0 deletions .github/workflows/feature.yml
@@ -0,0 +1,57 @@
name: Feature

on:
pull_request:
branches: [staging]

jobs:
review_code:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14.x']

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}

- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Get Yarn Cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Dependencies
uses: actions/cache@v2.1.5
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
env:
CI: true

- name: Linting
run: yarn run eslint

- name: Type checking
run: yarn run tsc

- name: Tests
run: yarn run test:ci

- name: Build
run: yarn run build
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,52 @@
name: Release

on:
push:
branches: [production]

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14.x']

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}

- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Get Yarn Cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Dependencies
uses: actions/cache@v2.1.5
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
access: public
token: ${{ secrets.NPM_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/staging.yml
@@ -0,0 +1,57 @@
name: Staging

on:
pull_request:
branches: [production]

jobs:
review_code:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14.x']

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}

- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Get Yarn Cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Dependencies
uses: actions/cache@v2.1.5
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Install Dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
env:
CI: true

- name: Linting
run: yarn run eslint

- name: Type checking
run: yarn run tsc

- name: Tests
run: yarn run test:ci

- name: Build
run: yarn run build
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -102,3 +102,7 @@ dist

# TernJS port file
.tern-port

# Misc
.DS_Store
.vscode
1 change: 1 addition & 0 deletions .husky/.gitignore
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint -e $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
14.15.4
8 changes: 8 additions & 0 deletions jest.config.js
@@ -0,0 +1,8 @@
module.exports = {
bail: true,
collectCoverage: true,
collectCoverageFrom: ['src/index.ts'],
preset: 'ts-jest',
roots: ['<rootDir>'],
testEnvironment: 'node',
}
115 changes: 115 additions & 0 deletions package.json
@@ -0,0 +1,115 @@
{
"name": "rehype-code-titles",
"version": "1.0.0",
"description": "Rehype plugin for parsing code blocks and adding titles to code blocks",
"author": {
"email": "me@codybrunner.dev",
"name": "Cody Brunner",
"url": "https://codybrunner.dev"
},
"repository": {
"type": "git",
"url": "https://github.com/rockchalkwushock/rehype-code-titles.git"
},
"bugs": {
"url": "https://github.com/rockchalkwushock/rehype-code-titles/issues"
},
"homepage": "https://github.com/rockchalkwushock/rehype-code-titles#readme",
"license": "MIT",
"files": [
"dist"
],
"keywords": [
"code-titles",
"html",
"mdx",
"rehype",
"rehype-plugin",
"remark",
"unified"
],
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"commit": "git cz",
"format": "prettier --write",
"lint": "eslint",
"prepare": "husky install",
"release": "standard-version",
"test": "jest --maxWorkers=50%",
"test:ci": "jest --ci --passWithNoTests --runInBand",
"test:coverage": "yarn test --coverage",
"test:watch": "jest --maxWorkers=25% --onlyChanged --watch",
"type-check": "tsc --noEmit"
},
"devDependencies": {
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@rockchalkwushock/eslint-config": "^1.0.3",
"@types/dedent": "^0.7.0",
"@types/jest": "^26.0.22",
"@types/node": "^14.14.41",
"commitizen": "^4.2.3",
"cz-conventional-changelog": "^3.3.0",
"dedent": "^0.7.0",
"eslint": "^7.24.0",
"husky": "^6.0.0",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"standard-version": "^9.2.0",
"ts-jest": "^26.5.5",
"typescript": "^4.2.4"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"eslintConfig": {
"extends": "@rockchalkwushock/eslint-config",
"ignorePatterns": [
"package.json",
"tsconfig.json"
]
},
"lint-staged": {
"*.+(js|json|md|mdx|ts|tsx|yml|yaml)": [
"prettier --write"
],
"*.+(ts|tsx)": [
"eslint --fix",
"tsc --esModuleInterop --noEmit",
"jest --lastCommit --maxWorkers=25% --passWithNoTests"
]
},
"prettier": {
"arrowParens": "avoid",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
},
"standard-version": {
"types": [
{
"section": "Bugs 🐛",
"type": "fix"
},
{
"section": "Features 🎉",
"type": "feat"
},
{
"section": "Tests 🧪",
"type": "test"
}
]
}
}
1 change: 1 addition & 0 deletions src/index.ts
@@ -0,0 +1 @@
export const x = 42
20 changes: 20 additions & 0 deletions tsconfig.json
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"module": "CommonJS",
"moduleResolution": "Node",
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "dist",
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
},
"exclude": ["node_modules", "src/**/*.test.ts", "src/__snapshots__/*.snap"],
"include": ["src"]
}

0 comments on commit ddb843a

Please sign in to comment.