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 @next scope for native packages #28046
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@next/swc-darwin-arm64` | ||
|
||
This is the **aarch64-apple-darwin** binary for `@next/swc` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "next-swc-darwin-arm64", | ||
"name": "@next/swc-darwin-arm64", | ||
"version": "0.0.0", | ||
"os": [ | ||
"darwin" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@next/swc-darwin-x64` | ||
|
||
This is the **x86_64-apple-darwin** binary for `@next/swc` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "next-swc-darwin-x64", | ||
"name": "@next/swc-darwin-x64", | ||
"version": "0.0.0", | ||
"os": [ | ||
"darwin" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@next/swc-linux-x64-gnu` | ||
|
||
This is the **x86_64-unknown-linux-gnu** binary for `@next/swc` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "next-swc-linux-x64-gnu", | ||
"name": "@next/swc-linux-x64-gnu", | ||
"version": "0.0.0", | ||
"os": [ | ||
"linux" | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@next/swc-win32-x64-msvc` | ||
|
||
This is the **x86_64-pc-windows-msvc** binary for `@next/swc` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "next-swc-win32-x64-msvc", | ||
"name": "@next/swc-win32-x64-msvc", | ||
"version": "0.0.0", | ||
"os": [ | ||
"win32" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,36 +15,33 @@ const cwd = process.cwd() | |
|
||
// Copy binaries to package folders, update version, and publish | ||
let nativePackagesDir = path.join(cwd, 'packages/next/build/swc/npm') | ||
let nativePackages = await readdir(nativePackagesDir) | ||
for (let nativePackage of nativePackages) { | ||
if (nativePackage === '.gitignore') { | ||
continue | ||
} | ||
let binaryName = `next-swc.${nativePackage.substr(9)}.node` | ||
let platforms = await (await readdir(nativePackagesDir)).filter( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the outside await is not necessary here since filter() is not async There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh yeah, not sure what happened there |
||
(name) => name !== '.gitignore' | ||
) | ||
for (let platform of platforms) { | ||
let binaryName = `next-swc.${platform}.node` | ||
await copy( | ||
path.join(cwd, 'packages/next/build/swc/dist', binaryName), | ||
path.join(nativePackagesDir, nativePackage, binaryName) | ||
path.join(nativePackagesDir, platform, binaryName) | ||
) | ||
let pkg = JSON.parse( | ||
await readFile( | ||
path.join(nativePackagesDir, nativePackage, 'package.json') | ||
) | ||
await readFile(path.join(nativePackagesDir, platform, 'package.json')) | ||
) | ||
pkg.version = version | ||
await writeFile( | ||
path.join(nativePackagesDir, nativePackage, 'package.json'), | ||
path.join(nativePackagesDir, platform, 'package.json'), | ||
JSON.stringify(pkg, null, 2) | ||
) | ||
execSync( | ||
`npm publish ${path.join(nativePackagesDir, nativePackage)}${ | ||
`npm publish ${path.join(nativePackagesDir, platform)}${ | ||
gitref.includes('canary') ? ' --tag canary' : '' | ||
}` | ||
) | ||
// lerna publish in next step will fail if git status is not clean | ||
execSync( | ||
`git update-index --skip-worktree ${path.join( | ||
nativePackagesDir, | ||
nativePackage, | ||
platform, | ||
'package.json' | ||
)}` | ||
) | ||
|
@@ -54,9 +51,9 @@ const cwd = process.cwd() | |
let nextPkg = JSON.parse( | ||
await readFile(path.join(cwd, 'packages/next/package.json')) | ||
) | ||
for (let name of nativePackages) { | ||
for (let platform of platforms) { | ||
let optionalDependencies = nextPkg.optionalDependencies || {} | ||
optionalDependencies[name] = version | ||
optionalDependencies['@next/swc-' + platform] = version | ||
nextPkg.optionalDependencies = optionalDependencies | ||
} | ||
await writeFile( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we initialize these packages on
npm
already with 0.0.0?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No ,
0.0.0
is more of a placeholder as the versions get overwritten in thepublish-native.js
script. The updated versions are not being committed at the moment because it seemed kind of weird to commit it after the tag, but let me know if you have other ideas.