Skip to content

Commit

Permalink
feat: use of changeset + upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhulle committed Nov 25, 2023
1 parent 0bad04f commit 5eccdfa
Show file tree
Hide file tree
Showing 55 changed files with 2,638 additions and 3,312 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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)
19 changes: 19 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "stijnvanhulle/template"
}
],
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
},
"ignore": []
}
6 changes: 6 additions & 0 deletions .changeset/gold-boxes-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@stijnvanhulle/template-core": minor
"@stijnvanhulle/template-demo": minor
---

use of changeset + upgrade packages
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"sandboxes": [],
"node": "18",
"installCommand": "install:csb"
}
}
2 changes: 1 addition & 1 deletion .codesandbox/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"command": "corepack enable && pnpm install --frozen-lockfile"
}
]
}
}
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
}
}
}
51 changes: 51 additions & 0 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"lineWidth": 160,
"indentWidth": 2,
"newLineKind": "lf",
"useTabs": false,
"typescript": {
"associations": [
"**/*.{js,mjs,cjs,ts,tsx}"
],
"quoteStyle": "preferSingle",
"trailingCommas": "onlyMultiLine",
"objectPattern.trailingCommas": "onlyMultiLine",
"objectExpression.trailingCommas": "onlyMultiLine",
"arrayPattern.trailingCommas": "onlyMultiLine",
"parameters.trailingCommas": "onlyMultiLine",
"arguments.trailingCommas": "onlyMultiLine",
// [{},{},]
"arrayExpression.trailingCommas": "onlyMultiLine",
"typeParameters.trailingCommas": "onlyMultiLine",
"semiColons": "asi",
"binaryExpression.linePerExpression": true,
"jsx.quoteStyle": "preferDouble",
"preferSingleLine": false,
// https://github.com/lydell/eslint-plugin-simple-import-sort/tree/main?tab=readme-ov-file#how-do-i-use-this-with-dprint
"importDeclaration.sortNamedImports": "maintain",
"module.sortImportDeclarations": "maintain",
"module.sortExportDeclarations": "maintain"
},
"json": {
"trailingCommas": "never"
},
"markdown": {},
"excludes": [
"**/node_modules",
"**/*-lock.json",
"**/*-lock.yaml",
"**/.next",
"**/dist",
"**/coverage",
"**/public",
"**/__snapshots__",
"CHANGELOG.md",
"**/mocks/hellowWorld.js"
],
"plugins": [
// You may specify any urls or file paths here that you wish.
"https://plugins.dprint.dev/typescript-0.88.2.wasm",
"https://plugins.dprint.dev/json-0.18.0.wasm",
"https://plugins.dprint.dev/markdown-0.16.2.wasm"
]
}
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
root = true

[*]
indent_style = space
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = LF
tab_width = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ mocks/**
**/mocks/**
*.d.ts
**.d.ts
tsup.config.ts
**/tsup.config.ts
**/__snapshots__**/
66 changes: 47 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
name: ci

on:
workflow_dispatch:
inputs:
tag:
description: override release tag
required: false
push:
branches: ['main', 'alpha', 'beta', 'rc']
paths:
- 'packages/**'
branches:
- main
- 'releases/**'

workflow_dispatch:

jobs:
build:
name: Build and Test
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/[email protected]
with:
version: 8

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
Expand All @@ -35,15 +36,15 @@ jobs:

- name: Install bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: pnpm install --prefer-offline

- uses: dtinth/setup-github-actions-caching-for-turbo@v1
with:
# Set the prefix for the cache keys.
cache-prefix: kubb_
cache-prefix: stijnvanhulle_

- name: Build
run: bun run build --concurrency=1

Expand All @@ -58,22 +59,49 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Release
id: release
- name: Publish
uses: changesets/action@v1
id: publish
continue-on-error: true
if: ${{ success() && github.ref == 'refs/heads/main' && (github.event_name != 'pull_request' || github.event.action == 'closed' && github.event.pull_request.merged == true) }}
if: ${{ success() && github.event.inputs.tag == '' && github.ref == 'refs/heads/main' && (github.event_name != 'pull_request' || github.event.action == 'closed' && github.event.pull_request.merged == true) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: bun run release
with:
publish: bun run release

- name: Release canary
- name: Publish ${{ inputs.tag || 'canary' }}
continue-on-error: true
if: steps.release.outcome == 'failure'
# if: ${{ steps.publish.outcome == 'failure' || github.event.inputs.tag != '' }}
if: ${{ github.event.inputs.tag != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
bun run release:canary --concurrency=1
bun run release:canary --tag ${{ inputs.tag || 'canary' }}
- name: Send a discord notification
if: steps.publish.outputs.published == 'true'
uses: actions/github-script@v6
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
fetch(process.env.DISCORD_WEBHOOK_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
content: `New release available. [Read the changelog](https://github.com/kubb-project/kubb/releases)`
}),
})
.then((res) => {
console.log('Sent discord notification', res)
})
.catch((err) => {
console.error('Error sending discord notification', err)
})
41 changes: 15 additions & 26 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@ name: pr

on:
pull_request:
workflow_dispatch:
# inputs:
# os:
# description: Choose os
# required: true
# type: choice
# options:
# - ubuntu-latest
# - macos-latest
# - windows-latest

paths-ignore:
- "docs/**"
- "**/*.md"

jobs:
build:
name: Build and Test
Expand All @@ -24,7 +17,7 @@ jobs:
node-version: [18]
experimental: [false]
## comment out for support of node 19,20
# include:
# include:
# - os: ubuntu-latest
# node-version: 19
# experimental: true
Expand All @@ -34,17 +27,17 @@ jobs:

runs-on: ${{ matrix.os || 'ubuntu-latest' }}
continue-on-error: ${{ matrix.experimental || false }}

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: pnpm/[email protected]
with:
version: 8

- name: Setup Node.js(${{ matrix.node-version }}) environment
uses: actions/setup-node@v3
with:
Expand All @@ -54,21 +47,21 @@ jobs:

- name: Install bun
uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: pnpm install --prefer-offline

- uses: dtinth/setup-github-actions-caching-for-turbo@v1
with:
# Set the prefix for the cache keys.
cache-prefix: kubb_
cache-prefix: stijnvanhulle_

- name: Build
run: bun run build --concurrency=1

- name: Typecheck
run: bun run typecheck --concurrency=1

- name: Linting
env:
NODE_OPTIONS: "--max_old_space_size=4096"
Expand All @@ -80,13 +73,9 @@ jobs:

- name: Test with Bun
continue-on-error: true
run: bun run test:bun

- name: Test with Jest
continue-on-error: true
run: bun run test:jest
run: bun run test:bun --coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Loading

0 comments on commit 5eccdfa

Please sign in to comment.