-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish architecture specific packages
- Loading branch information
1 parent
06c903f
commit 8e604ee
Showing
8 changed files
with
97 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ pkg/ | |
dist/ | ||
.parcel-cache | ||
node/*.flow | ||
artifacts | ||
npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
const fs = require('fs'); | ||
|
||
let index = fs.readFileSync(__dirname + '/node/index.d.ts', 'utf8'); | ||
let dir = `${__dirname}/../`; | ||
let index = fs.readFileSync(dir + '/node/index.d.ts', 'utf8'); | ||
index = '// @flow\n' + index; | ||
index = index.replace(/export interface (.*?) \{((?:.|\n)*?)\}/g, 'export type $1 = {|$2|};'); | ||
index = index.replace(/export declare function/g, 'declare export function'); | ||
|
||
let targets = fs.readFileSync(__dirname + '/node/targets.d.ts', 'utf8'); | ||
let targets = fs.readFileSync(dir + '/node/targets.d.ts', 'utf8'); | ||
targets = targets.replace(/export interface (.*?) \{((?:.|\n)*?)\}/g, 'export type $1 = {|$2|};'); | ||
index = index.replace("import type {Targets} from './targets';", targets); | ||
|
||
fs.writeFileSync(__dirname + '/node/index.js.flow', index); | ||
fs.writeFileSync(dir + '/node/index.js.flow', index); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const fs = require('fs'); | ||
const pkg = require('../package.json'); | ||
|
||
const dir = `${__dirname}/..`; | ||
const triples = [ | ||
'x86_64-apple-darwin', | ||
'x86_64-unknown-linux-gnu', | ||
'x86_64-pc-windows-msvc', | ||
'aarch64-apple-darwin', | ||
'aarch64-unknown-linux-gnu', | ||
'armv7-unknown-linux-gnueabihf', | ||
'aarch64-unknown-linux-musl', | ||
'x86_64-unknown-linux-musl' | ||
]; | ||
const cpuToNodeArch = { | ||
x86_64: 'x64', | ||
aarch64: 'arm64', | ||
i686: 'ia32', | ||
armv7: 'arm', | ||
}; | ||
const sysToNodePlatform = { | ||
linux: 'linux', | ||
freebsd: 'freebsd', | ||
darwin: 'darwin', | ||
windows: 'win32', | ||
}; | ||
|
||
let optionalDependencies = {}; | ||
|
||
for (let triple of triples) { | ||
let [cpu, , os, abi] = triple.split('-'); | ||
cpu = cpuToNodeArch[cpu] || cpu; | ||
os = sysToNodePlatform[os] || os; | ||
|
||
let t = `${os}-${cpu}`; | ||
if (abi) { | ||
t += '-' + abi; | ||
} | ||
|
||
let name = `parcel-css.${t}.node`; | ||
|
||
let pkg2 = {...pkg}; | ||
pkg2.name += '-' + t; | ||
pkg2.os = [os]; | ||
pkg2.cpu = [cpu]; | ||
pkg2.main = name; | ||
pkg2.files = [name]; | ||
delete pkg2.napi; | ||
delete pkg2.devDependencies; | ||
delete pkg2.dependencies; | ||
delete pkg2.optionalDependencies; | ||
delete pkg2.targets; | ||
delete pkg2.scripts; | ||
delete pkg2.types; | ||
|
||
optionalDependencies[pkg2.name] = '^' + pkg.version; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
try { | ||
fs.mkdirSync(dir + '/npm/' + t); | ||
} catch (err) {} | ||
fs.writeFileSync(`${dir}/npm/${t}/package.json`, JSON.stringify(pkg2, false, 2) + '\n'); | ||
fs.copyFileSync(`${dir}/artifacts/bindings-${triple}/${name}`, `${dir}/npm/${t}/${name}`); | ||
fs.writeFileSync(`${dir}/npm/${t}/README.md`, `This is the ${triple} build of @parcel/css. See https://github.com/parcel-bundler/parcel-css for details.`); | ||
} | ||
|
||
pkg.optionalDependencies = optionalDependencies; | ||
fs.writeFileSync(`${dir}/package.json`, JSON.stringify(pkg, false, 2) + '\n'); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think the
^
should be omitted