Skip to content

Commit

Permalink
BW-614 #comment changes for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
piya99 committed Aug 26, 2019
1 parent 8faf8e2 commit ec9eabe
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
39 changes: 36 additions & 3 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const deployFunctionsCommand = ` ${buildApps} &&
setConfig
firebase deploy -P productVariant-env --only functions &&
firebase deploy -P productVariant-env --only hosting`;

const commandList = {
"run-web":
{
Expand Down Expand Up @@ -74,8 +74,8 @@ const commandList = {
},
"run-functions":
{
"command": `${buildApps} && ${compileFunctions} && ${buildSSRServer}
&& firebase serve -P productVariant-env --only functions`,
"command": `buildApps ${compileFunctions} && buildSSRServer
firebase serve -P productVariant-env --only functions`,
"description": "deploy firebase functions local",
"options": {
"productVariant": {
Expand All @@ -93,7 +93,40 @@ const commandList = {
"choices": env,
"default": 'dev',
"alias": ['E', 'e']
},
"buildApps": {
"demand": false,
"hidden": true,
"type": 'string'
},
"buildSSRServer": {
"demand": false,
"hidden": true,
"type": 'string'
},
"buildSSR": {
"demand": true,
"default": false,
"type": 'boolean',
"description": 'build SSR Functions e.g. true',
"alias": ['S', 's']
}
},
"builder": args => {
const buildSSR = args.argv.buildSSR;
let buildAppstemp = buildApps;
if (buildSSR){
buildAppstemp = buildAppstemp.replace(new RegExp(escapeRegExp('productVariant'), 'g'), args.argv.productVariant );
buildAppstemp = buildAppstemp.replace(new RegExp(escapeRegExp('env'), 'g'), args.argv.env );
}

args.options(
{
'buildApps': { 'default': buildSSR ? `${buildAppstemp} &&` : '' },
'buildSSRServer': { 'default': buildSSR ? `${buildSSRServer} &&` : '' }
}
);
replaceVariableInIndex(['trivia', 'trivia-admin'], args.argv.productVariant);
}
},
"deploy-functions":
Expand Down
2 changes: 1 addition & 1 deletion functions/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const ssrFunction = require('firebase-functions');
// const server = require('./server');


const ngApp = require('./server').default;
const ngApp = require('./../../dist/server').default;

const runtimeOpts = {
memory: '512MB'
Expand Down
2 changes: 1 addition & 1 deletion webpack.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
minimize: false
},
output: {
path: path.join(__dirname, `functions/server/functions`),
path: path.join(__dirname, `functions/dist`),
library: 'app',
libraryTarget: 'umd',
filename: '[name].js'
Expand Down

0 comments on commit ec9eabe

Please sign in to comment.