ElMassimo / iles

🏝 The joyful site generator
https://iles.pages.dev
MIT License
1.08k stars 31 forks source link

feat: add pwa module by @userquin #127

Closed userquin closed 2 years ago

userquin commented 2 years ago

Description 📖

Adds @island/pwa module via vite-plugin-pwa, also includes:

There are a few pending things (there are some todo@userquin on the module):

Background 📜

Allow îles apps work offline and improve performance.

The Fix 🔨

Add the module and configure the package

Screenshots 📷

Small video with îles docs working offline: https://streamable.com/n4ogwu

Here Lighthouse result:

imagen

nx-cloud[bot] commented 2 years ago

Nx Cloud Report

CI is running for commit a56571a5691802655b1fade44a22c71061cdc296.

📂 Click to track the progress, see the status, the terminal output, and the build insights.


Sent with 💌 from NxCloud.

userquin commented 2 years ago

on Windows I cannot execute the tests, we need to fix this

ElMassimo commented 2 years ago

@userquin What are the error messages when executing tests in Windows?

userquin commented 2 years ago

@ElMassimo

F:\work\projects\quini\GitHub\antfu\iles-pwa>pnpm run test

> root@ test F:\work\projects\quini\GitHub\antfu\iles-pwa
> packages/iles/bin/iles.js test

"packages" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
 ELIFECYCLE  Test failed. See above for more details.       

Executing it via (adding node) "test": "node packages/iles/bin/iles.js test":

F:\work\projects\quini\GitHub\antfu\iles-pwa>pnpm run test

> root@ test F:\work\projects\quini\GitHub\antfu\iles-pwa
> node packages/iles/bin/iles.js test

node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: spawn vitest ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn vitest',
  path: 'vitest',
  spawnargs: [
    '--config',
    'F:/work/projects/quini/GitHub/antfu/iles-pwa/packages/iles/config.js'
  ]
}
 ELIFECYCLE  Test failed. See above for more details.

It seems the cli.d.ts is empty...

userquin commented 2 years ago

why not just running it via iles test? I get the same error using node

ElMassimo commented 2 years ago

Gotcha, it's because the command hardcodes the path in a non-cross-platform way.

iles test was not available initially, but it might be a good way to do it now that the command exists.

userquin commented 2 years ago

Let's follow-up on any additional changes, I'm ok if you want to merge this first, and do the switch to prompt in the docs later on, just let me know.

If you merge this PR, beware not deploying docs, or maybe you can merge it on a new branch and so we can play with it here.

userquin commented 2 years ago

uhmm, I need add a hint on the docs, we need also add the module when using vite-plugin-pwa as a Vite plugin to make the app work offline.

userquin commented 2 years ago

Se me olvidaba Máximo, hay que revisar el tema de netlify, en teoría creo que las cabeceras están bien, pero habrá que probarlo, igual puedes habilitar un hook para hacer un preview aquí.