@inglorious/create-app 1.4.1 → 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 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 registration |
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
- if (extension === ".ts") {
96
- return `// Only the framework-free helpers: "client" also loads React's and Preact's
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
- return `import { isNative } from "@inglorious/web/mobile"
109
- import { registerSW } from "virtual:pwa-register"
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
- if (!isNative()) {
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: "autoUpdate",
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.1",
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",
@@ -37,7 +37,7 @@
37
37
  "prompts": "^2.4.2"
38
38
  },
39
39
  "devDependencies": {
40
- "@inglorious/eslint-config": "1.1.4",
40
+ "@inglorious/eslint-config": "1.2.0",
41
41
  "prettier": "^3.9.6"
42
42
  },
43
43
  "scripts": {
@@ -22,6 +22,7 @@
22
22
  "@inglorious/vite-plugin-hmr": "workspace:*",
23
23
  "@inglorious/vite-plugin-jsx": "workspace:*",
24
24
  "eslint": "^10.13.0",
25
+ "eslint-plugin-react": "^7.37.5",
25
26
  "prettier": "^3.9.10",
26
27
  "rollup-plugin-minify-template-literals": "^2.2.0",
27
28
  "sharp": "^0.35.5",
@@ -21,6 +21,8 @@
21
21
  "@inglorious/eslint-config": "workspace:*",
22
22
  "@inglorious/vite-plugin-hmr": "workspace:*",
23
23
  "@types/node": "^22.20.5",
24
+ "@typescript-eslint/eslint-plugin": "^8.72.0",
25
+ "@typescript-eslint/parser": "^8.72.0",
24
26
  "@typescript/native": "npm:typescript@^7.0.2",
25
27
  "eslint": "^10.13.0",
26
28
  "jiti": "^2.7.0",
@@ -23,6 +23,8 @@
23
23
  "@inglorious/vite-plugin-hmr": "workspace:*",
24
24
  "@inglorious/vite-plugin-jsx": "workspace:*",
25
25
  "@types/node": "^22.20.5",
26
+ "@typescript-eslint/eslint-plugin": "^8.72.0",
27
+ "@typescript-eslint/parser": "^8.72.0",
26
28
  "@typescript/native": "npm:typescript@^7.0.2",
27
29
  "eslint": "^10.13.0",
28
30
  "jiti": "^2.7.0",
@@ -22,6 +22,8 @@
22
22
  "@inglorious/vite-plugin-hmr": "workspace:*",
23
23
  "@inglorious/vite-plugin-vue": "workspace:*",
24
24
  "@types/node": "^22.20.5",
25
+ "@typescript-eslint/eslint-plugin": "^8.72.0",
26
+ "@typescript-eslint/parser": "^8.72.0",
25
27
  "@typescript/native": "npm:typescript@^7.0.2",
26
28
  "eslint": "^10.13.0",
27
29
  "jiti": "^2.7.0",