Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(async (token: string) => {
const project = await getProject(token);
showWarning(project);
const confirmation = await userConfirmation();
if (!confirmation) {
console.log('\nYou chose not to continue. Nothing was changed.\n');
return false;
}
console.log('');
let task = showTask('Downloading project configuration');
const config = await firebaseTools.setup.web({ project, token });
task.done('config/project.json');
// Write config to top-level config directory
await promisify(writeFile)(
resolvePath(__dirname, '../../config/project.json'),
JSON.stringify(config, null, 2)
);
// Deploy database rules
task = showTask('Deploying Firestore indexes and security rules');
await firebaseTools.deploy({
project,
token,
cwd: resolvePath(__dirname, '../../config')
});
choices: projects
.sort(project =>
project.name.toLowerCase().includes('jscore') ? -1 : 1
)
.map(project => ({
name: `${project.displayName} (${project.projectId})`,
value: project
}))
}
]);
return response.projectId.projectId;
})();
// Write config to top-level config directory
await firebaseTools.setup
.web({ project, token })
.then(config =>
fs.writeFile(
path.resolve(__dirname, '../config/project.json'),
JSON.stringify(config, null, 2)
)
);
// npm install the dependencies for functions
await exec('npm install', {
cwd: path.resolve(__dirname, '../config/functions')
});
// Deploy database rules
await firebaseTools.deploy({
project,