Skip to content

Commit 6c7ed9f

Browse files
authored
feat(plugin-typescript): setup plugin project base (#917)
1 parent 3dcc4b1 commit 6c7ed9f

File tree

11 files changed

+211
-0
lines changed

11 files changed

+211
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import tseslint from 'typescript-eslint';
2+
import baseConfig from '../../eslint.config.js';
3+
4+
export default tseslint.config(
5+
...baseConfig,
6+
{
7+
files: ['**/*.ts'],
8+
languageOptions: {
9+
parserOptions: {
10+
projectService: true,
11+
tsconfigRootDir: import.meta.dirname,
12+
},
13+
},
14+
},
15+
{
16+
files: ['**/*.json'],
17+
rules: {
18+
'@nx/dependency-checks': 'error',
19+
},
20+
},
21+
);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "@code-pushup/typescript-plugin",
3+
"version": "0.57.0",
4+
"license": "MIT",
5+
"description": "Code PushUp plugin for incrementally adopting strict compilation flags in TypeScript projects",
6+
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-typescript#readme",
7+
"bugs": {
8+
"url": "https://github.com/code-pushup/cli/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20label%3A\"🧩%20typescript-plugin\""
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/code-pushup/cli.git",
13+
"directory": "packages/plugin-typescript"
14+
},
15+
"keywords": [
16+
"CLI",
17+
"Code PushUp",
18+
"plugin",
19+
"typescript"
20+
],
21+
"publishConfig": {
22+
"access": "public"
23+
},
24+
"type": "module",
25+
"dependencies": {},
26+
"scripts": {}
27+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "plugin-typescript",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "packages/plugin-typescript/src",
5+
"projectType": "library",
6+
"targets": {
7+
"build": {
8+
"executor": "@nx/js:tsc",
9+
"outputs": ["{options.outputPath}"],
10+
"options": {
11+
"outputPath": "dist/packages/plugin-typescript",
12+
"main": "packages/plugin-typescript/src/index.ts",
13+
"tsConfig": "packages/plugin-typescript/tsconfig.lib.json",
14+
"assets": ["packages/plugin-typescript/*.md"]
15+
}
16+
},
17+
"lint": {
18+
"executor": "@nx/linter:eslint",
19+
"outputs": ["{options.outputFile}"],
20+
"options": {
21+
"lintFilePatterns": [
22+
"packages/plugin-typescript/**/*.ts",
23+
"packages/plugin-typescript/package.json"
24+
]
25+
}
26+
},
27+
"unit-test": {
28+
"executor": "@nx/vite:test",
29+
"options": {
30+
"configFile": "packages/plugin-typescript/vite.config.unit.ts"
31+
}
32+
},
33+
"integration-test": {
34+
"executor": "@nx/vite:test",
35+
"options": {
36+
"configFile": "packages/plugin-typescript/vite.config.integration.ts"
37+
}
38+
}
39+
},
40+
"tags": ["scope:plugin", "type:feature", "publishable"]
41+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { TYPESCRIPT_PLUGIN_SLUG } from './lib/constants.js';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const TYPESCRIPT_PLUGIN_SLUG = 'typescript';
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "ESNext",
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.test.json"
21+
}
22+
]
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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": [
10+
"vite.config.unit.ts",
11+
"vite.config.integration.ts",
12+
"src/**/*.test.ts",
13+
"src/**/*.mock.ts",
14+
"mocks/**/*.ts"
15+
]
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
6+
},
7+
"include": [
8+
"vite.config.unit.ts",
9+
"vite.config.integration.ts",
10+
"mocks/**/*.ts",
11+
"src/**/*.test.ts",
12+
"src/**/*.test.tsx",
13+
"src/**/*.test.js",
14+
"src/**/*.test.jsx",
15+
"src/**/*.d.ts"
16+
]
17+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/// <reference types="vitest" />
2+
import { defineConfig } from 'vite';
3+
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';
4+
5+
export default defineConfig({
6+
cacheDir: '../../node_modules/.vite/plugin-typescript',
7+
test: {
8+
reporters: ['basic'],
9+
globals: true,
10+
cache: {
11+
dir: '../../node_modules/.vitest/plugin-typescript',
12+
},
13+
alias: tsconfigPathAliases(),
14+
pool: 'threads',
15+
poolOptions: { threads: { singleThread: true } },
16+
coverage: {
17+
reporter: ['text', 'lcov'],
18+
reportsDirectory: '../../coverage/plugin-typescript/integration-tests',
19+
exclude: ['mocks/**', '**/types.ts'],
20+
},
21+
environment: 'node',
22+
include: ['src/**/*.integration.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
23+
globalSetup: ['../../global-setup.ts'],
24+
setupFiles: [
25+
'../../testing/test-setup/src/lib/cliui.mock.ts',
26+
'../../testing/test-setup/src/lib/reset.mocks.ts',
27+
'../../testing/test-setup/src/lib/chrome-path.setup.ts',
28+
],
29+
},
30+
});
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/// <reference types="vitest" />
2+
import { defineConfig } from 'vite';
3+
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';
4+
5+
export default defineConfig({
6+
cacheDir: '../../node_modules/.vite/plugin-typescript',
7+
test: {
8+
reporters: ['basic'],
9+
globals: true,
10+
cache: {
11+
dir: '../../node_modules/.vitest/plugin-typescript',
12+
},
13+
alias: tsconfigPathAliases(),
14+
pool: 'threads',
15+
poolOptions: { threads: { singleThread: true } },
16+
coverage: {
17+
reporter: ['text', 'lcov'],
18+
reportsDirectory: '../../coverage/plugin-typescript/unit-tests',
19+
exclude: ['mocks/**', '**/types.ts'],
20+
},
21+
environment: 'node',
22+
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
23+
globalSetup: ['../../global-setup.ts'],
24+
setupFiles: [
25+
'../../testing/test-setup/src/lib/cliui.mock.ts',
26+
'../../testing/test-setup/src/lib/fs.mock.ts',
27+
'../../testing/test-setup/src/lib/console.mock.ts',
28+
'../../testing/test-setup/src/lib/reset.mocks.ts',
29+
],
30+
},
31+
});

0 commit comments

Comments
 (0)