Skip to content

Commit

Permalink
fix: add pre-release warning text, hide pre-release commands from hel…
Browse files Browse the repository at this point in the history
…p listing (#674)

1. fixed app install unzip concurrency issue
  • Loading branch information
shazron authored May 16, 2023
1 parent def82b7 commit 0eaa3fb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/BaseCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ class BaseCommand extends Command {
get appVersion () {
return this.pjson.version
}

preRelease () {
this.log(chalk.yellow('Pre-release warning: This command is in pre-release, and not suitable for production.'))
}
}

BaseCommand.flags = {
Expand Down
15 changes: 9 additions & 6 deletions src/commands/app/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ 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')

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 @@ -100,10 +103,8 @@ class InstallCommand extends BaseCommand {

this.spinner.start(`Extracting app package to ${destFolderPath}...`)
return unzipper.Open.file(zipFilePath)
.then((d) => {
d.extract({ path: destFolderPath, concurrency: 5 })
this.spinner.succeed(`Extracted app package to ${destFolderPath}`)
})
.then((d) => d.extract({ path: destFolderPath }))
.then(() => this.spinner.succeed(`Extracted app package to ${destFolderPath}`))
}

async validateConfig (outputPath, configFileName, configFilePath = path.join(outputPath, configFileName)) {
Expand Down Expand Up @@ -140,8 +141,10 @@ class InstallCommand extends BaseCommand {
}
}

InstallCommand.description = `Install an Adobe Developer App Builder packaged app
`
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.flags = {
...BaseCommand.flags,
Expand Down
9 changes: 7 additions & 2 deletions src/commands/app/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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 DEFAULTS = {
OUTPUT_ZIP_FILE: 'app.zip',
Expand All @@ -31,6 +32,8 @@ 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 @@ -268,8 +271,10 @@ class Pack extends BaseCommand {
}
}

Pack.description = `Package a new Adobe Developer App for distribution
`
Pack.hidden = true // hide from help for pre-release

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

Pack.flags = {
...BaseCommand.flags,
Expand Down

0 comments on commit 0eaa3fb

Please sign in to comment.