Git Product home page Git Product logo

pwa-workshop-codelab's Introduction

PWA Edit

PWA Edit is the sample app that you'll build as you complete the PWA Workshop.

Files

There are two kinds of files in this codebase: application files and source files. Application files are files you will not touch during the course of the workshop; they exist to provide a full functional experience. Source files are files you'll be touching throughout the course of the workshop.

Source files

  • js/main.js - Main application JavaScript
  • service-worker.js - Service worker file, first use during the Going Offline codelab
  • manifest.json - Web App Manifest file, first used during the From Tab to Taskbar codelab
  • js/lib/install.js - Provides a base class for the install button, used during the Install Button codelab
  • js/lib/actions.js - Provides a base class for the menu, used during the Capable codelab

Application files

  • index.html - Main application HTML
  • offline.html - Offline fallback HTML
  • preview/index.html - Preview page HTML
  • css/* - Styling for the applcation
  • images/* - Images associated with the application
  • package.json and package-lock.json - Node dependency files
  • wmr.config.mjs - Config file for WMR, the light-weight build tool being used for this project.

pwa-workshop-codelab's People

Contributors

snugug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pwa-workshop-codelab's Issues

Outdated dependencies

Both WMR and its service-worker plugin are quite outdated, leading to some inconsistency issues

Fails on setup

trying to follow along with Progressive Web Apps: Going Offline it fails on 2. Get Set Up with the following ...

name@DESKTOP-G3DFJ6S:/mnt/d/pwa-workshop-codelab-starter$ npm ci
added 4 packages in 2.032s
name@DESKTOP-G3DFJ6S:/mnt/d/pwa-workshop-codelab-starter$ npm start

> [email protected] start /mnt/d/pwa-workshop-codelab-starter
> wmr .

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'worker_threads'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/mnt/d/pwa-workshop-codelab-starter/node_modules/wmr/wmr.cjs:2:162)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `wmr .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/name/.npm/_logs/2021-07-10T17_51_28_330Z-debug.log

and the contents of the debug log ...

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/mnt/d/pwa-workshop-codelab-starter/node_modules/.bin:/home/name/.local/bin:/home/name/.wasmer/bin:/home/name/.wasienv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/qemu:/mnt/c/Program Files/Python36/Scripts/:/mnt/c/Program Files/Python36/:/mnt/c/Program Files/Python38/Scripts/:/mnt/c/Program Files/Python38/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/NSIS:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/Gource/cmd:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/Name/AppData/Local/Microsoft/WindowsApps:/mnt/c/Windows/SysWOW64/downlevel:/mnt/c/Users/Name/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/Name/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Name/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0/LocalCache/local-packages/Python37/Scripts:/snap/bin:/home/name/.wasmer/globals/wapm_packages/.bin
9 verbose lifecycle [email protected]~start: CWD: /mnt/d/pwa-workshop-codelab-starter
10 silly lifecycle [email protected]~start: Args: [ '-c', 'wmr .' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `wmr .`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /mnt/d/pwa-workshop-codelab-starter
16 verbose Linux 5.10.43.3-microsoft-standard-WSL2
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.19.0
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `wmr .`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

after looking up the problem I found out about the --experimental-worker flag ... and now I get this ...

name@DESKTOP-G3DFJ6S:/mnt/d/pwa-workshop-codelab-starter$ export NODE\_OPTIONS=--experimental-worker
name@DESKTOP-G3DFJ6S:/mnt/d/pwa-workshop-codelab-starter$ npm start

> [email protected] start /mnt/d/pwa-workshop-codelab-starter
> wmr .

util.js:280
    throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "superCtor" argument must be of type Function. Received type undefined
    at inherits (util.js:280:11)
    at Object.<anonymous> (/mnt/d/pwa-workshop-codelab-starter/node_modules/wmr/wmr.cjs:2:1126493)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `wmr .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/name/.npm/_logs/2021-07-10T18_07_09_878Z-debug.log

This is where I'm stuck ...

P2

User based attack appeal for abbritation

Undefined value of screens

In actions.js below code is used to get the array with multiple screens..

// Line 151 of actions.js, Branch: pwa06--service-worker-includes
const { screens } = await window.getScreens()

It throws below error when preview is triggered, as window.getScreens returns an array not an object..

image

Quick, fix to this error might be to just assign the array directly to screens variable, by removing curly braces

const screens  = await window.getScreens();

Alternatively, maybe global variable screen can be used to show the preview at correct position
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.