Skip to content

Commit

Permalink
chore(cli): Merge updates from 'main' into 'prerelease/9.0.0-alpha' (#…
Browse files Browse the repository at this point in the history
…2866)

* release v8.11.2 (#2793)

* v8.11.2

* Fix scripting errors

* Bump heroku-color (#2797)

* fix(authorizations): surface api warnings in temporary fix (#2804)

* Surface api warnings for authorizations:create

* Surface remaining api warnings for authorizations command

* Add api warning header test for authorizations:create

* Update response type in authorizations:info

* release v8.11.3 (#2807)

* v8.11.3

* Fix scripting errors

* chore(telemetry): add environment variable to optionally disable telemetry (#2810)

* Add DISABLE_TELEMETRY env variable & functionality

* WIP create test for DISABLE_TELEMETRY env variable

* Update DISABLE_TELEMETRY and remove wip test

* Clean code up

* release v8.11.4 (#2811)

* v8.11.4

* Fix scripting errors

* chore: update opentelemetry/instrumentation to 0.50.0 and improve integration test runs (#2834)

* chore: update opentelemetry/instrumentation to 0.50.0

* chore: change ubuntu runner for integration tests

* chore: change integration runner back to ubuntu-latest

* chore: remove macos run from integration tests

* test: try out run integration tests without oclif/test

* Revert "test: try out run integration tests without oclif/test"

This reverts commit 2ed9824.

* chore: remove run-v5 integration test run

* test: run integration test suites separately

* test: testing location

* test: fix directory location for orgs-v5 integration tests

* fix: add quotation marks around public key in sign/deb script (#2849)

* chore(auth): update warning copy (#2842)

* Update auth copy & tests

* Update test

* release v8.11.5 (#2850)

* v8.11.5

* fix: add missing links back to CLI readme

* chore: separate unit testing and linting (#2858)

* Updated 'heroku-cli-util' dependency version and its dependencies (#2863)

* Updating yarn.lock after merge

* Fixing test

* Removing integration tests for deleted orgs-v5 package

* Fixing tests

---------

Co-authored-by: Zane Whitfield <zwhitfield@salesforce.com>
Co-authored-by: Eric <eblack@salesforce.com>
Co-authored-by: Katy Bowman <katy.bowman@salesforce.com>
  • Loading branch information
4 people authored May 3, 2024
1 parent 794f861 commit a124379
Show file tree
Hide file tree
Showing 95 changed files with 216 additions and 181 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn --immutable --network-timeout 1000000
- run: yarn test
- name: unit tests
run: yarn test
- name: linting
run: yarn lint

integration:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
environment: AcceptanceTests
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
Expand All @@ -38,7 +41,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn --immutable --network-timeout 1500000
- run: yarn lerna run test:integration
- name: Run cli package integration tests
run: |
cd packages/cli
yarn test:integration
acceptance:
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"scripts": {
"build": "lerna run prepack --concurrency 4",
"buildCLI": "cd packages/cli && yarn prepack",
"lint": "lerna run lint",
"test": "lerna run test --concurrency 4",
"lint": "lerna run lint --concurrency 4",
"version": "cp packages/cli/CHANGELOG.md CHANGELOG.md && git add CHANGELOG.md",
"cleanNodeModules": "rm -rf ./packages/*/node_modules && rm -rf ./node_modules && rm -rf ./.yarn/cache",
"migrateCommand": "lerna run --scope=command-migration build && node ./packages/migration/.bin/command-migration.mjs --files",
Expand Down
2 changes: 1 addition & 1 deletion packages/certs-v5/commands/certs/chain.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

// let error = require('../../lib/error.js')
// let readFile = require('../../lib/read_file.js')
Expand Down
2 changes: 1 addition & 1 deletion packages/certs-v5/commands/certs/key.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

// let error = require('../../lib/error.js')
// let readFile = require('../../lib/read_file.js')
Expand Down
6 changes: 3 additions & 3 deletions packages/certs-v5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"dependencies": {
"@heroku-cli/color": "^2.0.1",
"@heroku-cli/notifications": "^1.2.4",
"@heroku/heroku-cli-util": "^8.0.13",
"date-fns": "^1.29.0",
"heroku-cli-util": "^8.0.11",
"inquirer": "^8.2.6",
"lodash": "^4.17.21",
"psl": "^1.1.29"
Expand All @@ -29,7 +29,7 @@
"chai-as-promised": "^7.1.1",
"lolex": "^3.1.0",
"mocha": "^9.2.2",
"nock": "^10.0.6",
"nock": "^13.3.3",
"nyc": "^15.1.0",
"oclif": "3.11.3",
"proxyquire": "^2.1.0",
Expand Down Expand Up @@ -62,7 +62,7 @@
"lint": "eslint . --ext .js --config ../../.eslintrc --ignore-path ../../.eslintignore",
"postpublish": "rm oclif.manifest.json",
"prepack": "oclif manifest",
"test": "nyc mocha --forbid-only \"test/**/*.unit.test.js\" && yarn lint",
"test": "nyc mocha --forbid-only \"test/**/*.unit.test.js\"",
"version": "oclif readme && git add README.md"
}
}
2 changes: 1 addition & 1 deletion packages/certs-v5/test/helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'
/* globals cli */

global.cli = require('heroku-cli-util')
global.cli = require('@heroku/heroku-cli-util')
cli.raiseErrors = true
cli.color.enabled = false

Expand Down
11 changes: 5 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@heroku-cli/schema": "^1.0.25",
"@heroku/buildpack-registry": "^1.0.1",
"@heroku/eventsource": "^1.0.7",
"@heroku/heroku-cli-util": "^8.0.13",
"@oclif/core": "^2.8.11",
"@oclif/core-v1": "npm:@oclif/core@^1.26.2",
"@oclif/plugin-commands": "2.2.2",
Expand All @@ -33,7 +34,7 @@
"@oclif/plugin-which": "2.2.8",
"@opentelemetry/api": "^1.4.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.41.1",
"@opentelemetry/instrumentation": "^0.41.1",
"@opentelemetry/instrumentation": "^0.50.0",
"@opentelemetry/resources": "^1.15.1",
"@opentelemetry/sdk-trace-base": "^1.15.1",
"@opentelemetry/sdk-trace-node": "^1.15.1",
Expand All @@ -55,7 +56,6 @@
"github-url-to-object": "^4.0.4",
"glob": "^10.3.10",
"got": "^9.6.0",
"heroku-cli-util": "^8.0.12",
"http-call": "5.3.0",
"inquirer": "^8.2.6",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -89,7 +89,7 @@
},
"devDependencies": {
"@heroku-cli/schema": "^1.0.25",
"@oclif/test": "^2.3.25",
"@oclif/test": "^2.3.28",
"@types/ansi-styles": "^3.2.1",
"@types/bytes": "^3.1.4",
"@types/chai": "^4.3.14",
Expand Down Expand Up @@ -369,16 +369,15 @@
"build": "rm -rf lib && tsc",
"lint": "eslint . --ext .ts --config ../../.eslintrc --ignore-path ../../.eslintignore-lib",
"postpublish": "rm -f oclif.manifest.json",
"posttest": "yarn lint",
"prepack": "yarn run build && oclif manifest",
"pretest": "tsc -p test --noEmit && cd ../.. && yarn build",
"test:acceptance": "yarn pretest && mocha --forbid-only \"test/**/*.acceptance.test.ts\" && node ./bin/bats-test-runner",
"test:integration": "yarn pretest && mocha --forbid-only \"test/**/*.integration.test.ts\"",
"test:smoke": "yarn pretest && mocha --forbid-only \"test/**/smoke.acceptance.test.ts\"",
"test:unit:justTest:local": "nyc mocha \"test/**/*.unit.test.ts\"",
"test:unit:justTest:ci": "nyc mocha --forbid-only \"test/**/*.unit.test.ts\"",
"test": "yarn pretest && yarn test:unit:justTest:ci && yarn posttest",
"test:local": "yarn pretest && yarn test:unit:justTest:local && yarn posttest",
"test": "yarn pretest && yarn test:unit:justTest:ci",
"test:local": "yarn pretest && yarn test:unit:justTest:local",
"version": "oclif readme --multi && git add README.md ../../docs"
},
"types": "lib/index.d.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ By default, the CLI auth token is only valid for 1 year. To generate a long-live
if (token && token.access_token.expires_in) {
const d = new Date()
d.setSeconds(d.getSeconds() + token.access_token.expires_in)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a long-lived token, use ${color.cmd('heroku authorizations:create')}.`}`)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a token that expires in one year, use ${color.cmd('heroku authorizations:create')}.`}`)
}
} catch (error: any) {
this.warn(error)
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/test/unit/commands/auth/token.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ describe('auth:token', function () {
.command(['auth:token'])
.it('shows "long-term" token generation warning for non-internal users', ctx => {
expect(ctx.stdout).to.equal('foobar\n')
expect(ctx.stderr).to.contain('To generate a long-lived token, use heroku authorizations:create.')
expect(ctx.stderr).to.contain('To generate a token that expires in one year, use heroku')
expect(ctx.stderr).to.contain('authorizations:create.')
expect(ctx.stderr).to.not.contain('All tokens expire one year after we generate it.')
})

Expand All @@ -54,6 +55,6 @@ describe('auth:token', function () {
.it('shows AT2 token generation warning for internal users', ctx => {
expect(ctx.stdout).to.equal('foobar\n')
expect(ctx.stderr).to.contain('All tokens expire one year after we generate it.')
expect(ctx.stderr).to.not.contain('To generate a long-lived token, use heroku authorizations:create.')
expect(ctx.stderr).to.not.contain('To generate a token that expires in one year, use heroku authorizations:create.')
})
})
2 changes: 1 addition & 1 deletion packages/migration/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ import * as Heroku from '@heroku-cli/schema'
}

private migrateHerokuCliUtilsExports(sourceFile: ts.SourceFile, file: string): ts.SourceFile {
const importName = findRequiredPackageVarNameIfExits(sourceFile, 'heroku-cli-util')
const importName = findRequiredPackageVarNameIfExits(sourceFile, '@heroku/heroku-cli-util')

// todo: hoist requires to top of the file?
if (!importName) {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/authorizations.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')

function display(auth) {
const obj = {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/authorizations/create.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const authorizations = require('../../authorizations')

async function run(context, heroku) {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/authorizations/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
const _ = require('lodash')
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/authorizations/info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')
let authorizations = require('../../authorizations')

async function run(context, heroku) {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/authorizations/revoke.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
let auth = await cli.action('Revoking OAuth Authorization', {success: false}, heroku.request({
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/authorizations/rotate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')
let authorizations = require('../../authorizations')

async function run(context, heroku) {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/authorizations/update.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')
let authorizations = require('../../authorizations')

async function run(context, heroku) {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/clients/create.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')
let lib = require('../../clients')

async function run(context, heroku) {
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/clients/destroy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
let id = context.args.id
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/clients/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
const _ = require('lodash')
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/clients/info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
let client = await heroku.get(`/oauth/clients/${context.args.id}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/clients/rotate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
let id = context.args.id
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/clients/update.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')
let lib = require('../../clients')

let empty = o => Object.keys(o).length === 0
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/sessions/destroy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

let cli = require('heroku-cli-util')
let cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
let id = context.args.id
Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/lib/commands/sessions/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')

async function run(context, heroku) {
const _ = require('lodash')
Expand Down
4 changes: 2 additions & 2 deletions packages/oauth-v5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/oauth-v5/<%- commandPath %>"
},
"dependencies": {
"@heroku/heroku-cli-util": "^8.0.13",
"date-fns": "^1.29.0",
"heroku-cli-util": "^8.0.11",
"lodash": "^4.17.21"
},
"devDependencies": {
Expand Down Expand Up @@ -61,7 +61,7 @@
"lint": "eslint . --ext .js --config ../../.eslintrc --ignore-path ../../.eslintignore",
"postpublish": "rm oclif.manifest.json",
"prepack": "oclif manifest",
"test": "cross-env TZ=UTC nyc mocha --forbid-only \"test/**/*.unit.test.js\" && yarn lint",
"test": "cross-env TZ=UTC nyc mocha --forbid-only \"test/**/*.unit.test.js\"",
"version": "oclif readme && git add README.md"
}
}
2 changes: 1 addition & 1 deletion packages/oauth-v5/test/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const nock = require('nock')
const chai = require('chai')
chai.use(require('chai-as-promised'))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const nock = require('nock')
const {expect} = require('chai')
const cmd = require('../../../lib/commands/authorizations/create')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const {expect} = require('chai')
const nock = require('nock')
const cmd = require('../../../lib/commands/authorizations')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const nock = require('nock')
const {expect} = require('chai')
const cmd = require('../../../lib/commands/authorizations/info')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const nock = require('nock')
const cmd = require('../../../lib/commands/authorizations/revoke')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const nock = require('nock')
const cmd = require('../../../lib/commands/authorizations/rotate')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const nock = require('nock')
const cmd = require('../../../lib/commands/authorizations/update')

Expand Down
2 changes: 1 addition & 1 deletion packages/oauth-v5/test/unit/clients/create.unit.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const cli = require('heroku-cli-util')
const cli = require('@heroku/heroku-cli-util')
const {expect} = require('chai')
let nock = require('nock')
let cmd = require('../../../lib/commands/clients/create')
Expand Down
Loading

0 comments on commit a124379

Please sign in to comment.