- add environment import/export API endpoints and client integration - add environment export actions and toolbar import/export buttons in UI - move theme switcher to sidebar bottom and show root package version - switch snippet card menu icon to cog for consistent options affordance
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
import { playwright } from '@vitest/browser-playwright';
|
|
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
const rootPackageJsonPath = path.resolve(dirname, '../package.json');
|
|
const APP_VERSION = (() => {
|
|
try {
|
|
const json = JSON.parse(fs.readFileSync(rootPackageJsonPath, 'utf8')) as {
|
|
version?: string;
|
|
};
|
|
return json.version ?? 'dev';
|
|
} catch {
|
|
return 'dev';
|
|
}
|
|
})();
|
|
|
|
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
export default defineConfig({
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(APP_VERSION),
|
|
},
|
|
plugins: [react()],
|
|
server: {
|
|
proxy: {
|
|
'/environments': 'http://localhost:13000',
|
|
'/credentials': 'http://localhost:13000',
|
|
'/snippets': 'http://localhost:13000',
|
|
'/sessions': 'http://localhost:13000',
|
|
'/scenarios': 'http://localhost:13000',
|
|
},
|
|
},
|
|
test: {
|
|
projects: [{
|
|
extends: true,
|
|
plugins: [
|
|
// The plugin will run tests for the stories defined in your Storybook config
|
|
// See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
|
|
storybookTest({
|
|
configDir: path.join(dirname, '.storybook')
|
|
})],
|
|
test: {
|
|
name: 'storybook',
|
|
browser: {
|
|
enabled: true,
|
|
headless: true,
|
|
provider: playwright({}),
|
|
instances: [{
|
|
browser: 'chromium'
|
|
}]
|
|
}
|
|
}
|
|
}]
|
|
}
|
|
}); |