Some checks failed
Test examples / Test Examples (20) (push) Has been cancelled
Test examples / Test Examples (22) (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Trigger Release / start (push) Has been cancelled
Stale issue handler / stale (push) Has been cancelled
Update Font Data / create-pull-request (push) Has been cancelled
build-and-deploy / deploy-target (push) Has been cancelled
build-and-deploy / build (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / build-wasm (nodejs) (push) Has been cancelled
build-and-deploy / build-wasm (web) (push) Has been cancelled
build-and-deploy / Deploy preview tarball (push) Has been cancelled
build-and-deploy / Potentially publish release (push) Has been cancelled
build-and-deploy / publish-turbopack-npm-packages (push) Has been cancelled
build-and-deploy / Deploy examples (push) Has been cancelled
build-and-deploy / thank you, build (push) Has been cancelled
build-and-deploy / Upload Turbopack Bytesize metrics to Datadog (push) Has been cancelled
Rspack Next.js development integration tests / Rspack integration tests (push) Has been cancelled
Rspack Next.js production integration tests / Rspack integration tests (push) Has been cancelled
Turbopack Next.js development integration tests / Next.js integration tests (push) Has been cancelled
Turbopack Next.js production integration tests / Next.js integration tests (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack development test manifest (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack production test manifest (push) Has been cancelled
Upload bundler test manifests to areweturboyet.com / Upload test results (push) Has been cancelled
Update React / create-pull-request (push) Has been cancelled
test-e2e-project-reset-cron / reset-test-project (push) Has been cancelled
Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days / run (push) Has been cancelled
87 lines
2.5 KiB
JavaScript
87 lines
2.5 KiB
JavaScript
// This script must be run with tsx
|
|
|
|
const { existsSync, rmSync, readdirSync } = require('fs')
|
|
const { join } = require('path')
|
|
const { NEXT_DIR, exec, logCommand } = require('./pack-util')
|
|
|
|
const sweepInstalled = existsSync(`${process.env.CARGO_HOME}/bin/cargo-sweep`)
|
|
const cacheInstalled = existsSync(`${process.env.CARGO_HOME}/bin/cargo-cache`)
|
|
|
|
function removeNestedNext(directory) {
|
|
const items = readdirSync(directory, { withFileTypes: true })
|
|
|
|
for (const item of items) {
|
|
const fullPath = join(directory, item.name)
|
|
if (item.isDirectory()) {
|
|
if (item.name === 'node_modules' || item.name === '.git') {
|
|
// skip
|
|
} else if (item.name === '.next') {
|
|
console.log(`removing ${fullPath}`)
|
|
rmSync(fullPath, { recursive: true, force: true })
|
|
} else {
|
|
removeNestedNext(fullPath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
logCommand(`Remove .next directories`)
|
|
removeNestedNext(NEXT_DIR)
|
|
|
|
logCommand(`Remove .cache directories`)
|
|
rmSync(join(NEXT_DIR, 'node_modules/.cache'), { recursive: true, force: true })
|
|
|
|
rmSync('target/rust-analyzer/debug/incremental', {
|
|
recursive: true,
|
|
force: true,
|
|
})
|
|
function removeDirs(title, prefix) {
|
|
logCommand(title)
|
|
rmSync(`${prefix}target/tmp`, { recursive: true, force: true })
|
|
rmSync(`${prefix}target/release/incremental`, {
|
|
recursive: true,
|
|
force: true,
|
|
})
|
|
rmSync(`${prefix}target/debug/incremental`, { recursive: true, force: true })
|
|
}
|
|
removeDirs('Remove incremental dirs', '')
|
|
|
|
exec('Prune pnpm', 'pnpm prune', {
|
|
env: {
|
|
...process.env,
|
|
// We don't need to download the native build as we are not going to use it
|
|
NEXT_SKIP_NATIVE_POSTINSTALL: '1',
|
|
},
|
|
})
|
|
exec('Prune pnpm store', 'pnpm store prune')
|
|
|
|
if (!sweepInstalled) exec('Install cargo-sweep', 'cargo install cargo-sweep')
|
|
|
|
if (existsSync('target')) {
|
|
exec('Sweep', 'cargo sweep --maxsize 20000')
|
|
}
|
|
|
|
function chunkArray(array, chunkSize) {
|
|
const chunks = []
|
|
for (let i = 0; i < array.length; i += chunkSize) {
|
|
chunks.push(array.slice(i, i + chunkSize))
|
|
}
|
|
return chunks
|
|
}
|
|
// git tag -d $(git tag -l)
|
|
const tags = exec('Get tags', `git tag -l`, {
|
|
stdio: ['inherit', 'pipe', 'inherit'],
|
|
})
|
|
.toString()
|
|
.trim()
|
|
.split('\n')
|
|
for (const someTags of chunkArray(tags, 100)) {
|
|
exec('Delete local tags', `git tag -d ${someTags.join(' ')}`)
|
|
}
|
|
exec('Fetch & prune', 'git fetch -p')
|
|
|
|
exec('Git GC', 'git gc --prune=1day')
|
|
|
|
if (!cacheInstalled) exec('Install cargo-cache', 'cargo install cargo-cache')
|
|
exec('Optimize cargo cache', 'cargo cache -e')
|