UNPKG

amplify-codegen

Version:
24 lines (21 loc) 724 B
const { loadConfig } = require('../codegen-config'); const configureProjectWalkThrough = require('../walkthrough/configure'); const add = require('./add'); async function configure(context) { let withoutInit = false; try { context.amplify.getProjectMeta(); } catch (e) { withoutInit = true; } const config = loadConfig(context, withoutInit); if (!config.getProjects().length) { await add(context); return; } const project = await configureProjectWalkThrough(context, config.getProjects(), withoutInit); config.addProject(project); config.save(); console.log('Codegen configured. Remember to run "amplify codegen" to generate your types and statements.') } module.exports = configure;