Skip to content

Commit

Permalink
feat: include plugin launch path plugin.html in built manifests [LIBS…
Browse files Browse the repository at this point in the history
…-346] (#745)
  • Loading branch information
amcgee committed Sep 16, 2022
1 parent f455836 commit 8843f6b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion cli/src/lib/generateManifests.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ module.exports = (paths, config, publicUrl) => {
version: config.version,
core_app: config.coreApp,

launch_path: 'index.html',
launch_path: paths.launchPath,
plugin_launch_path: paths.pluginLaunchPath,
default_locale: 'en',
activities: {
dhis: {
Expand Down Expand Up @@ -146,6 +147,10 @@ module.exports = (paths, config, publicUrl) => {
// Write d2 config json
const appConfig = { ...config }
delete appConfig['entryPoints']
appConfig.entryPoints = {
app: paths.launchPath,
plugin: config.entryPoints.plugin ? paths.pluginLaunchPath : undefined,
}
delete appConfig['pwa']

fs.writeJsonSync(paths.shellPublicConfigJson, appConfig, { spaces: 2 })
Expand Down
3 changes: 3 additions & 0 deletions cli/src/lib/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ module.exports = (cwd = process.cwd()) => {
),
buildLibBundleFile: '{name}-{version}.zip',
buildLibBundleOutput: path.join(base),

launchPath: 'index.html',
pluginLaunchPath: 'plugin.html',
}

reporter.debug('PATHS', paths)
Expand Down
2 changes: 1 addition & 1 deletion cli/src/lib/plugin/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = async ({ port, paths }) => {
port,
host,
// open browser
open: ['/plugin.html'],
open: [`/${paths.pluginLaunchPath}`],
client: {
logging: 'none',
overlay: {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/lib/plugin/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module.exports = ({ env: webpackEnv, paths }) => {
Object.assign(
{
inject: true,
filename: 'plugin.html',
filename: paths.pluginLaunchPath,
template: paths.shellPublicPluginHtml,
},
isProduction
Expand Down
2 changes: 1 addition & 1 deletion cli/src/lib/pwa/injectPrecacheManifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = function injectPrecacheManifest(paths, config) {
globPatterns: ['**/*'],
// Skip index.html and `static` directory;
// CRA's workbox-webpack-plugin handles it smartly
globIgnores: ['static/**/*', 'index.html'],
globIgnores: ['static/**/*', paths.launchPath],
additionalManifestEntries: config.pwa.caching.additionalManifestEntries,
injectionPoint: 'self.__WB_BUILD_MANIFEST',
// Skip revision hashing for files with hash or semver in name:
Expand Down

0 comments on commit 8843f6b

Please sign in to comment.