Skip to content

Commit

Permalink
chore: change template tool chain
Browse files Browse the repository at this point in the history
  • Loading branch information
wood3n committed Sep 22, 2024
1 parent b4144d5 commit 3fd68f8
Show file tree
Hide file tree
Showing 66 changed files with 8,208 additions and 2,201 deletions.
5 changes: 5 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works with multi-package repos, or single-package repos to help you version and publish your code. You can find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
"changelog": "@changesets/changelog-git",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [],
"snapshot": {
"prereleaseTemplate": "{tag}-{timestamp}"
}
}
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
dist
es
lib
assets
public
coverage
storybook-static

node_modules
**/node_modules

54 changes: 41 additions & 13 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
const project = ["./tsconfig.node.json", "./packages/*/tsconfig.json", "./packages/*/tsconfig.node.json"];

module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/stylistic",
"plugin:import-x/recommended",
"plugin:import-x/typescript",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:jsx-a11y/recommended",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "simple-import-sort"],
plugins: ["@typescript-eslint", "simple-import-sort", "jsx-a11y"],
root: true,
parserOptions: {
sourceType: "module",
ecmaVersion: "latest",
project: ["./tsconfig.eslint.json", "./packages/*/tsconfig.json"],
project,
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: true,
},
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import-x/resolver": {
"import/resolver": {
node: {
project,
},
typescript: {
alwaysTryTypes: true,
project: ["./packages/*/tsconfig.json"],
project,
},
},
react: {
version: "18",
},
},
overrides: [
{
Expand All @@ -36,6 +51,18 @@ module.exports = {
"eol-last": 0,
"no-undef": 0,
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"max-len": 0,
"no-console": 0,
indent: 0,
Expand All @@ -50,10 +77,11 @@ module.exports = {
},
],
"object-curly-spacing": ["error", "always"],
"import-x/no-cycle": 0,
"import-x/prefer-default-export": 0,
"import-x/no-extraneous-dependencies": 0,
"import-x/extensions": [
"jsx-a11y/alt-text": 0,
"import/no-cycle": 0,
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": 0,
"import/extensions": [
"error",
"ignorePackages",
{
Expand Down Expand Up @@ -114,8 +142,8 @@ module.exports = {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unsafe-argument": 0,
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-unused-expressions": 2,
"@typescript-eslint/consistent-type-imports": [2, { disallowTypeAnnotations: false }],
"@typescript-eslint/prefer-nullish-coalescing": 0,
},
};
47 changes: 47 additions & 0 deletions .github/workflows/deploy-storybook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy Storybook to GitHub Pages

on:
workflow_dispatch:
push:
branches:
- "master"
paths:
- "packages/components/**"

permissions:
contents: read
pages: write
id-token: write

# List of jobs
jobs:
deploy:
runs-on: ubuntu-latest
# Job steps
steps:
# Manual Checkout
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Set up Node
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

# Set up pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.7
run_install: false

- name: Deploy github pages
uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3
with:
install_command: pnpm install # default: npm ci
build_command: npx turbo run build-storybook # default: npm run build-storybook
path: packages/components/storybook-static # default: dist/storybook
checkout: false # default: true
43 changes: 43 additions & 0 deletions .github/workflows/preview-storybook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Vercel Preview Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
pull_request:
types: [opened, synchronize]

jobs:
Deploy-Preview:
if: ${{ ! startsWith(github.event.pull_request.title, 'auto-changesets-release') }}
runs-on: ubuntu-latest
steps:
# Manual Checkout
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Set up Node
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

# Set up pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.7
run_install: false

- name: Install Vercel CLI
run: pnpm i -g vercel

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release

on:
workflow_dispatch:
push:
branches: master

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
Release:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > .npmrc

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8.15.7
run_install: true

- name: Create release pull request
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run ci:publish
version: npx changeset version
title: "auto-changesets-release"
commit: "chore: auto update packages version and changelog"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
48 changes: 0 additions & 48 deletions .github/workflows/release.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/snapshot-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Snapshot release on PR

on:
pull_request:
types: [opened, synchronize]

jobs:
Release:
name: SnapshotRelease
if: ${{ ! startsWith(github.event.pull_request.title, 'auto-changesets-release') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > .npmrc

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.7
run_install: true

- name: Check for changesets
id: changesets
run: |
if [ -n "$(git diff origin/master --name-only -- '*.changeset/*')" ]; then
echo "hasChangesets=true" >> $GITHUB_OUTPUT
else
echo "hasChangesets=false" >> $GITHUB_OUTPUT
fi
- name: Snapshot release
if: steps.changesets.outputs.hasChangesets == 'true'
run: npx turbo run build && npx changeset version --snapshot beta && npx changeset publish --tag beta --no-git-tag
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ typings/

# Optional npm cache directory
.npm
.npmrc

# Optional eslint cache
.eslintcache
Expand Down Expand Up @@ -120,3 +121,13 @@ dist
build_*
es
lib

# packages/components storybook output
*storybook.log
storybook-static

# vercel preview deploy config
.vercel

# turborepo cache
.turbo
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm dlx commitlint --edit \
pnpm dlx commitlint --edit $1
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
pnpm run coverage

pnpm exec lint-staged
Loading

0 comments on commit 3fd68f8

Please sign in to comment.