diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bb35ac8b..74bb01e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: pnpm install - name: Run Unit tests - run: pnpm run test + run: pnpm run test:unit:ci - name: Run E2E tests env: VITE_ACCESS_TOKEN: ${{ secrets.VITE_ACCESS_TOKEN }} diff --git a/package.json b/package.json index b29ba8a6..bc7569ca 100644 --- a/package.json +++ b/package.json @@ -48,17 +48,22 @@ "tests" ], "scripts": { - "lint": "eslint --max-warnings=0 './src/**/*.{ts,js}'", - "build": "node vite.build.mjs && tsc", + "dev": "vite build --watch", + "build": "node vite.build.mjs", + "test": "pnpm run test:unit:ci && pnpm run test:e2e", + "test:unit": "vitest", + "test:unit:ci": "vitest run", + "test:unit:ui": "vitest --ui", + "test:e2e": "vitest run -c vitest.config.e2e.ts", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "playground": "pnpm run --filter ./playground/vanilla dev", "playground:svelte": "pnpm run --filter ./playground/svelte dev", "playground:next": "pnpm run --filter ./playground/nextjs dev", "dev:umd": "npx serve ./", - "test": "vitest run", - "test:e2e": "vitest run -c vitest.config.e2e.ts", - "test:ui": "vitest --ui --coverage.enabled=true", "coverage": "vitest run --coverage", - "prepare": "npm run build" + "prepare": "pnpm simple-git-hooks", + "prepublishOnly": "pnpm build" }, "devDependencies": { "@commitlint/cli": "^19.6.1", diff --git a/vite.build.mjs b/vite.build.mjs index 409b3938..c88be2f2 100644 --- a/vite.build.mjs +++ b/vite.build.mjs @@ -34,7 +34,7 @@ const bundles = [ ;(async () => { for (const bundle of bundles) { await build({ - configFile: false, + configFile: 'vite.config.ts', build: { lib: { entry: resolve(__dirname, 'src', bundle.entry), diff --git a/vite.config.ts b/vite.config.ts index 868ca842..af776385 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,12 +5,13 @@ import { defineConfig } from 'vitest/config'; import dts from 'vite-plugin-dts'; // eslint-disable-next-line no-console -console.log(`${lightGreen('Storyblok Richtext')} v${pkg.version}`); +console.log(`${lightGreen('Storyblok JS Client')} v${pkg.version}`); export default defineConfig(() => ({ plugins: [ dts({ insertTypesEntry: true, + outDir: 'dist/types', }), banner({ content: `/**\n * name: ${pkg.name}\n * (c) ${new Date().getFullYear()}\n * description: ${pkg.description}\n * author: ${pkg.author}\n */`,