From 8339fc3408b00b3428766ee998e46138b816c3fb Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Fri, 12 Nov 2021 23:14:26 -0600 Subject: [PATCH 1/4] chore: Misc cleaning --- README.md | 2 +- packages/cli/tests/build.snapshot.js | 90 ---------------------------- packages/cli/tests/build.test.js | 32 ++++------ packages/cli/tests/create.test.js | 28 ++++----- packages/cli/tests/images/create.js | 1 - packages/cli/tests/lib/cli.js | 8 +-- yarn.lock | 46 ++------------ 7 files changed, 31 insertions(+), 176 deletions(-) delete mode 100644 packages/cli/tests/build.snapshot.js diff --git a/README.md b/README.md index ea2d0bbc5..10eec8072 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ ### Requirements -> **Important**: [Node.js](https://nodejs.org/en/) > V8.x and npm 5.2+ is a minimum requirement. +> **Important**: [Node.js](https://nodejs.org/en/) >= v12 is required. ### Usage diff --git a/packages/cli/tests/build.snapshot.js b/packages/cli/tests/build.snapshot.js deleted file mode 100644 index 8d55625eb..000000000 --- a/packages/cli/tests/build.snapshot.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Unused - * @date 08/22/2017 - * --> keep stats for other templates - */ - -const commons = { - 'polyfills.*.js': { size: 4620 }, - 'polyfills.*.js.map': { size: 31760 }, - 'favicon.ico': { size: 15086 }, -}; - -const smallBuildCommons = { - ...commons, - assets: { - 'favicon.ico': { size: 15086 }, - 'icon.png': { size: 51484 }, - }, - 'sw.js': { size: 3330 }, - 'manifest.json': { size: 298 }, - 'push-manifest.json': { size: 100 }, -}; - -const fullBuildCommons = { - ...commons, - assets: { - 'favicon.ico': { size: 15086 }, - icons: { - 'android-chrome-192x192.png': { size: 14058 }, - 'android-chrome-512x512.png': { size: 51484 }, - 'apple-touch-icon.png': { size: 12746 }, - 'favicon-16x16.png': { size: 626 }, - 'favicon-32x32.png': { size: 1487 }, - 'mstile-150x150.png': { size: 9050 }, - }, - }, - 'push-manifest.json': { size: 327 }, - 'manifest.json': { size: 426 }, - 'sw.js': { size: 3850 }, -}; - -export default { - empty: { - ...smallBuildCommons, - 'bundle.*.js': { size: 9810 }, - 'bundle.*.js.map': { size: 44660 }, - 'index.html': { size: 630 }, - 'style.*.css': { size: 131 }, - 'style.*.css.map': { size: 359 }, - 'ssr-build': { - 'ssr-bundle.js': { size: 16245 }, - 'ssr-bundle.js.map': { size: 31821 }, - 'style.*.css': { size: 130 }, - 'style.*.css.map': { size: 360 }, - }, - }, - simple: { - ...smallBuildCommons, - 'bundle.*.js': { size: 10460 }, - 'bundle.*.js.map': { size: 48670 }, - 'index.html': { size: 640 }, - 'style.*.css': { size: 296 }, - 'style.*.css.map': { size: 621 }, - 'manifest.json': { size: 290 }, - 'ssr-build': { - 'ssr-bundle.js': { size: 18205 }, - 'ssr-bundle.js.map': { size: 33478 }, - 'style.*.css': { size: 296 }, - 'style.*.css.map': { size: 621 }, - }, - }, - root: { - ...fullBuildCommons, - 'bundle.*.js': { size: 18460 }, - 'bundle.*.js.map': { size: 101500 }, - 'route-home.chunk.*.js': { size: 1020 }, - 'route-home.chunk.*.js.map': { size: 4977 }, - 'route-profile.chunk.*.js': { size: 1660 }, - 'route-profile.chunk.*.js.map': { size: 8607 }, - 'index.html': { size: 870 }, - 'style.*.css': { size: 1065 }, - 'style.*.css.map': { size: 2246 }, - 'ssr-build': { - 'ssr-bundle.js': { size: 39459 }, - 'ssr-bundle.js.map': { size: 65629 }, - 'style.*.css': { size: 1065 }, - 'style.*.css.map': { size: 2250 }, - }, - }, -}; diff --git a/packages/cli/tests/build.test.js b/packages/cli/tests/build.test.js index fa0b8c56c..d610c5241 100644 --- a/packages/cli/tests/build.test.js +++ b/packages/cli/tests/build.test.js @@ -9,10 +9,6 @@ const images = require('./images/build'); const { promisify } = require('util'); const glob = promisify(require('glob').glob); -// TODO -// const ours = ['empty', 'full', 'simple', 'root']; -const ours = ['default']; - const prerenderUrlFiles = [ 'prerender-urls.json', 'prerender-urls.js', @@ -50,26 +46,24 @@ function testMatch(src, tar) { } describe('preact build', () => { - ours.forEach(key => { - it(`builds the '${key}' output`, async () => { - let dir = await create(key); + it(`builds the 'default' template`, async () => { + let dir = await create('default'); - await build(dir); - dir = join(dir, 'build'); + await build(dir); + dir = join(dir, 'build'); - let output = await snapshot(dir); - testMatch(output, images[key]); - }); + let output = await snapshot(dir); + testMatch(output, images.default); + }); - it(`builds the '${key}' output with esm`, async () => { - let dir = await create(key); + it(`builds the 'default' template with esm`, async () => { + let dir = await create('default'); - await build(dir, { esm: true }); - dir = join(dir, 'build'); + await build(dir, { esm: true }); + dir = join(dir, 'build'); - let output = await snapshot(dir); - testMatch(output, images[key + '-esm']); - }); + let output = await snapshot(dir); + testMatch(output, images['default-esm']); }); it('should use SASS styles', async () => { diff --git a/packages/cli/tests/create.test.js b/packages/cli/tests/create.test.js index d05d6c346..0c13dae8c 100644 --- a/packages/cli/tests/create.test.js +++ b/packages/cli/tests/create.test.js @@ -4,20 +4,15 @@ const { create } = require('./lib/cli'); const { expand } = require('./lib/utils'); const snapshots = require('./images/create'); -// TODO: Move all `examples/` to `preactjs-templates` -const ours = ['default']; - describe('preact create', () => { - ours.forEach(key => { - it(`scaffolds the '${key}' official template`, async () => { - let dir = await create(key); - - let output = await expand(dir).then(arr => { - return arr.map(x => relative(dir, x)); - }); + it(`scaffolds the 'default' official template`, async () => { + let dir = await create('default'); - expect(output.sort()).toEqual(snapshots[key]); + let output = await expand(dir).then(arr => { + return arr.map(x => relative(dir, x)); }); + + expect(output.sort()).toEqual(snapshots.default); }); it(`should use template.html from the github repo`, async () => { @@ -38,9 +33,10 @@ describe('preact create', () => { expect(template.includes('apple-touch-icon')).toEqual(true); }); - // it('should fail given an invalid name', async () => { - // const exit = jest.spyOn(process, 'exit'); - // await create('default', '*()@!#!$-invalid-name'); - // expect(exit).toHaveBeenCalledWith(1); - // }); + it('should fail given an invalid name', async () => { + const exit = jest.spyOn(process, 'exit').mockImplementation(() => {}); + await create('simple', '*()@!#!$-Invalid-Name'); + + expect(exit).toHaveBeenCalledWith(1); + }); }); diff --git a/packages/cli/tests/images/create.js b/packages/cli/tests/images/create.js index 5cc6cf701..6cd269512 100644 --- a/packages/cli/tests/images/create.js +++ b/packages/cli/tests/images/create.js @@ -1,7 +1,6 @@ const path = require('path'); exports.default = [ - // '.babelrc', '.gitignore', 'package.json', 'README.md', diff --git a/packages/cli/tests/lib/cli.js b/packages/cli/tests/lib/cli.js index 190597bb9..fb2912801 100644 --- a/packages/cli/tests/lib/cli.js +++ b/packages/cli/tests/lib/cli.js @@ -1,5 +1,5 @@ const { join } = require('path'); -const { existsSync, mkdirSync, unlinkSync, symlinkSync } = require('fs'); +const { mkdirSync, symlinkSync } = require('fs'); const cmd = require('../../lib/commands'); const { tmpDir } = require('./output'); const shell = require('shelljs'); @@ -25,12 +25,6 @@ exports.create = async function (template, name) { await cmd.create(template, dest, { name, cwd: '.' }); - // TODO: temporary – will resolve after 2.x->3.x release - // Templates are using 2.x, which needs `.babelrc` for TEST modification. - // The 3.x templates won't need `.babelrc` for { modules: commonjs } - let babelrc = join(dest, '.babelrc'); - existsSync(babelrc) && unlinkSync(babelrc); - return dest; }; diff --git a/yarn.lock b/yarn.lock index aa7c01487..d1130eaf1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2749,11 +2749,6 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" -acorn-es7-plugin@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz#f2ee1f3228a90eead1245f9ab1922eb2e71d336b" - integrity sha1-8u4fMiipDurRJF+asZIusucdM2s= - acorn-globals@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" @@ -2797,11 +2792,6 @@ acorn-walk@^8.0.0: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.1.0.tgz#d3c6a9faf00987a5e2b9bdb506c2aa76cd707f83" integrity sha512-mjmzmv12YIG/G8JQdQuz2MUDShEJ6teYpT5bmWA4q7iwoGen8xtt3twF3OvzIUl+Q06aWIjvnwQUKvQ6TtMRjg== -"acorn@>= 2.5.2 <= 5.7.5": - version "5.7.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" - integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== - acorn@^4.0.4: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" @@ -3917,9 +3907,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001196, caniuse-lite@^1.0.30001219: - version "1.0.30001230" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz#8135c57459854b2240b57a4a6786044bdc5a9f71" - integrity sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ== + version "1.0.30001280" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001280.tgz" + integrity sha512-kFXwYvHe5rix25uwueBxC569o53J6TpnGu0BEEn+6Lhl2vsnAumRFWEBhDft1fwyo6m1r4i+RqA4+163FpeFcA== capture-stack-trace@^1.0.0: version "1.0.1" @@ -6197,14 +6187,6 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fast-async@^6.3.7: - version "6.3.8" - resolved "https://registry.yarnpkg.com/fast-async/-/fast-async-6.3.8.tgz#031b9e1d5a84608b117b3e7c999ad477ed2b08a2" - integrity sha512-TjlooyqrYm/gOXjD2UHNwfrWkvTbzU105Nk4bvcRTeRoL+wIeK6rqbqDg3CN9z5p37cE2iXhP6SxQFz8OVIaUg== - dependencies: - nodent-compiler "^3.2.10" - nodent-runtime ">=3.2.1" - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -10122,26 +10104,6 @@ node-releases@^1.1.71: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.72.tgz#14802ab6b1039a79a0c7d662b610a5bbd76eacbe" integrity sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw== -nodent-compiler@^3.2.10: - version "3.2.13" - resolved "https://registry.yarnpkg.com/nodent-compiler/-/nodent-compiler-3.2.13.tgz#149aefee22fe55f70e76ae7f1323e641e0c762e6" - integrity sha512-nzzWPXZwSdsWie34om+4dLrT/5l1nT/+ig1v06xuSgMtieJVAnMQFuZihUwREM+M7dFso9YoHfDmweexEXXrrw== - dependencies: - acorn ">= 2.5.2 <= 5.7.5" - acorn-es7-plugin "^1.1.7" - nodent-transform "^3.2.9" - source-map "^0.5.7" - -nodent-runtime@>=3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/nodent-runtime/-/nodent-runtime-3.2.1.tgz#9e2755d85e39f764288f0d4752ebcfe3e541e00e" - integrity sha512-7Ws63oC+215smeKJQCxzrK21VFVlCFBkwl0MOObt0HOpVQXs3u483sAmtkF33nNqZ5rSOQjB76fgyPBmAUrtCA== - -nodent-transform@^3.2.9: - version "3.2.9" - resolved "https://registry.yarnpkg.com/nodent-transform/-/nodent-transform-3.2.9.tgz#ec11a6116b5476e60bc212371cf6b8e4c74f40b6" - integrity sha512-4a5FH4WLi+daH/CGD5o/JWRR8W5tlCkd3nrDSkxbOzscJTyTUITltvOJeQjg3HJ1YgEuNyiPhQbvbtRjkQBByQ== - nopt@^4.0.1, nopt@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" @@ -13428,7 +13390,7 @@ source-map-url@^0.4.0: resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== -source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7: +source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= From 872367f0c19bd4fdc3af9783fa190511e7f95abd Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sun, 14 Nov 2021 00:30:30 -0600 Subject: [PATCH 2/4] chore: Removing (non-functional) setTemplate helper --- docs/webpack-helpers.md | 9 ------ .../cli/lib/lib/webpack/transform-config.js | 29 ------------------- 2 files changed, 38 deletions(-) diff --git a/docs/webpack-helpers.md b/docs/webpack-helpers.md index b794c2a98..a6b3e28d6 100644 --- a/docs/webpack-helpers.md +++ b/docs/webpack-helpers.md @@ -118,15 +118,6 @@ helpers.getPluginsByType(config, webpack.optimize.CommonsChunkPlugin); Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[PluginWrapper](#pluginwrapper)>** -### setHtmlTemplate - -Sets template used by HtmlWebpackPlugin. - -**Parameters** - -- `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack config](https://webpack.js.org/configuration/#options). -- `template` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** template path. See [HtmlWebpackPlugin docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md). - ## PluginWrapper Wrapper around webpack's [plugin](https://webpack.js.org/configuration/plugins/#plugins). diff --git a/packages/cli/lib/lib/webpack/transform-config.js b/packages/cli/lib/lib/webpack/transform-config.js index efea27ff8..a6ea20425 100644 --- a/packages/cli/lib/lib/webpack/transform-config.js +++ b/packages/cli/lib/lib/webpack/transform-config.js @@ -1,6 +1,5 @@ const { resolve } = require('path'); const webpack = require('webpack'); -const { statSync } = require('fs'); const { stat } = require('fs').promises; const { error } = require('../../util'); @@ -274,34 +273,6 @@ class WebpackConfigHelpers { getPluginsByType(config, type) { return this.getPlugins(config).filter(w => w.plugin instanceof type); } - - /** - * Sets template used by HtmlWebpackPlugin. - * - * @param {object} config - [webpack config](https://webpack.js.org/configuration/#options). - * @param {string} template - template path. See [HtmlWebpackPlugin docs](https://github.com/jantimon/html-webpack-plugin/blob/master/docs/template-option.md). - * - * @memberof WebpackConfigHelpers - */ - setHtmlTemplate(config, template) { - let isPath; - try { - statSync(template); - isPath = true; - } catch (e) {} - - let templatePath = isPath - ? `!!${require.resolve('ejs-loader')}?esModule=false!${resolve( - this._cwd, - template - )}` - : template; - let { plugin: htmlWebpackPlugin } = this.getPluginsByName( - config, - 'HtmlWebpackPlugin' - )[0]; - htmlWebpackPlugin.options.template = templatePath; - } } /** From c60a0361c588c2d0b9dd723cf9edebc892939943 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Mon, 15 Nov 2021 01:32:56 -0600 Subject: [PATCH 3/4] docs: Merging in changes from #1615 --- README.md | 80 +++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 10eec8072..4beda4c49 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ - [preact watch](#preact-watch) - [preact list](#preact-list) - [preact info](#preact-info) -- [Deploying](#deploying) - [Pre-rendering](#pre-rendering) - [Custom Configuration](#custom-configuration) - [Plugins](#plugins) @@ -25,6 +24,8 @@ - [Using CSS preprocessors](#using-css-preprocessors) - [SASS](#sass) - [LESS](#less) +- [Using Environment Variables](#using-environment-variables) +- [Route-Based Code Splitting](#route-based-code-splitting) ### Features @@ -148,7 +149,7 @@ $ preact watch --prerender Pre-render static content on first run --prerenderUrls Path to pre-rendered routes config (default prerender-urls.json) --template Path to custom HTML template - --refresh Will use [`Preact-refresh`](https://github.com/JoviDeCroock/preact-refresh) to do hot-reloading + --refresh Enables experimental preact-refresh functionality -c, --config Path to custom CLI config (default preact.config.js) -H, --host Set server hostname (default 0.0.0.0) -p, --port Set server port (default 8080) @@ -172,18 +173,6 @@ $ preact list Prints debugging information concerning the local environment. -### Deploying - -```sh -# create a production build: -npm run build - -# generate configuration in Firebase Hosting format: -npm run serve -- --server config - -# Copy your static files to a server! -``` - ### Pre-rendering Preact CLI in order to follow [PRPL] pattern renders initial route (`/`) into generated static `index.html` - this ensures that users get to see your page before any JavaScript is run, and thus providing users with slow devices or poor connection your website's content much faster. @@ -308,7 +297,7 @@ module.exports = [ #### Template -A template is used to render your page by [EJS](https://ejs.co/). +A template is used to render your page by [EJS](https://ejs.co/). You can uses the data of `prerenderUrls` which does not have `title`, using `htmlWebpackPlugin.options.CLI_DATA.preRenderData` in EJS. The default one is visible [here](packages/cli/lib/resources/template.html) and it's going to be enough for the majority of cases. @@ -352,36 +341,6 @@ export default { If you'd like to use these variables in your application, you can use the [DefinePlugin] config from our recipes wiki. -[promise]: https://npm.im/promise-polyfill -[fetch]: https://github.com/developit/unfetch -[preact]: https://github.com/preactjs/preact -[webpackconfighelpers]: docs/webpack-helpers.md -[`.babelrc`]: https://babeljs.io/docs/usage/babelrc -[simple]: https://github.com/preactjs-templates/simple -[`"browserslist"`]: https://github.com/ai/browserslist -[```.babelrc```]: https://babeljs.io/docs/usage/babelrc -[default]: https://github.com/preactjs-templates/default -[workbox]: https://developers.google.com/web/tools/workbox -[preact-router]: https://github.com/preactjs/preact-router -[material]: https://github.com/preactjs-templates/material -[netlify]: https://github.com/preactjs-templates/netlify -[typescript]: https://github.com/preactjs-templates/typescript -[widget]: https://github.com/preactjs-templates/widget -[plugins wiki]: https://github.com/preactjs/preact-cli/wiki/Plugins -[preactjs-templates organization]: https://github.com/preactjs-templates -[preactjs-templates/default]: https://github.com/preactjs-templates/default -[recipes wiki]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes -[prpl]: https://developers.google.com/web/fundamentals/performance/prpl-pattern -[`babel-preset-env`]: https://github.com/babel/babel-preset-env#targetsbrowsers -[proof]: https://googlechrome.github.io/lighthouse/viewer/?gist=142af6838482417af741d966e7804346 -[preact cli preset]: https://github.com/preactjs/preact-cli/blob/master/packages/cli/lib/lib/babel-config.js -[service workers]: https://developers.google.com/web/fundamentals/getting-started/primers/service-workers -[customize babel]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes#customising-babel-options-using-loader-helpers -[`async!`]: https://github.com/preactjs/preact-cli/blob/1.4.1/examples/full/src/components/app.js#L7 -[sass]: https://sass-lang.com -[less]: http://lesscss.org -[defineplugin]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes#use-environment-variables-in-your-application - ### Route-Based Code Splitting "Route" components are automatically code-splitted at build time to create smaller bundles and avoid loading more code than is needed by each page. This works by intercepting imports for route components with an [async loader](https://github.com/preactjs/preact-cli/tree/master/packages/async-loader), which returns a lightweight wrapper component that handles code splitting seamlessly. @@ -411,7 +370,7 @@ Automatic code splitting is applied to all JavaScript and TypeScript files in th -> **Note**: +> **Note**: > Automatic code splitting **only** supports default exports, not named exports: > > ```diff @@ -420,3 +379,32 @@ Automatic code splitting is applied to all JavaScript and TypeScript files in th > ``` > > This is an intentional limitation that ensures effective code splitting. For components that need named exports, place them in a directory that doesn't trigger automatic code splitting. You can then manually code-split the default export by re-exporting it from `routes/` or importing it with the `"async!"` prefix. + +[promise]: https://npm.im/promise-polyfill +[fetch]: https://github.com/developit/unfetch +[preact]: https://github.com/preactjs/preact +[webpackconfighelpers]: docs/webpack-helpers.md +[`.babelrc`]: https://babeljs.io/docs/usage/babelrc +[simple]: https://github.com/preactjs-templates/simple +[`"browserslist"`]: https://github.com/ai/browserslist +[```.babelrc```]: https://babeljs.io/docs/usage/babelrc +[default]: https://github.com/preactjs-templates/default +[workbox]: https://developers.google.com/web/tools/workbox +[preact-router]: https://github.com/preactjs/preact-router +[netlify]: https://github.com/preactjs-templates/netlify +[typescript]: https://github.com/preactjs-templates/typescript +[widget]: https://github.com/preactjs-templates/widget +[plugins wiki]: https://github.com/preactjs/preact-cli/wiki/Plugins +[preactjs-templates organization]: https://github.com/preactjs-templates +[preactjs-templates/default]: https://github.com/preactjs-templates/default +[recipes wiki]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes +[prpl]: https://developers.google.com/web/fundamentals/performance/prpl-pattern +[`babel-preset-env`]: https://github.com/babel/babel-preset-env#targetsbrowsers +[proof]: https://googlechrome.github.io/lighthouse/viewer/?gist=142af6838482417af741d966e7804346 +[preact cli preset]: https://github.com/preactjs/preact-cli/blob/master/packages/cli/lib/lib/babel-config.js +[service workers]: https://developers.google.com/web/fundamentals/getting-started/primers/service-workers +[customize babel]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes#customising-babel-options-using-loader-helpers +[`async!`]: https://github.com/preactjs/preact-cli/blob/1.4.1/examples/full/src/components/app.js#L7 +[sass]: https://sass-lang.com +[less]: http://lesscss.org +[defineplugin]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes#use-environment-variables-in-your-application From 5a0448f2fb8bc73ced06c290a94e8edf8f364174 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Tue, 16 Nov 2021 11:19:52 -0600 Subject: [PATCH 4/4] docs: Adding changeset --- .changeset/unlucky-brooms-rule.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/unlucky-brooms-rule.md diff --git a/.changeset/unlucky-brooms-rule.md b/.changeset/unlucky-brooms-rule.md new file mode 100644 index 000000000..8ea1b0e3b --- /dev/null +++ b/.changeset/unlucky-brooms-rule.md @@ -0,0 +1,5 @@ +--- +'preact-cli': patch +--- + +Removing old & non-functional config helper `setHtmlTemplate`