Skip to content

Commit

Permalink
Merge branch 'master' into mode-prerener
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekbh committed Dec 14, 2020
2 parents 963b3ec + 4b9ef92 commit 0b746e7
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 111 deletions.
5 changes: 0 additions & 5 deletions .changeset/curvy-eggs-eat.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fair-ants-deny.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/famous-dolls-leave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/green-pugs-design.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/many-chairs-add.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/ninety-drinks-wave.md

This file was deleted.

8 changes: 1 addition & 7 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
github: [preactjs]
open_collective: preact
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL
9 changes: 0 additions & 9 deletions .github/dependabot.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ $ preact build
--template Path to custom HTML template
--preload Adds preload tags to the document its assets (default false)
--analyze Launch interactive Analyzer to inspect production bundle(s)
--prerender Renders route(s) into generated static HTML (default true)
--prerenderUrls Path to pre-rendered routes config (default prerender-urls.json)
--brotli Adds brotli redirects to the service worker (default false)
--inline-css Adds critical css to the prerendered markup (default true)
Expand Down
22 changes: 22 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# preact-cli

## 3.0.5

### Patch Changes

- [`57cb566`](https://github.com/preactjs/preact-cli/commit/57cb566a697ceebcd094057b9db48827897d5b5b) [#1490](https://github.com/preactjs/preact-cli/pull/1490) Thanks [@rschristian](https://github.com/rschristian)! - Adds the 'prerender' argument to the list of arguments to be validated against

## 3.0.4

### Patch Changes

- [`6670ba0`](https://github.com/preactjs/preact-cli/commit/6670ba0b9ee03f03f98cfec490aee996b58a17eb) [#1461](https://github.com/preactjs/preact-cli/pull/1461) Thanks [@ForsakenHarmony](https://github.com/ForsakenHarmony)! - fix: await copying of files in create command

* [`30fb1fc`](https://github.com/preactjs/preact-cli/commit/30fb1fc0a2ec101a46ecbb6539ffccc2aec215d7) [#1478](https://github.com/preactjs/preact-cli/pull/1478) Thanks [@rschristian](https://github.com/rschristian)! - No longer copies 'sw-debug.js' to output directory on prod builds. No functional changes, as it was not used.

- [`2c53b0a`](https://github.com/preactjs/preact-cli/commit/2c53b0a94952c19f8e625dfa52ecbc0ae8c0c3cb) [#1438](https://github.com/preactjs/preact-cli/pull/1438) Thanks [@VanTanev](https://github.com/VanTanev)! - fix: allow an async component to return null rendering

* [`fce7e7a`](https://github.com/preactjs/preact-cli/commit/fce7e7a2a1b3f5cbe9856004a89723ef75b016bf) [#1460](https://github.com/preactjs/preact-cli/pull/1460) Thanks [@ForsakenHarmony](https://github.com/ForsakenHarmony)! - chore: remove preact-compat as it's unused

- [`ab84275`](https://github.com/preactjs/preact-cli/commit/ab84275c7d84c99a57085f9913d93069d461fb95) [#1434](https://github.com/preactjs/preact-cli/pull/1434) Thanks [@rschristian](https://github.com/rschristian)! - This disable SSR size tracking. This stops `size-plugin-ssr.json` from being generated and stops file sizes from being reported to the developer.

* [`67fafc8`](https://github.com/preactjs/preact-cli/commit/67fafc8e3d0d98665a193e10bc7c9a1ce2aeeedf) [#1467](https://github.com/preactjs/preact-cli/pull/1467) Thanks [@prateekbh](https://github.com/prateekbh)! - Allow only valid options for commands.

## 3.0.2

### Patch Changes
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/lib/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ const options = [
name: '--analyze',
description: 'Launch interactive Analyzer to inspect production bundle(s)',
},
{
name: '--prerender',
description: 'Renders route(s) into generated static HTML',
default: true,
},
{
name: '--prerenderUrls',
description: 'Path to pre-rendered routes config',
Expand Down Expand Up @@ -116,7 +121,7 @@ async function command(src, argv) {

if (argv['experimental-fast-rendering']) {
warn(
'You have enabled experiment fast rendering. You might have to adjust template.html according to the new API.'
'You have enabled experimental and unstable fast rendering. You might have to adjust template.html according to the new API.'
);
await fastPrerender(argv, stats);
}
Expand Down
84 changes: 42 additions & 42 deletions packages/cli/lib/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,48 @@ const RGX = /\.(woff2?|ttf|eot|jpe?g|ico|png|gif|webp|mp4|mov|ogg|webm)(\?.*)?$/
const isMedia = str => RGX.test(str);
const capitalize = str => str.charAt(0).toUpperCase() + str.substring(1);

const options = [
{
name: '--name',
description: 'The application name',
},
{
name: '--cwd',
description: 'A directory to use instead of $PWD',
default: '.',
},
{
name: '--force',
description: 'Force destination output; will override!',
default: false,
},
{
name: '--install',
description: 'Install dependencies',
default: true,
},
{
name: '--yarn',
description: 'Use `yarn` instead of `npm`',
default: false,
},
{
name: '--git',
description: 'Initialize git repository',
default: false,
},
{
name: '--license',
description: 'License type',
default: 'MIT',
},
{
name: '-v, --verbose',
description: 'Verbose output',
default: false,
},
];

// Formulate Questions if `create` args are missing
function requestParams(argv, templates) {
const cwd = resolve(argv.cwd);
Expand Down Expand Up @@ -385,48 +427,6 @@ async function command(repo, dest, argv) {
);
}

const options = [
{
name: '--name',
description: 'The application name',
},
{
name: '--cwd',
description: 'A directory to use instead of $PWD',
default: '.',
},
{
name: '--force',
description: 'Force destination output; will override!',
default: false,
},
{
name: '--install',
description: 'Install dependencies',
default: true,
},
{
name: '--yarn',
description: 'Use `yarn` instead of `npm`',
default: false,
},
{
name: '--git',
description: 'Initialize git repository',
default: false,
},
{
name: '--license',
description: 'License type',
default: 'MIT',
},
{
name: '-v, --verbose',
description: 'Verbose output',
default: false,
},
];

module.exports = {
command,
options,
Expand Down
42 changes: 21 additions & 21 deletions packages/cli/lib/commands/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,6 @@ const runWebpack = require('../lib/webpack/run-webpack');
const { warn } = require('../util');
const { validateArgs } = require('./validate-args');

async function command(src, argv) {
validateArgs(argv, options, 'watch');
if (argv.rhl) {
delete argv.rhl;
argv.refresh = argv.rhl;
}
argv.src = src || argv.src;
argv.production = false;

if (argv.https || process.env.HTTPS) {
let { key, cert, cacert } = argv;
if (key && cert) {
argv.https = { key, cert, ca: cacert };
} else {
warn('Reverting to `webpack-dev-server` internal certificate.');
}
}

return runWebpack(argv, true);
}

const options = [
{
name: '--src',
Expand Down Expand Up @@ -114,6 +93,27 @@ const options = [
},
];

async function command(src, argv) {
validateArgs(argv, options, 'watch');
if (argv.rhl) {
delete argv.rhl;
argv.refresh = argv.rhl;
}
argv.src = src || argv.src;
argv.production = false;

if (argv.https || process.env.HTTPS) {
let { key, cert, cacert } = argv;
if (key && cert) {
argv.https = { key, cert, ca: cacert };
} else {
warn('Reverting to `webpack-dev-server` internal certificate.');
}
}

return runWebpack(argv, true);
}

module.exports = {
command,
options,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "preact-cli",
"version": "3.0.3",
"version": "3.0.5",
"description": "Start building a Preact Progressive Web App in seconds.",
"repository": "preactjs/preact-cli",
"main": "lib/index.js",
Expand Down

0 comments on commit 0b746e7

Please sign in to comment.