Skip to content

Commit b217fd5

Browse files
authored
chore: remove deprecated feature flags (#413)
* chore: remove deprecated feature flags * fix: build issue * fix: lgtm
1 parent 5716d10 commit b217fd5

27 files changed

+12
-907
lines changed

packages/amplify-codegen/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
"@aws-amplify/graphql-docs-generator": "2.4.2",
2525
"@aws-amplify/graphql-types-generator": "2.8.6",
2626
"@graphql-codegen/core": "1.8.3",
27-
"amplify-codegen-appsync-model-plugin": "^1.22.3",
28-
"amplify-graphql-docs-generator": "^2.2.1",
29-
"amplify-graphql-types-generator": "^2.7.0",
3027
"chalk": "^3.0.0",
3128
"fs-extra": "^8.1.0",
3229
"glob-all": "^3.1.0",

packages/amplify-codegen/src/commands/models.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { parse } = require('graphql');
44
const glob = require('glob-all');
55
const { FeatureFlags, pathManager } = require('amplify-cli-core');
66
const gqlCodeGen = require('@graphql-codegen/core');
7-
const { getModelgenPackage } = require('../utils/getModelgenPackage');
7+
const appSyncDataStoreCodeGen = require('@aws-amplify/appsync-modelgen-plugin');
88
const { validateDartSDK } = require('../utils/validateDartSDK');
99
const { validateAmplifyFlutterCapableZeroThreeFeatures } = require('../utils/validateAmplifyFlutterCapableZeroThreeFeatures');
1010
const { validateAmplifyFlutterCoreLibraryDependency } = require('../utils/validateAmplifyFlutterCoreLibraryDependency');
@@ -79,9 +79,6 @@ async function generateModels(context) {
7979
const outputPath = path.join(projectRoot, getModelOutputPath(context));
8080
const schema = parse(schemaContent);
8181
const projectConfig = context.amplify.getProjectConfig();
82-
//get modelgen package
83-
const modelgenPackageMigrationflag = 'codegen.useAppSyncModelgenPlugin';
84-
const appSyncDataStoreCodeGen = getModelgenPackage(FeatureFlags.getBoolean(modelgenPackageMigrationflag));
8582

8683
const generateIndexRules = readFeatureFlag('codegen.generateIndexRules');
8784
const emitAuthProvider = readFeatureFlag('codegen.emitAuthProvider');

packages/amplify-codegen/src/commands/statements.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ const Ora = require('ora');
55
const loadConfig = require('../codegen-config');
66
const constants = require('../constants');
77
const { ensureIntrospectionSchema, getFrontEndHandler, getAppSyncAPIDetails } = require('../utils');
8-
const { FeatureFlags } = require('amplify-cli-core');
9-
const { getDocsgenPackage } = require('../utils/getDocsgenPackage');
10-
const docsgenPackageMigrationflag = 'codegen.useDocsGeneratorPlugin';
8+
const { generate } = require('@aws-amplify/graphql-docs-generator')
119

1210
async function generateStatements(context, forceDownloadSchema, maxDepth, withoutInit = false, decoupleFrontend = '') {
1311
try {
@@ -36,8 +34,6 @@ async function generateStatements(context, forceDownloadSchema, maxDepth, withou
3634
return;
3735
}
3836

39-
const { generate } = getDocsgenPackage(FeatureFlags.getBoolean(docsgenPackageMigrationflag));
40-
4137
for (const cfg of projects) {
4238
const includeFiles = path.join(projectPath, cfg.includes[0]);
4339
const opsGenDirectory = cfg.amplifyExtension.docsFilePath
@@ -63,7 +59,6 @@ async function generateStatements(context, forceDownloadSchema, maxDepth, withou
6359
separateFiles: true,
6460
language,
6561
maxDepth: maxDepth || cfg.amplifyExtension.maxDepth,
66-
retainCaseStyle: FeatureFlags.getBoolean('codegen.retainCaseStyle')
6762
});
6863
opsGenSpinner.succeed(constants.INFO_MESSAGE_OPS_GEN_SUCCESS + path.relative(path.resolve('.'), opsGenDirectory));
6964
} finally {

packages/amplify-codegen/src/commands/types.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ const Ora = require('ora');
55
const constants = require('../constants');
66
const loadConfig = require('../codegen-config');
77
const { ensureIntrospectionSchema, getFrontEndHandler, getAppSyncAPIDetails } = require('../utils');
8-
const { FeatureFlags } = require('amplify-cli-core');
9-
const { getTypesgenPackage } = require('../utils/getTypesgenPackage');
10-
const typesgenPackageMigrationflag = 'codegen.useTypesGeneratorPlugin';
8+
const { generate } = require('@aws-amplify/graphql-types-generator');
119

1210
async function generateTypes(context, forceDownloadSchema, withoutInit = false, decoupleFrontend = '') {
1311
let frontend = decoupleFrontend;
@@ -38,8 +36,6 @@ async function generateTypes(context, forceDownloadSchema, withoutInit = false,
3836
({ projectPath } = context.amplify.getEnvInfo());
3937
}
4038

41-
const { generate } = getTypesgenPackage(FeatureFlags.getBoolean(typesgenPackageMigrationflag));
42-
4339
try {
4440
projects.forEach(async cfg => {
4541
const { generatedFileName } = cfg.amplifyExtension || {};

packages/amplify-codegen/src/utils/getDocsgenPackage.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/amplify-codegen/src/utils/getModelgenPackage.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/amplify-codegen/src/utils/getTypesgenPackage.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/amplify-codegen/src/utils/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ const isCodegenConfigured = require('./isCodegenConfigured');
1515
const getSDLSchemaLocation = require('./getSDLSchemaLocation');
1616
const switchToSDLSchema = require('./switchToSDLSchema');
1717
const ensureIntrospectionSchema = require('./ensureIntrospectionSchema');
18-
const getModelgenPackage = require('./getModelgenPackage');
19-
const getDocsgenPackage = require('./getDocsgenPackage');
20-
const getTypesgenPackage = require('./getTypesgenPackage');
2118

2219
module.exports = {
2320
getAppSyncAPIDetails,
@@ -37,7 +34,4 @@ module.exports = {
3734
getSDLSchemaLocation,
3835
switchToSDLSchema,
3936
ensureIntrospectionSchema,
40-
getModelgenPackage,
41-
getDocsgenPackage,
42-
getTypesgenPackage
4337
};

packages/amplify-codegen/tests/commands/add.test.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,6 @@ jest.mock('../../src/commands/types');
2323
jest.mock('../../src/commands/statements');
2424
jest.mock('../../src/codegen-config');
2525
jest.mock('../../src/utils');
26-
// Mock the Feature flags for statements and types generation to use migrated packages
27-
jest.mock('amplify-cli-core', () => {
28-
return {
29-
FeatureFlags: {
30-
getBoolean: jest.fn().mockImplementation((name, defaultValue) => {
31-
if (name === 'codegen.useDocsGeneratorPlugin') {
32-
return true;
33-
}
34-
if (name === 'codegen.useTypesGeneratorPlugin') {
35-
return true;
36-
}
37-
})
38-
},
39-
};
40-
});
4126

4227
const MOCK_INCLUDE_PATTERN = 'MOCK_INCLUDE';
4328
const MOCK_EXCLUDE_PATTERN = 'MOCK_EXCLUDE';

packages/amplify-codegen/tests/commands/configure.test.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,6 @@ jest.mock('../../src/commands/add');
77
jest.mock('../../src/codegen-config');
88
jest.mock('../../src/walkthrough/configure');
99

10-
// Mock the Feature flags for statements and types generation to use migrated packages
11-
jest.mock('amplify-cli-core', () => {
12-
return {
13-
FeatureFlags: {
14-
getBoolean: jest.fn().mockImplementation((name, defaultValue) => {
15-
if (name === 'codegen.useDocsGeneratorPlugin') {
16-
return true;
17-
}
18-
if (name === 'codegen.useTypesGeneratorPlugin') {
19-
return true;
20-
}
21-
})
22-
},
23-
};
24-
});
25-
2610
const MOCK_CONFIG_METHOD = {
2711
getProjects: jest.fn(),
2812
addProject: jest.fn(),

0 commit comments

Comments
 (0)