Skip to content

Commit 0a285c7

Browse files
committed
fix: clear tsconfig exclude
1 parent ef73e57 commit 0a285c7

File tree

7 files changed

+6154
-614
lines changed

7 files changed

+6154
-614
lines changed

.github/scripts/bump-edge.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { execSync } from 'node:child_process'
2+
import { inc } from 'semver'
3+
import { determineBumpType, loadWorkspace } from './utils'
4+
5+
async function main () {
6+
const workspace = await loadWorkspace(process.cwd())
7+
8+
const commit = execSync('git rev-parse --short HEAD').toString('utf-8').trim().slice(0, 8)
9+
const date = Math.round(Date.now() / (1000 * 60))
10+
11+
const bumpType = await determineBumpType()
12+
13+
if (!workspace.packages.length) {
14+
workspace.packages.push(workspace.workspacePkg)
15+
}
16+
17+
for (const pkg of workspace.packages.filter(p => !p.data.private)) {
18+
const newVersion = inc(pkg.data.version, bumpType || 'patch')
19+
workspace.setVersion(pkg.data.name, `${newVersion}-${date}.${commit}`, {
20+
updateDeps: true
21+
})
22+
const newname = (pkg.data.name + '-edge')
23+
workspace.rename(pkg.data.name, newname)
24+
}
25+
26+
await workspace.save()
27+
}
28+
29+
main().catch((err) => {
30+
console.error(err)
31+
process.exit(1)
32+
})

.github/scripts/release-edge.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
# Restore all git changes
6+
git restore -s@ -SW -- .
7+
8+
TAG=${1:-latest}
9+
10+
# Bump versions to edge
11+
pnpm jiti ./.github/scripts/bump-edge
12+
13+
# Update token
14+
if [[ ! -z ${NODE_AUTH_TOKEN} ]] ; then
15+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
16+
echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
17+
echo "always-auth=true" >> ~/.npmrc
18+
npm whoami
19+
fi
20+
21+
# Release packages
22+
echo "Publishing package..."
23+
pnpm publish --access public --no-git-checks --tag $TAG

