Skip to content

Commit

Permalink
♻️ Refactor(enviroment): Change repo in monorepo and change CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
INeedJobToStartWork committed Nov 20, 2024
1 parent 84c2df8 commit 6e31bf9
Show file tree
Hide file tree
Showing 48 changed files with 18,287 additions and 9,726 deletions.
23 changes: 23 additions & 0 deletions .github/common-actions/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'install'
description: 'Sets up Node.js and runs install'

runs:
using: 'composite'
steps:
- name: 🚀 Setup pnpm
uses: pnpm/action-setup@v4
- name: 🟢 Setup node
uses: actions/[email protected]
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: 🤖 Setup Git User
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "INEEDJ"
- name: ↘️ Install dependencies
shell: bash
run: pnpm install --no-frozen-lockfile
33 changes: 11 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
name: CI

name: CI/CD
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]

branches: [main]
jobs:
Continuous-Integration:
Deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: \🟢 Setup node
uses: actions/[email protected]
with:
node-version: 20

- name: 🚀 Setup pnpm
uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Format Files
- uses: actions/checkout@v3
- name: 🟢 Setup
uses: ./.github/common-actions/install
- name: 📝 Lint
run: pnpm lint
- name: ♻️ Format
run: pnpm format
# - name: Linting Files
# run: pnpm lint:fix --force && pnpm lint --force
- name: Building Files
run: pnpm build
- name: Start Files
run: pnpm start
- name: 🏗️ Build Package
run: pnpm build:npm
43 changes: 21 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
---
name: Publish Package to npmjs
on:
release:
types:
- created
push:
branches:
- main

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

jobs:
release:
name: 📦 Publish to npm
name: Release
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
id-token: write
steps:
- name: 📚 Checkout
uses: actions/checkout@v4
- name: 🟢 Setup node
uses: actions/setup-node@v4
- name: Checkout Repo
uses: actions/checkout@v3

- name: 🟢 Setup
uses: ./.github/common-actions/install

- name: 🗨️ Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
node-version: ^20
registry-url: https://registry.npmjs.org
- name: 🚀 Setup pnpm
uses: pnpm/action-setup@v4
- name: ↘️ Install dependencies
run: pnpm install --no-frozen-lockfile
- name: 🏗️ Build Package
run: pnpm build:npm
- name: 📦 Publish to npm
working-directory: ./dist
run: npm publish --access public --provenance
publish: pnpm npm:publish --no-git-checks --tag latest
title: "🤖 ci(changesets): :package: version packages"
commit: "🤖 ci(changesets): version packages"
setupGitUser: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ yarn-error.log*

# local env files
.env*.local
.env
**/.env

# vercel
.vercel
Expand Down
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@

pnpm pre
Binary file modified .nvmrc
Binary file not shown.
120 changes: 42 additions & 78 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,44 @@
{
"name": "oh-my-error",
"version": "2.0.0-prerelease.3",
"description": "A simple error handler for nodejs",
"keywords": [
"error",
"handler",
"nodejs",
"typescript"
],
"homepage": "https://github.com/INeedJobToStartWork/MyError#readme",
"bugs": "https://github.com/INeedJobToStartWork/MyError/issues/new/choose",
"repository": {
"type": "git",
"url": "https://github.com/INeedJobToStartWork/MyError"
},
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": {
"import": "./index.d.ts",
"require": "./index.d.cts"
},
"import": "./index.js",
"require": "./index.cjs",
"*": "./*"
}
},
"scripts": {
"build": "pnpm tsup --config ./config/tsuprc/tsup.prod.ts",
"build:npm": "pnpm npm:prepack && pnpm tsup --config ./config/tsuprc/tsup.prod.ts && pnpm npm:postpack",
"dev": "pnpm tsup --config ./config/tsuprc/tsup.dev.ts",
"format": "pnpm prettier . --write && pnpm prettier . --check",
"preinstall": "husky install",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"npm:postpack": "clean-package restore",
"npm:prepack": "clean-package",
"pre": "npx lint-staged",
"pre:husky": "git add . && npx lint-staged",
"start": "node ./dist/index.cjs",
"test": "pnpm vitest"
},
"lint-staged": {
"*": [
"git add .",
"pnpm format",
"pnpm lint:fix",
"pnpm lint"
]
},
"devDependencies": {
"@changesets/cli": "^2.27.8",
"@esplugins/no-internal-exports": "^1.0.0",
"@ineedj/eslintrc": "^1.2.3",
"@ineedj/prettierrc": "^2.0.0",
"@ineedj/tsconfig": "^1.0.0",
"@types/eslint": "~9.6.1",
"@types/lint-staged": "~13.3.0",
"@types/node": "^20.16.10",
"clean-package": "^2.2.0",
"commitsmile": "^0.6.1",
"esbuild-plugin-copy": "^2.1.1",
"eslint": "8.57.0",
"eslint-config-hardcore": "^47.0.1",
"gen-esm-wrapper": "^1.1.3",
"globals": "^15.10.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"tsup": "^8.3.0",
"typescript": "5.3.2",
"vitest": "^2.1.1"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
}
"name": "oh-my-error-monorepo",
"version": "0.0.0",
"private": true,
"description": "",
"main": "index.js",
"scripts": {
"dev": "turbo dev",
"build": "turbo build",
"build:npm": "turbo build:npm",
"start": "turbo start",
"lint": "turbo lint",
"lint:fix": "turbo lint:fix",
"lint:test": "turbo lint:fix",
"format": "turbo format",
"bench": "turbo bench",
"clean": "turbo clean",
"npm:prepack": "turbo npm:prepack",
"npm:postpack": "turbo npm:postpack",
"npm:version": "changeset version",
"npm:publish": "changeset publish",
"preinstall": "husky init",
"pre": "turbo pre",
"pre:husky": "git add . && lint-staged",
"prepare": "husky",
"test": "turbo test"
},
"devDependencies": {
"commitsmile": "^0.6.1",
"turbo": "^2.3.0",
"lint-staged": "^15.2.10",
"husky": "^9.1.6",
"@changesets/cli": "^2.27.8"
},
"author": "INEEDJ <[email protected]>",
"license": "MIT",
"engines": {
"node": ">=20"
},
"lint-staged": {
"*": ""
},
"packageManager": "[email protected]"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions packages/oh-my-error/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 INeedJobToStartWork

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 6e31bf9

Please sign in to comment.