Skip to content

Commit

Permalink
Migrate from directus/directus
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj committed Aug 13, 2024
0 parents commit f5a4a47
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 0 deletions.
23 changes: 23 additions & 0 deletions base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Base",
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"checkJs": true,
"allowSyntheticDefaultImports": true,
"declaration": true
}
}
16 changes: 16 additions & 0 deletions license
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MIT License

Copyright 2024 Monospace, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 9 additions & 0 deletions node18-cjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node.js 18 CommonJS",
"extends": "../base/tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"target": "ES2022"
}
}
11 changes: 11 additions & 0 deletions node18-esm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node.js 18 ESM",
"extends": "../base/tsconfig.json",
"compilerOptions": {
"module": "Node16",
"target": "ES2022",
"moduleResolution": "Node16",
"verbatimModuleSyntax": true
}
}
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@directus/tsconfig",
"version": "2.0.0",
"description": "TSConfig files used in Directus projects",
"homepage": "https://directus.io",
"repository": {
"type": "git",
"url": "https://github.com/directus/directus.git",
"directory": "packages/tsconfig"
},
"funding": "https://github.com/directus/directus?sponsor=1",
"license": "MIT",
"author": "Rijk van Zanten <rijkvanzanten@me.com>",
"exports": {
"./base": "./base/tsconfig.json",
"./node18-cjs": "./node18-cjs/tsconfig.json",
"./node18-esm": "./node18-esm/tsconfig.json",
"./vue3": "./vue3/tsconfig.json"
}
}
24 changes: 24 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Directus TSConfig

Shared TSConfig files used by the projects in the Directus ecosystem.

The following configs are available:

- [`node18-cjs`](./node18-cjs/tsconfig.json) - Config for CommonJS modules running under Node.js 18
- [`node18-esm`](./node18-esm/tsconfig.json) - Config for ESM modules running under Node.js 18
- [`vue3`](./vue3/tsconfig.json) - Config for Vue.js 3 modules
- [`base`](./base/tsconfig.json) - Set of basic rules (included in all of the configs above)

## Usage

```
pnpm add -D @directus/tsconfig
```

To use one of the shared config, extend the local `tsconfig.json` from it:

```json
{
"extends": "@directus/tsconfig/node18-esm"
}
```
32 changes: 32 additions & 0 deletions vue3/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Vue.js 3",
"extends": "../base/tsconfig.json",
"compilerOptions": {
// It's recommended to author and ship in ES modules.
// This recommendation includes environments like Vitest, Vite Config File, Vite SSR, etc.
"module": "ES2022",

// - Vue 3 supports ES2016+
// - For Vite, the actual compilation target is determined by the
// `build.target` option in the Vite config.
// So don't change the `target` field here. It has to be
// at least `ES2020` for dynamic `import()`s and `import.meta` to work correctly.
"target": "ES2022",

// Add DOM definitions.
"lib": ["ES2022", "DOM", "DOM.Iterable"],

// Enable some resolution features that are only available in bundlers.
"moduleResolution": "bundler",
"resolveJsonModule": true,

// Any imports or exports without a type modifier are left around. This is important for `<script setup>`.
// Anything that uses the type modifier is dropped entirely.
"verbatimModuleSyntax": true,

// Required in Vue projects
"jsx": "preserve",
"jsxImportSource": "vue"
}
}

0 comments on commit f5a4a47

Please sign in to comment.