amplify-cli-core
Advanced tools
Comparing version 1.2.1-alpha.27 to 1.3.0-beta.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [1.3.0-beta.0](https://github.com/aws-amplify/amplify-cli/compare/amplify-cli-core@1.2.0...amplify-cli-core@1.3.0-beta.0) (2020-08-31) | ||
### Bug Fixes | ||
* add compatibility to json parse for non-string values ([#5147](https://github.com/aws-amplify/amplify-cli/issues/5147)) ([3bc9306](https://github.com/aws-amplify/amplify-cli/commit/3bc9306c7b3d078d9b531f5950e8a304fc031d23)) | ||
### Features | ||
* resource Tagging Support ([#5178](https://github.com/aws-amplify/amplify-cli/issues/5178)) ([e34226d](https://github.com/aws-amplify/amplify-cli/commit/e34226dde30d7d345e3cc2e72e187b242a09c389)) | ||
# 1.2.0 (2020-07-29) | ||
@@ -8,0 +24,0 @@ |
@@ -0,4 +1,5 @@ | ||
import { $TSAny } from '.'; | ||
export interface CLIContext { | ||
getEnvInfo: () => any; | ||
getEnvInfo: () => $TSAny; | ||
} | ||
//# sourceMappingURL=cliContext.d.ts.map |
@@ -59,3 +59,3 @@ "use strict"; | ||
this.loadConfig = async (fileName) => { | ||
const configFileData = await __1.JSONUtilities.readJson(fileName, { | ||
const configFileData = __1.JSONUtilities.readJson(fileName, { | ||
throwIfNotExist: false, | ||
@@ -62,0 +62,0 @@ }); |
@@ -275,3 +275,3 @@ "use strict"; | ||
const configFileName = path.join(FeatureFlags.instance.projectPath, constants_1.amplifyConfigFileName); | ||
let config = await __1.JSONUtilities.readJson(configFileName, { | ||
let config = __1.JSONUtilities.readJson(configFileName, { | ||
throwIfNotExist: false, | ||
@@ -285,3 +285,3 @@ preserveComments: true, | ||
}; | ||
await __1.JSONUtilities.writeJson(configFileName, config, { | ||
__1.JSONUtilities.writeJson(configFileName, config, { | ||
keepComments: true, | ||
@@ -288,0 +288,0 @@ }); |
@@ -7,2 +7,94 @@ export * from './cliContext'; | ||
export * from './jsonValidationError'; | ||
export * from './state-manager'; | ||
export * from './tags'; | ||
export declare type $TSAny = any; | ||
export declare type $TSContext = { | ||
amplify: AmplifyToolkit; | ||
print: $TSAny; | ||
migrationInfo: $TSAny; | ||
prompt: $TSAny; | ||
exeInfo: $TSAny; | ||
input: $TSAny; | ||
parameters: $TSAny; | ||
usageData: $TSAny; | ||
runtime: $TSAny; | ||
}; | ||
export declare type $TSMeta = any; | ||
export declare type $TSTeamProviderInfo = any; | ||
export declare type $TSObject = Record<string, $TSAny>; | ||
interface AmplifyToolkit { | ||
buildResources: () => $TSAny; | ||
confirmPrompt: (prompt: string, defaultValue?: boolean) => $TSAny; | ||
constants: $TSAny; | ||
constructExeInfo: () => $TSAny; | ||
copyBatch: () => $TSAny; | ||
crudFlow: () => $TSAny; | ||
deleteProject: () => $TSAny; | ||
executeProviderUtils: () => $TSAny; | ||
getAllEnvs: () => $TSAny; | ||
getPlugin: () => $TSAny; | ||
getCategoryPluginInfo: (context: $TSContext) => $TSAny; | ||
getAllCategoryPluginInfo: (context: $TSContext) => $TSAny; | ||
getFrontendPlugins: () => $TSAny; | ||
getEnvDetails: () => $TSAny; | ||
getEnvInfo: () => $TSAny; | ||
getProviderPlugins: () => $TSAny; | ||
getPluginInstance: () => $TSAny; | ||
getProjectConfig: () => $TSAny; | ||
getProjectDetails: () => $TSAny; | ||
getProjectMeta: () => $TSMeta; | ||
getResourceStatus: (category?: $TSAny, resourceName?: $TSAny, providerName?: $TSAny, filteredResources?: $TSAny) => $TSAny; | ||
getResourceOutputs: () => $TSAny; | ||
getWhen: () => $TSAny; | ||
inputValidation: () => $TSAny; | ||
listCategories: () => $TSAny; | ||
makeId: () => $TSAny; | ||
openEditor: () => $TSAny; | ||
onCategoryOutputsChange: (context: $TSContext, amplifyMeta: $TSMeta) => $TSAny; | ||
pathManager: () => $TSAny; | ||
pressEnterToContinue: () => $TSAny; | ||
pushResources: () => $TSAny; | ||
storeCurrentCloudBackend: () => $TSAny; | ||
readJsonFile: () => $TSAny; | ||
removeEnvFromCloud: () => $TSAny; | ||
removeResource: () => $TSAny; | ||
sharedQuestions: () => $TSAny; | ||
showAllHelp: () => $TSAny; | ||
showHelp: () => $TSAny; | ||
showHelpfulProviderLinks: () => $TSAny; | ||
showResourceTable: () => $TSAny; | ||
serviceSelectionPrompt: () => $TSAny; | ||
updateProjectConfig: () => $TSAny; | ||
updateamplifyMetaAfterResourceUpdate: () => $TSAny; | ||
updateamplifyMetaAfterResourceAdd: () => $TSAny; | ||
updateamplifyMetaAfterResourceDelete: () => $TSAny; | ||
updateProvideramplifyMeta: () => $TSAny; | ||
updateamplifyMetaAfterPush: () => $TSAny; | ||
updateamplifyMetaAfterBuild: () => $TSAny; | ||
updateAmplifyMetaAfterPackage: () => $TSAny; | ||
updateBackendConfigAfterResourceAdd: () => $TSAny; | ||
updateBackendConfigAfterResourceUpdate: () => $TSAny; | ||
updateBackendConfigAfterResourceRemove: () => $TSAny; | ||
loadEnvResourceParameters: () => $TSAny; | ||
saveEnvResourceParameters: () => $TSAny; | ||
removeResourceParameters: () => $TSAny; | ||
triggerFlow: () => $TSAny; | ||
addTrigger: () => $TSAny; | ||
updateTrigger: () => $TSAny; | ||
deleteTrigger: () => $TSAny; | ||
deleteAllTriggers: () => $TSAny; | ||
deleteDeselectedTriggers: () => $TSAny; | ||
dependsOnBlock: () => $TSAny; | ||
getTriggerMetadata: () => $TSAny; | ||
getTriggerPermissions: () => $TSAny; | ||
getTriggerEnvVariables: () => $TSAny; | ||
getTriggerEnvInputs: () => $TSAny; | ||
getUserPoolGroupList: () => $TSAny; | ||
forceRemoveResource: () => $TSAny; | ||
writeObjectAsJson: () => $TSAny; | ||
hashDir: () => $TSAny; | ||
leaveBreadcrumbs: () => $TSAny; | ||
readBreadcrumbs: () => $TSAny; | ||
loadRuntimePlugin: () => $TSAny; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,2 +19,4 @@ "use strict"; | ||
__exportStar(require("./jsonValidationError"), exports); | ||
__exportStar(require("./state-manager"), exports); | ||
__exportStar(require("./tags"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,7 +5,7 @@ export declare class JSONUtilities { | ||
preserveComments?: boolean | undefined; | ||
} | undefined) => Promise<T | undefined>; | ||
} | undefined) => T | undefined; | ||
static writeJson: (fileName: string, data: any, options?: { | ||
minify?: boolean | undefined; | ||
keepComments?: boolean | undefined; | ||
} | undefined) => Promise<void>; | ||
} | undefined) => void; | ||
static parse: <T>(jsonString: string, options?: { | ||
@@ -12,0 +12,0 @@ preserveComments?: boolean | undefined; |
@@ -29,3 +29,3 @@ "use strict"; | ||
exports.JSONUtilities = JSONUtilities; | ||
JSONUtilities.readJson = async (fileName, options) => { | ||
JSONUtilities.readJson = (fileName, options) => { | ||
if (!fileName) { | ||
@@ -47,3 +47,3 @@ throw new Error(`'fileName' argument missing`); | ||
} | ||
const content = await fs.readFile(fileName, 'utf8'); | ||
const content = fs.readFileSync(fileName, 'utf8'); | ||
const data = JSONUtilities.parse(content, { | ||
@@ -54,3 +54,3 @@ preserveComments: mergedOptions.preserveComments, | ||
}; | ||
JSONUtilities.writeJson = async (fileName, data, options) => { | ||
JSONUtilities.writeJson = (fileName, data, options) => { | ||
if (!fileName) { | ||
@@ -72,8 +72,8 @@ throw new Error(`'fileName' argument missing`); | ||
const dirPath = path.dirname(fileName); | ||
await fs.ensureDir(dirPath); | ||
await fs.writeFile(fileName, jsonString, 'utf8'); | ||
fs.ensureDirSync(dirPath); | ||
fs.writeFileSync(fileName, jsonString, 'utf8'); | ||
}; | ||
JSONUtilities.parse = (jsonString, options) => { | ||
if (!jsonString || jsonString.trim().length === 0) { | ||
throw new Error("'jsonString' argument missing"); | ||
if (jsonString === undefined || (typeof jsonString === 'string' && jsonString.trim().length === 0)) { | ||
throw new Error("'jsonString' argument missing or empty"); | ||
} | ||
@@ -84,9 +84,15 @@ const mergedOptions = { | ||
}; | ||
let cleanString = jsonString; | ||
if (cleanString.charCodeAt(0) === 0xfeff) { | ||
cleanString = cleanString.slice(1); | ||
let data; | ||
if (typeof jsonString === 'string') { | ||
let cleanString = jsonString; | ||
if (cleanString.charCodeAt(0) === 0xfeff) { | ||
cleanString = cleanString.slice(1); | ||
} | ||
data = hjson.parse(cleanString, { | ||
keepWsc: mergedOptions.preserveComments, | ||
}); | ||
} | ||
const data = hjson.parse(cleanString, { | ||
keepWsc: mergedOptions.preserveComments, | ||
}); | ||
else { | ||
return jsonString; | ||
} | ||
return data; | ||
@@ -108,8 +114,3 @@ }; | ||
else { | ||
jsonString = hjson.stringify(data, { | ||
space: 2, | ||
separator: true, | ||
quotes: 'all', | ||
keepWsc: mergedOptions.keepComments, | ||
}); | ||
jsonString = JSON.stringify(data, null, 2); | ||
} | ||
@@ -116,0 +117,0 @@ return jsonString; |
{ | ||
"name": "amplify-cli-core", | ||
"version": "1.2.1-alpha.27+fd0a4bcfb", | ||
"version": "1.3.0-beta.0", | ||
"description": "Amplify CLI Core", | ||
@@ -58,3 +58,3 @@ "repository": { | ||
}, | ||
"gitHead": "fd0a4bcfbf8532cb3e13438923a1e03f7260ef26" | ||
"gitHead": "c6cc09a9247be30f45948f5a6656a824abc662c9" | ||
} |
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
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
118272
79
1326
0
10