22
libs/shared/.spec.swcrc
Normal file
22
libs/shared/.spec.swcrc
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"jsc": {
|
||||
"target": "es2017",
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"decorators": true,
|
||||
"dynamicImport": true
|
||||
},
|
||||
"transform": {
|
||||
"decoratorMetadata": true,
|
||||
"legacyDecorator": true
|
||||
},
|
||||
"keepClassNames": true,
|
||||
"externalHelpers": true,
|
||||
"loose": true
|
||||
},
|
||||
"module": {
|
||||
"type": "es6"
|
||||
},
|
||||
"sourceMaps": true,
|
||||
"exclude": []
|
||||
}
|
||||
11
libs/shared/README.md
Normal file
11
libs/shared/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# shared
|
||||
|
||||
This library was generated with [Nx](https://nx.dev).
|
||||
|
||||
## Building
|
||||
|
||||
Run `nx build shared` to build the library.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `nx test shared` to execute the unit tests via [Jest](https://jestjs.io).
|
||||
22
libs/shared/eslint.config.mjs
Normal file
22
libs/shared/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}'],
|
||||
},
|
||||
],
|
||||
},
|
||||
languageOptions: {
|
||||
parser: await import('jsonc-eslint-parser'),
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ['**/out-tsc'],
|
||||
},
|
||||
];
|
||||
21
libs/shared/jest.config.cts
Normal file
21
libs/shared/jest.config.cts
Normal file
@@ -0,0 +1,21 @@
|
||||
/* eslint-disable */
|
||||
const { readFileSync } = require('fs');
|
||||
|
||||
// Reading the SWC compilation config for the spec files
|
||||
const swcJestConfig = JSON.parse(
|
||||
readFileSync(`${__dirname}/.spec.swcrc`, 'utf-8'),
|
||||
);
|
||||
|
||||
// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves
|
||||
swcJestConfig.swcrc = false;
|
||||
|
||||
module.exports = {
|
||||
displayName: '@my-monorepo/shared',
|
||||
preset: '../../jest.preset.js',
|
||||
testEnvironment: 'node',
|
||||
transform: {
|
||||
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||
coverageDirectory: 'test-output/jest/coverage',
|
||||
};
|
||||
21
libs/shared/package.json
Normal file
21
libs/shared/package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@my-monorepo/shared",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"@my-monorepo/source": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
}
|
||||
1
libs/shared/src/index.ts
Normal file
1
libs/shared/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './lib/shared.js';
|
||||
7
libs/shared/src/lib/shared.spec.ts
Normal file
7
libs/shared/src/lib/shared.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { shared } from './shared.js';
|
||||
|
||||
describe('shared', () => {
|
||||
it('should work', () => {
|
||||
expect(shared()).toEqual('shared');
|
||||
});
|
||||
});
|
||||
3
libs/shared/src/lib/shared.ts
Normal file
3
libs/shared/src/lib/shared.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function shared(): string {
|
||||
return 'shared';
|
||||
}
|
||||
13
libs/shared/tsconfig.json
Normal file
13
libs/shared/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
20
libs/shared/tsconfig.lib.json
Normal file
20
libs/shared/tsconfig.lib.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
||||
"emitDeclarationOnly": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [],
|
||||
"exclude": [
|
||||
"jest.config.ts",
|
||||
"jest.config.cts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
20
libs/shared/tsconfig.spec.json
Normal file
20
libs/shared/tsconfig.spec.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/jest",
|
||||
"types": ["jest", "node"],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": [
|
||||
"jest.config.ts",
|
||||
"jest.config.cts",
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user