@julien-lin/universal-pwa-cli 1.1.2 → 1.1.4

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/dist/index.cjs CHANGED
@@ -96,7 +96,18 @@ async function initCommand(options = {}) {
96
96
  const finalOutputDir = outputDir ?? (result.framework === "WordPress" ? (0, import_path.join)(result.projectPath, "public") : (0, import_path.join)(result.projectPath, "public"));
97
97
  console.log(import_chalk.default.blue("\u{1F4DD} Generating manifest.json..."));
98
98
  const appName = name ?? (result.framework ? `${result.framework} App` : "My PWA");
99
- const appShortName = shortName && shortName.length > 0 && shortName.length <= 12 ? shortName : appName.substring(0, 12);
99
+ const normalizedShortName = shortName && typeof shortName === "string" && shortName.trim().length > 0 ? shortName.trim() : void 0;
100
+ let appShortName;
101
+ if (normalizedShortName && normalizedShortName.length > 0 && normalizedShortName.length <= 12) {
102
+ appShortName = normalizedShortName;
103
+ } else {
104
+ const fallbackName = appName && appName.length > 0 ? appName : "My PWA";
105
+ appShortName = fallbackName.substring(0, 12);
106
+ }
107
+ if (!appShortName || appShortName.trim().length === 0) {
108
+ appShortName = "PWA";
109
+ }
110
+ appShortName = String(appShortName);
100
111
  let iconPaths = [];
101
112
  if (!skipIcons && iconSource) {
102
113
  const iconSourcePath = (0, import_fs.existsSync)(iconSource) ? iconSource : (0, import_path.join)(result.projectPath, iconSource);
@@ -126,11 +137,12 @@ async function initCommand(options = {}) {
126
137
  result.warnings.push(`Icon source not found: ${iconSourcePath}`);
127
138
  }
128
139
  }
140
+ const finalShortName = appShortName && typeof appShortName === "string" && appShortName.trim().length > 0 ? appShortName.trim().substring(0, 12) : appName && appName.length > 0 ? appName.substring(0, 12) : "PWA";
129
141
  let manifestPath;
130
142
  if (iconPaths.length > 0) {
131
143
  const manifestWithIcons = (0, import_universal_pwa_core2.generateManifest)({
132
144
  name: appName,
133
- shortName: appShortName,
145
+ shortName: finalShortName,
134
146
  startUrl: "/",
135
147
  scope: "/",
136
148
  display: "standalone",
@@ -150,7 +162,7 @@ async function initCommand(options = {}) {
150
162
  console.log(import_chalk.default.yellow("\u26A0 Generating manifest with placeholder icon"));
151
163
  const manifestMinimal = (0, import_universal_pwa_core2.generateManifest)({
152
164
  name: appName,
153
- shortName: appShortName,
165
+ shortName: finalShortName,
154
166
  startUrl: "/",
155
167
  scope: "/",
156
168
  display: "standalone",
package/dist/index.js CHANGED
@@ -73,7 +73,18 @@ async function initCommand(options = {}) {
73
73
  const finalOutputDir = outputDir ?? (result.framework === "WordPress" ? join(result.projectPath, "public") : join(result.projectPath, "public"));
74
74
  console.log(chalk.blue("\u{1F4DD} Generating manifest.json..."));
75
75
  const appName = name ?? (result.framework ? `${result.framework} App` : "My PWA");
76
- const appShortName = shortName && shortName.length > 0 && shortName.length <= 12 ? shortName : appName.substring(0, 12);
76
+ const normalizedShortName = shortName && typeof shortName === "string" && shortName.trim().length > 0 ? shortName.trim() : void 0;
77
+ let appShortName;
78
+ if (normalizedShortName && normalizedShortName.length > 0 && normalizedShortName.length <= 12) {
79
+ appShortName = normalizedShortName;
80
+ } else {
81
+ const fallbackName = appName && appName.length > 0 ? appName : "My PWA";
82
+ appShortName = fallbackName.substring(0, 12);
83
+ }
84
+ if (!appShortName || appShortName.trim().length === 0) {
85
+ appShortName = "PWA";
86
+ }
87
+ appShortName = String(appShortName);
77
88
  let iconPaths = [];
78
89
  if (!skipIcons && iconSource) {
79
90
  const iconSourcePath = existsSync(iconSource) ? iconSource : join(result.projectPath, iconSource);
@@ -103,11 +114,12 @@ async function initCommand(options = {}) {
103
114
  result.warnings.push(`Icon source not found: ${iconSourcePath}`);
104
115
  }
105
116
  }
117
+ const finalShortName = appShortName && typeof appShortName === "string" && appShortName.trim().length > 0 ? appShortName.trim().substring(0, 12) : appName && appName.length > 0 ? appName.substring(0, 12) : "PWA";
106
118
  let manifestPath;
107
119
  if (iconPaths.length > 0) {
108
120
  const manifestWithIcons = generateManifest({
109
121
  name: appName,
110
- shortName: appShortName,
122
+ shortName: finalShortName,
111
123
  startUrl: "/",
112
124
  scope: "/",
113
125
  display: "standalone",
@@ -127,7 +139,7 @@ async function initCommand(options = {}) {
127
139
  console.log(chalk.yellow("\u26A0 Generating manifest with placeholder icon"));
128
140
  const manifestMinimal = generateManifest({
129
141
  name: appName,
130
- shortName: appShortName,
142
+ shortName: finalShortName,
131
143
  startUrl: "/",
132
144
  scope: "/",
133
145
  display: "standalone",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julien-lin/universal-pwa-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "CLI pour transformer n'importe quel projet web en PWA",
5
5
  "keywords": [
6
6
  "pwa",
@@ -44,7 +44,7 @@
44
44
  "glob": "^13.0.0",
45
45
  "pino": "^9.14.0",
46
46
  "zod": "^4.2.1",
47
- "@julien-lin/universal-pwa-core": "^1.1.2"
47
+ "@julien-lin/universal-pwa-core": "^1.1.4"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@vitest/coverage-v8": "^2.1.4",