chore(library): implement turporepo (#206)
This commit is contained in:
parent
89d1fde3d2
commit
7d05ecc580
16 changed files with 1302 additions and 26678 deletions
4
.eslintrc.cjs
Normal file
4
.eslintrc.cjs
Normal file
|
@ -0,0 +1,4 @@
|
|||
/** @type {import("@types/eslint").Linter.Config} */
|
||||
module.exports = {
|
||||
extends: ["turbo"],
|
||||
};
|
3
.github/workflows/build-and-test.yml
vendored
3
.github/workflows/build-and-test.yml
vendored
|
@ -26,6 +26,7 @@ jobs:
|
|||
node-version: ${{ matrix.node-version }}
|
||||
cache: "npm"
|
||||
- run: npm ci
|
||||
- run: npm run clean
|
||||
- run: npm run check
|
||||
- run: npm run test
|
||||
- run: npm run test-ci
|
||||
- run: npm run lint
|
||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -11,3 +11,6 @@ pnpm-debug.log*
|
|||
*~
|
||||
*swp
|
||||
*swo
|
||||
|
||||
.turbo/
|
||||
|
||||
|
|
54
MONOREPO.md
Normal file
54
MONOREPO.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
# Monorepo Guide
|
||||
This project is a monorepo configured with Turborepo + NPM workspace. Here are some common development scripts.
|
||||
|
||||
## Scripts
|
||||
To clean and remove files, such as `node_modules`, `dist`, `.turbo` in every workspace.
|
||||
```bash
|
||||
npm run clean
|
||||
```
|
||||
|
||||
Filtering workspaces. For more detail [https://turbo.build/repo/docs/core-concepts/monorepos/filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering).
|
||||
```bash
|
||||
# Append the `npm run` command with `-- --filter=<workspace>`
|
||||
|
||||
# with workspace name
|
||||
npm run test -- --filter=validator
|
||||
|
||||
# Or equivalent
|
||||
npm run test -- --filter=packages/validator
|
||||
```
|
||||
|
||||
To run tests.
|
||||
```bash
|
||||
# Run all tests in every workspace.
|
||||
npm run test
|
||||
|
||||
# Run test in selected workspace.
|
||||
npm run test -- --filter=<workspace>
|
||||
|
||||
npm run test -- --filter=form
|
||||
|
||||
# Run test in watch mode. Can be filtered too.
|
||||
npm run test:watch -- --filter=<workspace>
|
||||
```
|
||||
|
||||
To lint workspaces.
|
||||
```bash
|
||||
# Lint all workspaces. Can be filtered.
|
||||
npm run lint
|
||||
|
||||
# Lint and fix.
|
||||
npm run lint:fix
|
||||
```
|
||||
|
||||
To build workspaces.
|
||||
```bash
|
||||
# Build all workspaces. Can be filtered.
|
||||
npm run build
|
||||
```
|
||||
|
||||
To typecheck workspaces.
|
||||
```bash
|
||||
# Typecheck all workspaces. Can be filtered.
|
||||
npm run check
|
||||
```
|
|
@ -11,11 +11,12 @@
|
|||
"check": "astro check && tsc --noEmit && astro build",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
"astro": "astro",
|
||||
"clean": "rimraf node_modules .turbo dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astro-reactive/form": "file:packages/form",
|
||||
"@astro-reactive/validator": "file:packages/validator",
|
||||
"@astro-reactive/form": "*",
|
||||
"@astro-reactive/validator": "*",
|
||||
"astro": "^1.6.5"
|
||||
},
|
||||
"main": "index.js",
|
||||
|
@ -27,5 +28,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/ayoayco/astro-reactive-library/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ayoayco/astro-reactive-library#readme"
|
||||
"homepage": "https://github.com/ayoayco/astro-reactive-library#readme",
|
||||
"devDependencies": {
|
||||
"rimraf": "^3.0.2"
|
||||
}
|
||||
}
|
||||
|
|
10855
apps/docs/package-lock.json
generated
10855
apps/docs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,8 @@
|
|||
"check": "astro check && tsc --noEmit && astro build",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
"astro": "astro",
|
||||
"clean": "rimraf node_modules .turbo dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@algolia/client-search": "^4.13.1",
|
||||
|
@ -31,12 +32,15 @@
|
|||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Rishav-12/astro-reactive-library.git"
|
||||
"url": "git+https://github.com/ayoayco/astro-reactive-library.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Rishav-12/astro-reactive-library/issues"
|
||||
"url": "https://github.com/ayoayco/astro-reactive-library/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Rishav-12/astro-reactive-library#readme"
|
||||
"homepage": "https://github.com/ayoayco/astro-reactive-library#readme",
|
||||
"devDependencies": {
|
||||
"rimraf": "^3.0.2"
|
||||
}
|
||||
}
|
||||
|
|
14593
apps/landing-page/package-lock.json
generated
14593
apps/landing-page/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -11,7 +11,7 @@
|
|||
"preview": "astro preview",
|
||||
"astro": "astro",
|
||||
"format": "prettier --write .",
|
||||
"clean": "rimraf dist node_modules"
|
||||
"clean": "rimraf dist node_modules dist .turbo"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/tailwind": "^2.0.2",
|
||||
|
|
2341
package-lock.json
generated
2341
package-lock.json
generated
File diff suppressed because it is too large
Load diff
37
package.json
37
package.json
|
@ -14,31 +14,34 @@
|
|||
".": "./index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run dev -w apps/demo",
|
||||
"demo": "npm run dev -w apps/demo",
|
||||
"docs": "npm run dev -w apps/docs",
|
||||
"landing-page": "npm run dev -w apps/landing-page",
|
||||
"test": "npm run test --workspaces --if-present",
|
||||
"lint": "npm run lint --workspaces --if-present",
|
||||
"lint:fix": "npm run lint:fix --workspaces --if-present",
|
||||
"build": "npm run build --workspaces --if-present",
|
||||
"check": "npm run check --workspaces --if-present",
|
||||
"test:watch": "npm run test:watch --workspaces --if-present",
|
||||
"start": "turbo run dev --filter=demo",
|
||||
"demo": "turbo run dev --filter=demo",
|
||||
"docs": "turbo run dev --filter=docs",
|
||||
"landing-page": "turbo run dev --filter=landing-page",
|
||||
"test": "turbo run test",
|
||||
"lint": "turbo run lint",
|
||||
"lint:fix": "turbo run lint:fix",
|
||||
"build": "turbo run build",
|
||||
"check": "turbo run check",
|
||||
"clean": "turbo clean",
|
||||
"test:watch": "turbo run test:watch",
|
||||
"patch": "npm version patch -w",
|
||||
"minor": "npm version minor -w",
|
||||
"major": "npm version major -w",
|
||||
"publish": "npm publish --access public -w"
|
||||
"publish": "turbo run lint build test && npm publish --access public -w",
|
||||
"test-ci": "npm run test --workspaces --if-present"
|
||||
},
|
||||
"license": "ISC",
|
||||
"workspaces": [
|
||||
"packages/form",
|
||||
"packages/validator",
|
||||
"apps/demo",
|
||||
"apps/docs",
|
||||
"apps/landing-page",
|
||||
"packages/common"
|
||||
"packages/*",
|
||||
"apps/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"prettier-plugin-astro": "^0.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-config-turbo": "^0.0.4",
|
||||
"rimraf": "^3.0.2",
|
||||
"turbo": "^1.6.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/** @type {import("@types/eslint").Linter.Config} */
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["@typescript-eslint", "prettier"],
|
||||
extends: [
|
||||
"../../../.eslintrc.cjs",
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:prettier/recommended",
|
||||
|
|
|
@ -3,12 +3,15 @@
|
|||
"version": "0.1.2",
|
||||
"description": "Common code for Astro Reactive Packages",
|
||||
"main": "index.js",
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
"exports": {
|
||||
".": "./index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"check": "tsc --noEmit"
|
||||
"check": "tsc --noEmit",
|
||||
"clean": "rimraf node_modules .turbo dist"
|
||||
},
|
||||
"files": [
|
||||
"types/",
|
||||
|
@ -23,5 +26,8 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/ayoayco/astro-reactive-library/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ayoayco/astro-reactive-library#readme"
|
||||
"homepage": "https://github.com/ayoayco/astro-reactive-library#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
"format": "prettier -w .",
|
||||
"lint": "eslint . --ext .ts,.js",
|
||||
"lint:fix": "eslint --fix . --ext .ts,.js",
|
||||
"check": "astro check && tsc --noEmit"
|
||||
"check": "astro check && tsc --noEmit",
|
||||
"clean": "rimraf node_modules .turbo dist"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/eslint": "^8.4.6",
|
||||
|
@ -39,12 +40,12 @@
|
|||
"@typescript-eslint/parser": "^5.37.0",
|
||||
"astro": "^1.5.0",
|
||||
"astro-component-tester": "^0.6.0",
|
||||
"common": "file:packages/common",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-astro": "^0.7.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^4.8.3",
|
||||
"vitest": "^0.25.2"
|
||||
},
|
||||
|
@ -53,8 +54,11 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@astro-reactive/common": "^0.1.2",
|
||||
"@astro-reactive/validator": "^0.2.3",
|
||||
"@astro-reactive/common": "*",
|
||||
"@astro-reactive/validator": "*",
|
||||
"short-unique-id": "^4.4.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
"format": "prettier -w .",
|
||||
"lint": "eslint . --ext .ts,.js",
|
||||
"lint:fix": "eslint --fix . --ext .ts,.js",
|
||||
"check": "astro check && tsc --noEmit"
|
||||
"check": "astro check && tsc --noEmit",
|
||||
"clean": "rimraf node_modules .turbo dist"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/eslint": "^8.4.6",
|
||||
|
@ -37,12 +38,12 @@
|
|||
"@typescript-eslint/parser": "^5.37.0",
|
||||
"astro": "^1.5.0",
|
||||
"astro-component-tester": "^0.6.0",
|
||||
"common": "file:packages/common",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-astro": "^0.7.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^4.8.3",
|
||||
"vitest": "^0.25.2"
|
||||
},
|
||||
|
@ -50,7 +51,7 @@
|
|||
"astro": "^1.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astro-reactive/common": "^0.1.2"
|
||||
"@astro-reactive/common": "*"
|
||||
},
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
|
@ -59,5 +60,8 @@
|
|||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ayoayco/astro-reactive-library/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
|
|
24
turbo.json
Normal file
24
turbo.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"$schema": "https://turborepo.org/schema.json",
|
||||
"pipeline": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": ["dist/**"]
|
||||
},
|
||||
"lint": {
|
||||
"outputs": []
|
||||
},
|
||||
"lint:fix": {
|
||||
"outputs": []
|
||||
},
|
||||
"test:watch": {
|
||||
"cache": false
|
||||
},
|
||||
"dev": {
|
||||
"cache": false
|
||||
},
|
||||
"test": {},
|
||||
"check": {},
|
||||
"clean": {}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue