Skip to content

Commit 0604279

Browse files
fix: separate "build" and "start" commands (#428)
* fix: separate "build" and "start" commands * Update README.md * separate start and build commands * clarify starting script
1 parent f89563f commit 0604279

File tree

4 files changed

+25
-83
lines changed

4 files changed

+25
-83
lines changed

x/examples/website-wrapper-app/.scripts/start.mjs

Lines changed: 0 additions & 52 deletions
This file was deleted.

x/examples/website-wrapper-app/README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ Then, run the following command to generate and place the assets in the appropri
5555
npx capacitor-assets generate --ios
5656
```
5757

58-
### Viewing your site in the example navigation iframe
59-
60-
Many sites don't handle their own navigation - if this applies to you, you can run a proxy to demonstrate what your site would look like in an example same-origin navigation iframe.
61-
62-
* You will need an [ngrok account](https://ngrok.com/), from which you can get your [`--navigatorToken`](https://dashboard.ngrok.com/get-started/your-authtoken)
63-
64-
```sh
65-
npm run start -- --platform=ios --entryUrl="https://www.example.com" \
66-
--navigatorToken="<YOUR_NGROK_AUTH_TOKEN>" --navigatorPath="/nav"
67-
```
68-
6958
### Publishing your app in the App Store
7059

7160
[Follow these instructions on how to publish your app for beta testing and the App Store.](https://developer.apple.com/documentation/xcode/distributing-your-app-for-beta-testing-and-releases)
@@ -112,31 +101,40 @@ Then, run the following command to generate and place the assets in the appropri
112101
npx capacitor-assets generate --android
113102
```
114103

115-
### Viewing your site in the example navigation iframe
104+
### Publishing your app in the Google Play Store
105+
106+
[Follow these instructions to learn how to publish your app to the Google Play Store](https://developer.android.com/studio/publish)
107+
108+
## Available Configuration Options
109+
110+
| Option | Description | Possible Values |
111+
| ------------------- | ------------------------------------------------------------------------------- | ------------------------ |
112+
| `--platform` | **(Required)** Specifies the target platform for the build. | `"ios"` or `"android"` |
113+
| `--entryUrl` | **(Required)** The primary url of your website. | Any valid url |
114+
| `--appId` | The unique identifier for the app (e.g., iOS Bundle ID, Android Application ID). | A reverse domain name string (e.g., `com.company.appname`) |
115+
| `--appName` | The user-visible name of the application. | Any valid application name string (e.g., "My Awesome App") |
116+
| `--output` | The directory where the generated app project files will be saved. | A valid, absolute file path (e.g., `/users/me/my-generated-app`) |
117+
| `--additionalDomains` | A list of other domains that should be accessible within the app. | Comma-separated domains |
118+
| `--smartDialerConfig` | A JSON string containing the configuration for the [smart dialer feature](../../smart#yaml-config-for-the-smart-dialer). | Valid JSON string |
119+
120+
## Viewing your site in the example navigation iframe
116121

117122
Many sites don't handle their own navigation - if this applies to you, you can run a proxy to demonstrate what your site would look like in an example same-origin navigation iframe.
118123

119124
* You will need an [ngrok account](https://ngrok.com/), from which you can get your [`--navigatorToken`](https://dashboard.ngrok.com/get-started/your-authtoken)
120125

121126
```sh
122-
npm run start -- --platform=android --entryUrl="https://www.example.com" \
127+
npm run start:navigator -- --entryUrl="https://www.example.com" \
123128
--navigatorToken="<YOUR_NGROK_AUTH_TOKEN>" --navigatorPath="/nav"
124129
```
125130

126-
### Publishing your app in the Google Play Store
127-
128-
[Follow these instructions to learn how to publish your app to the Google Play Store](https://developer.android.com/studio/publish)
131+
Once the server has started, you can then run the build commands above in a separate terminal to view the demo in your app.
129132

130133
## Available Configuration Options
131134

132135
| Option | Description | Possible Values |
133136
| ------------------- | ------------------------------------------------------------------------------- | ------------------------ |
134-
| `--platform` | **(Required)** Specifies the target platform for the build. | `"ios"` or `"android"` |
135137
| `--entryUrl` | **(Required)** The primary url of your website. | Any valid url |
136-
| `--appId` | The unique identifier for the app (e.g., iOS Bundle ID, Android Application ID). | A reverse domain name string (e.g., `com.company.appname`) |
137-
| `--appName` | The user-visible name of the application. | Any valid application name string (e.g., "My Awesome App") |
138-
| `--output` | The directory where the generated app project files will be saved. | A valid, absolute file path (e.g., `/users/me/my-generated-app`) |
139-
| `--additionalDomains` | A list of other domains that should be accessible within the app. | Comma-separated domains |
140138
| `--smartDialerConfig` | A JSON string containing the configuration for the [smart dialer feature](../../smart#yaml-config-for-the-smart-dialer). | Valid JSON string |
141139
| `--navigatorToken` | Your ngrok authentication token for using the navigation proxy. | Your [ngrok auth token](https://dashboard.ngrok.com/get-started/your-authtoken) |
142140
| `--navigatorPath` | The path to use for the navigation iframe when using the navigation proxy. | Any valid path |
@@ -152,4 +150,5 @@ When encountering an issue, the first thing you'll want to do is run the doctor
152150
### Commonly occuring issues
153151

154152
> [!NOTE]
155-
> TODO: compile a list of commonly occuring issues.
153+
> TODO: compile a list of commonly occuring issues.
154+

x/examples/website-wrapper-app/basic_navigator_example/.scripts/start.mjs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { createServer } from "vite";
2121
import minimist from "minimist";
2222

2323
export default function main({
24-
entryDomain = "www.example.com",
24+
entryUrl = "https://www.example.com",
2525
navigatorToken,
26-
navigatorPath = "/",
26+
navigatorPath = "/nav",
2727
}) {
2828
return new Promise(async (resolve) => {
2929
const navigationServer = await createServer({
@@ -44,7 +44,7 @@ export default function main({
4444
}
4545

4646
return proxyMiddleware.web(request, response, {
47-
target: `https://${entryDomain}`,
47+
target: entryUrl,
4848
changeOrigin: true,
4949
});
5050
});
@@ -87,9 +87,5 @@ if (import.meta.url.endsWith(process.argv[1])) {
8787
throw new Error("`--navigatorToken` must be set!");
8888
}
8989

90-
if (!args.navigatorPath) {
91-
throw new Error("`--navigatorPath` must be set!");
92-
}
93-
9490
main(args).catch(console.error);
9591
}

x/examples/website-wrapper-app/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"open:android": "cd output/wrapper_app_project && npm run open:android",
2222
"open:ios": "cd output/wrapper_app_project && npm run open:ios",
2323
"reset": "npm run clean && npm ci",
24-
"start:navigator": "node ./basic_navigator_example/.scripts/start.mjs",
25-
"start": "node ./.scripts/start.mjs"
24+
"start:navigator": "node ./basic_navigator_example/.scripts/start.mjs"
2625
},
2726
"private": true
2827
}

0 commit comments

Comments
 (0)