Skip to content

Commit 6518798

Browse files
committed
chore: run nx generate @nrwl/js:library react
--unitTestRunner=vitest --bundler=vite --compiler=swc --importPath=@tanstack-query-with-orbitjs/react --setParserOptionsProject --skipTypeCheck
1 parent b291b86 commit 6518798

13 files changed

+215
-1
lines changed

libs/react/.eslintrc.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"parserOptions": {
8+
"project": ["libs/react/tsconfig.*?.json"]
9+
},
10+
"rules": {}
11+
},
12+
{
13+
"files": ["*.ts", "*.tsx"],
14+
"rules": {}
15+
},
16+
{
17+
"files": ["*.js", "*.jsx"],
18+
"rules": {}
19+
}
20+
]
21+
}

libs/react/.lib.swcrc

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"jsc": {
3+
"target": "es2017",
4+
"parser": {
5+
"syntax": "typescript",
6+
"decorators": true,
7+
"dynamicImport": true
8+
},
9+
"transform": {
10+
"decoratorMetadata": true,
11+
"legacyDecorator": true
12+
},
13+
"keepClassNames": true,
14+
"externalHelpers": true,
15+
"loose": true
16+
},
17+
"module": {
18+
"type": "commonjs",
19+
"strict": true,
20+
"noInterop": true
21+
},
22+
"sourceMaps": true,
23+
"exclude": ["jest.config.ts",".*\\.spec.tsx?$",".*\\.test.tsx?$","./src/jest-setup.ts$","./**/jest-setup.ts$",".*.js$"]
24+
}

libs/react/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# react
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Building
6+
7+
Run `nx build react` to build the library.
8+
9+
## Running unit tests
10+
11+
Run `nx test react` to execute the unit tests via [Jest](https://jestjs.io).

libs/react/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "@tanstack-query-with-orbitjs/react",
3+
"version": "0.0.1",
4+
"type": "commonjs"
5+
}

libs/react/project.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "react",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "libs/react/src",
5+
"projectType": "library",
6+
"targets": {
7+
"build": {
8+
"executor": "@nrwl/vite:build",
9+
"outputs": ["{options.outputPath}"],
10+
"options": {
11+
"outputPath": "dist/libs/react"
12+
}
13+
},
14+
"test": {
15+
"executor": "@nrwl/vite:test",
16+
"outputs": ["coverage/libs/react"],
17+
"options": {
18+
"passWithNoTests": true,
19+
"reportsDirectory": "../../coverage/libs/react"
20+
}
21+
},
22+
"lint": {
23+
"executor": "@nrwl/linter:eslint",
24+
"outputs": ["{options.outputFile}"],
25+
"options": {
26+
"lintFilePatterns": ["libs/react/**/*.ts"]
27+
}
28+
}
29+
},
30+
"tags": []
31+
}

libs/react/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./lib/react";

libs/react/src/lib/react.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {react} from "./react";
2+
3+
describe("react", () => {
4+
it("should work", () => {
5+
expect(react()).toEqual("react");
6+
});
7+
});

libs/react/src/lib/react.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function react(): string {
2+
return "react";
3+
}

libs/react/tsconfig.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"forceConsistentCasingInFileNames": true,
6+
"strict": true,
7+
"noImplicitOverride": true,
8+
"noPropertyAccessFromIndexSignature": true,
9+
"noImplicitReturns": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"types": ["vitest"]
12+
},
13+
"files": [],
14+
"include": [],
15+
"references": [
16+
{
17+
"path": "./tsconfig.lib.json"
18+
},
19+
{
20+
"path": "./tsconfig.spec.json"
21+
}
22+
]
23+
}

libs/react/tsconfig.lib.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"declaration": true,
6+
"types": ["node"]
7+
},
8+
"include": ["src/**/*.ts"],
9+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10+
}

libs/react/tsconfig.spec.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"types": ["vitest/globals", "node"]
6+
},
7+
"include": [
8+
"vite.config.ts",
9+
"src/**/*.test.ts",
10+
"src/**/*.spec.ts",
11+
"src/**/*.test.tsx",
12+
"src/**/*.spec.tsx",
13+
"src/**/*.test.js",
14+
"src/**/*.spec.js",
15+
"src/**/*.test.jsx",
16+
"src/**/*.spec.jsx",
17+
"src/**/*.d.ts"
18+
]
19+
}

libs/react/vite.config.ts

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/// <reference types="vitest" />
2+
import {defineConfig} from "vite";
3+
4+
import viteTsConfigPaths from "vite-tsconfig-paths";
5+
import dts from "vite-plugin-dts";
6+
import {join} from "path";
7+
8+
export default defineConfig({
9+
cacheDir: "../../node_modules/.vite/react",
10+
11+
plugins: [
12+
dts({
13+
tsConfigFilePath: join(__dirname, "tsconfig.lib.json"),
14+
// Faster builds by skipping tests. Set this to false to enable type checking.
15+
skipDiagnostics: true,
16+
}),
17+
18+
viteTsConfigPaths({
19+
root: "../../",
20+
}),
21+
],
22+
23+
// Uncomment this if you are using workers.
24+
// worker: {
25+
// plugins: [
26+
// viteTsConfigPaths({
27+
// root: '../../',
28+
// }),
29+
// ],
30+
// },
31+
32+
// Configuration for building your library.
33+
// See: https://vitejs.dev/guide/build.html#library-mode
34+
build: {
35+
lib: {
36+
// Could also be a dictionary or array of multiple entry points.
37+
entry: "src/index.ts",
38+
name: "react",
39+
fileName: "index",
40+
// Change this to the formats you want to support.
41+
// Don't forgot to update your package.json as well.
42+
formats: ["es", "cjs"],
43+
},
44+
rollupOptions: {
45+
// External packages that should not be bundled into your library.
46+
external: [],
47+
},
48+
},
49+
50+
test: {
51+
globals: true,
52+
cache: {
53+
dir: "../../node_modules/.vitest",
54+
},
55+
environment: "jsdom",
56+
include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
57+
},
58+
});

tsconfig.base.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"skipDefaultLibCheck": true,
1616
"baseUrl": ".",
1717
"paths": {
18-
"@tanstack-query-with-orbitjs/core": ["libs/core/src/index.ts"]
18+
"@tanstack-query-with-orbitjs/core": ["libs/core/src/index.ts"],
19+
"@tanstack-query-with-orbitjs/react": ["libs/react/src/index.ts"]
1920
}
2021
},
2122
"exclude": ["node_modules", "tmp"]

0 commit comments

Comments
 (0)