Skip to content

Commit

Permalink
chore(all): tsconfig sharing via internal package
Browse files Browse the repository at this point in the history
  • Loading branch information
serjilyashenko committed May 14, 2024
1 parent 7a2a104 commit 95f35f0
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 47 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ simple-pie-project
└─ packages
├─ pie-math
├─ simple-pie
└─ react-simple-pie
├─ react-simple-pie
└─ tsconfig
```

## Installing packages
Expand Down
3 changes: 2 additions & 1 deletion apps/homepage-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint": "tsc",
"lint-legacy": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions apps/homepage-legacy/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
Expand Down
16 changes: 16 additions & 0 deletions config/tsconfig.package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"preserveWatchOutput": true,
"skipLibCheck": true,
"noEmit": true,
"strict": true
},
"include": ["src"],
"exclude": ["node_modules"]
}
8 changes: 7 additions & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ Some common ones are:

## Linting

🚧TBD
TypeScript can be used in one of two ways - as a linter, or as a build tool.
`noEmit` prevents emitting files. So, TS is used to check source code's types.

`config` folder contains reusable `tsconfig.package.json`.\
`apps/hompage-legacy` has its own tsconfig

🚧 TBD
9 changes: 5 additions & 4 deletions docs/monorepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The monorepo is split into `apps` and `packages`.

```tree
simple-pie-project
├─ config
├─ docs
├─ apps
│ └─ homepage-legacy
Expand All @@ -32,10 +33,10 @@ They don't include any calculations and they are just "transport" packages (read

```mermaid
flowchart TD
PM[packages/pie-math] --> SP[packages/simple-pie]
PM[packages/pie-math] --> RSP[packages/react-simple-pie]
SP --> HL[apps/homepage-legacy]
PM[packages/pie-math] --> SP
PM --> RSP[packages/react-simple-pie]
SP[packages/simple-pie] --> HL[apps/homepage-legacy]
RSP --> HL
SP -.-> NPM[npm]
SP -.-> NPM([📦 npm])
RSP -.-> NPM
```
2 changes: 1 addition & 1 deletion docs/package-publishing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package publishing

The publishing is applied to the next packages:
The publishing is applied to external packages. The next ones:

- `packages/simple-pie`
- `packages/react-simple-pie`
Expand Down
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dev": "turbo dev",
"build": "turbo build",
"build:packages": "turbo build --filter='./packages/*'",
"lint": "turbo lint",
"changeset": "npx changeset",
"release": "changeset publish",
"prettier": "prettier --write .",
Expand Down
2 changes: 1 addition & 1 deletion packages/pie-math/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "./src/index.ts",
"private": true,
"scripts": {
"type-check": "tsc"
"lint": "tsc"
},
"author": "Serge Iyashenko <[email protected]>",
"repository": "https://github.com/serjilyashenko/simple-pie-project",
Expand Down
12 changes: 1 addition & 11 deletions packages/pie-math/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"preserveWatchOutput": true,
"skipLibCheck": true,
"noEmit": true,
"strict": true
},
"extends": "../../config/tsconfig.package.json",
"include": ["src"],
"exclude": ["node_modules"]
}
4 changes: 1 addition & 3 deletions packages/react-simple-pie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"scripts": {
"dev": "npm run build -- --watch",
"build": "tsup src/index.ts --format cjs,esm --dts --minify",
"npm:publish": "npm version patch && npm publish",
"type-check": "tsc",
"lint": "eslint src"
"lint": "tsc"
},
"devDependencies": {
"@types/react": "18.2.64",
Expand Down
12 changes: 2 additions & 10 deletions packages/react-simple-pie/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"extends": "../../config/tsconfig.package.json",
"compilerOptions": {
"jsx": "react-jsx",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"preserveWatchOutput": true,
"skipLibCheck": true,
"noEmit": true,
"strict": true
"jsx": "react-jsx"
},
"include": ["src"],
"exclude": ["node_modules"]
Expand Down
4 changes: 1 addition & 3 deletions packages/simple-pie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"scripts": {
"dev": "npm run build -- --watch",
"build": "tsup src/index.ts --format cjs,esm --dts --minify",
"npm:publish": "npm version patch && npm publish",
"type-check": "tsc",
"lint": "eslint src"
"lint": "tsc"
},
"devDependencies": {
"pie-math": "*",
Expand Down
12 changes: 1 addition & 11 deletions packages/simple-pie/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"preserveWatchOutput": true,
"skipLibCheck": true,
"noEmit": true,
"strict": true
},
"extends": "../../config/tsconfig.package.json",
"include": ["src"],
"exclude": ["node_modules"]
}
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"lint": {},
"dev": {
"cache": false,
"persistent": true,
Expand Down

0 comments on commit 95f35f0

Please sign in to comment.