Skip to content
Closed
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"extends": "@adobe/eslint-config-aio-lib-config",
"globals": {
"WSK_PROPS_PATH": true,
"createFileSystem": true,
"clearMockedFs": true,
"fixtureFile": true,
"fixtureFileWithTimeZoneAdjustment": true,
"fixtureJson": true,
"fixtureZip": true,
"fakeFileSystem": true,
"createTestBaseFlagsFunction": true,
"createTestFlagsFunction": true
},
Expand Down
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,44 @@
"@adobe/aio-lib-core-config": "^5",
"@adobe/aio-lib-core-networking": "^5",
"@adobe/aio-lib-runtime": "^6",
"@oclif/core": "^1.3.0",
"@oclif/core": "^2",
"@types/jest": "^29.5.3",
"chalk": "^4.1.2",
"dayjs": "^1.10.4",
"debug": "^4.1.1",
"inquirer": "^8.2.0",
"js-yaml": "^4",
"lodash.clonedeep": "^4.5.0",
"node-abort-controller": "^3.1.1",
"openwhisk": "^3.21.2",
"openwhisk-fqn": "^0.0.2",
"properties-reader": "2.2.0",
"sha1": "^1.1.1"
},
"devDependencies": {
"@adobe/eslint-config-aio-lib-config": "^3.0.0",
"@adobe/eslint-config-aio-lib-config": "^4.0.0",
"@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11",
"babel-jest": "^29.5.0",
"babel-runtime": "^6.26.0",
"dedent-js": "^1.0.1",
"eol": "^0.9.1",
"eslint": "^8.46.0",
"eslint": "^8.57.1",
"eslint-config-oclif": "^4.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsdoc": "^42.0.0",
"eslint-plugin-n": "^15.7",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsdoc": "^48.11.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-promise": "^6.6.0",
"execa": "^4.0.0",
"jest": "^29.6.2",
"jest-junit": "^16.0.0",
"jest-plugin-fs": "^2.9.0",
"oclif": "^3.2.0",
"stdout-stderr": "^0.1.9"
"stdout-stderr": "^0.1.9",
"typescript": "^5.1.6"
},
"engines": {
"node": ">=18"
Expand All @@ -69,9 +71,9 @@
"repository": "adobe/aio-cli-plugin-runtime",
"scripts": {
"eslint-fix": "eslint src test e2e --fix",
"posttest": "eslint src test e2e",
"test": "npm run unit-tests",
"unit-tests": "jest --ci",
"lint": "eslint src test e2e",
"test": "npm run unit-tests && npm run lint",
"unit-tests": "jest --ci --runInBand test",
"prepack": "oclif manifest && oclif readme --no-aliases",
"postpack": "rm -f oclif.manifest.json",
"version": "oclif readme --no-aliases && git add README.md",
Expand Down
5 changes: 5 additions & 0 deletions src/RuntimeBaseCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const { AbortController } = require('node-abort-controller')
global.AbortController = AbortController

const { Command, Flags } = require('@oclif/core')

const { propertiesFile, PropertyEnv, PropertyDefault } = require('./properties')
Expand Down Expand Up @@ -155,4 +158,6 @@ RuntimeBaseCommand.flags = {
})
}

RuntimeBaseCommand.args = {}

module.exports = RuntimeBaseCommand
18 changes: 7 additions & 11 deletions src/commands/runtime/action/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const fs = require('fs')
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { createKeyValueArrayFromFlag, createKeyValueArrayFromFile, createComponentsfromSequence, getKeyValueArrayFromMergedParameters } = require('@adobe/aio-lib-runtime').utils
const { kindForFileExtension } = require('../../../kinds')
const { Flags } = require('@oclif/core')
const { Flags, Args } = require('@oclif/core')

class ActionCreate extends RuntimeBaseCommand {
isUpdate () { return false }
Expand Down Expand Up @@ -66,7 +66,7 @@ class ActionCreate extends RuntimeBaseCommand {
if (!flags.kind && !flags.docker) {
throw (new Error(ActionCreate.errorMessages.missingKindForZip))
}
exec.code = fs.readFileSync(args.actionPath).toString('base64')
exec.code = Buffer.from(fs.readFileSync(args.actionPath)).toString('base64')
} else {
exec.code = fs.readFileSync(args.actionPath, { encoding: 'utf8' })
}
Expand Down Expand Up @@ -224,15 +224,10 @@ class ActionCreate extends RuntimeBaseCommand {
}
}

ActionCreate.args = [
{
name: 'actionName',
required: true
},
{
name: 'actionPath'
}
]
ActionCreate.args = {
actionName: Args.string({ required: true }),
actionPath: Args.string()
}

