From c4b0a9a781f39cd6069c4ee413323b6b2e14caa8 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 6 Jul 2022 14:17:53 -0500 Subject: [PATCH] add version to docs path This adds the @pybricks/ide-docs package version to the static path. This should ensure that we don't get a cached older version in the browser when the ide-docs package is updated. --- config/webpack.config.js | 4 ++-- src/app/App.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 3449b726..7a6daf6d 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -601,8 +601,8 @@ module.exports = function (webpackEnv) { new CopyPlugin({ patterns: [ { - from: 'node_modules/@pybricks/ide-docs/html', - to: 'static/docs', + from: `${path.dirname(require.resolve('@pybricks/ide-docs/package.json'))}/html`, + to: `static/docs/v${require('@pybricks/ide-docs/package.json').version}/`, }, ], }), diff --git a/src/app/App.tsx b/src/app/App.tsx index 0a69299c..91340716 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,7 +1,10 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2020-2022 The Pybricks Authors +import 'react-splitter-layout/lib/index.css'; +import './app.scss'; import { Classes } from '@blueprintjs/core'; +import docsPackage from '@pybricks/ide-docs/package.json'; import { getFocusableTreeWalker } from '@react-aria/focus'; import React, { FocusEventHandler, @@ -20,8 +23,6 @@ import StatusBar from '../status-bar/StatusBar'; import Terminal from '../terminal/Terminal'; import Toolbar from '../toolbar/Toolbar'; import { isMacOS } from '../utils/os'; -import 'react-splitter-layout/lib/index.css'; -import './app.scss'; const Docs: React.VFC = () => { const { setIsSettingShowDocsEnabled } = useSettingIsShowDocsEnabled(); @@ -119,7 +120,7 @@ const Docs: React.VFC = () => { contentWindow.document.documentElement.classList.add(Classes.DARK); } }} - src="static/docs/index.html" + src={`static/docs/v${docsPackage.version}/index.html`} allowFullScreen={true} role="documentation" width="100%"