Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@storybook/types": "8.4.7",
"auto": "^11.3.0",
"find-cache-dir": "^5.0.0",
"find-up": "^7.0.0",
"tsup": "^8.3.5",
"typescript": "^5.7.2",
"webpack": "^5.97.1"
Expand Down
19 changes: 0 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/preset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Options } from "@storybook/types";
import type { Configuration } from "webpack";
import { getProjectRoot, resolvePathInStorybookCache } from "./utils.js";
import { resolvePathInStorybookCache } from "./utils.js";

const virtualModuleFiles = [
/storybook-config-entry\.js$/,
Expand Down Expand Up @@ -32,7 +32,6 @@ export const webpackFinal = async (config: Configuration, options: Options) => {
},
},
],
include: [getProjectRoot()],
exclude: [/node_modules/, ...virtualModuleFiles],
},
],
Expand Down
57 changes: 0 additions & 57 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { join } from "node:path";

import findCacheDirectory from "find-cache-dir";
import { findUpSync } from "find-up";

/**
* Get the path of the file or directory with input name inside the Storybook cache directory:
Expand All @@ -21,59 +20,3 @@ export function resolvePathInStorybookCache(

return join(cacheDirectory, sub, fileOrDirectoryName);
}

/**
* @returns {string} The root directory of the project
*/
export const getProjectRoot = () => {
let result: string | undefined;
// Allow manual override in cases where auto-detect doesn't work
// biome-ignore lint/complexity/useLiteralKeys: Ignore
if (process.env["STORYBOOK_PROJECT_ROOT"]) {
// biome-ignore lint/complexity/useLiteralKeys: Ignore
return process.env["STORYBOOK_PROJECT_ROOT"];
}

try {
const found = findUpSync(".git", { type: "directory" });
if (found) {
result = join(found, "..");
}
} catch (e) {
//
}
try {
const found = findUpSync(".svn", { type: "directory" });
if (found) {
result = result || join(found, "..");
}
} catch (e) {
//
}
try {
const found = findUpSync(".hg", { type: "directory" });
if (found) {
result = result || join(found, "..");
}
} catch (e) {
//
}

try {
const splitDirname = __dirname.split("node_modules");
result = result || (splitDirname.length >= 2 ? splitDirname[0] : undefined);
} catch (e) {
//
}

try {
const found = findUpSync(".yarn", { type: "directory" });
if (found) {
result = result || join(found, "..");
}
} catch (e) {
//
}

return result || process.cwd();
};