Skip to content

Commit

Permalink
⚙️ chore: Migrate to monorepository (#211) (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrosenbauer authored Dec 12, 2024
1 parent 1c9d3d7 commit 7596ec2
Show file tree
Hide file tree
Showing 29 changed files with 591 additions and 701 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-release-notes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- uses: toolmantim/release-drafter@v6
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: '💚 Use Node.js'
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
- name: '📦 Install Packages'
run: yarn install
- name: '🕵️ Code Linting & Formatting'
Expand Down
58 changes: 31 additions & 27 deletions .github/workflows/pkg-npm-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
name: 'pkg: Publish to npm'
run-name: 'Publish to npm Registry (${{ inputs.version }})'
name: 'pkgs: Publish to internal npm registry'
run-name: 'Publish to GitHub npm Registry (${{ inputs.version }})'

on:
workflow_dispatch:
inputs:
version:
description: 'Semantic Version'
required: true
default: 'prerelease'
type: choice
options:
- patch
- minor
- major
- prerelease

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
name: 'Publish to GitHub npm Registry'
runs-on: ubuntu-latest-4-cores
timeout-minutes: 15
steps:
- name: '🛒 Checkout Code'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BOT_TOKEN }}

- name: '🟢 Use Node.js'
- name: "𝌤 Enable Corepack"
run: corepack enable

- name: '🟢 Setup Node.js'
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
registry-url: 'https://npm.pkg.github.com'
token: ${{ secrets.GH_BOT_TOKEN }}
scope: '@joggrdocs'
cache: 'yarn'

- name: '📦 Install packages'
run: yarn install

- name: '🏗️ Build'
run: yarn build

- name: '🔼 Increment Version'
run: yarn version ${{ inputs.version }}
# We have to run with npm because yarn's update is based on "stableVersion" which is not what we want
run: yarn workspaces foreach --all exec npm version --no-git-tag-version --no-workspaces-update ${{ inputs.version }}

- name: '#️⃣ Get Version'
uses: actions/github-script@v7
Expand All @@ -48,31 +54,29 @@ jobs:
script: |
const fs = require('fs');
const pj = JSON.parse(fs.readFileSync('${{ github.workspace }}/package.json'));
return pj.version;
return pj.version;
- name: '🏗️ Build'
run: yarn turbo run build --filter="./packages/*"

- name: '🧶 Setup .yarnrc.yml'
run: 'yarn config set npmScopes.joggrdocs.npmAuthToken ${{ secrets.GH_BOT_TOKEN }}'

- name: '🚢 Publish'
run: yarn workspaces foreach -A --include "packages/*" npm publish --tolerate-republish --access restricted

- name: '💾 Commit Incremented Version'
run: |
git config --local user.email "${{ secrets.GH_BOT_EMAIL }}"
git config --local user.name "${{ secrets.GH_BOT_NAME }}"
git add package.json
git commit -am "[🤖 release]: ${{ steps.version.outputs.result }} (${{ inputs.version }})"
git add ./packages/*/package.json ./package.json
git commit -m "[🤖 npm-publish]: ${{ steps.version.outputs.result }} (${{ inputs.version }}) [skip-ci]"
git push origin HEAD --force
- name: '📝 Generate Release Notes (user-input)'
uses: toolmantim/release-drafter@v6
- name: '📝 Publish Release Notes'
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: v${{ steps.version.outputs.result }}
publish: true

- name: Setup .yarnrc.yml
run: |
yarn config set npmScopes.joggr.npmRegistryServer "https://registry.npmjs.org"
yarn config set npmScopes.joggr.npmAlwaysAuth true
yarn config set npmScopes.joggr.npmAuthToken $NPM_AUTH_TOKEN
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}

- name: '🚢 Publish'
run: yarn npm publish --access public
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Turbo
.turbo
1 change: 1 addition & 0 deletions examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import exampleTable from './lib/table';
| `npm run generate:examples`
|
*/

(() => {
console.log('Building examples...');

Expand Down
35 changes: 6 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
{
"name": "@joggr/tempo",
"name": "tempo-root",
"version": "0.11.0",
"description": "Library used to programmatically build markdown documents, with a heavy tilt toward GitHub Flavored Markdown (GFM).",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
"workspaces": [
"packages/*"
],
"scripts": {
"test": "vitest --coverage",
"build": "rslib build",
"dev": "rslib build --watch",
"generate:examples": "tsx examples/index.ts",
"analyze": "biome check",
"analyze:types": "turbo analyze:types",
"analyze:ci": "biome ci --diagnostic-level=error",
"analyze:types": "tsc --noEmit",
"test": "turbo test",
"fix": "biome check --fix"
},
"repository": {
Expand All @@ -32,19 +19,9 @@
},
"author": "Joggr Team <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/joggrdocs/tempo/issues"
},
"homepage": "https://github.com/joggrdocs/tempo#readme",
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@rslib/core": "^0.1.3",
"@types/node": "^22.10.2",
"@vitest/coverage-istanbul": "^2.1.8",
"tsx": "^4.19.2",
"type-fest": "^4.30.0",
"typescript": "^5.7.2",
"vitest": "^2.1.8"
"turbo": "^2.3.3"
},
"packageManager": "[email protected]"
}
47 changes: 47 additions & 0 deletions packages/tempo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@joggr/tempo",
"version": "0.11.0",
"description": "Library used to programmatically build markdown documents, with a heavy tilt toward GitHub Flavored Markdown (GFM).",
"repository": {
"type": "git",
"url": "git+https://github.com/joggrdocs/tempo.git",
"directory": "packages/tempo"
},
"author": "Joggr Team <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/joggrdocs/tempo/issues"
},
"homepage": "https://github.com/joggrdocs/tempo/packages/tempo#readme",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"dev": "rslib build --watch",
"build": "rslib build",
"test": "vitest --coverage",
"generate:examples": "tsx examples/index.ts",
"analyze:types": "tsc --noEmit"
},
"devDependencies": {
"@rslib/core": "^0.1.3",
"@types/node": "^22.10.2",
"@vitest/coverage-istanbul": "^2.1.8",
"consola": "^3.2.3",
"tsx": "^4.19.2",
"type-fest": "^4.30.0",
"typescript": "^5.7.2",
"vitest": "^2.1.8"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://turbo.build/schema.json",
"remoteCache": {
"enabled": true
},
"ui": "tui",
"tasks": {
"build": {
"outputs": ["dist"],
"dependsOn": ["^build"]
},
"test": {
"outputs": [],
"dependsOn": ["^build"]
},
"analyze:types": {
"outputs": [],
"dependsOn": ["^build"]
},
"//#analyze": {
"dependsOn": [],
"outputs": []
},
"//#analyze:ci": {
"dependsOn": [],
"outputs": []
},
"//#fix": {
"dependsOn": [],
"outputs": []
}
}
}
Loading

0 comments on commit 7596ec2

Please sign in to comment.