Phase 1+2: Nx workspace with apps, libs, and module boundaries
This commit is contained in:
11
libs/api-interfaces/README.md
Normal file
11
libs/api-interfaces/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# api-interfaces
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build api-interfaces` to build the library.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test api-interfaces` to execute the unit tests via [Vitest](https://vitest.dev/).
|
||||
22
libs/api-interfaces/eslint.config.mjs
Normal file
22
libs/api-interfaces/eslint.config.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
import baseConfig from '../../eslint.config.mjs';
|
||||
|
||||
export default [
|
||||
...baseConfig,
|
||||
{
|
||||
files: ['**/*.json'],
|
||||
rules: {
|
||||
'@nx/dependency-checks': [
|
||||
'error',
|
||||
{
|
||||
ignoredFiles: [
|
||||
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
||||
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
languageOptions: {
|
||||
parser: await import('jsonc-eslint-parser'),
|
||||
},
|
||||
},
|
||||
];
|
||||
13
libs/api-interfaces/package.json
Normal file
13
libs/api-interfaces/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@fog-explorer/api-interfaces",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "commonjs",
|
||||
"main": "./src/index.js",
|
||||
"types": "./src/index.d.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0",
|
||||
"vitest": "^4.0.8",
|
||||
"@nx/vite": "^22.7.1"
|
||||
}
|
||||
}
|
||||
19
libs/api-interfaces/project.json
Normal file
19
libs/api-interfaces/project.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "api-interfaces",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "libs/api-interfaces/src",
|
||||
"projectType": "library",
|
||||
"tags": ["scope:shared", "type:lib"],
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/api-interfaces",
|
||||
"main": "libs/api-interfaces/src/index.ts",
|
||||
"tsConfig": "libs/api-interfaces/tsconfig.lib.json",
|
||||
"assets": ["libs/api-interfaces/*.md"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
libs/api-interfaces/src/index.ts
Normal file
1
libs/api-interfaces/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/api-interfaces';
|
||||
7
libs/api-interfaces/src/lib/api-interfaces.spec.ts
Normal file
7
libs/api-interfaces/src/lib/api-interfaces.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { apiInterfaces } from './api-interfaces';
|
||||
|
||||
describe('apiInterfaces', () => {
|
||||
it('should work', () => {
|
||||
expect(apiInterfaces()).toEqual('api-interfaces');
|
||||
});
|
||||
});
|
||||
3
libs/api-interfaces/src/lib/api-interfaces.ts
Normal file
3
libs/api-interfaces/src/lib/api-interfaces.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function apiInterfaces(): string {
|
||||
return 'api-interfaces';
|
||||
}
|
||||
23
libs/api-interfaces/tsconfig.json
Normal file
23
libs/api-interfaces/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"importHelpers": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
23
libs/api-interfaces/tsconfig.lib.json
Normal file
23
libs/api-interfaces/tsconfig.lib.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": [
|
||||
"vite.config.ts",
|
||||
"vite.config.mts",
|
||||
"vitest.config.ts",
|
||||
"vitest.config.mts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/*.test.js",
|
||||
"src/**/*.spec.js",
|
||||
"src/**/*.test.jsx",
|
||||
"src/**/*.spec.jsx"
|
||||
]
|
||||
}
|
||||
28
libs/api-interfaces/tsconfig.spec.json
Normal file
28
libs/api-interfaces/tsconfig.spec.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"types": [
|
||||
"vitest/globals",
|
||||
"vitest/importMeta",
|
||||
"vite/client",
|
||||
"node",
|
||||
"vitest"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts",
|
||||
"vite.config.mts",
|
||||
"vitest.config.ts",
|
||||
"vitest.config.mts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/*.test.js",
|
||||
"src/**/*.spec.js",
|
||||
"src/**/*.test.jsx",
|
||||
"src/**/*.spec.jsx",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
21
libs/api-interfaces/vitest.config.mts
Normal file
21
libs/api-interfaces/vitest.config.mts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
||||
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
cacheDir: '../../node_modules/.vite/libs/api-interfaces',
|
||||
plugins: [nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
||||
test: {
|
||||
name: 'api-interfaces',
|
||||
watch: false,
|
||||
globals: true,
|
||||
environment: 'node',
|
||||
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
||||
reporters: ['default'],
|
||||
coverage: {
|
||||
reportsDirectory: '../../coverage/libs/api-interfaces',
|
||||
provider: 'v8' as const,
|
||||
},
|
||||
},
|
||||
}));
|
||||
Reference in New Issue
Block a user