Merge pull request #1111 from napi-rs/fix-cli-copy-binary

Fix cli copy binary
This commit is contained in:
LongYinan 2022-04-01 13:57:18 +08:00 committed by GitHub
commit 1a2198e13c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 386 additions and 321 deletions

View file

@ -41,16 +41,16 @@
},
"devDependencies": {
"@octokit/rest": "^18.12.0",
"@types/inquirer": "^8.2.0",
"@types/inquirer": "^8.2.1",
"@types/js-yaml": "^4.0.5",
"@types/lodash-es": "^4.17.6",
"clipanion": "^3.1.0",
"colorette": "^2.0.16",
"core-js": "^3.21.1",
"debug": "^4.3.3",
"debug": "^4.3.4",
"env-paths": "^3.0.0",
"fdir": "^5.2.0",
"inquirer": "^8.2.1",
"inquirer": "^8.2.2",
"js-yaml": "^4.1.0",
"lodash-es": "4.17.21",
"toml": "^3.0.0",

View file

@ -88,9 +88,13 @@ export class BuildCommand extends Command {
)} field in ${chalk.underline(chalk.yellowBright('Cargo.toml'))}`,
})
targetTripleDir = Option.String('--target', process.env.RUST_TARGET ?? '', {
targetTripleDir = Option.String(
'--target',
process.env.RUST_TARGET ?? process.env.CARGO_BUILD_TARGET ?? '',
{
description: `Bypass to ${chalk.green('cargo build --target')}`,
})
},
)
features?: string = Option.String('--features', {
description: `Bypass to ${chalk.green('cargo build --features')}`,

View file

@ -77,7 +77,7 @@ export class PrePublishCommand extends Command {
cwd: pkgDir,
env: process.env,
})
if (!this.skipGHRelease) {
if (!this.skipGHRelease && repo && owner) {
debug(
`Start upload [${chalk.greenBright(
dstPath,
@ -85,14 +85,14 @@ export class PrePublishCommand extends Command {
)
try {
const releaseInfo = await octokit!.repos.getReleaseByTag({
repo: repo!,
owner: owner!,
tag: pkgInfo.tag!,
repo: repo,
owner: owner,
tag: pkgInfo.tag,
})
const dstFileStats = statSync(dstPath)
const assetInfo = await octokit!.repos.uploadReleaseAsset({
owner: owner!,
repo: repo!,
owner: owner,
repo: repo,
name: filename,
release_id: releaseInfo.data.id,
mediaType: { format: 'raw' },
@ -135,9 +135,16 @@ export class PrePublishCommand extends Command {
const headCommit = (await spawn('git log -1 --pretty=%B'))
.toString('utf8')
.trim()
debug(`Github repository: ${process.env.GITHUB_REPOSITORY}`)
const [owner, repo] = process.env.GITHUB_REPOSITORY!.split('/')
const { GITHUB_REPOSITORY } = process.env
if (!GITHUB_REPOSITORY) {
return {
owner: null,
repo: null,
pkgInfo: { name: null, version: null, tag: null },
}
}
debug(`Github repository: ${GITHUB_REPOSITORY}`)
const [owner, repo] = GITHUB_REPOSITORY.split('/')
const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN,
})

View file

@ -13,7 +13,7 @@
"build-release": "node ../../cli/scripts/index.js build --js false --release"
},
"dependencies": {
"@types/lodash": "^4.14.179",
"@types/lodash": "^4.14.181",
"lodash": "^4.17.21"
}
}

View file

@ -12,6 +12,6 @@
"table": "^6.8.0"
},
"devDependencies": {
"@types/dockerode": "^3.3.3"
"@types/dockerode": "^3.3.6"
}
}

View file

@ -70,39 +70,39 @@
},
"devDependencies": {
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^4.0.0",
"@taplo/cli": "^0.3.2",
"@types/debug": "^4.1.7",
"@types/lodash-es": "^4.17.6",
"@types/node": "^17.0.21",
"@types/node": "^17.0.23",
"@types/sinon": "^10.0.11",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"ava": "^4.1.0",
"benny": "^3.7.1",
"c8": "^7.11.0",
"colorette": "^2.0.16",
"cross-env": "^7.0.3",
"esbuild": "^0.14.25",
"eslint": "^8.11.0",
"esbuild": "^0.14.29",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.4",
"lerna": "^4.0.0",
"lint-staged": "^12.3.5",
"lint-staged": "^12.3.7",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"rollup": "^2.70.0",
"prettier": "^2.6.1",
"rollup": "^2.70.1",
"shx": "^0.3.4",
"sinon": "^13.0.1",
"source-map-support": "^0.5.21",
"ts-node": "^10.7.0",
"tslib": "^2.3.1",
"typescript": "^4.6.2"
"typescript": "^4.6.3"
},
"packageManager": "yarn@3.2.0"
}

642
yarn.lock

File diff suppressed because it is too large Load diff