@julien-lin/universal-pwa-cli 1.1.3 → 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,16 +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 normalizedShortName = shortName && typeof shortName === "string" && shortName.trim().length > 0 ? shortName.trim() : void 0;
99
100
  let appShortName;
100
- if (shortName && shortName.length > 0 && shortName.length <= 12) {
101
- appShortName = shortName;
101
+ if (normalizedShortName && normalizedShortName.length > 0 && normalizedShortName.length <= 12) {
102
+ appShortName = normalizedShortName;
102
103
  } else {
103
104
  const fallbackName = appName && appName.length > 0 ? appName : "My PWA";
104
105
  appShortName = fallbackName.substring(0, 12);
105
106
  }
106
- if (!appShortName || appShortName.length === 0) {
107
+ if (!appShortName || appShortName.trim().length === 0) {
107
108
  appShortName = "PWA";
108
109
  }
110
+ appShortName = String(appShortName);
109
111
  let iconPaths = [];
110
112
  if (!skipIcons && iconSource) {
111
113
  const iconSourcePath = (0, import_fs.existsSync)(iconSource) ? iconSource : (0, import_path.join)(result.projectPath, iconSource);
@@ -135,11 +137,12 @@ async function initCommand(options = {}) {
135
137
  result.warnings.push(`Icon source not found: ${iconSourcePath}`);
136
138
  }
137
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";
138
141
  let manifestPath;
139
142
  if (iconPaths.length > 0) {
140
143
  const manifestWithIcons = (0, import_universal_pwa_core2.generateManifest)({
141
144
  name: appName,
142
- shortName: appShortName,
145
+ shortName: finalShortName,
143
146
  startUrl: "/",
144
147
  scope: "/",
145
148
  display: "standalone",
@@ -159,7 +162,7 @@ async function initCommand(options = {}) {
159
162
  console.log(import_chalk.default.yellow("\u26A0 Generating manifest with placeholder icon"));
160
163
  const manifestMinimal = (0, import_universal_pwa_core2.generateManifest)({
161
164
  name: appName,
162
- shortName: appShortName,
165
+ shortName: finalShortName,
163
166
  startUrl: "/",
164
167
  scope: "/",
165
168
  display: "standalone",
package/dist/index.js CHANGED
@@ -73,16 +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 normalizedShortName = shortName && typeof shortName === "string" && shortName.trim().length > 0 ? shortName.trim() : void 0;
76
77
  let appShortName;
77
- if (shortName && shortName.length > 0 && shortName.length <= 12) {
78
- appShortName = shortName;
78
+ if (normalizedShortName && normalizedShortName.length > 0 && normalizedShortName.length <= 12) {
79
+ appShortName = normalizedShortName;
79
80
  } else {
80
81
  const fallbackName = appName && appName.length > 0 ? appName : "My PWA";
81
82
  appShortName = fallbackName.substring(0, 12);
82
83
  }
83
- if (!appShortName || appShortName.length === 0) {
84
+ if (!appShortName || appShortName.trim().length === 0) {
84
85
  appShortName = "PWA";
85
86
  }
87
+ appShortName = String(appShortName);
86
88
  let iconPaths = [];
87
89
  if (!skipIcons && iconSource) {
88
90
  const iconSourcePath = existsSync(iconSource) ? iconSource : join(result.projectPath, iconSource);
@@ -112,11 +114,12 @@ async function initCommand(options = {}) {
112
114
  result.warnings.push(`Icon source not found: ${iconSourcePath}`);
113
115
  }
114
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";
115
118
  let manifestPath;
116
119
  if (iconPaths.length > 0) {
117
120
  const manifestWithIcons = generateManifest({
118
121
  name: appName,
119
- shortName: appShortName,
122
+ shortName: finalShortName,
120
123
  startUrl: "/",
121
124
  scope: "/",
122
125
  display: "standalone",
@@ -136,7 +139,7 @@ async function initCommand(options = {}) {
136
139
  console.log(chalk.yellow("\u26A0 Generating manifest with placeholder icon"));
137
140
  const manifestMinimal = generateManifest({
138
141
  name: appName,
139
- shortName: appShortName,
142
+ shortName: finalShortName,
140
143
  startUrl: "/",
141
144
  scope: "/",
142
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.3",
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.3"
47
+ "@julien-lin/universal-pwa-core": "^1.1.4"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@vitest/coverage-v8": "^2.1.4",