From 848e80b64d7ecd85ed23792b57665fb365468ef2 Mon Sep 17 00:00:00 2001 From: Ak4zh Date: Wed, 9 Feb 2022 11:56:59 +0530 Subject: [PATCH 1/2] switch to capacitor.config.ts from capacitor.config.json --- capacitor.config.json | 17 ----------------- capacitor.config.ts | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) delete mode 100644 capacitor.config.json create mode 100644 capacitor.config.ts diff --git a/capacitor.config.json b/capacitor.config.json deleted file mode 100644 index 429f0fa..0000000 --- a/capacitor.config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "appId": "com.svelte.capacitor", - "appName": "Svelte Capacitor", - "bundledWebRuntime": false, - "npmClient": "npm", - "webDir": "public", - "plugins": { - "SplashScreen": { - "launchShowDuration": 0 - } - }, - "cordova": {}, - "server": { - "url": "http://change-me:5001", - "cleartext": true - } -} diff --git a/capacitor.config.ts b/capacitor.config.ts new file mode 100644 index 0000000..776d6cd --- /dev/null +++ b/capacitor.config.ts @@ -0,0 +1,23 @@ +import { CapacitorConfig } from '@capacitor/cli'; + +const config: CapacitorConfig = { + appId: 'com.svelte.capacitor', // TODO: add your app id + appName: 'Svelte Capacitor', + webDir: 'public', + bundledWebRuntime: false, + plugins: { + "SplashScreen": { + "launchShowDuration": 0 + } + }, + // remove server section before making production build + server: { + // for android only, below settings will work out of the box + // for iOS or both, change the url to http://your-device-ip + // To discover your workstation IP, just run ifconfig + "url": "http://10.0.2.2:5001", + "cleartext": true + } +}; + +export default config; From da445332bfadec4797c5c3470fc733f47cc3fb51 Mon Sep 17 00:00:00 2001 From: Ak4zh Date: Wed, 9 Feb 2022 12:04:19 +0530 Subject: [PATCH 2/2] added cordova-res to change splash screen --- README.md | 14 ++++++++++++++ package.json | 34 +++++++++++++++------------------- resources/.gitkeep | 0 src/components/.gitkeep | 0 src/components/.hidden | 1 - src/store/.gitkeep | 0 src/store/.hidden | 1 - src/utils/.gitkeep | 0 src/utils/.hidden | 1 - 9 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 resources/.gitkeep create mode 100644 src/components/.gitkeep delete mode 100644 src/components/.hidden create mode 100644 src/store/.gitkeep delete mode 100644 src/store/.hidden create mode 100644 src/utils/.gitkeep delete mode 100644 src/utils/.hidden diff --git a/README.md b/README.md index 3616cbf..a51c4b3 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,20 @@ Try to change something in `App.svelte`, and you should see the content reload o * You need to have an emulator/device connected to adb * Your device has to be connected to the same wifi network as your workstation. + +### Change Splash screen and app icon: + +* Add icon.png and splash.png to resources dir +* Recomended size: + - Icon - 512x512 + - Splash - 1920x1920 +* Next, run the following to generate all images then copy them into the native projects: +``` +cordova-res ios --skip-config --copy +cordova-res android --skip-config --copy +``` + + ### To build a production application: **Remember to remove the `server.url` in `capacitor.config.json`** diff --git a/package.json b/package.json index d13749d..04976ec 100644 --- a/package.json +++ b/package.json @@ -3,33 +3,29 @@ "version": "2.0.0", "scripts": { "#Build: Core": "Thesee scripts build the core application (routing logic, and views)", - "build:app": "routify -b && vite build", - "build:routify": "routify", - + "build:app": "routify -b && vite build", + "build:routify": "routify", "#Platform: Build": "These build the application for their specific platforms", - "build:android": "run-s build:app cap-run:android", - "build:ios": "run-s build:app cap-run:ios", - + "build:android": "run-s build:app cap-run:android", + "build:ios": "run-s build:app cap-run:ios", "#Platform: Sync": "These build the application for their specific platforms", - "cap-run:android": "cap sync android && cap open android", - "cap-run:ios": "cap sync ios && cap open ios", - + "cap-run:android": "cap sync android && cap open android", + "cap-run:ios": "cap sync ios && cap open ios", "#Dev: Platform": "These enable HMR (Hot module reloading) directly on the device - please check the readme.md for more on this.", - "dev:ios": "run-p dev:start cap-run:ios", - "dev:android": "run-p dev:start cap-run:android", - + "dev:ios": "run-p dev:start cap-run:ios", + "dev:android": "run-p dev:start cap-run:android", "#Dev: Core": "These allow the code to be developed with HMR", - "dev:preview": "vite preview", - "dev:start": "run-p build:routify dev:vite", - "dev:vite": "vite --host --port 5001", - + "dev:preview": "vite preview", + "dev:start": "run-p build:routify dev:vite", + "dev:vite": "vite --host --port 5001", "#Utilities": "Various utilities", - "validate": "svelte-check" + "validate": "svelte-check" }, "devDependencies": { "@roxi/routify": "^2.18.0", "@sveltejs/vite-plugin-svelte": "*", "@tsconfig/svelte": "^1.0.10", + "cordova-res": "^0.15.4", "cross-env": "^7.0.3", "npm-run-all": "^4.1.5", "prettier": "^2.2.1", @@ -44,8 +40,8 @@ }, "dependencies": { "@capacitor/android": "^3.0.1", - "@capacitor/ios": "^3.0.1", "@capacitor/cli": "^3.0.0", - "@capacitor/core": "^3.0.0" + "@capacitor/core": "^3.0.0", + "@capacitor/ios": "^3.0.1" } } diff --git a/resources/.gitkeep b/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/components/.gitkeep b/src/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/components/.hidden b/src/components/.hidden deleted file mode 100644 index 2974333..0000000 --- a/src/components/.hidden +++ /dev/null @@ -1 +0,0 @@ -Delete this file, this is only here so git saves the empty folders. \ No newline at end of file diff --git a/src/store/.gitkeep b/src/store/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/store/.hidden b/src/store/.hidden deleted file mode 100644 index 2974333..0000000 --- a/src/store/.hidden +++ /dev/null @@ -1 +0,0 @@ -Delete this file, this is only here so git saves the empty folders. \ No newline at end of file diff --git a/src/utils/.gitkeep b/src/utils/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/utils/.hidden b/src/utils/.hidden deleted file mode 100644 index 2974333..0000000 --- a/src/utils/.hidden +++ /dev/null @@ -1 +0,0 @@ -Delete this file, this is only here so git saves the empty folders. \ No newline at end of file