Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { exec } = require('child_process')
- const fs = require('fs')
- const source = process.argv[2] || 'inheritance'
- fs.readFile(`./structures/${source.toLowerCase()}/index.js`, 'utf8', (err, data) => {
- if (err) throw new Error(`could not find deployment source file 'index.js': ${err.message}`)
- fs.writeFile("./functions/index.js", data, (err) => {
- if (err) throw new Error(`could not create functions deployment source: ${err.message}`)
- else if (process.argv[3] !== 'deploy') return
- exec('firebase deploy --only functions', (err, stdout, stderr) => {
- if (err) throw new Error(`could not execute deploy command: ${err.message}`)
- console.log(`${stdout}`)
- })
- })
- })
Add Comment
Please, Sign In to add comment