Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Format tsup.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Jan 25, 2024
1 parent fe09b4b commit 047c2ec
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { globalPackages as globalManagerPackages } from "@storybook/manager/glob
import { globalPackages as globalPreviewPackages } from "@storybook/preview/globals";

// The current browsers supported by Storybook v7
const BROWSER_TARGET: Options['target'] = ["chrome100", "safari15", "firefox91"];
const NODE_TARGET: Options['target'] = ["node16"];
const BROWSER_TARGET: Options["target"] = [
"chrome100",
"safari15",
"firefox91",
];
const NODE_TARGET: Options["target"] = ["node16"];

type BundlerConfig = {
bundler?: {
Expand All @@ -27,7 +31,9 @@ export default defineConfig(async (options) => {
// "nodeEntries": ["./src/preset.ts"]
// }
// }
const packageJson = await readFile('./package.json', 'utf8').then(JSON.parse) as BundlerConfig;
const packageJson = (await readFile("./package.json", "utf8").then(
JSON.parse,
)) as BundlerConfig;
const {
bundler: {
exportEntries = [],
Expand Down Expand Up @@ -57,7 +63,7 @@ export default defineConfig(async (options) => {
dts: {
resolve: true,
},
format: ["esm", 'cjs'],
format: ["esm", "cjs"],
target: [...BROWSER_TARGET, ...NODE_TARGET],
platform: "neutral",
external: [...globalManagerPackages, ...globalPreviewPackages],
Expand Down Expand Up @@ -94,14 +100,14 @@ export default defineConfig(async (options) => {

if (nodeEntries.length > 0) {
configs.push({
...commonConfig,
entry: nodeEntries,
format: ['cjs'],
target: NODE_TARGET,
platform: 'node',
external: globalPreviewPackages,
});
}
...commonConfig,
entry: nodeEntries,
format: ["cjs"],
target: NODE_TARGET,
platform: "node",
external: globalPreviewPackages,
});
}

return configs;
});
});

0 comments on commit 047c2ec

Please sign in to comment.