* Move CodeMirror LRLanguage to new file This separates the base language support from the LSP and color picker. * Move the base CodeMirror KCL support to a local package * Start CodeMirror grammar tests * Exclude vitest config in tsconfig * Add KCL path to tsconfig * Remove stray import * Drop extension from import * Use __filename for commonjs compat * Check exec return before access * Build ES and CJS to dist * Format * Exclude all.test.ts from codespell This is to work around "fileTests" imported from Lezer. Future codespell versions look like they'll allow the code to be annotated, which would be nicer. --------- Co-authored-by: Matt Mundell <matt@mundell.me>
		
			
				
	
	
		
			71 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import react from '@vitejs/plugin-react'
 | 
						|
import viteTsconfigPaths from 'vite-tsconfig-paths'
 | 
						|
import eslint from '@nabla/vite-plugin-eslint'
 | 
						|
import { defineConfig, configDefaults } from 'vitest/config'
 | 
						|
import version from 'vite-plugin-package-version'
 | 
						|
// @ts-ignore: No types available
 | 
						|
import { lezer } from '@lezer/generator/rollup'
 | 
						|
 | 
						|
const config = defineConfig({
 | 
						|
  server: {
 | 
						|
    open: true,
 | 
						|
    port: 3000,
 | 
						|
    watch: {
 | 
						|
      ignored: [
 | 
						|
        '**/target/**',
 | 
						|
        '**/dist/**',
 | 
						|
        '**/build/**',
 | 
						|
        '**/test-results/**',
 | 
						|
        '**/playwright-report/**',
 | 
						|
      ],
 | 
						|
    },
 | 
						|
  },
 | 
						|
  test: {
 | 
						|
    globals: true,
 | 
						|
    pool: 'forks',
 | 
						|
    poolOptions: {
 | 
						|
      forks: {
 | 
						|
        maxForks: 2,
 | 
						|
        minForks: 1,
 | 
						|
      },
 | 
						|
    },
 | 
						|
    setupFiles: ['src/setupTests.ts', '@vitest/web-worker'],
 | 
						|
    environment: 'happy-dom',
 | 
						|
    coverage: {
 | 
						|
      provider: 'istanbul', // or 'v8'
 | 
						|
    },
 | 
						|
    exclude: [...configDefaults.exclude, '**/e2e/**/*'],
 | 
						|
    deps: {
 | 
						|
      optimizer: {
 | 
						|
        web: {
 | 
						|
          include: ['vitest-canvas-mock'],
 | 
						|
        },
 | 
						|
      },
 | 
						|
    },
 | 
						|
    clearMocks: true,
 | 
						|
    restoreMocks: true,
 | 
						|
    mockReset: true,
 | 
						|
    reporters: process.env.GITHUB_ACTIONS
 | 
						|
      ? ['dot', 'github-actions']
 | 
						|
      : ['verbose', 'hanging-process'],
 | 
						|
    testTimeout: 1000,
 | 
						|
    hookTimeout: 1000,
 | 
						|
    teardownTimeout: 1000,
 | 
						|
  },
 | 
						|
  build: {
 | 
						|
    outDir: 'build',
 | 
						|
  },
 | 
						|
  resolve: {
 | 
						|
    alias: {
 | 
						|
      '@kittycad/codemirror-lsp-client': '/packages/codemirror-lsp-client/src',
 | 
						|
      '@kittycad/codemirror-lang-kcl': '/packages/codemirror-lang-kcl/src',
 | 
						|
    },
 | 
						|
  },
 | 
						|
  plugins: [react(), viteTsconfigPaths(), eslint(), version(), lezer()],
 | 
						|
  worker: {
 | 
						|
    plugins: () => [viteTsconfigPaths()],
 | 
						|
  },
 | 
						|
})
 | 
						|
 | 
						|
export default config
 |