Skip to content

Commit

Permalink
feat: Initial Typist implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rfgamaral committed Nov 4, 2022
1 parent 9141667 commit 19451ab
Show file tree
Hide file tree
Showing 126 changed files with 72,425 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
############################################
# GENERATED BY IGNORE-SYNC, DO NOT EDIT!!! #
# https://github.com/foray1010/ignore-sync #
############################################

# Project cache
.cache/

# Visual Studio Code
.vscode/

# Project output
dist/
storybook-static/

# Project dependencies
node_modules/

# macOS
.DS_Store

# Log files
*.log
npm-debug.log*
2 changes: 2 additions & 0 deletions .eslintignore-sync
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[local]
.gitignore
71 changes: 71 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
},
globals: {
global: true,
module: true,
},
ignorePatterns: ['.eslintrc.js'],
plugins: ['unicorn'],
extends: [
'@doist/eslint-config/recommended-requiring-type-checking',
'@doist/eslint-config/simple-import-sort',
'@doist/eslint-config/react',
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
sourceType: 'module',
project: ['./tsconfig.json'],
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['./tsconfig.json'],
},
},
},
rules: {
// Rules no longer necessary with the new JSX Transformer
// ref: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',

// Experimental `eslint-plugin-unicorn` rules
// ref: https://github.com/Doist/eslint-config/issues/46
'unicorn/throw-new-error': 'error',
'unicorn/prefer-optional-catch-binding': 'error',
},
overrides: [
//
{
files: ['**/*.test.js', '**/*.test.ts'],
plugins: ['jest'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
},
// Disable rules that are pointless for Typescript files (this shouldn't be needed, but for
// some reason `react/prop-types` is being flagged for Typescript files)
{
files: ['./{src,stories}/**/*.tsx'],
rules: {
'react/prop-types': 'off',
},
},
// Disable rules that conflict with Storybook stories and TypeScript typings
{
files: ['./stories/**/*.{story,stories}.tsx', './typings/**/*.d.ts'],
rules: {
'func-style': 'off',
'import/no-default-export': 'off',
},
},
],
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Automatic end-of-line normalization for all text files
* text=auto eol=lf
Binary file added .github/assets/logo-dark-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logo-light-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"github>doist/renovate-config:frontend-base",
"github>doist/renovate-config-internal:npm-registry-token"
],
"packageRules": [
{
"matchPackagePatterns": ["^@tiptap/"],
"groupName": "tiptap packages"
}
],
"npmrc": "@doist:registry=https://npm.pkg.github.com/\nalways-auth=true\nengine-strict=true"
}
155 changes: 155 additions & 0 deletions .github/workflows/check-ci-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: CI Validation

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

env:
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}

concurrency:
group: check-ci-validation-${{ github.ref }}
cancel-in-progress: true

jobs:
prepare-workflow:
name: Prepare Workflow
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare Node.js environment
uses: actions/setup-node@v3
with:
cache: npm
node-version-file: .node-version

- name: Cache project 'node_modules' directory
uses: actions/cache@v3
id: node-modules-cache
with:
key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version') }}
path: node_modules/

- name: Install project npm dependencies
if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }}
run: |
npm ci
static-code-analysis:
name: Static Code Analysis
runs-on: ubuntu-latest
timeout-minutes: 60

needs:
- prepare-workflow

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare Node.js environment
uses: actions/setup-node@v3
with:
cache: npm
node-version-file: .node-version

- name: Cache project 'node_modules' directory
uses: actions/cache@v3
id: node-modules-cache
with:
key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version') }}
path: node_modules/

- name: Install project npm dependencies
if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }}
run: |
npm ci
- name: Analyse code style with Prettier
run: |
npm run prettier:check
- name: Analyse code quality with ESLint
run: |
npm run eslint:check
- name: Perform type checking with TypeScript
run: |
npm run typescript:check
unit-testing:
name: Unit Testing
runs-on: ubuntu-latest
timeout-minutes: 60

