amplify-cli-core
Advanced tools
Comparing version 1.3.1 to 1.3.2-beta.0
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.3.2-beta.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-cli-core@1.3.1...amplify-cli-core@1.3.2-beta.0) (2020-09-16) | ||
### Bug Fixes | ||
* refactor amplify.json file handling ([#5282](https://github.com/aws-amplify/amplify-cli/issues/5282)) ([a6269f3](https://github.com/aws-amplify/amplify-cli/commit/a6269f3177f3242df81e9d7dce0625295bb7a9fc)) | ||
## [1.3.1](https://github.com/aws-amplify/amplify-cli/compare/amplify-cli-core@1.3.0...amplify-cli-core@1.3.1) (2020-09-09) | ||
@@ -8,0 +19,0 @@ |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FeatureFlagFileProvider = void 0; | ||
const fs = __importStar(require("fs-extra")); | ||
const _ = __importStar(require("lodash")); | ||
const path = __importStar(require("path")); | ||
const __1 = require(".."); | ||
const constants_1 = require("../constants"); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const state_manager_1 = require("../state-manager"); | ||
class FeatureFlagFileProvider { | ||
@@ -36,5 +17,2 @@ constructor(environmentProvider, options = {}) { | ||
} | ||
if (!(await fs.pathExists(this.options.projectPath))) { | ||
throw new Error(`Project path: '${this.options.projectPath}' does not exist.`); | ||
} | ||
const result = { | ||
@@ -44,4 +22,3 @@ project: {}, | ||
}; | ||
const projectConfigFileName = path.join(this.options.projectPath, constants_1.amplifyConfigFileName); | ||
const projectFeatures = await this.loadConfig(projectConfigFileName); | ||
const projectFeatures = await this.loadConfig(this.options.projectPath); | ||
if (projectFeatures) { | ||
@@ -52,4 +29,3 @@ result.project = projectFeatures; | ||
if (envName !== '') { | ||
const envConfigFileName = path.join(this.options.projectPath, constants_1.amplifyConfigEnvFileNameTemplate(envName)); | ||
const envFeatures = await this.loadConfig(envConfigFileName); | ||
const envFeatures = await this.loadConfig(this.options.projectPath, envName); | ||
if (envFeatures) { | ||
@@ -61,4 +37,4 @@ result.environments[envName] = envFeatures; | ||
}; | ||
this.loadConfig = async (fileName) => { | ||
const configFileData = __1.JSONUtilities.readJson(fileName, { | ||
this.loadConfig = async (projectPath, env) => { | ||
const configFileData = state_manager_1.stateManager.getCLIJSON(projectPath, env, { | ||
throwIfNotExist: false, | ||
@@ -73,3 +49,3 @@ }); | ||
const mappedFeatures = Object.keys(configFileData.features).reduce((ffe, f) => { | ||
ffe[f.toLowerCase()] = _.transform(configFileData.features[f], toLower); | ||
ffe[f.toLowerCase()] = lodash_1.default.transform(configFileData.features[f], toLower); | ||
return ffe; | ||
@@ -76,0 +52,0 @@ }, {}); |
import { CLIEnvironmentProvider } from '..'; | ||
import { FeatureFlagsEntry } from '.'; | ||
import { FeatureFlagRegistration, FeatureFlagsEntry } from '.'; | ||
export declare class FeatureFlags { | ||
private environmentProvider; | ||
private projectPath; | ||
private useNewDefaults; | ||
private static instance; | ||
private readonly registrations; | ||
private fileValueProvider; | ||
private envValueProvider; | ||
private effectiveFlags; | ||
@@ -12,3 +15,3 @@ private newProjectDefaults; | ||
private constructor(); | ||
static initialize: (environmentProvider: CLIEnvironmentProvider, projectPath: string) => Promise<void>; | ||
static initialize: (environmentProvider: CLIEnvironmentProvider, useNewDefaults?: boolean, additionalFlags?: Record<string, FeatureFlagRegistration[]> | undefined) => Promise<void>; | ||
static ensureDefaultFeatureFlags: (newProject: boolean) => Promise<void>; | ||
@@ -23,2 +26,4 @@ static getBoolean: (flagName: string) => boolean; | ||
static isInitialized: () => boolean; | ||
static reloadValues: () => Promise<void>; | ||
private static removeOriginalConfigFile; | ||
private static ensureInitialized; | ||
@@ -30,2 +35,3 @@ private getValue; | ||
private transformEnvFlags; | ||
private loadValues; | ||
private registerFlag; | ||
@@ -32,0 +38,0 @@ private registerFlags; |
@@ -28,12 +28,15 @@ "use strict"; | ||
const fs = __importStar(require("fs-extra")); | ||
const path = __importStar(require("path")); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const path = __importStar(require("path")); | ||
const __1 = require(".."); | ||
const constants_1 = require("../constants"); | ||
const featureFlagFileProvider_1 = require("./featureFlagFileProvider"); | ||
const featureFlagEnvironmentProvider_1 = require("./featureFlagEnvironmentProvider"); | ||
const pathManager_1 = require("../state-manager/pathManager"); | ||
const state_manager_1 = require("../state-manager"); | ||
const jsonUtilities_1 = require("../jsonUtilities"); | ||
class FeatureFlags { | ||
constructor(environmentProvider, projectPath) { | ||
constructor(environmentProvider, projectPath, useNewDefaults) { | ||
this.environmentProvider = environmentProvider; | ||
this.projectPath = projectPath; | ||
this.useNewDefaults = useNewDefaults; | ||
this.registrations = new Map(); | ||
@@ -67,3 +70,8 @@ this.effectiveFlags = {}; | ||
if (!value) { | ||
value = flagRegistrationEntry.defaultValueForExistingProjects; | ||
if (this.useNewDefaults) { | ||
value = flagRegistrationEntry.defaultValueForNewProjects; | ||
} | ||
else { | ||
value = flagRegistrationEntry.defaultValueForExistingProjects; | ||
} | ||
} | ||
@@ -194,2 +202,19 @@ return value; | ||
}; | ||
this.loadValues = async () => { | ||
var _a, _b; | ||
const fileFlags = await this.fileValueProvider.load(); | ||
const envFlags = this.transformEnvFlags(await this.envValueProvider.load()); | ||
this.validateFlags([ | ||
{ | ||
name: 'File', | ||
flags: fileFlags, | ||
}, | ||
{ | ||
name: 'Environment', | ||
flags: envFlags, | ||
}, | ||
]); | ||
this.buildDefaultValues(); | ||
this.effectiveFlags = lodash_1.default.merge(this.useNewDefaults ? this.newProjectDefaults : this.existingProjectDefaults, fileFlags.project, (_a = fileFlags.environments[this.environmentProvider.getCurrentEnvName()]) !== null && _a !== void 0 ? _a : {}, envFlags.project, (_b = envFlags.environments[this.environmentProvider.getCurrentEnvName()]) !== null && _b !== void 0 ? _b : {}); | ||
}; | ||
this.registerFlag = (section, flags) => { | ||
@@ -217,18 +242,2 @@ var _a; | ||
this.registerFlags = () => { | ||
this.registerFlag('graphQLTransformer', [ | ||
{ | ||
name: 'transformerVersion', | ||
type: 'number', | ||
defaultValueForExistingProjects: 4, | ||
defaultValueForNewProjects: 5, | ||
}, | ||
]); | ||
this.registerFlag('keyTransformer', [ | ||
{ | ||
name: 'defaultQuery', | ||
type: 'boolean', | ||
defaultValueForExistingProjects: false, | ||
defaultValueForNewProjects: true, | ||
}, | ||
]); | ||
}; | ||
@@ -238,4 +247,4 @@ } | ||
exports.FeatureFlags = FeatureFlags; | ||
FeatureFlags.initialize = async (environmentProvider, projectPath) => { | ||
var _a, _b; | ||
FeatureFlags.initialize = async (environmentProvider, useNewDefaults = false, additionalFlags) => { | ||
var _a; | ||
if (typeof jest === 'undefined' && FeatureFlags.instance) { | ||
@@ -247,30 +256,19 @@ throw new Error('FeatureFlags can only be initialzied once'); | ||
} | ||
if (!projectPath) { | ||
throw new Error(`'projectPath' argument is required`); | ||
const projectPath = (_a = pathManager_1.pathManager.findProjectRoot()) !== null && _a !== void 0 ? _a : process.cwd(); | ||
await FeatureFlags.removeOriginalConfigFile(projectPath); | ||
const instance = new FeatureFlags(environmentProvider, projectPath, useNewDefaults); | ||
instance.registerFlags(); | ||
if (additionalFlags) { | ||
for (const sectionName of Object.keys(additionalFlags)) { | ||
const flags = additionalFlags[sectionName]; | ||
instance.registerFlag(sectionName, flags); | ||
} | ||
} | ||
if (!(await fs.pathExists(projectPath))) { | ||
throw new Error(`Project path: '${projectPath}' does not exist.`); | ||
} | ||
const instance = new FeatureFlags(environmentProvider, projectPath); | ||
instance.registerFlags(); | ||
const fileValueProvider = new featureFlagFileProvider_1.FeatureFlagFileProvider(environmentProvider, { | ||
instance.fileValueProvider = new featureFlagFileProvider_1.FeatureFlagFileProvider(environmentProvider, { | ||
projectPath, | ||
}); | ||
const envValueProvider = new featureFlagEnvironmentProvider_1.FeatureFlagEnvironmentProvider({ | ||
instance.envValueProvider = new featureFlagEnvironmentProvider_1.FeatureFlagEnvironmentProvider({ | ||
projectPath, | ||
}); | ||
const fileFlags = await fileValueProvider.load(); | ||
const envFlags = instance.transformEnvFlags(await envValueProvider.load()); | ||
instance.validateFlags([ | ||
{ | ||
name: 'File', | ||
flags: fileFlags, | ||
}, | ||
{ | ||
name: 'Environment', | ||
flags: envFlags, | ||
}, | ||
]); | ||
instance.buildDefaultValues(); | ||
instance.effectiveFlags = lodash_1.default.merge({}, fileFlags.project, (_a = fileFlags.environments[environmentProvider.getCurrentEnvName()]) !== null && _a !== void 0 ? _a : {}, envFlags.project, (_b = envFlags.environments[environmentProvider.getCurrentEnvName()]) !== null && _b !== void 0 ? _b : {}); | ||
await instance.loadValues(); | ||
FeatureFlags.instance = instance; | ||
@@ -280,4 +278,3 @@ }; | ||
FeatureFlags.ensureInitialized(); | ||
const configFileName = path.join(FeatureFlags.instance.projectPath, constants_1.amplifyConfigFileName); | ||
let config = __1.JSONUtilities.readJson(configFileName, { | ||
let config = state_manager_1.stateManager.getCLIJSON(FeatureFlags.instance.projectPath, undefined, { | ||
throwIfNotExist: false, | ||
@@ -291,5 +288,3 @@ preserveComments: true, | ||
}; | ||
__1.JSONUtilities.writeJson(configFileName, config, { | ||
keepComments: true, | ||
}); | ||
state_manager_1.stateManager.setCLIJSON(FeatureFlags.instance.projectPath, config); | ||
} | ||
@@ -327,7 +322,7 @@ }; | ||
if (removeProjectConfiguration) { | ||
const configFileName = path.join(FeatureFlags.instance.projectPath, constants_1.amplifyConfigFileName); | ||
const configFileName = pathManager_1.pathManager.getCLIJSONFilePath(FeatureFlags.instance.projectPath); | ||
await fs.remove(configFileName); | ||
} | ||
for (let envName of envNames) { | ||
const configFileName = path.join(FeatureFlags.instance.projectPath, constants_1.amplifyConfigEnvFileNameTemplate(envName)); | ||
const configFileName = pathManager_1.pathManager.getCLIJSONFilePath(FeatureFlags.instance.projectPath, envName); | ||
await fs.remove(configFileName); | ||
@@ -339,2 +334,23 @@ } | ||
}; | ||
FeatureFlags.reloadValues = async () => { | ||
FeatureFlags.ensureInitialized(); | ||
await FeatureFlags.instance.loadValues(); | ||
}; | ||
FeatureFlags.removeOriginalConfigFile = async (projectPath) => { | ||
const originalConfigFileName = 'amplify.json'; | ||
try { | ||
if (!projectPath) { | ||
return; | ||
} | ||
const originalConfigFilePath = path.join(projectPath, originalConfigFileName); | ||
const configFileData = jsonUtilities_1.JSONUtilities.readJson(originalConfigFilePath, { | ||
throwIfNotExist: false, | ||
}); | ||
if ((configFileData === null || configFileData === void 0 ? void 0 : configFileData.features) !== undefined) { | ||
fs.removeSync(originalConfigFilePath); | ||
} | ||
} | ||
catch (_a) { | ||
} | ||
}; | ||
FeatureFlags.ensureInitialized = () => { | ||
@@ -341,0 +357,0 @@ if (!FeatureFlags.instance) { |
@@ -0,1 +1,23 @@ | ||
export declare const PathConstants: { | ||
DotAWSDir: string; | ||
AWSCredentials: string; | ||
AWSConfig: string; | ||
AmplifyDirName: string; | ||
DotAmplifyDirName: string; | ||
DotConfigDirName: string; | ||
BackendDirName: string; | ||
CurrentCloudBackendDirName: string; | ||
AmplifyRcFileName: string; | ||
GitIgnoreFileName: string; | ||
ProjectConfigFileName: string; | ||
AmplifyMetaFileName: string; | ||
TagsFileName: string; | ||
LocalEnvFileName: string; | ||
LocalAWSInfoFileName: string; | ||
TeamProviderInfoFileName: string; | ||
BackendConfigFileName: string; | ||
CLIJSONFileName: string; | ||
CLIJSONFileNameGlob: string; | ||
CLIJsonWithEnvironmentFileName: (env: string) => string; | ||
}; | ||
export declare class PathManager { | ||
@@ -24,2 +46,3 @@ private readonly homeDotAmplifyDirPath; | ||
getAWSConfigFilePath: () => string; | ||
getCLIJSONFilePath: (projectPath: string, env?: string | undefined) => string; | ||
private constructPath; | ||
@@ -26,0 +49,0 @@ private validateProjectPath; |
@@ -22,7 +22,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pathManager = exports.PathManager = void 0; | ||
exports.pathManager = exports.PathManager = exports.PathConstants = void 0; | ||
const path = __importStar(require("path")); | ||
const fs = __importStar(require("fs-extra")); | ||
const os_1 = require("os"); | ||
const PathConstants = { | ||
exports.PathConstants = { | ||
DotAWSDir: '.aws', | ||
@@ -45,2 +45,5 @@ AWSCredentials: 'credentials', | ||
BackendConfigFileName: 'backend-config.json', | ||
CLIJSONFileName: 'cli.json', | ||
CLIJSONFileNameGlob: 'cli*.json', | ||
CLIJsonWithEnvironmentFileName: (env) => `cli.${env}.json`, | ||
}; | ||
@@ -50,29 +53,33 @@ class PathManager { | ||
this.getHomeDotAmplifyDirPath = () => this.homeDotAmplifyDirPath; | ||
this.getAmplifyDirPath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName]); | ||
this.getDotConfigDirPath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.DotConfigDirName]); | ||
this.getBackendDirPath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.BackendDirName]); | ||
this.getCurrentCloudBackendDirPath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.CurrentCloudBackendDirName]); | ||
this.getAmplifyRcFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyRcFileName]); | ||
this.getGitIgnoreFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.GitIgnoreFileName]); | ||
this.getTeamProviderInfoFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.TeamProviderInfoFileName]); | ||
this.getProjectConfigFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.DotConfigDirName, PathConstants.ProjectConfigFileName]); | ||
this.getLocalEnvFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.DotConfigDirName, PathConstants.LocalEnvFileName]); | ||
this.getLocalAWSInfoFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.DotConfigDirName, PathConstants.LocalAWSInfoFileName]); | ||
this.getAmplifyMetaFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.BackendDirName, PathConstants.AmplifyMetaFileName]); | ||
this.getBackendConfigFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.BackendDirName, PathConstants.BackendConfigFileName]); | ||
this.getTagFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.BackendDirName, PathConstants.TagsFileName]); | ||
this.getCurrentTagFilePath = (projectPath) => this.constructPath(projectPath, [PathConstants.AmplifyDirName, PathConstants.CurrentCloudBackendDirName, PathConstants.TagsFileName]); | ||
this.getAmplifyDirPath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName]); | ||
this.getDotConfigDirPath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.DotConfigDirName]); | ||
this.getBackendDirPath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.BackendDirName]); | ||
this.getCurrentCloudBackendDirPath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.CurrentCloudBackendDirName]); | ||
this.getAmplifyRcFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyRcFileName]); | ||
this.getGitIgnoreFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.GitIgnoreFileName]); | ||
this.getTeamProviderInfoFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.TeamProviderInfoFileName]); | ||
this.getProjectConfigFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.DotConfigDirName, exports.PathConstants.ProjectConfigFileName]); | ||
this.getLocalEnvFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.DotConfigDirName, exports.PathConstants.LocalEnvFileName]); | ||
this.getLocalAWSInfoFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.DotConfigDirName, exports.PathConstants.LocalAWSInfoFileName]); | ||
this.getAmplifyMetaFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.BackendDirName, exports.PathConstants.AmplifyMetaFileName]); | ||
this.getBackendConfigFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.BackendDirName, exports.PathConstants.BackendConfigFileName]); | ||
this.getTagFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.BackendDirName, exports.PathConstants.TagsFileName]); | ||
this.getCurrentTagFilePath = (projectPath) => this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, exports.PathConstants.CurrentCloudBackendDirName, exports.PathConstants.TagsFileName]); | ||
this.getCurrentAmplifyMetaFilePath = (projectPath) => this.constructPath(projectPath, [ | ||
PathConstants.AmplifyDirName, | ||
PathConstants.CurrentCloudBackendDirName, | ||
PathConstants.AmplifyMetaFileName, | ||
exports.PathConstants.AmplifyDirName, | ||
exports.PathConstants.CurrentCloudBackendDirName, | ||
exports.PathConstants.AmplifyMetaFileName, | ||
]); | ||
this.getCurrentBackendConfigFilePath = (projectPath) => this.constructPath(projectPath, [ | ||
PathConstants.AmplifyDirName, | ||
PathConstants.CurrentCloudBackendDirName, | ||
PathConstants.BackendConfigFileName, | ||
exports.PathConstants.AmplifyDirName, | ||
exports.PathConstants.CurrentCloudBackendDirName, | ||
exports.PathConstants.BackendConfigFileName, | ||
]); | ||
this.getDotAWSDirPath = () => path.normalize(path.join(os_1.homedir(), PathConstants.DotAWSDir)); | ||
this.getAWSCredentialsFilePath = () => path.normalize(path.join(this.getDotAWSDirPath(), PathConstants.AWSCredentials)); | ||
this.getAWSConfigFilePath = () => path.normalize(path.join(this.getDotAWSDirPath(), PathConstants.AWSConfig)); | ||
this.getDotAWSDirPath = () => path.normalize(path.join(os_1.homedir(), exports.PathConstants.DotAWSDir)); | ||
this.getAWSCredentialsFilePath = () => path.normalize(path.join(this.getDotAWSDirPath(), exports.PathConstants.AWSCredentials)); | ||
this.getAWSConfigFilePath = () => path.normalize(path.join(this.getDotAWSDirPath(), exports.PathConstants.AWSConfig)); | ||
this.getCLIJSONFilePath = (projectPath, env) => { | ||
const fileName = env === undefined ? exports.PathConstants.CLIJSONFileName : exports.PathConstants.CLIJsonWithEnvironmentFileName(env); | ||
return this.constructPath(projectPath, [exports.PathConstants.AmplifyDirName, fileName]); | ||
}; | ||
this.constructPath = (projectPath, segments = []) => { | ||
@@ -115,3 +122,3 @@ if (!projectPath) { | ||
}; | ||
this.homeDotAmplifyDirPath = path.join(os_1.homedir(), PathConstants.DotAmplifyDirName); | ||
this.homeDotAmplifyDirPath = path.join(os_1.homedir(), exports.PathConstants.DotAmplifyDirName); | ||
} | ||
@@ -118,0 +125,0 @@ } |
@@ -5,2 +5,3 @@ import { $TSMeta, $TSTeamProviderInfo, $TSAny } from '..'; | ||
throwIfNotExist?: boolean; | ||
preserveComments?: boolean; | ||
default?: T; | ||
@@ -20,2 +21,3 @@ }; | ||
getLocalAWSInfo: (projectPath?: string | undefined, options?: GetOptions<any> | undefined) => $TSAny; | ||
projectConfigExists: (projectPath?: string | undefined) => boolean; | ||
getProjectConfig: (projectPath?: string | undefined, options?: GetOptions<any> | undefined) => $TSAny; | ||
@@ -32,2 +34,5 @@ backendConfigFileExists: (projectPath?: string | undefined) => boolean; | ||
setCurrentMeta: (projectPath: string | undefined, meta: $TSMeta) => void; | ||
cliJSONFileExists: (projectPath: string, env?: string | undefined) => boolean; | ||
getCLIJSON: (projectPath: string, env?: string | undefined, options?: GetOptions<any> | undefined) => $TSAny; | ||
setCLIJSON: (projectPath: string, cliJSON: any, env?: string | undefined) => void; | ||
private getData; | ||
@@ -34,0 +39,0 @@ } |
@@ -77,2 +77,3 @@ "use strict"; | ||
}; | ||
this.projectConfigExists = (projectPath) => fs.existsSync(pathManager_1.pathManager.getProjectConfigFilePath(projectPath)); | ||
this.getProjectConfig = (projectPath, options) => { | ||
@@ -127,2 +128,17 @@ const filePath = pathManager_1.pathManager.getProjectConfigFilePath(projectPath); | ||
}; | ||
this.cliJSONFileExists = (projectPath, env) => fs.existsSync(pathManager_1.pathManager.getCLIJSONFilePath(projectPath, env)); | ||
this.getCLIJSON = (projectPath, env, options) => { | ||
const filePath = pathManager_1.pathManager.getCLIJSONFilePath(projectPath, env); | ||
const mergedOptions = { | ||
throwIfNotExist: true, | ||
...options, | ||
}; | ||
return this.getData(filePath, mergedOptions); | ||
}; | ||
this.setCLIJSON = (projectPath, cliJSON, env) => { | ||
const filePath = pathManager_1.pathManager.getCLIJSONFilePath(projectPath, env); | ||
jsonUtilities_1.JSONUtilities.writeJson(filePath, cliJSON, { | ||
keepComments: true, | ||
}); | ||
}; | ||
this.getData = (filePath, options) => { | ||
@@ -129,0 +145,0 @@ var _a; |
{ | ||
"name": "amplify-cli-core", | ||
"version": "1.3.1", | ||
"version": "1.3.2-beta.0", | ||
"description": "Amplify CLI Core", | ||
@@ -58,3 +58,3 @@ "repository": { | ||
}, | ||
"gitHead": "13c87a13691725f700f3577ac99c882813ecb8c5" | ||
"gitHead": "d20a491b3a8b763ec86c941a6a511fb79669d024" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124121
1377
9
75
2