docusaurus/packages/docusaurus-plugin-pwa/src/pluginOptionSchema.js
Sébastien Lorber 02cd5d343b
fix(v2): PWA issues + improve docs (#4377)
* debug pwa

* more debugging logs + attempt to upgrade workbox

* fix PWA ?

* fix PWA ?

* enable pwa debugging for deploy previews

* try to fix the  app installed issue?

* try to fix appinstalled not firing

* try to add related applications to the PWA manifest

* attempt to fix related_applications

* attempt to fix related_applications

* attempt to fix related_applications

* improve PWA strategies

* improve PWA doc

* refactor/cleanup registerSw

* cleanup
2021-03-10 20:00:42 +01:00

54 lines
1.5 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const Joi = require('joi');
const path = require('path');
const DEFAULT_OPTIONS = {
debug: false,
offlineModeActivationStrategies: [
'appInstalled',
'queryString',
'standalone',
],
injectManifestConfig: {},
pwaHead: [],
swCustom: undefined,
swRegister: path.join(__dirname, 'registerSw.js'),
reloadPopup: '@theme/PwaReloadPopup',
};
exports.PluginOptionSchema = Joi.object({
debug: Joi.bool().default(DEFAULT_OPTIONS.debug),
offlineModeActivationStrategies: Joi.array()
.items(
Joi.string()
.valid(
'appInstalled',
'queryString',
'standalone',
'mobile',
'saveData',
'always',
)
.required(),
)
.default(DEFAULT_OPTIONS.offlineModeActivationStrategies),
injectManifestConfig: Joi.object().default(
DEFAULT_OPTIONS.injectManifestConfig,
),
pwaHead: Joi.array()
.items(Joi.object({tagName: Joi.string().required()}).unknown().required())
.default(DEFAULT_OPTIONS.pwaHead),
swCustom: Joi.string(),
swRegister: Joi.alternatives()
.try(Joi.string(), Joi.bool().valid(false))
.default(DEFAULT_OPTIONS.swRegister),
reloadPopup: Joi.alternatives()
.try(Joi.string(), Joi.bool().valid(false))
.default(DEFAULT_OPTIONS.reloadPopup),
});