Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: Delete node_modules in repro generation #19734

Merged
merged 2 commits into from
Nov 2, 2022
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: 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