Skip to content

Commit

Permalink
Revert "feat: version blocking for CLI (aws-amplify#7834)" (aws-ampli…
Browse files Browse the repository at this point in the history
…fy#8170)

This reverts commit 045ef3b.
  • Loading branch information
SwaySway authored and marcvberg committed Oct 13, 2021
1 parent ef53a5f commit 50eb70a
Show file tree
Hide file tree
Showing 22 changed files with 115 additions and 921 deletions.
206 changes: 88 additions & 118 deletions .circleci/config.yml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions packages/amplify-cli-core/src/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export type $TSContext = {
newUserInfo?: $TSAny;
filesystem: IContextFilesystem;
template: IContextTemplate;
versionInfo: CLIVersionInfo;
};

export type CategoryName = string;
Expand Down Expand Up @@ -144,11 +143,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
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
"engines": {
"node": ">=12.0.0"
},
"amplify-cli": {
"configuration": {
"minimumCompatibleCLIVersion": "5.2.0"
}
},
"dependencies": {
"@aws-cdk/cloudformation-diff": "~1.119.0",
"amplify-app": "3.0.10",
Expand Down
11 changes: 1 addition & 10 deletions packages/amplify-cli/src/__tests__/context-manager.test.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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());
};
Loading

0 comments on commit 50eb70a

Please sign in to comment.