Skip to content

Commit

Permalink
Merge pull request #56 from IBM-Cloud/chore/remove-devex-commands
Browse files Browse the repository at this point in the history
chore: Removed devx commands
  • Loading branch information
steveclay authored Aug 18, 2023
2 parents 4ba6521 + 86a61eb commit 3dd2068
Show file tree
Hide file tree
Showing 25 changed files with 256 additions and 431 deletions.
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
```
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

# IBM Cloud CLI Extension for VS Code

This extension provides capabilities for the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli/index.html) from directly within the VS Code editor. Use the VS Code command palette to quickly access all `ibmcloud dev` commands, without the need to leave the editor's context.
This extension provides capabilities for the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli/index.html) from directly within the VS Code editor. Use the VS Code command palette to quickly access `ibmcloud` commands, without the need to leave the editor's context.

## Changelog
- v1.0.0
- BREAKING CHANGE: Removed dev commands (list, build, deploy, debug, diag, shell, status, run, stop, console, view, test)
- v0.3.0
- Removed deprecated cf commands
- v0.2.0
Expand Down Expand Up @@ -64,22 +66,19 @@ Easily invoke commands from the IBM Cloud CLI from directly inside of the VS Cod
### Using `ibmcloud dev` workflow:

Steps to get started:
- Create a project using one of the two methods below:
- `ibmcloud dev create` using the IBM Cloud CLI (outside of VS Code)
- [IBM Cloud CLI Documentation](https://cloud.ibm.com/docs/apps?topic=apps-create-deploy-app-cli)
- Create a project or open an existing project. Examples on how to create a project are listed below:
- [Create and deploy a Node.js Express app by using IBM Cloud Schematics](https://cloud.ibm.com/docs/apps?topic=apps-tutorial-node-webapp)
- [Create and deploy a Java Spring app by using IBM Cloud Schematics](https://cloud.ibm.com/docs/apps?topic=apps-tutorial-spring-webapp)
- [Create and deploy a Java Liberty app by using IBM Cloud Schematics](https://cloud.ibm.com/docs/apps?topic=apps-tutorial-liberty-webapp)
- [Create and deploy an app using Code Engine](https://cloud.ibm.com/docs/apps?topic=apps-tutorial-cd-code-engine)
- [Create and deploy a secure app with Devops](https://cloud.ibm.com/docs/apps?topic=apps-tutorial-cd-devsecops)
- [Develop a Kubernetes app with Helm](https://www.ibm.com/cloud/architecture/tutorials/use-develop-kubernetes-app-with-helm-toolchain)
- Open the *project’s folder* in VS Code
- Press Ctrl-K+Ctrl-O or navigate to File -> Open Folder to select folder
- Use the `ibmcloud dev build` command to build the app into a Docker image
- Use the `ibmcloud dev debug` command to run the app in local Docker for development
- Use the `ibmcloud dev run` command to run the app in local Docker in release mode
- Use the `ibmcloud dev deploy` command to deploy the app (in the Docker container) to IBM Cloud
- Use the `ibmcloud dev view` command to open your deployed project on IBM Cloud in a web browser
- Use the `ibmcloud dev console` command to open the IBM Cloud console for your project in a web browser

### Supported CLI/plugins:

- `ibmcloud login/logout` - IBM Cloud User Authentication
- `ibmcloud dev` - IBM Cloud Developer CLI
- `ibmcloud ks` - IBM Cloud Kubernetes Service CLI
- `ibmcloud api` - View IBM Cloud API endpoint
- `ibmcloud regions` - View IBM Cloud regions
Expand Down
85 changes: 2 additions & 83 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ibm-developer",
"displayName": "IBM Cloud CLI",
"description": "Extension for VS Code editor to enable IBM Cloud CLI capabilities from within the editing environment.",
"version": "0.3.0",
"version": "1.0.0",
"publisher": "IBM",
"license": "Apache 2.0 (see LICENSE.txt)",
"bugs": {
Expand Down Expand Up @@ -39,21 +39,6 @@
"onCommand:extension.ibmcloud.logout",
"onCommand:extension.ibmcloud.cli-update",
"onCommand:extension.ibmcloud.cli-install",
"onCommand:extension.ibmcloud.dev.list",
"onCommand:extension.ibmcloud.dev.build.release",
"onCommand:extension.ibmcloud.dev.build",
"onCommand:extension.ibmcloud.dev.debug",
"onCommand:extension.ibmcloud.dev.deploy",
"onCommand:extension.ibmcloud.dev.diag",
"onCommand:extension.ibmcloud.dev.run",
"onCommand:extension.ibmcloud.dev.shell.run",
"onCommand:extension.ibmcloud.dev.shell.tools",
"onCommand:extension.ibmcloud.dev.status",
"onCommand:extension.ibmcloud.dev.stop",
"onCommand:extension.ibmcloud.dev.test",
"onCommand:extension.ibmcloud.dev.console",
"onCommand:extension.ibmcloud.dev.view",
"onCommand:extension.ibmcloud.dev.console.app",
"onCommand:extension.ibmcloud.ks.cluster.get",
"onCommand:extension.ibmcloud.ks.cluster.rm",
"onCommand:extension.ibmcloud.ks.clusters",
Expand Down Expand Up @@ -114,66 +99,6 @@
"command": "extension.ibmcloud.cli-install",
"title": "ibmcloud plugin install --all -r 'IBM Cloud' -f (install cli extensions)"
},
{
"command": "extension.ibmcloud.dev.list",
"title": "ibmcloud dev list"
},
{
"command": "extension.ibmcloud.dev.debug",
"title": "ibmcloud dev debug"
},
{
"command": "extension.ibmcloud.dev.deploy",
"title": "ibmcloud dev deploy"
},
{
"command": "extension.ibmcloud.dev.diag",
"title": "ibmcloud dev diag"
},
{
"command": "extension.ibmcloud.dev.build",
"title": "ibmcloud dev build (debug)"
},
{
"command": "extension.ibmcloud.dev.build.release",
"title": "ibmcloud dev build (release)"
},
{
"command": "extension.ibmcloud.dev.run",
"title": "ibmcloud dev run"
},
{
"command": "extension.ibmcloud.dev.status",
"title": "ibmcloud dev status"
},
{
"command": "extension.ibmcloud.dev.shell.run",
"title": "ibmcloud dev shell (run container)"
},
{
"command": "extension.ibmcloud.dev.shell.tools",
"title": "ibmcloud dev shell (tools container)"
},
{
"command": "extension.ibmcloud.dev.stop",
"title": "ibmcloud dev stop"
},
{
"command": "extension.ibmcloud.dev.test",
"title": "ibmcloud dev test"
},
{
"command": "extension.ibmcloud.dev.console",
"title": "ibmcloud dev console"
},
{
"command": "extension.ibmcloud.dev.console.app",
"title": "ibmcloud dev console <project name>"
},
{
"command": "extension.ibmcloud.dev.view",
"title": "ibmcloud dev view"
},
{
"command": "extension.ibmcloud.ks.cluster.get",
"title": "ibmcloud ks cluster get"
Expand Down Expand Up @@ -318,16 +243,10 @@
"ibm": {
"cli": {
"command": "ibmcloud",
"version": "2.7.0",
"version": "2.18.0",
"url": "https://cloud.ibm.com/docs/cli"
},
"plugins": [
{
"displayName": "dev",
"command": "dev",
"version": "2.10.0",
"url": "https://cloud.ibm.com/docs/cli?topic=cli-idt-cli"
},
{
"displayName": "container-service[kubernetes-service]",
"command": "ks",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/iam/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions src/commands/iam/serviceId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,8 +25,8 @@ export class ServiceIdCommand extends PromptingCommand {

try {
const serviceIds = await getServiceIds();
this.inputs[0].pickerOptions = serviceIds.map((serviceId:ServiceId) => serviceId.name);
} catch(e) {
this.inputs[0].pickerOptions = serviceIds.map((serviceId: ServiceId) => serviceId.name);
} catch (e) {
console.error('Could not provide picker options for service id list');
console.error(e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions src/commands/plugin/install.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,11 +28,11 @@ export class PluginInstallCommand extends PromptingCommand {
];

try {
const installedPlugins = await getInstalledPlugins();
const allPlugins = await getRepoPlugins();
const installedPlugins = await getInstalledPlugins();
const allPlugins = await getRepoPlugins();

// Provide only the plugins that have NOT been installed to user to select from
this.inputs[0].pickerOptions = allPlugins.filter((name:string) => installedPlugins.indexOf(name) == -1);
// Provide only the plugins that have NOT been installed to user to select from
this.inputs[0].pickerOptions = allPlugins.filter((name: string) => installedPlugins.indexOf(name) == -1);
} catch (e) {
console.error('Could not provide picker options for plugin list');
console.error(e);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/plugin/updateUninstall.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/resource/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions src/commands/resource/serviceAlias.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@ import { PromptingCommand } from '../../util/PromptingCommand';
export class ServiceAliasCommand extends PromptingCommand {

async execute(): Promise<any> {
try {
try {
if (!await isCF()) {
await targetCF();
}
Expand All @@ -38,9 +38,9 @@ export class ServiceAliasCommand extends PromptingCommand {
// NOTE: Currently we only provide picker options for service-aliases
// since we can't get a consumable format from CLI to get cf apps
// so user must enter the app name manually
this.inputs[0].pickerOptions = serviceAliases.map((serviceAlias:Resource) => serviceAlias.name);
this.inputs[0].pickerOptions = serviceAliases.map((serviceAlias: Resource) => serviceAlias.name);

} catch(e) {
} catch (e) {
console.error('Could not picker options for service aliases list');
console.error(e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
18 changes: 2 additions & 16 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,6 @@ import { ServiceAliasCommand } from './commands/resource';

const outputChannel = window.createOutputChannel('IBMCloud');
let checkedVersions = false;
let unsupportedDevVersion = false;

/*
* activate method is called when your extension is activated
Expand All @@ -49,7 +48,6 @@ export function activate(context: ExtensionContext) {
registerCommand(context, 'extension.ibmcloud.regions', { cmd: 'ibmcloud', args: ['regions'] }, outputChannel);
registerCommand(context, 'extension.ibmcloud.target', { cmd: 'ibmcloud', args: ['target'] }, outputChannel);


// IBM Cloud DEV commands *************************************
registerCommand(context, 'extension.ibmcloud.dev.list', { cmd: 'ibmcloud', args: ['dev', 'list', '--caller-vscode'] }, outputChannel, true);
registerCommand(context, 'extension.ibmcloud.dev.build', { cmd: 'ibmcloud', args: ['dev', 'build', '--caller-vscode', '--debug'] }, outputChannel, false);
Expand Down Expand Up @@ -135,13 +133,6 @@ function registerPromptingCommand(context: ExtensionContext, key: string, opt, o


function executeCommand(command: SystemCommand): Promise<any> {

const targetPlugin = command.args[0];
if (targetPlugin === 'dev' && unsupportedDevVersion === true) {
const message = `\n\nExecution blocked. You must update you 'dev' extension to the minimum supported version.`;
outputChannel.append(message);
return;
}
return command.execute();
}

Expand Down Expand Up @@ -199,13 +190,8 @@ function checkVersions(): Promise<any> {
// loop over plugins and find match based on name
if (displayName.search(plugin.displayName) >= 0) {
if (semver.gt(plugin.version, cleanVersion)) {
const devPlugin = plugin.command === 'dev';
const message = `\n\nThe recommended minimum version for the IBM Cloud '${plugin.displayName}' CLI plugin is ${plugin.version}.\nYour system is currently running ${cleanVersion}.\nYou ${devPlugin ? 'must' : 'can'} update using the 'ibmcloud plugin update' command or visit ${plugin.url}`;
const message = `\n\nThe recommended minimum version for the IBM Cloud '${plugin.displayName}' CLI plugin is ${plugin.version}.\nYour system is currently running ${cleanVersion}.\nYou can update using the 'ibmcloud plugin update' command or visit ${plugin.url}`;
outputChannel.append(message);

if (devPlugin) {
unsupportedDevVersion = true;
}
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ibmcloud/cf.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions src/ibmcloud/iam.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2016, 2022
* Copyright IBM Corporation 2016, 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
**/

'use strict';

import { SystemCommand } from '../util/SystemCommand';

export interface ServiceId {
Expand All @@ -28,7 +28,7 @@ export interface ServiceId {
* @returns {Promise<Array<ServiceId>}
*/
export async function getServiceIds(): Promise<Array<ServiceId>> {
const getIds = new SystemCommand('ibmcloud', ['iam', 'service-ids', '--output', 'json']);
const getIds = new SystemCommand('ibmcloud', ['iam', 'service-ids', '--output', 'json']);
await getIds.execute();

if (getIds.stderr) {
Expand Down
Loading

0 comments on commit 3dd2068

Please sign in to comment.