-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.ts
83 lines (72 loc) · 2.18 KB
/
scripts.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { kush } from "kush-cli";
import { ssrBuild } from "./src/next/prerender";
import { resolveConfig } from "vite";
import * as fs from "fs-extra";
import config from "./vite.config";
kush`
dev:
$ echo vite dev
await ${async () => {
require("./src/next/server");
}}
build-client:
$ echo vite client build
$ vite build --outDir ./dist/client
build-server:
$ echo vite server build
$ vite build --outDir ./dist/server --ssr src/render/server.ssr.tsx
build-static:
$ echo vite static build
await ${async () => {
const viteConfig = await resolveConfig(getConfig() as any, "build");
ssrBuild(viteConfig, {}, []).catch((err: any) => {
console.error(err);
});
}}
build:
$ build-client
$ build-server
serve-static:
$ serve dist/static
export:
$ build-static
start:
$ echo vite start
await ${async () => {
process.env.NODE_ENV = "production";
require("./src/next/server");
}}
ios-dev:
await ${() => {
let config = fs.readJson("capacitor.config.json");
// @ts-ignore
config.server = {
// Server object contains port and url configurations
server: {
// You can make the app to load an external url (i.e. to live reload)
url: "http://192.168.1.33:8100",
// You can configure the local hostname, but it's recommended to keep localhost
// as it allows to run web APIs that require a secure context such as
// navigator.geolocation and MediaDevices.getUserMedia.
// It is possible to configure the local scheme that is used. This can be useful
// when migrating from cordova-plugin-ionic-webview, where the default scheme on iOS is ionic.
// iosScheme: 'ionic',
// androidScheme: 'http',
// Normally all external URLs are opened in the browser. By setting this option, you tell
// Capacitor to open URLs belonging to these hosts inside its WebView.
// allowNavigation: ['example.org', '*.example.org', '192.0.2.1'],
},
};
}}
$ echo vite dev
await ${async () => {
require("./src/next/server");
}}
`();
function getConfig() {
return {
configFile: false,
...config,
// configFile: require('./vite.config.ts',
};
}