@inglorious/create-app 1.1.0 → 1.1.1

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
@@ -67,6 +67,12 @@ When mobile support is enabled, build and sync native projects with:
67
67
  pnpm mobile:sync
68
68
  ```
69
69
 
70
+ For Android and iOS builds, install Android Studio with the Android SDK and a Java runtime compatible with Capacitor. Capacitor currently works reliably with JDK 21, so prefer JDK 21 over newer Java versions if you hit Java compatibility issues. Set `JAVA_HOME` to your JDK 21 install and `ANDROID_HOME` to your Android SDK path before running the native app. See the official Capacitor setup guides for platform-specific instructions:
71
+
72
+ - Android: https://capacitorjs.com/docs/android
73
+ - iOS: https://capacitorjs.com/docs/ios
74
+ - Android Studio: https://developer.android.com/studio
75
+
70
76
  ## License
71
77
 
72
78
  **MIT License - Free and open source**
package/bin/index.js CHANGED
@@ -316,9 +316,86 @@ function addMobileSupport(targetDir, pkg, projectName, templateName) {
316
316
 
317
317
  const extension = templateName.startsWith("ts") ? "ts" : "js"
318
318
  fs.writeFileSync(
319
- path.join(targetDir, `capacitor.config.${extension}`),
319
+ path.join(targetDir, `capacitor.config.ts`), // HACK: apparently only ts config works!
320
320
  createCapacitorConfigSource(projectName, extension),
321
321
  )
322
+
323
+ appendMobileSetupToReadme(targetDir)
324
+ }
325
+
326
+ function appendMobileSetupToReadme(targetDir) {
327
+ const readmePath = path.join(targetDir, "README.md")
328
+ if (!fs.existsSync(readmePath)) {
329
+ return
330
+ }
331
+
332
+ const readme = fs.readFileSync(readmePath, "utf-8")
333
+ if (readme.includes("## Mobile Setup")) {
334
+ return
335
+ }
336
+
337
+ const mobileReadme = `
338
+ ## Mobile Setup
339
+
340
+ This project includes Capacitor for Android and iOS support.
341
+
342
+ Please note that mobile development depends on external platform tooling that is not installed or managed by the CLI. If the app does not just work after scaffolding, it is usually because one or more native prerequisites are missing on the machine.
343
+
344
+ ### Android
345
+
346
+ Before you run the native apps, make sure you have:
347
+
348
+ - Android Studio installed with the Android SDK: https://developer.android.com/studio
349
+ - A Java Development Kit compatible with Capacitor. Capacitor is currently known to work reliably with JDK 21, so prefer JDK 21 over newer versions if you run into Java compatibility errors.
350
+ - The SDK path available via ANDROID_HOME (for example, on macOS this is often $HOME/Library/Android/sdk)
351
+
352
+ On macOS, the following shell variables are commonly needed:
353
+
354
+ \`\`\`bash
355
+ export JAVA_HOME="/path/to/jdk-21"
356
+ export ANDROID_HOME="$HOME/Library/Android/sdk"
357
+ export PATH="$ANDROID_HOME/platform-tools:$PATH"
358
+ \`\`\`
359
+
360
+ ### iOS
361
+
362
+ For iOS you also need the Apple toolchain and device setup on a Mac:
363
+
364
+ - Xcode from the App Store
365
+ - iOS development tools and simulator components (this can be very large, often multiple GB)
366
+ - A valid Apple Developer team / signing identity in Xcode
367
+ - Device trust setup for your iPhone in Settings > General > VPN & Device Management
368
+
369
+ The most common first-time setup commands are:
370
+
371
+ \`\`\`bash
372
+ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
373
+ sudo xcodebuild -license accept
374
+ \`\`\`
375
+
376
+ If you are using a physical device, you may also need to approve the developer certificate on the device and ensure the app is signed with a valid team.
377
+
378
+ ### Official resources
379
+
380
+ - Android: https://capacitorjs.com/docs/android
381
+ - iOS: https://capacitorjs.com/docs/ios
382
+ - Android Studio: https://developer.android.com/studio
383
+ - Xcode: https://developer.apple.com/xcode/
384
+
385
+ Then sync and open the native project:
386
+
387
+ \`\`\`bash
388
+ pnpm mobile:sync
389
+ pnpm mobile:android
390
+ # or
391
+ pnpm mobile:ios
392
+ \`\`\`
393
+ `
394
+
395
+ fs.writeFileSync(
396
+ readmePath,
397
+ `${readme.trimEnd()}${EOL}${EOL}${mobileReadme.trim()}${EOL}`,
398
+ )
322
399
  }
