Skip to content

Commit

Permalink
Breaking Change: Oclif core migration (#2270)
Browse files Browse the repository at this point in the history
* Revert "refactor: revert oclif upgrade (#2256)"

This reverts commit f6cb67b.

* chore: update yarn.lock

* chore: run acceptance tests only on node 16

* prerelease: bump cli version to 8.0.2-beta.0

* chore: yarn.lock update

* fix: enable version command

* prerelease: bump cli version to 8.0.2-beta.1

* Revert "prerelease: bump cli version to 8.0.2-beta.1"

This reverts commit a717d57.

* Revert "prerelease: bump cli version to 8.0.2-beta.0"

This reverts commit d01f4aa.
  • Loading branch information
k80bowman committed Mar 16, 2023
1 parent 7edc021 commit 3988765
Show file tree
Hide file tree
Showing 290 changed files with 5,650 additions and 4,121 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
@@ -1,2 +1,5 @@
node_modules
packages/*/lib
packages/*/tmp
tmp
dst
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Expand Up @@ -16,15 +16,15 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
yarn: cache
cache: yarn
- run: yarn --frozen-lockfile --network-timeout 1000000
- run: yarn test

acceptance:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x, 16.x]
node-version: [16.x]
os: [ubuntu-latest, macos-latest]
environment: AcceptanceTests
env:
Expand All @@ -36,9 +36,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
cache: yarn
- run: yarn --frozen-lockfile --network-timeout 1000000
- name: Build packages
run: yarn lerna run prepack
- run: ./bin/run whoami
- run: ./scripts/run-acceptance
- run: yarn lerna run test:acceptance

# dummy job needed to pass changeling compliance because it only watches one build
done:
Expand Down Expand Up @@ -66,7 +69,7 @@ jobs:
run: |
cp yarn.lock packages/cli
cd packages/cli
yarn --frozen-lockfile
yarn --frozen-lockfile --network-timeout 1000000
- name: Building deb
run: ./scripts/pack/deb
- uses: actions/upload-artifact@v3
Expand All @@ -88,7 +91,7 @@ jobs:
run: |
cp yarn.lock packages/cli
cd packages/cli
yarn --frozen-lockfile
yarn --frozen-lockfile --network-timeout 1000000
- name: Building tarballs
run: ./scripts/pack/tarballs
- uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -156,7 +159,7 @@ jobs:
run: |
cp yarn.lock packages/cli
cd packages/cli
yarn --frozen-lockfile --prefer-offline
yarn --frozen-lockfile --prefer-offline --network-timeout 1000000
- name: Upload production artifacts
run: |
cd packages/cli
Expand Down Expand Up @@ -208,7 +211,7 @@ jobs:
- run: |
cp yarn.lock packages/cli
cd packages/cli
yarn --frozen-lockfile
yarn --frozen-lockfile --network-timeout 1000000
./scripts/release/homebrew.js
change-management:
Expand All @@ -225,5 +228,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: |
yarn --frozen-lockfile
yarn --frozen-lockfile --network-timeout 1000000
./scripts/postrelease/change_management
4 changes: 2 additions & 2 deletions .gitignore
Expand Up @@ -10,8 +10,8 @@ node_modules
/tmp
/packages/cli/docs/*

.vscode

**/.DS_Store
./idea
.vscode


