Open navh opened 1 year ago
Thx for the issue - a PR is definitely welcome
For this case I would opt to remove the illegal characters from the name when generating the capacitor config file, which happens in
https://github.com/Tommertom/svelte-ionic-app/blob/main/packages/create-capacitor-svelte-app/src/creator.js from line 234 onwards (typescript and non-typescript version).
And same way in https://github.com/Tommertom/svelte-ionic-app/tree/main/packages/create-ionic-svelte-app line 224 onwards
if (opts.types != 'typescript') out(
'capacitor.config.json',
`{
"webDir":"build",
"appId":"${opts.name}.ionic.io",
"appName":"${opts.name}",
"_server": {
"url": "http://${ip.address()}:5173/",
"cleartext": true
}
}`
);
if (opts.types == 'typescript') out('capacitor.config.ts',
getTSCapacitorConfig({
appId: opts.name + '.ionic.io',
appName: opts.name,
ip: ip.address() // 'http://192.168.137.1'
})
)
}
into (pseudo code)
const appSafeName=stripTheUglyStuff(opts.name);
if (opts.types != 'typescript') out(
'capacitor.config.json',
`{
"webDir":"build",
"appId":"${appSafeName}.ionic.io",
"appName":"${opts.name}",
"_server": {
"url": "http://${ip.address()}:5173/",
"cleartext": true
}
}`
);
if (opts.types == 'typescript') out('capacitor.config.ts',
getTSCapacitorConfig({
appId: opts.name + '.ionic.io',
appName: appSafeName,
ip: ip.address() // 'http://192.168.137.1'
})
)
}
But this is how I would solve it - happy to hear your view!
When I create a new project, it let me name my project with dashes. Later on, this throws an
Invalid App ID
, forcing me to re-name.It would be nice if
Name for your new project:
a name could trigger a"some-name" is an Invalid App ID due to {reason}, are you sure? yes / Different Name
loop.Easier may just be adding a hint to the
Name for your new project:
->Name (alphanum and underscores) for your new project
.Below is creating a project with a dash: