* build(frontend): enable custom condition for resolving source files during dev and build * feat(packages): apply conditional name to export properties * chore(packages): add standard exports to flamegraph and prometheus * chore(packages): resolve main, module, types to built files * build(packages): clean up prepare-npm-package for custom condition changes * refactor(packages): reduce repetition in conditional exports * build(storybook): add @grafana-app/source to conditionNames * test(frontend): add grafana-app/source customCondition for jest tests * refactor(frontend): remove nested package import paths * chore(jest): use customExportConditions for source files and browser * chore(i18n): use src for ./eslint-plugin export * chore(packages): set packages tsconfigs to moduleResolution bundler * chore(packages): fix rollup builds * build(packages): build cjs as multiple files * chore(sql): reference MonitoringLogger for moduleresolution bundler to pass typecheck * chore(ui): add type refs for moduleresolution bundler to pass typecheck * feat(schema): add exports for cleaner import paths * refactor(frontend): clean up schema paths to point to exports instead of nested file paths * build(storybook): hack the builder-manager for custom conditions to resolve * build(decoupled-plugins): fix broken builds due to missing conditionNames * chore(e2e): pass condition to playwright to resolve local packages * build(frontend): fix failing build * chore(select): fix typings * style(frontend): clean up eslint suppressions * chore(packages): fix type errors due to incorrect tsconfig settings * build(generate-apis): use swc with ts-node and moduleResolution bundler * chore(cypress): add conditionNames to resolve monorepo packages * build(npm): update prepare to work with latest exports changes * build(packages): fix prepare-npm-package script * fix(e2e-selectors): update debugoverlay for data-testid change * build(packages): stop editing package.json at pack n publish time * rerun ci * chore(api-clients): use moduleResolution: bundler for customConditions support * chore(api-clients): fix generation * build(packages): remove aliasing exports, remove exports with only customConditions * Revert "refactor(frontend): clean up schema paths to point to exports instead of nested file paths" This reverts commit 7949b6ea0e60e51989d2a8149b7a24647cd68916. * revert(schema): remove exports from package so builds work * build(api-clients): fix up api-clients exports and rollup config * build(api-clients): Update generated package exports for api clients * build(schema): add overrides to cjsOutput and esmOutput so built directory structure is correct * fix(packages): use rootDirs to prevent types/src directories in built d.ts file paths * build(packages): prevent empty exports added to package.json during pack * docs(packages): update readme with custom conditions information --------- Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
50 lines
1.7 KiB
JavaScript
50 lines
1.7 KiB
JavaScript
process.env.TZ = 'Pacific/Easter'; // UTC-06:00 or UTC-05:00 depending on daylight savings
|
|
|
|
import path from 'path';
|
|
|
|
import { grafanaESModules, nodeModulesToTransform } from './utils.js';
|
|
|
|
export default {
|
|
moduleNameMapper: {
|
|
'\\.(css|scss|sass)$': 'identity-obj-proxy',
|
|
'react-inlinesvg': path.resolve(import.meta.dirname, 'mocks', 'react-inlinesvg.tsx'),
|
|
'\\.(svg|png|jpg)': path.resolve(import.meta.dirname, 'mocks', 'images.ts'),
|
|
'^monaco-editor$': 'monaco-editor/esm/vs/editor/editor.api.js',
|
|
'@kusto/monaco-kusto': '@kusto/monaco-kusto/release/esm/monaco.contribution.js',
|
|
},
|
|
modulePaths: ['<rootDir>'],
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'cjs'],
|
|
setupFiles: ['jest-canvas-mock'],
|
|
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
|
|
testEnvironment: 'jsdom',
|
|
testEnvironmentOptions: {
|
|
customExportConditions: ['@grafana-app/source', 'browser'],
|
|
},
|
|
testMatch: ['<rootDir>/**/__tests__/**/*.{js,jsx,ts,tsx}', '<rootDir>/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'],
|
|
transform: {
|
|
'^.+\\.(t|j)sx?$': [
|
|
'@swc/jest',
|
|
{
|
|
sourceMaps: 'inline',
|
|
jsc: {
|
|
parser: {
|
|
syntax: 'typescript',
|
|
tsx: true,
|
|
decorators: false,
|
|
dynamicImport: true,
|
|
},
|
|
transform: {
|
|
react: {
|
|
runtime: 'automatic',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
// Jest will throw `Cannot use import statement outside module` if it tries to load an
|
|
// ES module without it being transformed first. ./config/README.md#esm-errors-with-jest
|
|
transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)],
|
|
watchPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/dist'],
|
|
};
|