Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
chore: set up graphql project
Browse files Browse the repository at this point in the history
  • Loading branch information
batrdn committed Mar 4, 2024
1 parent 4d80f48 commit 98a551d
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"{workspaceRoot}/.eslintignore",
"{workspaceRoot}/eslint.config.js"
]
},
"@nx/js:tsc": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["default", "^default"]
}
}
}
20 changes: 20 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 @@ -27,6 +27,7 @@
"@nx/js": "18.0.5",
"@swc-node/register": "1.8.0",
"@swc/core": "~1.3.85",
"@swc/helpers": "~0.5.2",
"@types/jest": "^29.4.0",
"@types/node": "18.19.18",
"@typescript-eslint/eslint-plugin": "6.21.0",
Expand Down
25 changes: 25 additions & 0 deletions packages/graphql/.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"
}
}
]
}
11 changes: 11 additions & 0 deletions packages/graphql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# graphql

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

## Building

Run `nx build graphql` to build the library.

## Running unit tests

Run `nx test graphql` to execute the unit tests via [Jest](https://jestjs.io).
11 changes: 11 additions & 0 deletions packages/graphql/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: '@mocking-bird/graphql',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/graphql',
};
10 changes: 10 additions & 0 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@mocking-bird/graphql",
"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 packages/graphql/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@mocking-bird/graphql",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/graphql/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/graphql",
"main": "packages/graphql/src/index.ts",
"tsConfig": "packages/graphql/tsconfig.lib.json",
"assets": ["packages/graphql/*.md"]
}
},
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/graphql/jest.config.ts"
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions packages/graphql/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/graphql';
7 changes: 7 additions & 0 deletions packages/graphql/src/lib/graphql.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { graphql } from './graphql';

describe('graphql', () => {
it('should work', () => {
expect(graphql()).toEqual('graphql');
});
});
3 changes: 3 additions & 0 deletions packages/graphql/src/lib/graphql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function graphql(): string {
return 'graphql';
}
22 changes: 22 additions & 0 deletions packages/graphql/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"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"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/graphql/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", "test/**/*.spec.ts", "test/**/*.test.ts"]
}
14 changes: 14 additions & 0 deletions packages/graphql/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"baseUrl": ".",
"paths": {
"@mocking-bird/core": ["packages/core/src/index.ts"],
"@mocking-bird/graphql": ["packages/graphql/src/index.ts"],
"@mocking-bird/mongoose": ["packages/mongoose/src/index.ts"]
}
},
Expand Down

0 comments on commit 98a551d

Please sign in to comment.