include offline copy of docs

This grabs the docs via the @pybricks/ide-docs package and copies them
to the build directory with copy-webpack-plugin.

The service worker automatically picks up these files for precache
since they go through webpack.
This commit is contained in:
David Lechner
2021-01-25 21:05:14 -06:00
parent 62ceab4561
commit afc8e7c628
5 changed files with 37 additions and 4 deletions
+9
View File
@@ -8,6 +8,7 @@ const {
getLoaders,
loaderByName,
} = require('@craco/craco');
const CopyPlugin = require('copy-webpack-plugin');
const LicensePlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
const satisfies = require('spdx-satisfies');
@@ -187,6 +188,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`,
module.exports = {
webpack: {
plugins: [
new CopyPlugin({
patterns: [
{
from: 'node_modules/@pybricks/ide-docs/build/html',
to: 'static/docs',
},
],
}),
new LicensePlugin({
outputFilename: 'static/oss-licenses.json',
perChunkOutput: false,
+2
View File
@@ -11,6 +11,7 @@
"@blueprintjs/core": "^3.38.1",
"@craco/craco": "^6.0.0",
"@pybricks/firmware": "4.5.0",
"@pybricks/ide-docs": "1.0.0",
"@pybricks/mpy-cross-v5": "^2.0.0",
"@shopify/react-i18n": "^5.2.1",
"@testing-library/dom": "^7.29.2",
@@ -30,6 +31,7 @@
"@types/zen-push": "^0.1.1",
"ace-builds": "^1.4.12",
"babel-plugin-macros": "^3.0.1",
"copy-webpack-plugin": "6",
"file-saver": "^2.0.5",
"jszip": "^3.5.0",
"license-webpack-plugin": "^2.3.11",
+1 -1
View File
@@ -52,7 +52,7 @@ function App(): JSX.Element {
<div className="h-100 w-100">
{dragging && <div className="h-100 w-100 p-absolute" />}
<iframe
src="https://docs.pybricks.com"
src="static/docs/index.html"
allowFullScreen={true}
title="docs"
width="100%"
+1 -1
View File
@@ -22,7 +22,7 @@ clientsClaim();
// Their URLs are injected into the manifest variable below.
// This variable must be present somewhere in your service worker file,
// even if you decide not to use precaching. See https://cra.link/PWA
precacheAndRoute(self.__WB_MANIFEST);
precacheAndRoute(self.__WB_MANIFEST, { ignoreURLParametersMatching: [/.*/] });
// Set up App Shell-style routing, so that all navigation requests
// are fulfilled with your index.html shell. Learn more at
+24 -2
View File
@@ -1462,6 +1462,11 @@
dependencies:
jszip "^3.5.0"
"@pybricks/ide-docs@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@pybricks/ide-docs/-/ide-docs-1.0.0.tgz#e93ff78c65730bbdd26b9deaf3110799d46de8e6"
integrity sha512-pe52fHG3S2QIx7RLX8+a+5oQo5A/svR2bxJWWImwZ2unAbPYmZ2G/25zgtYb9JF4Fec2f9mLT2zRiGqUjiCjiw==
"@pybricks/mpy-cross-v5@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@pybricks/mpy-cross-v5/-/mpy-cross-v5-2.0.0.tgz#9d64e1dedda0a7a028117f510ce5365f504df400"
@@ -3885,6 +3890,23 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
copy-webpack-plugin@6:
version "6.4.1"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-6.4.1.tgz#138cd9b436dbca0a6d071720d5414848992ec47e"
integrity sha512-MXyPCjdPVx5iiWyl40Va3JGh27bKzOTNY3NjUTrosD2q7dR/cLD0013uqJ3BpFbUjyONINjb6qI7nDIJujrMbA==
dependencies:
cacache "^15.0.5"
fast-glob "^3.2.4"
find-cache-dir "^3.3.1"
glob-parent "^5.1.1"
globby "^11.0.1"
loader-utils "^2.0.0"
normalize-path "^3.0.0"
p-limit "^3.0.2"
schema-utils "^3.0.0"
serialize-javascript "^5.0.1"
webpack-sources "^1.4.3"
core-js-compat@^3.6.2, core-js-compat@^3.8.0:
version "3.8.2"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.8.2.tgz#3717f51f6c3d2ebba8cbf27619b57160029d1d4c"
@@ -5358,7 +5380,7 @@ fast-diff@^1.1.2:
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
fast-glob@^3.1.1:
fast-glob@^3.1.1, fast-glob@^3.2.4:
version "3.2.5"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661"
integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==
@@ -5788,7 +5810,7 @@ glob-parent@^3.1.0:
is-glob "^3.1.0"
path-dirname "^1.0.0"
glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@~5.1.0:
glob-parent@^5.0.0, glob-parent@^5.1.0, glob-parent@^5.1.1, glob-parent@~5.1.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229"
integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==