Skip to content

Commit

Permalink
fix: app pack and app install help was hidden in the README text (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
shazron committed Feb 1, 2024
1 parent 77fbf16 commit 6d4b656
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
9 changes: 2 additions & 7 deletions src/commands/app/install.js
Expand Up @@ -21,7 +21,6 @@ const { validateJsonWithSchema } = require('../../lib/install-helper')
const jsYaml = require('js-yaml')
const { USER_CONFIG_FILE, DEPLOY_CONFIG_FILE } = require('../../lib/defaults')
const ora = require('ora')
const chalk = require('chalk')

// eslint-disable-next-line node/no-missing-require
const libConfig = require('@adobe/aio-cli-lib-app-config')
Expand All @@ -30,8 +29,6 @@ class InstallCommand extends BaseCommand {
async run () {
const { args, flags } = await this.parse(InstallCommand)

this.preRelease()

aioLogger.debug(`flags: ${JSON.stringify(flags, null, 2)}`)
aioLogger.debug(`args: ${JSON.stringify(args, null, 2)}`)

Expand Down Expand Up @@ -155,10 +152,8 @@ class InstallCommand extends BaseCommand {
}
}

InstallCommand.hidden = true // hide from help for pre-release

InstallCommand.description = chalk.yellow(`(Pre-release) This command will support installing apps packaged by '<%= config.bin %> app pack'.
`)
InstallCommand.description = `This command will support installing apps packaged by '<%= config.bin %> app pack'.
`

InstallCommand.flags = {
...BaseCommand.flags,
Expand Down
9 changes: 2 additions & 7 deletions src/commands/app/pack.js
Expand Up @@ -20,7 +20,6 @@ const execa = require('execa')
const { loadConfigFile, writeFile } = require('../../lib/import-helper')
const { getObjectValue } = require('../../lib/app-helper')
const ora = require('ora')
const chalk = require('chalk')
const junk = require('junk')

// eslint-disable-next-line node/no-missing-require
Expand All @@ -37,8 +36,6 @@ class Pack extends BaseCommand {
async run () {
const { args, flags } = await this.parse(Pack)

this.preRelease()

aioLogger.debug(`flags: ${JSON.stringify(flags, null, 2)}`)
aioLogger.debug(`args: ${JSON.stringify(args, null, 2)}`)

Expand Down Expand Up @@ -356,10 +353,8 @@ class Pack extends BaseCommand {
}
}

Pack.hidden = true // hide from help for pre-release

Pack.description = chalk.yellow(`(Pre-release) This command will support packaging apps for redistribution.
`)
Pack.description = `This command will support packaging apps for redistribution.
`

Pack.flags = {
...BaseCommand.flags,
Expand Down
15 changes: 11 additions & 4 deletions test/BaseCommand.test.js
Expand Up @@ -67,12 +67,19 @@ test('args', async () => {

test('basecommand defines method', async () => {
const cmd = new TheCommand()

expect(cmd.getLaunchUrlPrefix).toBeDefined()
expect(typeof cmd.getLaunchUrlPrefix).toBe('function')
mockAioConfig.get.mockReturnValue('http://prefix?fake=')
expect(cmd.getLaunchUrlPrefix()).toBe('http://prefix?fake=')
mockAioConfig.get.mockReturnValue(null)
expect(cmd.getLaunchUrlPrefix()).toEqual(expect.stringContaining('https://'))
expect(cmd.preRelease).toBeDefined()
expect(typeof cmd.preRelease).toBe('function')
})

test('preRelease() outputs to log', async () => {
const cmd = new TheCommand()
cmd.log = jest.fn()

cmd.preRelease()
expect(cmd.log).toHaveBeenCalledWith(expect.stringMatching('Pre-release warning: This command is in pre-release, and not suitable for production.'))
})

test('getLaunchUrlPrefix() warns on older url', async () => {
Expand Down
1 change: 1 addition & 0 deletions test/commands/app/install.test.js
Expand Up @@ -85,6 +85,7 @@ test('exports', () => {
expect(TheCommand.prototype instanceof BaseCommand).toBeTruthy()
expect(typeof TheCommand.flags).toBe('object')
expect(TheCommand.description).toBeDefined()
expect(TheCommand.hidden).toBeFalsy()
})

test('description', async () => {
Expand Down
1 change: 1 addition & 0 deletions test/commands/app/pack.test.js
Expand Up @@ -82,6 +82,7 @@ test('exports', async () => {
expect(TheCommand.prototype instanceof BaseCommand).toBeTruthy()
expect(typeof TheCommand.flags).toBe('object')
expect(TheCommand.description).toBeDefined()
expect(TheCommand.hidden).toBeFalsy()
})

test('description', async () => {
Expand Down

0 comments on commit 6d4b656

Please sign in to comment.