Skip to content

Commit

Permalink
chore: migrate to yakumo v1 and yarn v4
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Dec 12, 2023
1 parent dd1833f commit 0032539
Show file tree
Hide file tree
Showing 8 changed files with 962 additions and 57 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
- name: Install
run: yarn
run: yarn --no-immutable
- name: Lint
run: yarn lint

Expand All @@ -27,7 +27,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
- name: Install
run: yarn
run: yarn --no-immutable
- name: Build
run: yarn build

Expand All @@ -47,7 +47,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: yarn
run: yarn --no-immutable
- name: Unit Test
run: yarn test:json
- name: Report Coverage
Expand Down
19 changes: 15 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
lib
dist
temp
external
.cache

tsconfig.temp.json
/external

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

todo.md
yarn.lock
package-lock.json
pnpm-lock.yaml

todo.md
coverage/
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
package-lock.json
tsconfig.temp.json
tsconfig.tsbuildinfo
report.*.json

.eslintcache
.DS_Store
.idea
.vscode
.yarn
*.suo
*.ntvs*
*.njsproj
Expand Down
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"packages/*",
"plugins/*"
],
"packageManager": "yarn@1.22.19",
"packageManager": "yarn@4.0.2",
"license": "MIT",
"scripts": {
"client": "yakumo client",
"esbuild": "yakumo esbuild",
"build": "yakumo build",
"build": "tsc -b packages/client && yakumo build",
"bump": "yakumo version",
"dep": "yakumo upgrade",
"pub": "yakumo publish",
Expand Down Expand Up @@ -50,15 +50,12 @@
"rollup-plugin-node-polyfills": "^0.2.1",
"shx": "^0.3.4",
"typescript": "^5.3.2",
"yakumo": "^0.3.13",
"yakumo-esbuild": "^0.3.26",
"yakumo-esbuild-yaml": "^0.3.1",
"yakumo-mocha": "^0.3.1",
"yakumo-publish": "^0.3.10",
"yakumo-publish-sync": "^0.3.3",
"yakumo-tsc": "^0.3.12",
"yakumo-upgrade": "^0.3.6",
"yakumo-version": "^0.3.4",
"yakumo": "^1.0.0-alpha.3",
"yakumo-esbuild": "^1.0.0-alpha.0",
"yakumo-esbuild-yaml": "^1.0.0-alpha.0",
"yakumo-mocha": "^1.0.0-alpha.0",
"yakumo-publish-sync": "^1.0.0-alpha.0",
"yakumo-tsc": "^1.0.0-alpha.1",
"yml-register": "^1.1.0"
}
}
46 changes: 24 additions & 22 deletions packages/client/src/yakumo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRequire } from 'module'
import { UserConfig } from 'vite'
import { register } from 'yakumo'
import { Context } from 'yakumo'
import { buildExtension } from '.'
import ns from 'ns-require'

Expand All @@ -10,27 +10,29 @@ declare module 'yakumo' {
}
}

register('client', async (project) => {
for (const path in project.targets) {
const meta = project.targets[path]
const deps = {
...meta.dependencies,
...meta.devDependencies,
...meta.peerDependencies,
...meta.optionalDependencies,
}
let config: UserConfig = {}
if (meta.yakumo?.client) {
const require = createRequire(project.cwd + path + '/package.json')
const exports = ns.unwrapExports(require(meta.yakumo.client))
if (typeof exports === 'function') {
await exports()
export function apply(ctx: Context) {
ctx.register('client', async () => {
for (const path in ctx.yakumo.targets) {
const meta = ctx.yakumo.targets[path]
const deps = {
...meta.dependencies,
...meta.devDependencies,
...meta.peerDependencies,
...meta.optionalDependencies,
}
let config: UserConfig = {}
if (meta.yakumo?.client) {
const require = createRequire(ctx.yakumo.cwd + path + '/package.json')
const exports = ns.unwrapExports(require(meta.yakumo.client))
if (typeof exports === 'function') {
await exports()
continue
}
config = exports
} else if (!deps['@koishijs/client']) {
continue
}
config = exports
} else if (!deps['@koishijs/client']) {
continue
await buildExtension(ctx.yakumo.cwd + path, config)
}
await buildExtension(project.cwd + path, config)
}
})
})
}
1 change: 1 addition & 0 deletions packages/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"emitDeclarationOnly": false,
},
"include": [
"src",
Expand Down
32 changes: 15 additions & 17 deletions yakumo.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
require:
- esbuild-register
- yakumo-esbuild
- yakumo-esbuild-yaml
- yakumo-mocha
- yakumo-publish
- yakumo-publish-sync
- yakumo-tsc
- yakumo-upgrade
- yakumo-version
- '@koishijs/client/lib/yakumo'

pipeline:
build:
- tsc
- esbuild
- client
- name: yakumo
config:
pipeline:
build:
- tsc
- esbuild
- client
clean:
- tsc --clean
- name: yakumo-esbuild
- name: yakumo-esbuild-yaml
- name: yakumo-mocha
- name: yakumo-publish-sync
- name: yakumo-tsc
- name: '@koishijs/client/lib/yakumo'

0 comments on commit 0032539

Please sign in to comment.