Skip to content

Commit

Permalink
add shared type lib
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmojicatech committed Nov 25, 2023
1 parent 3c0b074 commit 75dfa34
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 9 deletions.
25 changes: 25 additions & 0 deletions libs/disney-planner-models/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
7 changes: 7 additions & 0 deletions libs/disney-planner-models/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# disney-planner-models

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build disney-planner-models` to build the library.
10 changes: 10 additions & 0 deletions libs/disney-planner-models/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "disney-planner-models",
"version": "0.0.1",
"dependencies": {
"tslib": "^2.3.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts"
}
29 changes: 29 additions & 0 deletions libs/disney-planner-models/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "disney-planner-models",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/disney-planner-models/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/disney-planner-models",
"main": "libs/disney-planner-models/src/index.ts",
"tsConfig": "libs/disney-planner-models/tsconfig.lib.json",
"assets": ["libs/disney-planner-models/*.md"]
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/disney-planner-models/**/*.ts",
"libs/disney-planner-models/package.json"
]
}
}
},
"tags": []
}
4 changes: 4 additions & 0 deletions libs/disney-planner-models/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export {
DisneyPark,
UpcomingTrip
} from './lib/upcoming-trips';
13 changes: 13 additions & 0 deletions libs/disney-planner-models/src/lib/upcoming-trips.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const DISNEY_PARK_MAP = {
epcot: 'Epcot',
studios: 'Hollywood Studios',
animal: 'Animal Kingdom',
magic: 'Magic Kingdom',
}

export type DisneyPark = keyof typeof DISNEY_PARK_MAP;

export interface UpcomingTrip {
date: string;
park: DisneyPark;
}
19 changes: 19 additions & 0 deletions libs/disney-planner-models/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
10 changes: 10 additions & 0 deletions libs/disney-planner-models/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
14 changes: 7 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@types/express": "4.17.14",
"@types/jest": "29.4.4",
"@types/minimist": "^1.2.2",
"@types/node": "16.11.7",
"@types/node": "18.7.1",
"@types/node-fetch": "^2.6.2",
"@types/react": "18.2.24",
"@types/react-dom": "18.2.9",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
],
"@pmt/pmt-input": ["libs/pmt-input/src/index.ts"],
"@pmt/pmt-mobile-toolbar": ["libs/pmt-mobile-toolbar/src/index.ts"],
"@pmt/pmt-simple-form": ["libs/pmt-simple-form/src/index.ts"]
"@pmt/pmt-simple-form": ["libs/pmt-simple-form/src/index.ts"],
"disney-planner-models": ["libs/disney-planner-models/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down

0 comments on commit 75dfa34

Please sign in to comment.