add path api to CLI

This commit is contained in:
Gabriel Pastori
2023-11-19 15:01:19 -03:00
parent e5e6e27dbc
commit f28fbfcea0
10 changed files with 207 additions and 62 deletions

View File

@@ -2,7 +2,7 @@ const { exec } = require('child_process')
const fs = require('fs')
const path = require('path')
module.exports = () => {
module.exports = (envs = {}) => {
return new Promise((resolve, reject) => {
console.log('📦 Build start')
console.time('📦 Build complete')
@@ -13,7 +13,8 @@ module.exports = () => {
console.timeEnd('📦 Remove dist folder')
}
exec('npm run build', { cwd: path.join(__dirname, '..', '..') }, (err, stdout) => {
// pass envs to build
exec(`npm run build`, { env: envs, cwd: path.join(__dirname, '..', '..') }, (err, stdout) => {
if (err) {
console.error(err)
reject(err)