ActionCreate.flags = {
...RuntimeBaseCommand.flags,
Expand Down Expand Up @@ -311,6 +306,7 @@ ActionCreate.flags = {
}

ActionCreate.description = 'Creates an Action'

ActionCreate.errorMessages = {
websecure: 'Cannot specify --web-secure without also specifying --web [true|raw]',
sequenceWithAction: 'Cannot specify sequence and a code artifact at the same time',
Expand Down
11 changes: 5 additions & 6 deletions src/commands/runtime/action/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { Flags } = require('@oclif/core')
const { Flags, Args } = require('@oclif/core')

class ActionDelete extends RuntimeBaseCommand {
async run () {
Expand All @@ -29,12 +29,11 @@ class ActionDelete extends RuntimeBaseCommand {
}
}

ActionDelete.args = [
{
name: 'actionName',
ActionDelete.args = {
actionName: Args.string({
required: true
}
]
})
}

ActionDelete.flags = {
...RuntimeBaseCommand.flags,
Expand Down
11 changes: 5 additions & 6 deletions src/commands/runtime/action/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ governing permissions and limitations under the License.
const fs = require('fs')
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { fileExtensionForKind } = require('../../../kinds')
const { Flags } = require('@oclif/core')
const { Flags, Args } = require('@oclif/core')

class ActionGet extends RuntimeBaseCommand {
async run () {
Expand Down Expand Up @@ -93,12 +93,11 @@ class ActionGet extends RuntimeBaseCommand {
}
}

ActionGet.args = [
{
name: 'actionName',
ActionGet.args = {
actionName: Args.string({
required: true
}
]
})
}

ActionGet.flags = {
...RuntimeBaseCommand.flags,
Expand Down
11 changes: 5 additions & 6 deletions src/commands/runtime/action/invoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ governing permissions and limitations under the License.
*/

const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { Flags } = require('@oclif/core')
const { Flags, Args } = require('@oclif/core')
const { getKeyValueObjectFromMergedParameters } = require('@adobe/aio-lib-runtime').utils

class ActionInvoke extends RuntimeBaseCommand {
Expand Down Expand Up @@ -49,12 +49,11 @@ class ActionInvoke extends RuntimeBaseCommand {
}
}

ActionInvoke.args = [
{
name: 'actionName',
ActionInvoke.args = {
actionName: Args.string({
required: true
}
]
})
}

ActionInvoke.flags = {
...RuntimeBaseCommand.flags,
Expand Down
13 changes: 6 additions & 7 deletions src/commands/runtime/action/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ governing permissions and limitations under the License.
const moment = require('dayjs')
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { parsePackageName } = require('@adobe/aio-lib-runtime').utils
const { Flags, CliUx: cli } = require('@oclif/core')
const { Flags, Args, ux } = require('@oclif/core')
const decorators = require('../../../decorators').decorators()

class ActionList extends RuntimeBaseCommand {
Expand Down Expand Up @@ -86,20 +86,19 @@ class ActionList extends RuntimeBaseCommand {
}
}
}
cli.ux.table(result, columns)
ux.table(result, columns)
}
} catch (err) {
await this.handleError('failed to list the actions', err)
}
}
}

ActionList.args = [
{
name: 'packageName',
ActionList.args = {
packageName: Args.string({
required: false
}
]
})
}

ActionList.flags = {
...RuntimeBaseCommand.flags,
Expand Down
10 changes: 1 addition & 9 deletions src/commands/runtime/action/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ class ActionUpdate extends ActionCreate {
isUpdate () { return true }
}

ActionUpdate.args = [
{
name: 'actionName',
required: true
},
{
name: 'actionPath'
}
]
ActionUpdate.args = ActionCreate.args

ActionUpdate.flags = ActionCreate.flags

Expand Down
15 changes: 7 additions & 8 deletions src/commands/runtime/activation/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
const { Flags } = require('@oclif/core')
const { Flags, Args } = require('@oclif/core')
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { printLogs } = require('@adobe/aio-lib-runtime').utils

class ActivationGet extends RuntimeBaseCommand {
async run () {
const { args, flags } = await this.parse(ActivationGet)
let id = args.activationID
let id = args.activationId
try {
const ow = await this.wsk()
if (flags.last) {
Expand All @@ -28,7 +28,7 @@ class ActivationGet extends RuntimeBaseCommand {
}
}
if (!id) {
this.error('missing required argument activationID')
this.error('missing required argument activationId')
}

if (flags.logs) {
Expand All @@ -45,11 +45,10 @@ class ActivationGet extends RuntimeBaseCommand {
}
}

ActivationGet.args = [
{
name: 'activationID'
}
]
ActivationGet.args = {
activationId: Args.string({
})
}

ActivationGet.flags = {
...RuntimeBaseCommand.flags,
Expand Down
12 changes: 5 additions & 7 deletions src/commands/runtime/activation/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ governing permissions and limitations under the License.

const moment = require('dayjs')
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const { Flags, CliUx: cli } = require('@oclif/core')
const { Flags, Args, ux } = require('@oclif/core')
const decorators = require('../../../decorators').decorators()
const statusStrings = ['success', 'app error', 'dev error', 'sys error']

Expand Down Expand Up @@ -187,7 +187,7 @@ class ActivationList extends RuntimeBaseCommand {
}
}
if (listActivation) {
cli.ux.table(listActivation, columns, {
ux.table(listActivation, columns, {
'no-truncate': true
})
}
Expand All @@ -198,11 +198,9 @@ class ActivationList extends RuntimeBaseCommand {
}
}

ActivationList.args = [
{
name: 'action_name'
}
]
ActivationList.args = {
action_name: Args.string({})
}

ActivationList.flags = {
...RuntimeBaseCommand.flags,
Expand Down
10 changes: 4 additions & 6 deletions src/commands/runtime/activation/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
governing permissions and limitations under the License.
*/

const { Flags } = require('@oclif/core')
const { Flags, Args } = require('@oclif/core')
const RuntimeBaseCommand = require('../../../RuntimeBaseCommand')
const rtLib = require('@adobe/aio-lib-runtime')
const printLogs = rtLib.utils.printLogs
Expand Down Expand Up @@ -86,11 +86,9 @@ class ActivationLogs extends RuntimeBaseCommand {
}
}

ActivationLogs.args = [
{
name: 'activationId'
}
]
ActivationLogs.args = {
activationId: Args.string({})
}

ActivationLogs.flags = {
...RuntimeBaseCommand.flags,
Expand Down
Loading