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

use npm pack instead of yarn pack #52563

Merged
merged 3 commits into from
Jul 11, 2023
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
26 changes: 25 additions & 1 deletion .github/actions/next-stats-action/src/prepare/repo-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,37 @@ module.exports = (actionInfo) => {
Array.from(pkgDatas.keys()).map(async (pkgName) => {
const { pkgPath, packedPkgPath } = pkgDatas.get(pkgName)

await execa('yarn', ['pack', '-f', packedPkgPath], {
let cleanup = null

if (pkgName === '@next/swc') {
// next-swc uses a gitignore to prevent the committing of native builds but it doesn't
// use files in package.json because it publishes to individual packages based on architecture.
// When we used yarn to pack these packages the gitignore was ignored so the native builds were packed
// however npm does respect gitignore when packing so we need to remove it in this specific case
// to ensure the native builds are packed for use in gh actions and related scripts
await fs.rename(
path.join(pkgPath, 'native/.gitignore'),
path.join(pkgPath, 'disabled-native-gitignore')
)
cleanup = async () => {
await fs.rename(
path.join(pkgPath, 'disabled-native-gitignore'),
path.join(pkgPath, 'native/.gitignore')
)
}
}

const { stdout } = await execa('npm', ['pack'], {
cwd: pkgPath,
env: {
...process.env,
COREPACK_ENABLE_STRICT: '0',
},
})
await fs.rename(path.resolve(pkgPath, stdout.trim()), packedPkgPath)
if (cleanup) {
await cleanup()
}
})
)
return pkgPaths
Expand Down
1 change: 0 additions & 1 deletion packages/react-dev-overlay/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions packages/react-refresh-utils/.gitignore

This file was deleted.