Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tender-carrots-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'preact-cli': patch
---

Ensuring the sw flag is a boolean in watch mode
3 changes: 1 addition & 2 deletions packages/cli/lib/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ const rimraf = require('rimraf');
const { resolve } = require('path');
const { promisify } = require('util');
const runWebpack = require('../lib/webpack/run-webpack');
const { toBool } = require('../util');
const { validateArgs } = require('./validate-args');

const toBool = val => val === void 0 || (val === 'false' ? false : val);

const options = [
{
name: '--src',
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/lib/commands/watch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const runWebpack = require('../lib/webpack/run-webpack');
const { warn } = require('../util');
const { toBool, warn } = require('../util');
const { validateArgs } = require('./validate-args');

const options = [
Expand Down Expand Up @@ -101,6 +101,7 @@ async function command(src, argv) {
}
argv.src = src || argv.src;
argv.production = false;
argv.sw = toBool(argv.sw);

if (argv.https || process.env.HTTPS) {
let { key, cert, cacert } = argv;
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ exports.normalizeTemplatesResponse = function (repos = []) {
description: repo.description || '',
}));
};

exports.toBool = function (val) {
return val === void 0 || (val === 'false' ? false : val);
};