From 43d6ddeb2aba9d2c28a709134074debbca23bed1 Mon Sep 17 00:00:00 2001 From: Defne Date: Sun, 18 May 2025 13:06:40 +0200 Subject: [PATCH 1/3] test workflow --- src/lib/useGetPolygons.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/useGetPolygons.ts b/src/lib/useGetPolygons.ts index 184c877..f8f8ec0 100644 --- a/src/lib/useGetPolygons.ts +++ b/src/lib/useGetPolygons.ts @@ -1,4 +1,4 @@ -// react hook that returns polygons data: +// react hook that returns polygons data import { useCallback } from 'react'; import { usePolygonContext } from './context/PolygonContext'; From acef60841433fd1f0b9afff26825b675ed3c46bb Mon Sep 17 00:00:00 2001 From: Defne Date: Sun, 18 May 2025 13:17:50 +0200 Subject: [PATCH 2/3] fix flow file --- .github/workflows/test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae84263..9173e77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,8 +21,10 @@ jobs: - name: Install dependencies run: npm ci - - name: Run component tests - run: npm run test:component - env: - # Add any environment variables needed for tests - CI: true \ No newline at end of file + - name: Cypress run + uses: cypress-io/github-action@v6 + with: + build: npm run build -- --skip-lint + start: npm run dev + browser: chrome + component: true \ No newline at end of file From d3a065ad206c88536ace9dbffb68bef8757bc62b Mon Sep 17 00:00:00 2001 From: Defne Date: Sun, 18 May 2025 13:23:37 +0200 Subject: [PATCH 3/3] fix test flow --- .github/workflows/test.yml | 6 ++-- vite.config.ts | 64 ++++++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9173e77..6caefcf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,9 @@ jobs: - name: Cypress run uses: cypress-io/github-action@v6 with: - build: npm run build -- --skip-lint + build: npm run build start: npm run dev browser: chrome - component: true \ No newline at end of file + component: true + env: + NODE_ENV: production \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 9802308..76f9d29 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,41 +6,51 @@ import { EsLinter, linterPlugin } from 'vite-plugin-linter'; import tsConfigPaths from 'vite-tsconfig-paths'; import * as packageJson from './package.json'; -export default defineConfig((configEnv) => ({ - plugins: [ +export default defineConfig((configEnv) => { + const plugins = [ dts({ insertTypesEntry: true, include: ['src/lib/'], }), react(), tsConfigPaths(), - linterPlugin({ - include: ['./src/**/*.{ts,tsx}'], - linters: [new EsLinter({ configEnv })], - }), - ], - build: { - lib: { - entry: path.join('src', 'lib/index.ts'), - name: 'polygon-annotation', - formats: ['es', 'umd'], - fileName: (format) => `polygon-annotation.${format}.js`, - }, - rollupOptions: { - external: [...Object.keys(packageJson.peerDependencies)], - output: { - globals: { - react: 'React', - 'react-dom': 'ReactDOM', + ]; + + // Only add linter in development + if (process.env.NODE_ENV !== 'production') { + plugins.push( + linterPlugin({ + include: ['./src/**/*.{ts,tsx}'], + linters: [new EsLinter({ configEnv })], + }) + ); + } + + return { + plugins, + build: { + lib: { + entry: path.join('src', 'lib/index.ts'), + name: 'polygon-annotation', + formats: ['es', 'umd'], + fileName: (format) => `polygon-annotation.${format}.js`, + }, + rollupOptions: { + external: [...Object.keys(packageJson.peerDependencies)], + output: { + globals: { + react: 'React', + 'react-dom': 'ReactDOM', + }, }, }, }, - }, - test: { - deps: { - web: { - transformAssets: true, + test: { + deps: { + web: { + transformAssets: true, + }, }, }, - }, -})); + }; +});