323
400
 
324
401
  function createServiceWorkerSource() {
@@ -446,11 +523,11 @@ function findMainPath(targetDir) {
446
523
  return candidates.find((candidate) => fs.existsSync(candidate)) ?? null
447
524
  }
448
525
 
449
- function createCapacitorConfigSource(projectName, extension) {
526
+ function createCapacitorConfigSource(projectName /* , extension */) {
450
527
  const appId = `com.inglorious.${toJavaIdentifier(projectName)}`
451
528
 
452
- if (extension === "ts") {
453
- return `import type { CapacitorConfig } from "@capacitor/cli"
529
+ //if (extension === "ts") { // HACK: apparently only ts config files work!
530
+ return `import type { CapacitorConfig } from "@capacitor/cli"
454
531
 
455
532
  const config: CapacitorConfig = {
456
533
  appId: "${appId}",
@@ -458,17 +535,6 @@ const config: CapacitorConfig = {
458
535
  webDir: "dist",
459
536
  }
460
537
 
461
- export default config
462
- `
463
- }
464
-
465
- return `/** @type {import("@capacitor/cli").CapacitorConfig} */
466
- const config = {
467
- appId: "${appId}",
468
- appName: "${projectName}",
469
- webDir: "dist",
470
- }
471
-
472
538
  export default config
473
539
  `
474
540
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/create-app",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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",
@@ -2,7 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
+ />
6
9
  <link rel="icon" type="image/svg+xml" href="/logo.png" />
7
10
  <link rel="stylesheet" href="/style.css" />
8
11
  <title>Inglorious App</title>
@@ -2,7 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
+ />
6
9
  <link rel="icon" type="image/svg+xml" href="/logo.png" />
7
10
  <link rel="stylesheet" href="/style.css" />
8
11
  <title>Inglorious App</title>
@@ -2,7 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
+ />
6
9
  <link rel="icon" type="image/svg+xml" href="/logo.png" />
7
10
  <link rel="stylesheet" href="/style.css" />
8
11
  <title>Inglorious App</title>
@@ -4,7 +4,10 @@
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="/public/logo.png" />
6
6
  <link rel="stylesheet" href="/public/style.css" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <meta
8
+ name="viewport"
9
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
10
+ />
8
11
  <title>Inglorious App</title>
9
12
  </head>
10
13
 
@@ -3,6 +3,7 @@ export default {
3
3
  title: "My SSX App",
4
4
  meta: {
5
5
  description: "Built with @inglorious/ssx",
6
+ viewport: "width=device-width, initial-scale=1.0, viewport-fit=cover",
6
7
  },
7
8
  // SSX includes image optimization by default
8
9
  vite: {
@@ -4,6 +4,7 @@ const siteConfig: SiteConfig = {
4
4
  title: "My SSX App",
5
5
  meta: {
6
6
  description: "Built with @inglorious/ssx",
7
+ viewport: "width=device-width, initial-scale=1.0, viewport-fit=cover",
7
8
  },
8
9
  // SSX includes image optimization by default
9
10
  vite: {
@@ -2,7 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
+ />
6
9
  <link rel="icon" type="image/svg+xml" href="/logo.png" />
7
10
  <link rel="stylesheet" href="/style.css" />
8
11
  <title>Inglorious App</title>
@@ -2,7 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
+ />
6
9
  <link rel="icon" type="image/svg+xml" href="/logo.png" />
7
10
  <link rel="stylesheet" href="/style.css" />
8
11
  <title>Inglorious App</title>
@@ -2,7 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
8
+ />
6
9
  <link rel="icon" type="image/svg+xml" href="/logo.png" />
7
10
  <link rel="stylesheet" href="/style.css" />
8
11
  <title>Inglorious App</title>