mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Merge pull request #30643 from storybookjs/norbert/cache-dir-in-proper-place
Core: Always place cache dir inside `node_modules`
This commit is contained in:
commit
91d2a08d08
@ -635,6 +635,7 @@ jobs:
|
||||
command: |
|
||||
cd code
|
||||
yarn local-registry --open &
|
||||
yarn wait-on tcp:127.0.0.1:6001
|
||||
cd ../../
|
||||
mkdir features-1
|
||||
cd features-1
|
||||
|
@ -13,7 +13,7 @@ import findCacheDirectory from 'find-cache-dir';
|
||||
*/
|
||||
export function resolvePathInStorybookCache(fileOrDirectoryName: string, sub = 'default'): string {
|
||||
let cacheDirectory = findCacheDirectory({ name: 'storybook' });
|
||||
cacheDirectory ||= join(process.cwd(), '.cache', 'storybook');
|
||||
cacheDirectory ||= join(process.cwd(), 'node_modules', '.cache', 'storybook');
|
||||
|
||||
return join(cacheDirectory, sub, fileOrDirectoryName);
|
||||
}
|
||||
|
@ -177,7 +177,18 @@ export const scaffoldNewProject = async (
|
||||
// If target directory has a .cache folder, remove it
|
||||
// so that it does not block the creation of the new project
|
||||
await rm(`${targetDir}/.cache`, { recursive: true, force: true });
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
try {
|
||||
// If target directory has a node_modules folder, remove it
|
||||
// so that it does not block the creation of the new project
|
||||
await rm(`${targetDir}/node_modules`, { recursive: true, force: true });
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
||||
try {
|
||||
// Create new project in temp directory
|
||||
await execa.command(createScript, {
|
||||
stdio: 'pipe',
|
||||
@ -220,7 +231,7 @@ export const scaffoldNewProject = async (
|
||||
logger.line(1);
|
||||
};
|
||||
|
||||
const BASE_IGNORED_FILES = ['.git', '.gitignore', '.DS_Store', '.cache'];
|
||||
const BASE_IGNORED_FILES = ['.git', '.gitignore', '.DS_Store', '.cache', 'node_modules'];
|
||||
|
||||
const IGNORED_FILES_BY_PACKAGE_MANAGER: Record<CoercedPackageManagerName, string[]> = {
|
||||
npm: [...BASE_IGNORED_FILES],
|
||||
|
Loading…
x
Reference in New Issue
Block a user