1 change: 1 addition & 0 deletions .tool-versions
@@ -0,0 +1 @@
nodejs 16.19.0
9 changes: 6 additions & 3 deletions package.json
@@ -1,12 +1,13 @@
{
"devDependencies": {
"@oclif/tslint": "^3.1.1",
"eslint": "5.13.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"lerna": "^3.22.1",
"lerna": "^6.4.1",
"promise-request-retry": "^1.0.2",
"standard": "12.0.1",
"tmp": "^0.2.1"
Expand All @@ -19,12 +20,14 @@
]
},
"engines": {
"node": ">=10.0.0"
"node": ">=14"
},
"private": true,
"scripts": {
"build": "lerna run prepack",
"test": "lerna run test --concurrency 4",
"version": "cp packages/cli/CHANGELOG.md CHANGELOG.md && git add CHANGELOG.md"
"version": "cp packages/cli/CHANGELOG.md CHANGELOG.md && git add CHANGELOG.md",
"cleanNodeModules": "rm -rf ./packages/*/node_modules && rm -rf ./node_modules"
},
"workspaces": [
"packages/*"
Expand Down
9 changes: 5 additions & 4 deletions packages/addons-v5/package.json
Expand Up @@ -19,14 +19,15 @@
"printf": "0.6.1"
},
"devDependencies": {
"@heroku-cli/dev-cli": "^1.26.13",
"@oclif/plugin-legacy": "^1.2.0",
"@oclif/core": "^1.26.2",
"@oclif/plugin-legacy": "^1.3.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"lolex": "^3.1.0",
"mocha": "^5.2.0",
"nock": "9.0.13",
"nyc": "^15.1.0",
"oclif": "3.6.4",
"sinon": "^6.3.5"
},
"files": [
Expand All @@ -44,9 +45,9 @@
"repository": "heroku/cli",
"scripts": {
"postpublish": "rm oclif.manifest.json",
"prepack": "oclif-dev manifest",
"prepack": "oclif manifest",
"release": "np",
"test": "nyc mocha",
"version": "oclif-dev readme && git add README.md"
"version": "oclif readme && git add README.md"
}
}
2 changes: 1 addition & 1 deletion packages/addons-v5/test/commands/addons/create.js
Expand Up @@ -5,7 +5,7 @@ const cmd = commands.find(c => c.topic === 'addons' && c.command === 'create')
const { expect } = require('chai')
const lolex = require('lolex')
const _ = require('lodash')
const Config = require('@oclif/config')
const { Config } = require('@oclif/core')
const sinon = require('sinon')
let config

Expand Down
11 changes: 6 additions & 5 deletions packages/apps-v5/package.json
Expand Up @@ -15,7 +15,8 @@
"repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/apps-v5/<%- commandPath %>"
},
"dependencies": {
"@heroku-cli/command": "^8.4.1",
"@heroku-cli/command": "^9.0.2",
"@oclif/core": "^1.26.2",
"filesize": "^4.0.0",
"fs-extra": "^7.0.1",
"heroku-cli-util": "^8.0.11",
Expand All @@ -29,15 +30,15 @@
"urijs": "1.19.11"
},
"devDependencies": {
"@heroku-cli/dev-cli": "^1.26.13",
"@oclif/plugin-legacy": "^1.2.0",
"@oclif/plugin-legacy": "^1.3.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"lolex": "^3.1.0",
"mocha": "^5.2.0",
"mockdate": "^2.0.2",
"netrc-parser": "^3.1.6",
"nock": "^10.0.6",
"oclif": "3.6.4",
"proxyquire": "^2.1.0",
"set-tz": "^0.1.0",
"std-mocks": "1.0.1",
Expand All @@ -61,8 +62,8 @@
"repository": "heroku/cli",
"scripts": {
"postpublish": "rm oclif.manifest.json",
"prepack": "oclif-dev manifest && oclif-dev readme",
"prepack": "oclif manifest",
"test": "mocha",
"version": "oclif-dev readme && git add README.md"
"version": "oclif readme && git add README.md"
}
}
2 changes: 1 addition & 1 deletion packages/apps-v5/test/commands/apps/create.js
Expand Up @@ -5,7 +5,7 @@ const cli = require('heroku-cli-util')
const nock = require('nock')
const expect = require('chai').expect
const apps = commands.find(c => c.topic === 'apps' && c.command === 'create')
const Config = require('@oclif/config')
const { Config } = require('@oclif/core')
let config

