Skip to content

Commit

Permalink
chore: Setup monorepo (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista authored Nov 10, 2023
1 parent c9f0db9 commit 753a22b
Show file tree
Hide file tree
Showing 46 changed files with 4,818 additions and 1,812 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.turbo
dist
node_modules
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"root": true,
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"mocha": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "mocha", "prettier"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"parserOptions": {
"ecmaVersion": 8
},
"ignorePatterns": ["node_modules/", "dist/", ".turbo/"],
"rules": {
"mocha/no-skipped-tests": "error",
"mocha/no-exclusive-tests": "error",
"prettier/prettier": "error",

// Intermediate deescalation to warnings
//
// FIXME Slowly remove these problems, then remove these overrides
"no-undef": "warn",
"no-constant-condition": "warn",

"no-unused-vars": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-var-requires": "warn"
}
}
78 changes: 78 additions & 0 deletions .github/workflows/publish-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish packages

on:
push:
branches:
- main

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

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "yarn"

# Install the dependencies without running the post-install scripts
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline --ignore-scripts
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# Run the post-install scripts
- name: Build Dependencies
run: yarn install --frozen-lockfile --offline

# Cache build artifacts from turbo
#
# This step will speed up workflow runs that don't touch the whole codebase
# (or the ones that don't touch the codebase at all)
- name: Cache turbo build setup
uses: actions/cache@v3
with:
path: node_modules/.cache/turbo
key: ${{ runner.os }}-turbo-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Lint
run: yarn lint

- name: Build
run: yarn build

- name: Test
run: yarn test

# This step uses the changesets CLI to bump the package versions and/or publish the unpublished packages
#
# How this works is:
#
# - If there are any changesets (markdown files in the .changeset directory),
# changesets CLI will bump the package versions according to the bumps specified in the markdown files.
#
# - A PR is created containing these version bumps and with the changeset markdowns deleted
#
# - Once this PR is merged, this workflow kicks in again and this time checks
# whether there is anything that needs to be published
- name: Publish packages / create version bump PRs
uses: changesets/action@v1
with:
version: yarn changeset version
publish: yarn changeset publish

env:
# This is here because changesets/action will look for the .npmrc
# in HOME folder and if it doesn't fine one there it will create one
#
# Since we want to make sure it uses our .npmrc we'll just point it
# to our workspace root
HOME: ${{ github.workspace }}
GITHUB_TOKEN: ${{ secrets.LAYERZERO_BOT_GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/vape-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Vape Tests

on:
push:
# We have package publishing workflow running on main so this one is redundant
branches-ignore:
- "main"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "yarn"

# Install the dependencies without running the post-install scripts
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline --ignore-scripts
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# Run the post-install scripts
- name: Build Dependencies
run: yarn install --frozen-lockfile --offline

# Cache build artifacts from turbo
#
# This step will speed up workflow runs that don't touch the whole codebase
# (or the ones that don't touch the codebase at all)
- name: Cache turbo build setup
uses: actions/cache@v3
with:
path: node_modules/.cache/turbo
key: ${{ runner.os }}-turbo-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Lint
run: yarn lint

- name: Build
run: yarn build

- name: Test
run: yarn test
98 changes: 7 additions & 91 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,108 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm
# Turbo cache
.turbo

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Editor and OS files
.DS_Store
package-lock.json
.idea
.idea

# Build artifacts
dist
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.20.0
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
yarn.lock
*.log
.eslintignore
.prettierignore
.netrc
*ignore
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
printWidth: 145,
tabWidth: 4,
useTabs: false,
semi: false,
trailingComma: "es5",
}
Loading

0 comments on commit 753a22b

Please sign in to comment.