How to use the @pwa-manifest/core function in @pwa-manifest/core

To help you get started, we’ve selected a few @pwa-manifest/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 101arrowz / pwa-manifest / packages / parcel-plugin-pwa-manifest / index.ts View on Github external
const onBundled = async (bundle: ParcelBundle): Promise => {
    bundler.emit('pwaBuildStart');
    const pkg = await getPkg(
      bundle.entryAsset || bundle.childBundles.values().next().value.entryAsset
    );
    const opts = pkg.pwaManifest || pkg['pwa-manifest'];

    // istanbul ignore next
    if (typeof opts !== 'object') {
      if (typeof opts === 'undefined')
        throw 'No PWA Manifest options found in package.json.';
      throw 'The PWA Manifest parameter in package.json must be an object containing the desired parameters.';
    }
    const generator = new PWAManifestGenerator(
      opts,
      {
        baseURL: publicURL,
        resolveDir: pkg.pkgdir
      },
      {
        name: pkg.name,
        desc: pkg.description
      }
    );
    generator.on('*', (ev, ...args) => {
      bundler.emit(`pwa${ev.slice(0, 1).toUpperCase() + ev.slice(1)}`, ...args);
      if (ev.endsWith('Start')) {
        logger.progress(args[0]);
      }
    });
github 101arrowz / pwa-manifest / packages / webpack-plugin-pwa-manifest / index.ts View on Github external
this.cb = async (compilation, data) => {
      const logger = compilation.getLogger(NAME);
      try {
        const gen = new PWAManifestGenerator(opts, {
          baseURL: compilation.outputOptions.publicPath,
          resolveDir: '.'
        });
        const compHooks = WebpackPluginPWAManifest.getHooks(compilation);
        gen.on('*', (ev, ...args) => {
          const hook = compHooks[ev];
          if (hook.call) hook.call(...args);
          else hook.promise(...args);
          if (ev.endsWith('Start')) {
            logger.group(args[0]);
          }
        });
        if (!HtmlWebpackPlugin) {
          logger.warn(
            'html-webpack-plugin not installed, so HTML will not be injected.'
          );

@pwa-manifest/core

Core generation for a Web App Manifest, all necessary icons, and more!

MIT
Latest version published 1 year ago

Package Health Score

49 / 100
Full package analysis

Popular @pwa-manifest/core functions