diff --git a/packages/cli/src/commands/remove-plugin/removePlugin.test.ts b/packages/cli/src/commands/remove-plugin/removePlugin.test.ts index 51a910c8a5..c801aaaa02 100644 --- a/packages/cli/src/commands/remove-plugin/removePlugin.test.ts +++ b/packages/cli/src/commands/remove-plugin/removePlugin.test.ts @@ -1,12 +1,22 @@ -// Test Suite for removePlugin command. +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import fse from 'fs-extra'; import path from 'path'; -import { - // removeExportStatementFromPlugins, - removePluginDependencyFromApp, - //removePluginDirectory, -} from './removePlugin'; +import { removePluginDependencyFromApp } from './removePlugin'; const rootDir = fse.realpathSync(process.cwd().replace('/cli', '')); const BACKSTAGE = `@backstage`; @@ -21,7 +31,9 @@ describe('removePlugin', () => { const testPluginName = 'yarn-test-package'; const testPluginPackage = `${BACKSTAGE}/plugin-${testPluginName}`; - let packageFileContents = JSON.parse(fse.readFileSync(packageFile, 'utf8')); + const packageFileContents = JSON.parse( + fse.readFileSync(packageFile, 'utf8'), + ); packageFileContents.dependencies[testPluginPackage] = '0.1.0'; it('should remove plugin dependency from /packages/app/package.json', async () => { @@ -45,9 +57,7 @@ describe('removePlugin', () => { }); }); }); - +// Still to implement // test remove plugin dependency from app - // remove plugin from directory - // remove symlink from lerna scope diff --git a/packages/cli/src/commands/remove-plugin/removePlugin.ts b/packages/cli/src/commands/remove-plugin/removePlugin.ts index b1fa469be2..51f10fbc7a 100644 --- a/packages/cli/src/commands/remove-plugin/removePlugin.ts +++ b/packages/cli/src/commands/remove-plugin/removePlugin.ts @@ -33,7 +33,7 @@ export const checkExists = async (rootDir: string, pluginName: string) => { color: 'green', }).start(); try { - let pathExist = await fse.pathExists(destination); + const pathExist = await fse.pathExists(destination); if (pathExist) { spinner.succeed(); console.log( @@ -116,6 +116,9 @@ export const removeStatementContainingID = async (file: string, ID: string) => { throw new Error(`File was not modified.`); }; +const capitalize = (str: string): string => + str.charAt(0).toUpperCase() + str.slice(1); + export const removeExportStatementFromPlugins = async ( pluginsFile: string, pluginName: string, @@ -224,9 +227,6 @@ export const removePluginDependencyFromApp = async ( } }; -const capitalize = (str: string): string => - str.charAt(0).toUpperCase() + str.slice(1); - const removePlugin = async () => { const questions: Question[] = [ {