Skip to content

Commit

Permalink
refactor: version 3 (#107)
Browse files Browse the repository at this point in the history
* wip: add configs first

* refactor: monorepo, changesets, vitest, esm only jsdoc, dts-buddy

* fix: remove absolute paths from snapshots

* fix: normalize on windows

* fix: more windows paths woes

* revert: posixify paths didn't work as expected

* fix: expect posix for findNative

* fix: normalize whole paths for windows snapshots

* chore: add changeset for removed 4.0 optional peer dep
  • Loading branch information
dominikg authored Aug 18, 2023
1 parent 968dd41 commit 653233f
Show file tree
Hide file tree
Showing 317 changed files with 4,602 additions and 4,156 deletions.
9 changes: 9 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@svitejs/changesets-changelog-github-compact", { "repo": "dominikg/tsconfck" }],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "version-3",
"bumpVersionsWithWorkspaceProtocolOnly": true
}
5 changes: 5 additions & 0 deletions .changeset/gold-singers-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tsconfck': major
---

breaking(exports): remove package.json export
5 changes: 5 additions & 0 deletions .changeset/good-taxis-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tsconfck': minor
---

feat(exports): export unbundled esm js
5 changes: 5 additions & 0 deletions .changeset/lazy-geckos-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tsconfck': minor
---

feat(exports): export types as module declaration, including a .d.ts.map
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"tsconfck": "3.0.0-next.0"
},
"changesets": []
}
5 changes: 5 additions & 0 deletions .changeset/sweet-onions-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tsconfck': major
---

breaking(node): minimum supported node version is node18
5 changes: 5 additions & 0 deletions .changeset/tasty-icons-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tsconfck': major
---

breaking(peerDependencies): minimum supported typescript version for parseNative and findNative is 5.0
5 changes: 5 additions & 0 deletions .changeset/tricky-frogs-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tsconfck': major
---

breaking(exports): remove cjs export
52 changes: 52 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"ignorePatterns": [
"**/tests/fixtures/parse/invalid/**/*",
"**/tests/fixtures/find-all/recursive-symlink/**/*",
"**/tests/snapshots/**/*.js"
],
"root": true,
"extends": ["eslint:recommended", "plugin:n/recommended", "prettier"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2022
},
"plugins": ["n", "markdown"],
"rules": {
"no-debugger": ["error"]
},
"overrides": [
{
"files": ["**/*.md"],
"processor": "markdown/markdown",
"rules": {
"no-undef": "off",
"no-unused-vars": "off",
"no-console": "off",
"padded-blocks": "off",
"n/no-missing-import": "off",
"n/no-extraneous-require": "off",
"import/no-unresolved": "off"
}
},
{
"files": ["**/*.md/*.**"],
"rules": {
"no-undef": "off",
"no-unused-vars": "off",
"no-console": "off",
"padded-blocks": "off",
"n/no-missing-import": "off",
"import/no-unresolved": "off"
}
},
{
"files": ["**/tests/fixtures/**/*"],
"rules": {
"no-unused-vars": "off"
}
}
]
}
63 changes: 0 additions & 63 deletions .eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
18 changes: 9 additions & 9 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base","group:allNonMajor",":semanticCommits"],
"schedule": ["before 5am on the 3rd day of the month"],
"labels": ["dependencies"],
"rangeStrategy": "bump",
"packageRules": [
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: ['config:base', 'group:allNonMajor', ':semanticCommits'],
schedule: ['before 5am on the 3rd day of the month'],
labels: ['dependencies'],
rangeStrategy: 'bump',
packageRules: [
{
"matchDepTypes": ["peerDependencies","engines"],
"enabled": false
matchDepTypes: ['peerDependencies', 'engines'],
enabled: false
}
],
"ignoreDeps": [
ignoreDeps: [
// add deps that need manual attention here
]
}
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release

on:
push:
branches:
- main
- version-3

permissions: {}

jobs:
release:
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
# prevents this action from running on forks
if: github.repository == 'dominikg/tsconfck'
name: Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
# pseudo-matrix for convenience, NEVER use more than a single combination
node: [18]
os: [ubuntu-latest]
steps:
- name: checkout
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: install pnpm
shell: bash
run: |
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
echo installing pnpm version $PNPM_VER
npm i -g pnpm@$PNPM_VER
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'
- name: install
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: publint
run: pnpm check:publint
- name: generated files are up to date
run: pnpm generate && [ "`git status --porcelain=v1`" == "" ]
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: remove generated .npmrc
if: ${{ always() }}
run: rm -f "$HOME/.npmrc"
57 changes: 18 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
# build and test on linux, windows, mac with node 14, 16, 18
name: CI

on:
push:
branches:
- main
- version-3
pull_request:
branches:
- main

- version-3
jobs:
# "checks" job runs on linux + node16 only and checks that install, build, lint, format work
# it also primes the pnpm store cache for linux, important for downstream tests
checks:
timeout-minutes: 5
runs-on: ${{ matrix.os }}
strategy:
matrix:
# pseudo-matrix for convenience, NEVER use more than a single combination
node: [16]
node: [18]
os: [ubuntu-latest]
outputs:
build_successful: ${{ steps.build.outcome == 'success' }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -41,56 +37,44 @@ jobs:
- name: install
run: |
pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
node node_modules/esbuild/install.js
- name: build
id: build
run: pnpm build
- name: lint
if: (${{ success() }} || ${{ failure() }})
run: pnpm lint
- name: format
if: (${{ success() }} || ${{ failure() }})
run: pnpm format

run: pnpm check:format
- name: lint
if: ${{ !cancelled() }}
run: pnpm check:lint
- name: types
if: ${{ !cancelled() }}
run: pnpm check:types
- name: publint
if: ${{ !cancelled() }}
run: pnpm check:publint
- name: generated files are up to date
if: ${{ !cancelled() }}
run: pnpm generate && [ "`git status --porcelain=v1`" == "" ]

# this is the test matrix, it runs with node16 on linux,windows,macos + node14,18 on linux
# it is skipped if the build step of the checks job wasn't successful (still runs if lint or audit fail)
# this is the test matrix, it runs with node18 and 20
test:
needs: checks
if: (${{ success() }} || ${{ failure() }}) && (${{ needs.checks.output.build_successful }})
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: [16]
node: [18]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- node: 14
os: ubuntu-latest
- node: 18
os: ubuntu-latest
- node: 20
os: ubuntu-latest
steps:
- run: git config --global core.autocrlf false # prevent crlf on windows
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: install pnpm
if: matrix.node != 14
shell: bash
run: |
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
echo installing pnpm version $PNPM_VER
npm i -g pnpm@$PNPM_VER
- name: install legacy pnpm for node14
if: matrix.node == 14
run: |
npm i -g pnpm@^7.32.0
tmppkg="$(jq '.engines.pnpm = "^7.32.0"' package.json)" && echo -E "${tmppkg}" > package.json && tmppkg=""
sed -i 's/engine-strict=true/engine-strict=false/' .npmrc
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
Expand All @@ -99,10 +83,5 @@ jobs:
- name: install
run: |
pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
node node_modules/esbuild/install.js
- name: build
run: pnpm build:ci
- name: run tests
run: pnpm test


7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
*.cpuprofile
temp
*.tmp

# build and dist
build
dist
.eslintcache

# test coverage
/coverage
coverage
*.lcov

# env and local
Expand Down
Loading

0 comments on commit 653233f

Please sign in to comment.