chore(waku): Init waku-utils lib

Using ` nx g @nx/js:lib waku-utils `
This commit is contained in:
Emil Ivanichkov 2024-01-22 18:25:49 +02:00 committed by Emil Ivanichkov
parent 0ab69074fe
commit d82d2ccb99
15 changed files with 1317 additions and 39 deletions

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache

View File

@ -0,0 +1,25 @@
{
"extends": ["../../.eslintrc.cjs"],
"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
libs/waku-utils/README.md Normal file
View File

@ -0,0 +1,11 @@
# waku-utils
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build waku-utils` to build the library.
## Running unit tests
Run `nx test waku-utils` to execute the unit tests via [Vitest](https://vitest.dev/).

View File

@ -0,0 +1,10 @@
{
"name": "waku-utils",
"version": "0.0.1",
"dependencies": {
"tslib": "^2.3.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts"
}

View File

@ -0,0 +1,30 @@
{
"name": "waku-utils",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/waku-utils/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/waku-utils",
"main": "libs/waku-utils/src/index.ts",
"tsConfig": "libs/waku-utils/tsconfig.lib.json",
"assets": ["libs/waku-utils/*.md"]
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/vite:test",
"outputs": ["{options.reportsDirectory}"],
"options": {
"reportsDirectory": "../../coverage/libs/waku-utils"
}
}
},
"tags": []
}

View File

@ -0,0 +1 @@
export * from './lib/waku-utils'

View File

@ -0,0 +1,7 @@
import { wakuUtils } from './waku-utils'
describe('wakuUtils', () => {
it('should work', () => {
expect(wakuUtils()).toEqual('waku-utils')
})
})

View File

@ -0,0 +1,3 @@
export function wakuUtils(): string {
return 'waku-utils'
}

View File

@ -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"
}
]
}

View File

@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["vite.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}

View File

@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"]
},
"include": [
"vite.config.ts",
"vitest.config.ts",
"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"
]
}

View File

@ -0,0 +1,24 @@
import { defineConfig } from 'vite'
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'
export default defineConfig({
root: __dirname,
cacheDir: '../../node_modules/.vite/libs/waku-utils',
plugins: [nxViteTsPaths()],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
test: {
globals: true,
cache: { dir: '../../node_modules/.vitest' },
environment: 'node',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: { reportsDirectory: '../../coverage/libs/waku-utils', provider: 'v8' },
},
})

View File

@ -78,6 +78,7 @@
"@faker-js/faker": "^8.3.1",
"@fsouza/prettierd": "^0.24.2",
"@nx/js": "^17.2.8",
"@nx/vite": "17.2.8",
"@storybook/addon-essentials": "^7.2.0",
"@storybook/addon-interactions": "^7.2.0",
"@storybook/addon-links": "^7.2.0",
@ -88,6 +89,9 @@
"@storybook/react-vite": "^7.2.0",
"@storybook/test-runner": "^0.12.0",
"@storybook/testing-library": "^0.2.0",
"@swc-node/register": "~1.6.7",
"@swc/core": "~1.3.85",
"@types/node": "18.7.1",
"@types/react-color": "^3.0.6",
"@types/react-syntax-highlighter": "^15.5.7",
"@types/react-window": "^1.8.8",
@ -96,6 +100,8 @@
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
"@vitest/coverage-v8": "~0.34.6",
"@vitest/ui": "~0.34.6",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
@ -107,7 +113,8 @@
"tsx": "^4.7.0",
"typescript": "^5.0.2",
"vercel": "^32.0.1",
"vite": "^4.4.9"
"vite": "^5.0.0",
"vitest": "~0.34.6"
},
"packageManager": "yarn@3.6.1"
}

View File

@ -19,7 +19,10 @@
"lib": ["es2020", "ES2022.Error"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": "."
"baseUrl": ".",
"paths": {
"waku-utils": ["libs/waku-utils/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
}

1175
yarn.lock

File diff suppressed because it is too large Load Diff