Skip to content

Commit

Permalink
feat: introduce --allow-production when watching production environ…
Browse files Browse the repository at this point in the history
…ment (not recommended)
  • Loading branch information
adrians5j committed Oct 8, 2021
1 parent a42762e commit 8d627ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/cli-plugin-deploy-pulumi/commands/index.js
Expand Up @@ -103,6 +103,11 @@ module.exports = [
describe: `Turn on debug logs`,
type: "boolean"
});
yargs.option("allowProduction", {
default: false,
describe: `Enables running the watch command with "prod" and "production" environments (not recommended).`,
type: "boolean"
});
},
async argv => watch(argv, context)
);
Expand Down
10 changes: 6 additions & 4 deletions packages/cli-plugin-deploy-pulumi/commands/watch.js
Expand Up @@ -47,9 +47,11 @@ module.exports = async (inputs, context) => {
}

if (WATCH_DISABLED_ENVIRONMENTS.includes(inputs.env)) {
throw new Error(
`${chalk.red("webiny watch")} command cannot be used with production environments.`
);
if (!inputs.allowProduction) {
throw new Error(
`${chalk.red("webiny watch")} command cannot be used with production environments.`
);
}
}

if (!inputs.build && !inputs.deploy) {
Expand Down Expand Up @@ -322,7 +324,7 @@ module.exports = async (inputs, context) => {
};

const printLog = ({ pattern = "*", consoleLog, output }) => {
const plainPrefix = `${consoleLog.meta.functionName}:`;
const plainPrefix = `${consoleLog.meta.functionName}: `;
let message = consoleLog.args.join(" ").trim();
if (message) {
if (minimatch(plainPrefix, pattern)) {
Expand Down

0 comments on commit 8d627ab

Please sign in to comment.