.github/scripts/utils.ts

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { promises as fsp } from 'node:fs'
2+
import { resolve } from 'pathe'
3+
import { globby } from 'globby'
4+
import { execaSync } from 'execa'
5+
import { determineSemverChange, getGitDiff, loadChangelogConfig, parseCommits } from 'changelogen'
6+
7+
export interface Dep {
8+
name: string,
9+
range: string,
10+
type: string
11+
}
12+
13+
type ThenArg<T> = T extends PromiseLike<infer U> ? U : T
14+
export type Package = ThenArg<ReturnType<typeof loadPackage>>
15+
16+
export async function loadPackage (dir: string) {
17+
const pkgPath = resolve(dir, 'package.json')
18+
const data = JSON.parse(await fsp.readFile(pkgPath, 'utf-8').catch(() => '{}'))
19+
const save = () => fsp.writeFile(pkgPath, JSON.stringify(data, null, 2) + '\n')
20+
21+
const updateDeps = (reviver: (dep: Dep) => Dep | void) => {
22+
for (const type of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
23+
if (!data[type]) { continue }
24+
for (const e of Object.entries(data[type])) {
25+
const dep: Dep = { name: e[0], range: e[1] as string, type }
26+
delete data[type][dep.name]
27+
const updated = reviver(dep) || dep
28+
data[updated.type] = data[updated.type] || {}
29+
data[updated.type][updated.name] = updated.range
30+
}
31+
}
32+
}
33+
34+
return {
35+
dir,
36+
data,
37+
save,
38+
updateDeps
39+
}
40+
}
41+
42+
export async function loadWorkspace (dir: string) {
43+
const workspacePkg = await loadPackage(dir)
44+
const pkgDirs = (await globby(['packages/*'], { onlyDirectories: true })).sort()
45+
46+
const packages: Package[] = []
47+
48+
for (const pkgDir of pkgDirs) {
49+
const pkg = await loadPackage(pkgDir)
50+
if (!pkg.data.name) { continue }
51+
packages.push(pkg)
52+
}
53+
54+
const find = (name: string) => {
55+
const pkg = packages.find(pkg => pkg.data.name === name)
56+
if (!pkg) {
57+
throw new Error('Workspace package not found: ' + name)
58+
}
59+
return pkg
60+
}
61+
62+
const rename = (from: string, to: string) => {
63+
find(from).data._name = find(from).data.name
64+
find(from).data.name = to
65+
for (const pkg of packages) {
66+
pkg.updateDeps((dep) => {
67+
if (dep.name === from && !dep.range.startsWith('npm:')) {
68+
dep.range = 'npm:' + to + '@' + dep.range
69+
}
70+
})
71+
}
72+
}
73+
74+
const setVersion = (name: string, newVersion: string, opts: { updateDeps?: boolean } = {}) => {
75+
find(name).data.version = newVersion
76+
if (!opts.updateDeps) { return }
77+
78+
for (const pkg of packages) {
79+
pkg.updateDeps((dep) => {
80+
if (dep.name === name) {
81+
dep.range = newVersion
82+
}
83+
})
84+
}
85+
}
86+
87+
const save = () => Promise.all(packages.map(pkg => pkg.save()))
88+
89+
return {
90+
dir,
91+
workspacePkg,
92+
packages,
93+
save,
94+
find,
95+
rename,
96+
setVersion
97+
}
98+
}
99+
100+
export async function determineBumpType () {
101+
const config = await loadChangelogConfig(process.cwd())
102+
const commits = await getLatestCommits()
103+
104+
const bumpType = determineSemverChange(commits, config)
105+
106+
return bumpType === 'major' ? 'minor' : bumpType
107+
}
108+
109+
export async function getLatestCommits () {
110+
const config = await loadChangelogConfig(process.cwd())
111+
112+
let latestRef
113+
try {
114+
latestRef = execaSync('git', ['describe', '--tags', '--abbrev=0']).stdout
115+
} catch {
116+
latestRef = execaSync('git', ['rev-list', '--max-parents=0', 'HEAD']).stdout
117+
}
118+
119+
return parseCommits(await getGitDiff(latestRef), config)
120+
}

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,31 @@ jobs:
3131
- run: pnpm prepack
3232
- run: pnpm dev:generate
3333
- run: pnpm test
34+
35+
release-edge:
36+
if: |
37+
github.event_name == 'push' &&
38+
!contains(github.event.head_commit.message, '[skip-release]') &&
39+
!contains(github.event.head_commit.message, 'docs')
40+
needs:
41+
- test
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 20
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: actions/setup-node@v4
48+
with:
49+
node-version: '18'
50+
- uses: pnpm/[email protected]
51+
name: Install pnpm
52+
id: pnpm-install
53+
with:
54+
version: 8
55+
- name: Install dependencies
56+
run: pnpm install
57+
58+
- name: Release Edge
59+
run: bash ./.github/scripts/release-edge.sh
60+
env:
61+
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}

package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,24 @@
2525
"release": "pnpm test && release-it"
2626
},
2727
"dependencies": {
28-
"@nuxt/kit": "^3.3.1",
28+
"@nuxt/kit": "^3.8.0",
2929
"scule": "^1.0.0",
30-
"typescript": "^5.0.2",
31-
"vue-component-meta": "^1.2.0"
30+
"typescript": "^5.2.2",
31+
"vue-component-meta": "^1.8.22"
3232
},
3333
"devDependencies": {
34-
"@iconify/vue": "^4.1.0",
35-
"@nuxt/content": "^2.5.2",
34+
"@iconify/vue": "^4.1.1",
35+
"@nuxt/content": "^2.9.0",
3636
"@nuxt/module-builder": "latest",
37-
"@nuxt/test-utils": "^3.3.1",
37+
"@nuxt/test-utils": "^3.8.0",
3838
"@nuxtjs/eslint-config-typescript": "latest",
39+
"changelogen": "^0.5.5",
3940
"eslint": "latest",
40-
"nuxt": "^3.3.1",
41-
"release-it": "^15.9.1",
42-
"vitest": "^0.29.7",
43-
"vue": "^3.2.47"
41+
"jiti": "^1.21.0",
42+
"nuxt": "^3.8.0",
43+
"release-it": "^16.2.1",
44+
"vitest": "^0.34.6",
45+
"vue": "^3.3.7"
4446
},
4547
"build": {
4648
"entries": [

0 commit comments

Comments
 (0)