Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return;
}
const parametersFilePath = path.join(resourceDir, parametersFileName);
let parameters = {};
try {
parameters = context.amplify.readJsonFile(parametersFilePath);
} catch (e) {
context.print.error('Parameters file not found');
context.print.info(e.stack);
}
// Get models
const project = await TransformPackage.readProjectConfiguration(resourceDir);
// Check for common errors
const directiveMap = collectDirectivesByTypeNames(project.schema);
let modelTypes = [];
if (directiveMap.types) {
Object.keys(directiveMap.types).forEach(type => {
if (directiveMap.types[type].includes('model')) {
modelTypes.push(type);
}
});
}
/* eslint-disable */
({ authConfig, defaultAuthType } = await askDefaultAuthQuestion(context, parameters));
({ authConfig, resolverConfig } = await askAdditionalQuestions(context, parameters, authConfig, defaultAuthType, modelTypes));
let deploymentRootKey = await getPreviousDeploymentRootKey(previouslyDeployedBackendDir);
if (!deploymentRootKey) {
const deploymentSubKey = await hashDirectory(resourceDir);
deploymentRootKey = `${ROOT_APPSYNC_S3_KEY}/${deploymentSubKey}`;
}
const projectBucket = options.dryRun ? 'fake-bucket' : getProjectBucket(context);
const buildParameters = {
...parameters,
S3DeploymentBucket: projectBucket,
S3DeploymentRootKey: deploymentRootKey,
};
fs.ensureDirSync(buildDir);
// Transformer compiler code
// const schemaText = await TransformPackage.readProjectSchema(resourceDir);
const project = await TransformPackage.readProjectConfiguration(resourceDir);
// Check for common errors
const directiveMap = collectDirectivesByTypeNames(project.schema);
warnOnAuth(context, directiveMap.types);
await transformerVersionCheck(context, resourceDir, previouslyDeployedBackendDir, resourcesToBeUpdated, directiveMap.directives);
const transformerListFactory = getTransformerFactory(context, resourceDir, authConfig);
let searchableTransformerFlag = false;
if (directiveMap.directives.includes('searchable')) {
searchableTransformerFlag = true;
}
const buildConfig = {