Skip to content
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
2 changes: 1 addition & 1 deletion packages/next/build/swc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const path = require('path')
const bindings = loadBinding(
path.join(__dirname, '../../../native'),
'next-swc',
'next-swc'
'@next/swc'
)

async function transform(src, options) {
Expand Down
3 changes: 3 additions & 0 deletions packages/next/build/swc/npm/darwin-arm64/README.md
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"
Expand Down
3 changes: 3 additions & 0 deletions packages/next/build/swc/npm/darwin-x64/README.md
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"
Expand Down
3 changes: 3 additions & 0 deletions packages/next/build/swc/npm/linux-x64-gnu/README.md
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",
Copy link
Member

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?

Copy link
Member Author

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 the publish-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.

"version": "0.0.0",
"os": [
"linux"
Expand Down
3 changes: 0 additions & 3 deletions packages/next/build/swc/npm/next-swc-darwin-arm64/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/next/build/swc/npm/next-swc-darwin-x64/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/next/build/swc/npm/next-swc-linux-x64-gnu/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/next/build/swc/npm/next-swc-win32-x64-msvc/README.md

This file was deleted.

3 changes: 3 additions & 0 deletions packages/next/build/swc/npm/win32-x64-msvc/README.md
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"
Expand Down
27 changes: 12 additions & 15 deletions scripts/publish-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Member Author

Choose a reason for hiding this comment

The 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'
)}`
)
Expand All @@ -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(
Expand Down