Skip to content

Commit

Permalink
Merge pull request #19734 from storybookjs/chore/fix-repro-generation
Browse files Browse the repository at this point in the history
Maintenance: Delete node_modules in repro generation
  • Loading branch information
yannbf committed Nov 2, 2022
2 parents b9af9f7 + ad615a6 commit c18d0c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/generate-repros-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
CLEANUP_REPRO_NODE_MODULES: true
steps:
- uses: actions/setup-node@v3
with:
Expand Down
13 changes: 10 additions & 3 deletions scripts/next-repro-generators/generate-repros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pLimit from 'p-limit';
import prettyTime from 'pretty-hrtime';
import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-extra';
import { program } from 'commander';
import { AbortController } from 'node-abort-controller';
import type { AbortController } from 'node-abort-controller';
import { directory } from 'tempy';

import reproTemplates from '../../code/lib/cli/src/repro-templates';
Expand All @@ -16,9 +16,9 @@ import { JsPackageManagerFactory } from '../../code/lib/cli/src/js-package-manag
import { maxConcurrentTasks } from '../utils/maxConcurrentTasks';

import { localizeYarnConfigFiles, setupYarn } from './utils/yarn';
import { GeneratorConfig } from './utils/types';
import type { GeneratorConfig } from './utils/types';
import { getStackblitzUrl, renderTemplate } from './utils/template';
import { JsPackageManager } from '../../code/lib/cli/src/js-package-manager';
import type { JsPackageManager } from '../../code/lib/cli/src/js-package-manager';
import { runRegistry } from '../tasks/run-registry';

const OUTPUT_DIRECTORY = join(__dirname, '..', '..', 'repros');
Expand Down Expand Up @@ -161,6 +161,13 @@ const runGenerators = async (

await addDocumentation(baseDir, { name, dirName });

// Remove node_modules to save space and avoid GH actions failing
// They're not uploaded to the git repros repo anyway
if (process.env.CLEANUP_REPRO_NODE_MODULES) {
await remove(join(beforeDir, 'node_modules'));
await remove(join(baseDir, 'node_modules'));
}

console.log(
`✅ Created ${dirName} in ./${relative(
process.cwd(),
Expand Down

0 comments on commit c18d0c3

Please sign in to comment.