Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-pwa

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-pwa - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

create-pwa.appcache

8

package.json
{
"name": "create-pwa",
"version": "0.3.0",
"version": "0.4.0",
"description": "Easily create a progressive web app",

@@ -28,8 +28,8 @@ "scripts": {

"dependencies": {
"sharp": "^0.20.2",
"yargs": "^11.0.0"
"sharp": "^0.20.5",
"yargs": "^12.0.1"
},
"devDependencies": {
"tape": "^4.9.0"
"tape": "^4.9.1"
}
}

@@ -1,3 +0,1 @@

[![GitHub stars](https://img.shields.io/github/stars/scriptex/create-pwa.svg?style=social&label=Stars)](https://github.com/scriptex/create-pwa)
[![GitHub forks](https://img.shields.io/github/forks/scriptex/create-pwa.svg?style=social&label=Fork)](https://github.com/scriptex/create-pwa/network#fork-destination-box)
[![GitHub release](https://img.shields.io/github/release/scriptex/create-pwa.svg)](https://github.com/scriptex/create-pwa/releases/latest)

@@ -9,6 +7,6 @@ [![GitHub issues](https://img.shields.io/github/issues/scriptex/create-pwa.svg)](https://github.com/scriptex/create-pwa/issues)

[![npm](https://img.shields.io/npm/v/create-pwa.svg)](https://www.npmjs.com/package/create-pwa)
[![license](https://img.shields.io/github/license/scriptex/create-pwa.svg)](https://github.com/scriptex/create-pwa)
[![Analytics](https://ga-beacon.appspot.com/UA-83446952-1/github.com/scriptex/create-pwa/README.md)](https://github.com/scriptex/create-pwa/)
[![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/scriptex/create-pwa/)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/scriptex/create-pwa/graphs/commit-activity)
[![Greenkeeper badge](https://badges.greenkeeper.io/scriptex/create-pwa.svg)](https://greenkeeper.io/)
[![dependencies Status](https://david-dm.org/scriptex/create-pwa/status.svg)](https://david-dm.org/scriptex/create-pwa)
[![devDependencies Status](https://david-dm.org/scriptex/create-pwa/dev-status.svg)](https://david-dm.org/scriptex/create-pwa?type=dev)

@@ -33,3 +31,3 @@ # create-pwa

```console
```sh
# Using NPM:

@@ -55,3 +53,3 @@ npm i create-pwa --save-dev

```console
```sh
cd your/app/folder

@@ -64,7 +62,7 @@

```
```json
{
"scripts": {
"pwa": "create-pwa --icon=\"path/to/your/icon.png\""
}
"scripts": {
"pwa": "create-pwa --icon=\"path/to/your/icon.png\""
}
}

@@ -83,3 +81,3 @@ ```

1. Add the following to the `head` of your HTML file(s):
1. Add the following to the `head` of your HTML file(s):

@@ -92,20 +90,12 @@ ```html

2. Add the following snippet to your application's JavaScript bundle or place it in a `script` tag just before the closing `</body>` tag in your HTML file(s):
2. Add the following snippet to your application's JavaScript bundle or place it in a `script` tag just before the closing `</body>` tag in your HTML file(s):
```js
```javascript
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('./service-worker.js').then(
function(registration) {
// Registration was successful
console.log(
'ServiceWorker registration successful with scope: ',
registration.scope
);
},
function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
}
);
window.addEventListener('load', () => {
navigator.serviceWorker.register('./service-worker.js').then(registration => {
console.log(`ServiceWorker registration successful with scope: ${registration.scope}`);
}, error => {
console.log(`ServiceWorker registration failed: ${error}`);
});
});

@@ -112,0 +102,0 @@ }

@@ -19,2 +19,3 @@ #!/usr/bin/env node

const manifestTemplate = require('./manifest');
const appCacheTemplate = require('./appcache');
const serviceWorkerTemplate = require('./sw');

@@ -76,2 +77,12 @@

/**
* Create app's cache manifest
*/
const setAppCache = name => {
writeFileSync(
resolve(pwd, `${name}.appcache`),
appCacheTemplate()
);
};
/**
* Create all PWA required files

@@ -83,3 +94,3 @@ */

setIcons(argv.icon || icon);
setAppCache(name);
setManifest(name);

@@ -95,3 +106,4 @@ setServiceWorker(name);

module.exports.setIcons = setIcons;
module.exports.setAppCache = setAppCache;
module.exports.setManifest = setManifest;
module.exports.setServiceWorker = setServiceWorker;

@@ -70,2 +70,13 @@ /**

/**
* Test if an appcache file is created
*/
tape('Should create an appcache file', t => {
const ac = resolve(__dirname, './create-pwa.appcache');
const appCacheFileExists = existsSync(ac);
t.ok(appCacheFileExists, 'create-pwa.appcache exists');
t.end();
});
/**
* Test if icons are being generated

@@ -72,0 +83,0 @@ */

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc