Skip to content

Commit

Permalink
chore: refactor to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 3, 2024
1 parent 0edd83e commit 21a86a3
Show file tree
Hide file tree
Showing 32 changed files with 500 additions and 396 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
@@ -0,0 +1,7 @@
/external

dist
lib
tests

*.js
10 changes: 10 additions & 0 deletions .eslintrc.yml
@@ -0,0 +1,10 @@
root: true

env:
node: true

globals:
NodeJS: true

extends:
- '@cordisjs/eslint-config'
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

jobs:
build:
lint:
runs-on: ubuntu-latest

steps:
Expand All @@ -15,6 +15,19 @@ jobs:
uses: actions/setup-node@v4
- name: Install
run: yarn --no-immutable
- name: Lint
run: yarn lint

build:
runs-on: ubuntu-latest

steps:
- name: Check out
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
- name: Install
run: yarn --no-immutable
- name: Build
run: yarn build

Expand All @@ -37,3 +50,8 @@ jobs:
run: yarn --no-immutable
- name: Unit Test
run: yarn test:json
- name: Report Coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage/coverage-final.json
name: codecov
9 changes: 7 additions & 2 deletions .gitignore
@@ -1,6 +1,7 @@
lib
dist
temp

/external

.pnp.*
.yarn/*
Expand All @@ -10,14 +11,18 @@ temp
!.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

Expand Down
672 changes: 336 additions & 336 deletions .yarn/releases/yarn-4.0.2.cjs → .yarn/releases/yarn-4.1.0.cjs 100755 → 100644

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
59 changes: 20 additions & 39 deletions package.json
@@ -1,57 +1,38 @@
{
"name": "cordis",
"description": "AOP Framework for Modern JavaScript Applications",
"version": "3.7.1",
"sideEffects": false,
"name": "@root/cordis",
"private": true,
"type": "module",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.mjs",
"types": "./lib/index.d.ts"
},
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shigma/cordis.git"
},
"bugs": {
"url": "https://github.com/shigma/cordis/issues"
},
"homepage": "https://github.com/shigma/cordis",
"author": "Shigma <shigma10826@gmail.com>",
"license": "MIT",
"files": [
"lib",
"src"
"version": "1.0.0",
"workspaces": [
"external/*",
"packages/*"
],
"license": "MIT",
"scripts": {
"compile:cjs": "esbuild src/index.ts --outfile=lib/index.cjs --bundle --sourcemap --sources-content=false --platform=node --external:cosmokit --target=es2022",
"compile:esm": "esbuild src/index.ts --outfile=lib/index.mjs --bundle --sourcemap --sources-content=false --platform=neutral --external:cosmokit --target=es2022",
"build": "yarn compile:cjs && yarn compile:esm && yarn dtsc",
"test": "node --import tsx --test tests/*.spec.ts",
"build": "tsc -b",
"bump": "yarn yakumo --import tsx version",
"dep": "yarn yakumo --import tsx upgrade",
"pub": "yarn yakumo --import tsx publish",
"lint": "eslint --cache",
"test": "yarn yakumo --import tsx test -r esbuild-register -t 10000",
"test:text": "shx rm -rf coverage && c8 -r text yarn test",
"test:json": "shx rm -rf coverage && c8 -r json yarn test",
"test:html": "shx rm -rf coverage && c8 -r html yarn test"
},
"devDependencies": {
"@cordisjs/eslint-config": "^1.0.4",
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/node": "^20.10.2",
"c8": "^7.14.0",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"dtsc": "^3.0.1",
"esbuild": "^0.18.20",
"esbuild-register": "^3.5.0",
"eslint": "^8.55.0",
"shx": "^0.3.4",
"tsx": "^4.7.0",
"typescript": "^5.3.2"
},
"dependencies": {
"cosmokit": "^1.5.2"
"typescript": "^5.3.2",
"yakumo": "^1.0.0-beta.5",
"yakumo-esbuild": "^1.0.0-beta.2",
"yakumo-tsc": "^1.0.0-beta.2"
}
}
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions packages/core/package.json
@@ -0,0 +1,57 @@
{
"name": "cordis",
"description": "AOP Framework for Modern JavaScript Applications",
"version": "3.7.1",
"sideEffects": false,
"type": "module",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.mjs",
"types": "./lib/index.d.ts"
},
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shigma/cordis.git"
},
"bugs": {
"url": "https://github.com/shigma/cordis/issues"
},
"homepage": "https://github.com/shigma/cordis",
"author": "Shigma <shigma10826@gmail.com>",
"license": "MIT",
"files": [
"lib",
"src"
],
"scripts": {
"compile:cjs": "esbuild src/index.ts --outfile=lib/index.cjs --bundle --sourcemap --sources-content=false --platform=node --external:cosmokit --target=es2022",
"compile:esm": "esbuild src/index.ts --outfile=lib/index.mjs --bundle --sourcemap --sources-content=false --platform=neutral --external:cosmokit --target=es2022",
"build": "yarn compile:cjs && yarn compile:esm && yarn dtsc",
"test": "node --import tsx --test tests/*.spec.ts",
"test:text": "shx rm -rf coverage && c8 -r text yarn test",
"test:json": "shx rm -rf coverage && c8 -r json yarn test",
"test:html": "shx rm -rf coverage && c8 -r html yarn test"
},
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/node": "^20.10.2",
"c8": "^7.14.0",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"dtsc": "^3.0.1",
"esbuild": "^0.18.20",
"shx": "^0.3.4",
"tsx": "^4.7.0",
"typescript": "^5.3.2"
},
"dependencies": {
"cosmokit": "^1.5.2"
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions src/events.ts → packages/core/src/events.ts
Expand Up @@ -192,6 +192,7 @@ export interface Events<C extends Context = Context> {
'internal/fork'(fork: ForkScope<Context.Parameterized<C>>): void
'internal/runtime'(runtime: MainScope<Context.Parameterized<C>>): void
'internal/status'(scope: EffectScope<Context.Parameterized<C>>, oldValue: ScopeStatus): void
'internal/info'(this: C, format: any, ...param: any[]): void
'internal/error'(this: C, format: any, ...param: any[]): void
'internal/warning'(this: C, format: any, ...param: any[]): void
'internal/before-service'(name: string, value: any): void
Expand Down
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.
13 changes: 13 additions & 0 deletions packages/core/tsconfig.json
@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base",
"compilerOptions": {
"rootDir": "src",
"outFile": "lib/index.d.ts",
"noImplicitAny": false,
"noImplicitThis": false,
"strictFunctionTypes": false,
},
"include": [
"src",
],
}
13 changes: 13 additions & 0 deletions tsconfig.base.json
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es2022",
"module": "nodenext",
"sourceMap": true,
"declaration": true,
"composite": true,
"incremental": true,
"skipLibCheck": true,
"esModuleInterop": true,
"strict": true,
},
}
25 changes: 8 additions & 17 deletions tsconfig.json
@@ -1,21 +1,12 @@
{
"extends": "./tsconfig.base",
"compilerOptions": {
"rootDir": "src",
"outFile": "lib/index.d.ts",
"target": "es2022",
"module": "commonjs",
"sourceMap": true,
"declaration": true,
"emitDeclarationOnly": true,
"skipLibCheck": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strict": true,
"noImplicitAny": false,
"noImplicitThis": false,
"strictFunctionTypes": false,
"baseUrl": ".",
"paths": {
"cordis": ["packages/core/src"],
"@cordisjs/plugin-*": ["packages/*/src"],
"@cordisjs/*": ["packages/*/src"],
},
},
"include": [
"src",
],
"files": [],
}
8 changes: 8 additions & 0 deletions yakumo.yml
@@ -0,0 +1,8 @@
- name: yakumo
config:
pipeline:
build:
- tsc
- esbuild
- name: yakumo-tsc
- name: yakumo-esbuild

0 comments on commit 21a86a3

Please sign in to comment.