describe('apps:create', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-v5/test/commands/config/set.js
Expand Up @@ -12,7 +12,7 @@ const assertExit = require('../../assert_exit.js')

describe('config:set', () => {
beforeEach(async () => {
config = await require('@oclif/config').load()
config = await require('@oclif/core').Config.load()
cli.mockConsole()
cli.exit.mock()
})
Expand Down
1 change: 1 addition & 0 deletions packages/apps/.eslintrc
Expand Up @@ -4,5 +4,6 @@
"oclif-typescript"
],
"rules": {
"camelcase": "off"
}
}
5 changes: 3 additions & 2 deletions packages/apps/bin/run
@@ -1,4 +1,5 @@
#!/usr/bin/env node

require('@oclif/command').run()
.catch(require('@oclif/errors/handle'))
const oclif = require('@oclif/core')

oclif.run().catch(require('@oclif/core/handle'))
33 changes: 16 additions & 17 deletions packages/apps/package.json
Expand Up @@ -5,24 +5,18 @@
"bugs": "https://github.com/heroku/heroku-cli-plugin-apps/issues",
"dependencies": {
"@heroku-cli/color": "^1.1.14",
"@heroku-cli/command": "^8.4.1",
"@heroku-cli/command": "^9.0.2",
"@heroku-cli/schema": "^1.0.25",
"@oclif/command": "^1",
"@oclif/config": "^1",
"cli-ux": "^5.3.2",
"@oclif/core": "^1.26.2",
"inquirer": "^7.0.1",
"shell-escape": "^0.2.0",
"tslib": "^1",
"urijs": "^1.19.11"
},
"devDependencies": {
"@fancy-test/nock": "^0.1.1",
"@heroku-cli/dev-cli": "^1.26.13",
"@oclif/plugin-help": "^2",
"@oclif/test": "^1",
"@oclif/test": "^2.2.20",
"@types/chai": "^4",
"@types/mocha": "^5",
"@types/node": "^10",
"@types/shell-escape": "^0.2.0",
"@types/supports-color": "^5.3.0",
"@types/urijs": "^1.19.4",
Expand All @@ -32,12 +26,14 @@
"eslint-config-oclif-typescript": "^0.1.0",
"globby": "^10",
"mocha": "^5",
"nock": "^13.0.1",
"nyc": "^15.1.0",
"oclif": "3.6.4",
"ts-node": "^10",
"typescript": "3.7.5"
"typescript": "4.8.4"
},
"engines": {
"node": ">=10.0.0"
"node": ">=14"
},
"files": [
"/lib",
Expand All @@ -51,20 +47,23 @@
],
"license": "MIT",
"oclif": {
"commands": "./lib/commands",
"additionalHelpFlags": [
"-h"
],
"additionalVersionFlags": [
"-v"
],
"bin": "heroku",
"devPlugins": [
"@oclif/plugin-help"
]
"commands": "./lib/commands"
},
"repository": "heroku/heroku-cli-plugin-apps",
"scripts": {
"postpack": "rm -f oclif.manifest.json",
"lint": "eslint . --ext .ts --config .eslintrc",
"pretest": "tsc -p test --noEmit",
"posttest": "yarn lint",
"prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
"prepack": "rm -rf lib && tsc -b && oclif manifest",
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif-dev readme && git add README.md"
"version": "oclif readme && git add README.md"
}
}
18 changes: 11 additions & 7 deletions packages/apps/src/commands/domains/add.ts
@@ -1,11 +1,14 @@
import {color} from '@heroku-cli/color'
import {Command, flags} from '@heroku-cli/command'
import * as Heroku from '@heroku-cli/schema'
import cli from 'cli-ux'
import {CliUx} from '@oclif/core'
import Spinner from '@oclif/core/lib/cli-ux/action/spinner'
import {prompt} from 'inquirer'
import * as shellescape from 'shell-escape'
import waitForDomain from '../../lib/wait-for-domain'

const cli = CliUx.ux

interface DomainCreatePayload {
hostname: string;
sni_endpoint: string | null;
Expand Down Expand Up @@ -71,8 +74,9 @@ export default class DomainsAdd extends Command {
}

async run() {
const {args, flags} = this.parse(DomainsAdd)
const {args, flags} = await this.parse(DomainsAdd)
const {hostname} = args
const action = new Spinner()

const domainCreatePayload: DomainCreatePayload = {
hostname,
Expand All @@ -81,7 +85,7 @@ export default class DomainsAdd extends Command {

let certs: Array<Heroku.SniEndpoint> = []

cli.action.start(`Adding ${color.green(domainCreatePayload.hostname)} to ${color.app(flags.app)}`)
action.start(`Adding ${color.green(domainCreatePayload.hostname)} to ${color.app(flags.app)}`)
if (flags.cert) {
domainCreatePayload.sni_endpoint = flags.cert
} else {
Expand All @@ -91,14 +95,14 @@ export default class DomainsAdd extends Command {
}

if (certs.length > 1) {
cli.action.stop('resolving SNI endpoint')
action.stop('resolving SNI endpoint')
const certSelection = await this.certSelect(certs)

if (certSelection) {
domainCreatePayload.sni_endpoint = certSelection
}

cli.action.start(`Adding ${color.green(domainCreatePayload.hostname)} to ${color.app(flags.app)}`)
action.start(`Adding ${color.green(domainCreatePayload.hostname)} to ${color.app(flags.app)}`)
}

try {
Expand All @@ -122,10 +126,10 @@ export default class DomainsAdd extends Command {
}
}
}
} catch (error) {
} catch (error: any) {
cli.error(error)
} finally {
cli.action.stop()
action.stop()
}
}
}

0 comments on commit 3988765

Please sign in to comment.