needs:
- prepare-workflow

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare Node.js environment
uses: actions/setup-node@v3
with:
cache: npm
node-version-file: .node-version

- name: Cache project 'node_modules' directory
uses: actions/cache@v3
id: node-modules-cache
with:
key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version') }}
path: node_modules/

- name: Install project npm dependencies
if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }}
run: |
npm ci
- name: Test codebase correctnesss
run: |
npm run test
build-package:
name: Build Package
runs-on: ubuntu-latest
timeout-minutes: 60

needs:
- prepare-workflow

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare Node.js environment
uses: actions/setup-node@v3
with:
cache: npm
node-version-file: .node-version

- name: Cache project 'node_modules' directory
uses: actions/cache@v3
id: node-modules-cache
with:
key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version') }}
path: node_modules/

- name: Install project npm dependencies
if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }}
run: |
npm ci
- name: Build `@doist/typist` package
run: |
npm run build
21 changes: 21 additions & 0 deletions .github/workflows/check-semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Semantic Pull Request

on:
pull_request_target:
types:
- edited
- opened
- synchronize

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
validate-title:
name: Validate Title
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Validate pull request title
uses: amannn/action-semantic-pull-request@v5
101 changes: 101 additions & 0 deletions .github/workflows/publish-typist-package-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Typist Package Release

on:
workflow_dispatch:

jobs:
prepare-workflow:
name: Prepare Workflow
runs-on: ubuntu-latest
timeout-minutes: 5

if: github.ref == 'refs/heads/main'

outputs:
main-ci-validation-status: ${{ steps.gh-run-list.outputs.main-ci-validation-status }}
main-ci-validation-conclusion: ${{ steps.gh-run-list.outputs.main-ci-validation-conclusion }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_REPO_TOKEN }}

- name: Get latest 'CI Validation' workflow run status for `main` branch
id: gh-run-list
run: |
LATEST_WORKFLOW_RUN=$(gh run list --branch main --workflow check-ci-validation.yml --limit 1)
echo "main-ci-validation-status=$(echo $LATEST_WORKFLOW_RUN | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "main-ci-validation-conclusion=$(echo $LATEST_WORKFLOW_RUN | awk '{print $2}')" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-and-publish:
name: Release & Publish
runs-on: ubuntu-latest
timeout-minutes: 60

needs:
- prepare-workflow

if: |
needs.prepare-workflow.outputs.main-ci-validation-status == 'completed' &&
needs.prepare-workflow.outputs.main-ci-validation-conclusion == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_REPO_TOKEN }}

- name: Prepare Node.js environment
uses: actions/setup-node@v3
with:
cache: npm
node-version-file: .node-version

- name: Cache project 'node_modules' directory
uses: actions/cache@v3
id: node-modules-cache
with:
key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version') }}
path: node_modules/

- name: Install project npm dependencies
if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }}
run: |
npm ci
- name: Build package
run: |
npm run build
- name: Run automated package publishing
run: |
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GIT_AUTHOR_EMAIL: doistbot@users.noreply.github.com
GIT_AUTHOR_NAME: Doist Bot
GIT_COMMITTER_EMAIL: doistbot@users.noreply.github.com
GIT_COMMITTER_NAME: Doist Bot

validation-failure:
name: Validation Failure
runs-on: ubuntu-latest
timeout-minutes: 5

needs:
- prepare-workflow

if: |
needs.prepare-workflow.outputs.main-ci-validation-status != 'completed' ||
needs.prepare-workflow.outputs.main-ci-validation-conclusion != 'success'
steps:
- name: Log error message and set failing exit code
uses: actions/github-script@v6
with:
script: |
core.setFailed("Latest 'CI Validation' workflow for the `main` branch is still running or some checks were not successful.")
Loading

0 comments on commit 19451ab

Please sign in to comment.