Skip to content

Commit

Permalink
Revert "feat: version blocking for CLI (#8512)" (#8522)
Browse files Browse the repository at this point in the history
This reverts commit 52edf2b.

Co-authored-by: Colin Ihrig <colihrig@amazon.com>
  • Loading branch information
cjihrig and cjihrig-aws committed Oct 22, 2021
1 parent b440461 commit c48453b
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 809 deletions.
9 changes: 5 additions & 4 deletions packages/amplify-cli-core/src/errors/index.ts
Expand Up @@ -24,10 +24,11 @@ export class NotInitializedError extends Error {
public constructor() {
super();
this.name = 'NotInitializedError';
this.message = `No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.`;

this.message = `
No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.
`;
this.stack = undefined;
}
}
6 changes: 0 additions & 6 deletions packages/amplify-cli-core/src/index.ts
Expand Up @@ -51,7 +51,6 @@ export type $TSContext = {
newUserInfo?: $TSAny;
filesystem: IContextFilesystem;
template: IContextTemplate;
versionInfo: CLIVersionInfo;
};

export type CategoryName = string;
Expand Down Expand Up @@ -146,11 +145,6 @@ export type DeploymentSecrets = {
}>;
};

export type CLIVersionInfo = {
currentCLIVersion: string;
minimumCompatibleCLIVersion: string;
};

/**
* Plugins or other packages bundled with the CLI that pass a file to a system command or execute a binary file must export a function named
* "getPackageAssetPaths" of this type.
Expand Down
5 changes: 0 additions & 5 deletions packages/amplify-cli/package.json
Expand Up @@ -32,11 +32,6 @@
"engines": {
"node": ">=12.0.0"
},
"amplify-cli": {
"configuration": {
"minimumCompatibleCLIVersion": "6.4.0"
}
},
"dependencies": {
"@aws-cdk/cloudformation-diff": "~1.124.0",
"amplify-app": "3.0.16",
Expand Down
11 changes: 1 addition & 10 deletions packages/amplify-cli/src/__tests__/context-manager.test.ts
Expand Up @@ -23,24 +23,15 @@ jest.mock('../domain/amplify-usageData/', () => {
});
jest.mock('../app-config');

jest.mock('../version-gating', () => ({
getCurrentCLIVersion: jest.fn().mockReturnValue(() => '5.2.0'),
getMinimumCompatibleCLIVersion: jest.fn().mockReturnValue(() => '5.0.0'),
}));

describe('test attachUsageData', () => {
const version = '5.2.0';
const version = 'latestversion';
const mockContext = jest.genMockFromModule<Context>('../domain/context');

mockContext.input = new Input([
'/Users/userName/.nvm/versions/node/v8.11.4/bin/node',
'/Users/userName/.nvm/versions/node/v8.11.4/bin/amplify',
'status',
]);
mockContext.versionInfo = {
currentCLIVersion: '5.2.0',
minimumCompatibleCLIVersion: '5.0.0',
};
mockContext.pluginPlatform = new PluginPlatform();
mockContext.pluginPlatform.plugins['core'] = [new PluginInfo('', version, '', new PluginManifest('', ''))];

Expand Down
Expand Up @@ -6,8 +6,6 @@ import { constructMockPluginPlatform } from './mock-plugin-platform';

import { getAllCategoryPluginInfo } from '../../../extensions/amplify-helpers/get-all-category-pluginInfos';

jest.mock('../../../version-gating');

test('getAllCategoryPluginInfo', () => {
const mockPluginPlatform = constructMockPluginPlatform();
const mockProcessArgv = [
Expand Down
Expand Up @@ -3,8 +3,6 @@ import { constructMockPluginPlatform } from './mock-plugin-platform';
import { constructContext } from '../../../context-manager';
import { getCategoryPluginInfo } from '../../../extensions/amplify-helpers/get-category-pluginInfo';

jest.mock('../../../version-gating');

test('getCategoryPluginInfo returns the first pluginInfo to match category', () => {
const mockPluginPlatform = constructMockPluginPlatform();
const mockProcessArgv = [
Expand Down
Expand Up @@ -30,10 +30,10 @@ describe('getProjectMeta', () => {
});
it('should throw NotInitializedError when metaFile does not exists', () => {
stateManager_mock.metaFileExists.mockImplementation(() => false);
expect(() => getProjectMeta()).toThrow(
`No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.`,
);
expect(() => getProjectMeta()).toThrow(`
No Amplify backend project files detected within this folder. Either initialize a new Amplify project or pull an existing project.
- "amplify init" to initialize a new Amplify project
- "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Admin UI.
`);
});
});
266 changes: 0 additions & 266 deletions packages/amplify-cli/src/__tests__/version-gating.test.ts

This file was deleted.

5 changes: 3 additions & 2 deletions packages/amplify-cli/src/commands/version.ts
@@ -1,6 +1,7 @@
import { printer } from 'amplify-prompts';
import { Context } from '../domain/context';
import { printer } from 'amplify-prompts';
import { getAmplifyVersion } from '../extensions/amplify-helpers/get-amplify-version';

export const run = (context: Context) => {
printer.info(context.versionInfo.currentCLIVersion);
printer.info(getAmplifyVersion());
};

0 comments on commit c48453b

Please sign in to comment.