Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
fix: move targets to pjson
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 7, 2018
1 parent 4a74726 commit 35a077b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Expand Up @@ -12,8 +12,8 @@ jobs:
- checkout
- restore_cache: &restore_cache
keys:
- v3-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
- v3-yarn-{{checksum ".circleci/config.yml"}}
- v4-yarn-{{checksum ".circleci/config.yml"}}-{{ checksum "yarn.lock"}}
- v4-yarn-{{checksum ".circleci/config.yml"}}
- run: .circleci/greenkeeper
- run: yarn add -D nyc@11 @oclif/nyc-config@1 mocha-junit-reporter@1
- run: yarn run build
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
export PATH=/usr/local/share/.config/yarn/global/node_modules/.bin:$PATH
semantic-release -e @oclif/semantic-release
- save_cache:
key: v3-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
key: v4-yarn-{{checksum ".circleci/config.yml"}}-{{checksum "yarn.lock"}}
paths:
- ~/cli/node_modules
- /usr/local/share/.cache/yarn
Expand Down
12 changes: 10 additions & 2 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@heroku-cli/color": "^1.1.3",
"@oclif/command": "^1.4.7",
"@oclif/config": "^1.3.65",
"@oclif/config": "^1.3.66",
"@oclif/errors": "^1.0.3",
"@oclif/plugin-help": "^1.2.3",
"@oclif/plugin-warn-if-update-available": "^1.2.4",
Expand Down Expand Up @@ -63,6 +63,14 @@
"oclif": {
"commands": "./lib/commands",
"bin": "oclif-dev",
"targets": [
"darwin-x64",
"linux-x86",
"linux-x64",
"linux-arm",
"win32-x64",
"win32-x86"
],
"plugins": [
"@oclif/plugin-warn-if-update-available",
"@oclif/plugin-help"
Expand All @@ -72,7 +80,7 @@
"scripts": {
"build": "rm -rf lib && tsc",
"lint": "tsc -p test --noEmit && tslint -p test -t stylish",
"postpublish": "rm .oclif.manifest.json",
"postpublish": "node ./bin/run publish:s3 --xz && node ./bin/run publish:github --xz && rm .oclif.manifest.json",
"posttest": "yarn run lint",
"prepublishOnly": "yarn run build && node ./bin/run manifest && node ./bin/run readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
Expand Down
5 changes: 3 additions & 2 deletions src/commands/publish/github.ts
Expand Up @@ -12,7 +12,6 @@ export default class Publish extends Command {

static flags = {
root: flags.string({char: 'r', description: 'path to oclif CLI root', default: '.', required: true}),
targets: flags.string({char: 't', description: 'comma-separated targets to build for (e.g. darwin-x64, win32-x86)', required: true}),
'node-version': flags.string({description: 'node version of binary to get', default: process.versions.node, required: true}),
xz: flags.boolean({description: 'also create xz tarballs'}),
prerelease: flags.boolean({description: 'identify as prerelease'}),
Expand All @@ -31,12 +30,14 @@ export default class Publish extends Command {
const config = await Tarballs.config(root)
const version = config.version
const baseWorkspace = qq.join([config.root, 'tmp', 'base'])
const targets = config.pjson.oclif.targets
if (!targets) throw new Error('specify oclif.targets in package.json')

// first create the generic base workspace that will be copied later
await Tarballs.build({config, channel, output: baseWorkspace, version})

const tarballs: {target: string, tarball: string}[] = []
for (let [platform, arch] of flags.targets.split(',').map(t => t.split('-'))) {
for (let [platform, arch] of targets.map(t => t.split('-'))) {
const t = await Tarballs.target({config, platform, arch, channel, version, baseWorkspace, nodeVersion, xz: flags.xz})
tarballs.push(t)
}
Expand Down
7 changes: 4 additions & 3 deletions src/commands/publish/s3.ts
Expand Up @@ -18,9 +18,8 @@ export default class Publish extends Command {

static flags = {
root: flags.string({char: 'r', description: 'path to oclif CLI root', default: '.', required: true}),
targets: flags.string({char: 't', description: 'comma-separated targets to build for (e.g. darwin-x64, win32-x86)', required: true}),
'node-version': flags.string({description: 'node version of binary to get', default: process.versions.node, required: true}),
channel: flags.string({char: 'c', description: 'channel to publish (e.g. "stable" or "beta")', required: true}),
channel: flags.string({char: 'c', description: 'channel to publish (e.g. "stable" or "beta")', default: 'stable', required: true}),
bucket: flags.string({char: 'b', description: 's3 bucket to use'}),
xz: flags.boolean({description: 'also create xz tarballs'}),
}
Expand All @@ -33,12 +32,14 @@ export default class Publish extends Command {
const config = await Tarballs.config(root)
const version = channel === 'stable' ? config.version : `${config.version}-${channel}.${await Tarballs.gitSha(config.root, {short: true})}`
const baseWorkspace = qq.join([config.root, 'tmp', 'base'])
const targets = config.pjson.oclif.targets
if (!targets) throw new Error('specify oclif.targets in package.json')

// first create the generic base workspace that will be copied later
await Tarballs.build({config, channel, output: baseWorkspace, version})

const tarballs: {target: string, tarball: string}[] = []
for (let [platform, arch] of flags.targets.split(',').map(t => t.split('-'))) {
for (let [platform, arch] of targets.map(t => t.split('-'))) {
const t = await Tarballs.target({config, platform, arch, channel, version, baseWorkspace, nodeVersion, xz: flags.xz})
tarballs.push(t)
}
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -64,9 +64,9 @@
dependencies:
debug "^3.1.0"

"@oclif/config@^1.3.65":
version "1.3.65"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.3.65.tgz#29fa49602b6fab452c11bc29be2f9ac87256b852"
"@oclif/config@^1.3.66":
version "1.3.66"
resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.3.66.tgz#f62483a7c5ba0b72d705091ec67abdf7ea88fdf8"
dependencies:
debug "^3.1.0"

Expand Down

0 comments on commit 35a077b

Please sign in to comment.