Skip to content

Commit 93b7d31

Browse files
philnashdkundel
andauthored
chore(plugin-assets): updates to @twilio/cli-core v7 (#419)
* chore(plugin-assets): updates to @twilio/cli-core v7 Replaces @oclif/command and @oclif/config with @oclif/core Updates ./bin/run command and adds ./bin/dev command Sets engines property in package to Node 14 (matches @oclif/core) * chore(plugin-serverless): updates to @twilio/cli-core v7 Replaces `@oclif/command` and `@oclif/config` with `@oclif/core` Updates `./bin/run` command and adds `./bin/dev` command Sets engines property in package to Node 14 (matches `@oclif/core`) Updates commands to call `await this.parse` - For commands that inherit from `TwilioClientCommand`, flags and args are already parsed into `this.flags` and `this.args` when `super.run()` is called. This removes the call to parse a second time and uses `this.flags` and `this.args` instead * fix(plugin-assets): make *.cmd files runnable * chore(plugin-assets): adds package.json main property Copied from: https://github.com/oclif/hello-world/blob/main/src/index.ts Co-authored-by: Dominik Kundel <[email protected]>
1 parent 238e391 commit 93b7d31

File tree

9 files changed

+40
-18
lines changed

9 files changed

+40
-18
lines changed

Diff for: packages/plugin-assets/bin/dev

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env node
2+
3+
const oclif = require('@oclif/core');
4+
5+
// In dev mode -> use ts-node and dev plugins
6+
process.env.NODE_ENV = 'development';
7+
8+
// In dev mode, always show stack traces
9+
oclif.settings.debug = true;
10+
11+
// Configure the Twilio CLI environment
12+
require('@twilio/cli-core').configureEnv();
13+
14+
// Start the CLI
15+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle);

Diff for: packages/plugin-assets/bin/dev.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\dev" %*

Diff for: packages/plugin-assets/bin/run

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/usr/bin/env node
22
// Load up the command module *first* so that we're the parent rather than
33
// some other dependency.
4-
const command = require('@oclif/command');
4+
5+
const oclif = require('@oclif/core');
56

67
require('@twilio/cli-core').configureEnv();
7-
command.run()
8-
.then(require('@oclif/command/flush'))
9-
.catch(require('@oclif/errors/handle'));
8+
9+
oclif
10+
.run()
11+
.then(require('@oclif/core/flush'))
12+
.catch(require('@oclif/core/handle'));

Diff for: packages/plugin-assets/bin/run.cmd

100644100755
File mode changed.

Diff for: packages/plugin-assets/package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,24 @@
66
"contributors": [
77
"Phil Nash <[email protected]>"
88
],
9+
"main": "src/index.js",
910
"dependencies": {
10-
"@oclif/command": "^1.5.19",
11-
"@oclif/config": "^1.13.3",
11+
"@oclif/core": "^1.14.2",
1212
"@twilio-labs/serverless-api": "^5.4.4",
13-
"@twilio/cli-core": "^6.0.0",
13+
"@twilio/cli-core": "^7.0.0",
1414
"inquirer": "^8.0.0",
1515
"ora": "^5.4.0",
1616
"project-name-generator": "^2.1.9"
1717
},
1818
"devDependencies": {
19-
"@oclif/dev-cli": "^1.22.2",
20-
"@oclif/plugin-help": "^2.2.1",
19+
"@oclif/plugin-help": "^5.1.12",
2120
"@oclif/test": "^1.2.5",
2221
"@twilio/cli-test": "^2.1.1",
2322
"jest": "^26.6.3",
2423
"rimraf": "^3.0.2"
2524
},
2625
"engines": {
27-
"node": ">=10"
26+
"node": ">=14"
2827
},
2928
"files": [
3029
"/oclif.manifest.json",

Diff for: packages/plugin-assets/src/commands/assets/init.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { flags } = require('@oclif/command');
1+
const { Flags } = require('@oclif/core');
22
const { TwilioClientCommand } = require('@twilio/cli-core').baseCommands;
33
const { getPluginConfig } = require('../../pluginConfig');
44
const generateProjectName = require('project-name-generator');
@@ -28,11 +28,11 @@ class InitCommand extends TwilioClientCommand {
2828
}
2929

3030
InitCommand.flags = {
31-
'service-name': flags.string({
31+
'service-name': Flags.string({
3232
description:
3333
'A unique name for your asset service. May only contain alphanumeric characters and hyphens.',
3434
}),
35-
properties: flags.string({
35+
properties: Flags.string({
3636
default: 'service_sid, sid, domain_name',
3737
description:
3838
'The asset service environment properties you would like to display (JSON output always shows all properties).',

Diff for: packages/plugin-assets/src/commands/assets/list.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { flags } = require('@oclif/command');
1+
const { Flags } = require('@oclif/core');
22
const { TwilioClientCommand } = require('@twilio/cli-core').baseCommands;
33
const { getPluginConfig } = require('../../pluginConfig');
44
const { list } = require('../../list');
@@ -25,7 +25,7 @@ class ListCommand extends TwilioClientCommand {
2525
ListCommand.description = 'List all the assets in the service';
2626

2727
ListCommand.flags = {
28-
properties: flags.string({
28+
properties: Flags.string({
2929
default: 'sid, path, url, visibility',
3030
description:
3131
'The asset properties you would like to display (JSON output always shows all properties).',

Diff for: packages/plugin-assets/src/commands/assets/upload.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { flags } = require('@oclif/command');
1+
const { Flags } = require('@oclif/core');
22
const { TwilioClientCommand } = require('@twilio/cli-core').baseCommands;
33
const { getPluginConfig } = require('../../pluginConfig');
44
const { upload } = require('../../upload');
@@ -37,11 +37,11 @@ UploadCommand.args = [
3737
];
3838

3939
UploadCommand.flags = {
40-
protected: flags.boolean({
40+
protected: Flags.boolean({
4141
default: false,
4242
description: "Sets the uploaded asset's visibility to 'protected'",
4343
}),
44-
properties: flags.string({
44+
properties: Flags.string({
4545
default: 'sid, path, url, visibility',
4646
description:
4747
'The asset properties you would like to display (JSON output always shows all properties).',

Diff for: packages/plugin-assets/src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const { run } = require('@oclif/core');
2+
module.exports = run;

0 commit comments

Comments
 (0)