libmodulor
Version:
A TypeScript library to create platform-agnostic applications
165 lines (162 loc) ⢠4.63 kB
JavaScript
import { APP_TEST_DIR_NAME, APPS_ROOT_PATH, } from '../../../../../convention.js';
const GITIGNORE = `coverage
dist
node_modules
${APPS_ROOT_PATH.join('/')}/**/${APP_TEST_DIR_NAME}/reports
${APPS_ROOT_PATH.join('/')}/**/${APP_TEST_DIR_NAME}/*.test.ts
.env
`;
const BIOME_JSON = `{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"assist": {
"actions": {
"source": {
"organizeImports": {
"level": "on",
"options": {
"groups": [
[":NODE:"],
":BLANK_LINE:",
[":PACKAGE:"],
":BLANK_LINE:",
[":PATH:"]
]
}
},
"useSortedAttributes": "on",
"useSortedKeys": "on"
}
}
},
"files": {
"ignoreUnknown": true,
"includes": [
"**",
"!**/coverage",
"!**/dist",
"!**/node_modules",
"!**/package.json",
"!**/src/**/test/reports"
]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 4
},
"javascript": {
"formatter": {
"quoteStyle": "single"
},
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
},
"linter": {
"rules": {
"style": {
"noInferrableTypes": "error",
"noParameterAssign": "error",
"noUnusedTemplateLiteral": "error",
"noUselessElse": "error",
"useAsConstAssertion": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "error",
"useNumberNamespace": "error",
"useSelfClosingElements": "error",
"useSingleVarDeclarator": "error"
},
"suspicious": {
"noConsole": "error"
}
}
}
}
`;
export const PACKAGE_JSON = (name) => `{
"name": "${name}",
"version": "0.1.0",
"type": "module",
"private": true,
"scripts": {
"lint": "biome check --write .",
"test": "tsc && vitest run --passWithNoTests"
},
"dependencies": {
"inversify": "^7.11.0",
"libmodulor": "latest",
"reflect-metadata": "^0.2.2"
},
"devDependencies": {
"@biomejs/biome": "^2.5.2",
"@types/node": "^25.9.4",
"@vitest/coverage-v8": "^4.1.10",
"buffer": "^6.0.3",
"fast-check": "^4.8.0",
"jose": "^6.2.3",
"typescript": "^6.0.3",
"vite": "^8.1.3",
"vitest": "^4.1.10"
}
}
`;
const README_MD = (name) => `# ${name}
ššš
`;
const TSCONFIG_JSON = `{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"emitDecoratorMetadata": true,
"exactOptionalPropertyTypes": true,
"experimentalDecorators": true,
"jsx": "react-jsx",
"lib": ["dom", "esnext"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ESNext",
"verbatimModuleSyntax": true
}
}
`;
const VITEST_CONFIG_TS = `import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
coverage: {
enabled: true,
exclude: [
'/**/*.md',
'/**/*.test.ts',
'/**/*/.gitkeep',
'/**/test',
],
include: ['src'],
reporter: ['html', 'lcov', 'text'],
},
reporters: ['verbose'],
},
});
`;
export function files(name) {
return new Map([
[['.', '.gitignore'], GITIGNORE],
[['.', 'biome.json'], BIOME_JSON],
[['.', 'package.json'], PACKAGE_JSON(name)],
[['.', 'README.md'], README_MD(name)],
[['.', 'tsconfig.json'], TSCONFIG_JSON],
[['.', 'vitest.config.ts'], VITEST_CONFIG_TS],
]);
}