@inglorious/create-app 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/bin/lib/pwa.js +18 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,16 +25,16 @@ The CLI will guide you through the setup process, asking for a project name and
|
|
|
25
25
|
|
|
26
26
|
For the JavaScript and TypeScript Vite templates, the CLI then asks about the app's features:
|
|
27
27
|
|
|
28
|
-
| Question | Flag | Adds
|
|
29
|
-
| ------------------------- | ---------------------------------------------------- |
|
|
30
|
-
| Use Inglorious UI? | `--ui` / `--no-ui` | `@inglorious/ui`, its base styles and an app bar
|
|
31
|
-
| Which theme? | `--theme=inglorious\|material\|bootstrap` | The theme's stylesheet and class
|
|
32
|
-
| Is it a mobile app? | `--mobile` / `--no-mobile` | Capacitor for Android and iOS; with Inglorious UI, a bottom tab bar and safe-area spacing
|
|
33
|
-
| Add routing? | `--routing` / `--no-routing` | The Router, a home and an about page, and navigation between them
|
|
34
|
-
| Animate page transitions? | `--transitions` / `--no-transitions` | View transitions between pages (with routing and Inglorious UI)
|
|
35
|
-
| Which icon packs? | `--icons=material,fontawesome,lucide` / `--no-icons` | Iconify icon sets, drawn by Inglorious UI's `Icon` (with Inglorious UI)
|
|
36
|
-
| Translate the app? | `--i18n` / `--no-i18n`, `--languages=en,it` | `@inglorious/i18n`, a catalogue per language and a language picker; the first language is the default
|
|
37
|
-
| Enable PWA support? | `--pwa` / `--no-pwa` | `vite-plugin-pwa`, a manifest, icons and service worker
|
|
28
|
+
| Question | Flag | Adds |
|
|
29
|
+
| ------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| Use Inglorious UI? | `--ui` / `--no-ui` | `@inglorious/ui`, its base styles and an app bar |
|
|
31
|
+
| Which theme? | `--theme=inglorious\|material\|bootstrap` | The theme's stylesheet and class |
|
|
32
|
+
| Is it a mobile app? | `--mobile` / `--no-mobile` | Capacitor for Android and iOS; with Inglorious UI, a bottom tab bar and safe-area spacing |
|
|
33
|
+
| Add routing? | `--routing` / `--no-routing` | The Router, a home and an about page, and navigation between them |
|
|
34
|
+
| Animate page transitions? | `--transitions` / `--no-transitions` | View transitions between pages (with routing and Inglorious UI) |
|
|
35
|
+
| Which icon packs? | `--icons=material,fontawesome,lucide` / `--no-icons` | Iconify icon sets, drawn by Inglorious UI's `Icon` (with Inglorious UI) |
|
|
36
|
+
| Translate the app? | `--i18n` / `--no-i18n`, `--languages=en,it` | `@inglorious/i18n`, a catalogue per language and a language picker; the first language is the default |
|
|
37
|
+
| Enable PWA support? | `--pwa` / `--no-pwa` | `vite-plugin-pwa`, a manifest, icons, and a service worker that keeps installed apps on the latest version |
|
|
38
38
|
|
|
39
39
|
The app is generated in the syntax you chose: lit-html, JSX or Vue. Every question answered on the command line is skipped, so a project can be created without any prompt:
|
|
40
40
|
|
package/bin/lib/pwa.js
CHANGED
|
@@ -91,33 +91,37 @@ export function writePwaRegistration(targetDir) {
|
|
|
91
91
|
fs.writeFileSync(pwaPath, createPwaRegistrationSource(extension))
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
// The worker waits for the SKIP_WAITING message `watchPwaUpdate` sends: on
|
|
95
|
+
// its own, a new version would wait for every tab of the app to close, which
|
|
96
|
+
// for a PWA installed on a phone is never.
|
|
94
97
|
export function createPwaRegistrationSource(extension) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// typings, whose global JSX would replace Inglorious's.
|
|
98
|
-
/// <reference types="vite-plugin-pwa/vanillajs" />
|
|
99
|
-
import { isNative } from "@inglorious/web/mobile"
|
|
98
|
+
const registration = `import { isNative } from "@inglorious/web/mobile"
|
|
99
|
+
import { watchPwaUpdate } from "@inglorious/web/pwa"
|
|
100
100
|
import { registerSW } from "virtual:pwa-register"
|
|
101
101
|
|
|
102
102
|
if (!isNative()) {
|
|
103
|
-
registerSW(
|
|
103
|
+
registerSW({
|
|
104
|
+
onRegisteredSW(url, registration) {
|
|
105
|
+
if (registration) watchPwaUpdate(registration)
|
|
106
|
+
},
|
|
107
|
+
})
|
|
104
108
|
}
|
|
105
109
|
`
|
|
106
|
-
}
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
if (extension === ".ts") {
|
|
112
|
+
return `// Only the framework-free helpers: "client" also loads React's and Preact's
|
|
113
|
+
// typings, whose global JSX would replace Inglorious's.
|
|
114
|
+
/// <reference types="vite-plugin-pwa/vanillajs" />
|
|
115
|
+
${registration}`
|
|
116
|
+
}
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
registerSW()
|
|
113
|
-
}
|
|
114
|
-
`
|
|
118
|
+
return registration
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
export function createVitePwaConfig(projectName) {
|
|
118
122
|
return `VitePWA({
|
|
119
123
|
injectRegister: false,
|
|
120
|
-
registerType: "
|
|
124
|
+
registerType: "prompt",
|
|
121
125
|
pwaAssets: {
|
|
122
126
|
image: "public/logo.png",
|
|
123
127
|
preset: "minimal-2023",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/create-app",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "A scaffolding tool to quickly create a new app with Inglorious Web.",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|