cordova-react-vite 3.1.3 → 3.2.0
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/execute.js +45 -51
- package/package.json +1 -1
package/execute.js
CHANGED
|
@@ -63,88 +63,85 @@ function main() {
|
|
|
63
63
|
// ---- overwrite App.tsx ----
|
|
64
64
|
const appTsxPath = path.join(rootPath, "react", "src", "App.tsx");
|
|
65
65
|
const appTsxContent = `import { FC } from "react";
|
|
66
|
-
import {
|
|
66
|
+
import { FC } from "react";
|
|
67
67
|
import { AIOCordovaComponent, AIOCordova } from "aio-cordova";
|
|
68
68
|
|
|
69
69
|
const App: FC = () => {
|
|
70
70
|
return (
|
|
71
71
|
<AIOCordovaComponent
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
startWindows={() => <WindowsApp />}
|
|
73
|
+
startAndroid={(aioCordova) => <AndroidApp cordova={aioCordova} />}
|
|
74
74
|
/>
|
|
75
75
|
)
|
|
76
76
|
}
|
|
77
77
|
export default App;
|
|
78
78
|
|
|
79
|
-
const
|
|
80
|
-
|
|
79
|
+
const WindowsApp: FC = () => {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const AndroidApp: FC<{cordova:AIOCordova}> = ({cordova}) => {
|
|
83
|
+
return null;
|
|
81
84
|
}
|
|
82
85
|
`;
|
|
83
|
-
const
|
|
84
|
-
const indexCssContent = `
|
|
85
|
-
@import "tailwindcss";
|
|
86
|
-
`
|
|
87
|
-
const appCssPath = path.join(rootPath, "react", "src", "App.css");
|
|
86
|
+
const appCssPath = path.join(rootPath, "react", "src", "App.css");
|
|
88
87
|
const appCssContent = `
|
|
89
88
|
@import "tailwindcss";
|
|
90
89
|
|
|
91
90
|
@font-face {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
font-family: IRANSans-light;
|
|
92
|
+
font-style: normal;
|
|
93
|
+
font-weight: 300;
|
|
94
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_Light.eot');
|
|
95
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_Light.eot');
|
|
96
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_Light.eot?#iefix') format('embedded-opentype'),
|
|
97
|
+
url('./assets/iransans/woff2/IRANSansWeb(FaNum)_Light.woff2') format('woff2'),
|
|
98
|
+
url('./assets/iransans/woff/IRANSansWeb(FaNum)_Light.woff') format('woff'),
|
|
99
|
+
url('./assets/iransans/ttf/IRANSansWeb(FaNum)_Light.ttf') format('truetype');
|
|
100
|
+
}
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
@font-face {
|
|
103
|
+
font-family: IRANSans-ultra-light;
|
|
104
|
+
font-style: normal;
|
|
105
|
+
font-weight: 200;
|
|
106
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_UltraLight.eot');
|
|
107
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_UltraLight.eot?#iefix') format('embedded-opentype'),
|
|
108
|
+
url('./assets/iransans/woff2/IRANSansWeb(FaNum)_UltraLight.woff2') format('woff2'),
|
|
109
|
+
url('./assets/iransans/woff/IRANSansWeb(FaNum)_UltraLight.woff') format('woff'),
|
|
110
|
+
url('./assets/iransans/ttf/IRANSansWeb(FaNum)_UltraLight.ttf') format('truetype');
|
|
111
|
+
}
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
@font-face {
|
|
114
|
+
font-family: IRANSans-Medium;
|
|
115
|
+
font-style: normal;
|
|
116
|
+
font-weight: 200;
|
|
117
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_Medium.eot');
|
|
118
|
+
src: url('./assets/iransans/eot/IRANSansWeb(FaNum)_Medium.eot?#iefix') format('embedded-opentype'),
|
|
119
|
+
url('./assets/iransans/woff2/IRANSansWeb(FaNum)_Medium.woff2') format('woff2'),
|
|
120
|
+
url('./assets/iransans/woff/IRANSansWeb(FaNum)_Medium.woff') format('woff'),
|
|
121
|
+
url('./assets/iransans/ttf/IRANSansWeb(FaNum)_Medium.ttf') format('truetype');
|
|
122
|
+
}
|
|
124
123
|
body{
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
font-family:IRANSans-light;
|
|
125
|
+
}`
|
|
127
126
|
const viteConfigPath = path.join(rootPath, "react", "src", "vite.config.ts");
|
|
128
127
|
const viteConfigContent = `
|
|
129
128
|
import { defineConfig } from 'vite'
|
|
130
129
|
import react from '@vitejs/plugin-react'
|
|
131
130
|
import tailwindcss from '@tailwindcss/vite'
|
|
132
131
|
export default defineConfig({
|
|
133
|
-
plugins: [react(),
|
|
132
|
+
plugins: [react(),tailwindcss()]
|
|
134
133
|
})`
|
|
135
134
|
|
|
136
135
|
fs.writeFileSync(appTsxPath, appTsxContent, "utf8");
|
|
137
136
|
console.log("✔ src/App.tsx changed");
|
|
138
137
|
fs.writeFileSync(appCssPath, appCssContent, "utf8");
|
|
139
138
|
console.log("✔ src/App.css changed");
|
|
140
|
-
fs.writeFileSync(indexCssPath, indexCssContent, "utf8");
|
|
141
|
-
console.log("✔ src/index.css changed");
|
|
142
139
|
fs.writeFileSync(viteConfigPath, viteConfigContent, "utf8");
|
|
143
140
|
console.log("✔ src/vite.config.ts changed");
|
|
144
141
|
|
|
145
142
|
// ---- Cordova ----
|
|
146
143
|
console.log("creating cordova project");
|
|
147
|
-
run(`npx cordova create cordova ${
|
|
144
|
+
run(`npx cordova create cordova ${cordovaId} "${cordovaName}"`, rootPath);
|
|
148
145
|
|
|
149
146
|
// ---- Android platform ----
|
|
150
147
|
console.log("add android platform");
|
|
@@ -153,16 +150,13 @@ body{
|
|
|
153
150
|
// ---- Cordova Plugins ----
|
|
154
151
|
console.log("add cordova plugins...");
|
|
155
152
|
run(`npx cordova plugin add cordova-sqlite-storage`, path.join(rootPath, "cordova"));
|
|
156
|
-
|
|
157
|
-
run(`npx cordova plugin add cordova-plugin-file`, path.join(rootPath, "cordova"));
|
|
158
|
-
run(`npx cordova plugin add cordova-plugin-file-opener2`, path.join(rootPath, "cordova"));
|
|
159
|
-
run(`npx cordova plugin add cordova-plugin-email-composer`, path.join(rootPath, "cordova"));
|
|
153
|
+
|
|
160
154
|
// ---- package.json root ----
|
|
161
155
|
console.log("create root package.json");
|
|
162
156
|
const rootPkg = {
|
|
163
157
|
name: npmName,
|
|
164
158
|
version: "1.0.0",
|
|
165
|
-
description: `${
|
|
159
|
+
description: `${cordovaName} - React + Cordova project`,
|
|
166
160
|
scripts: {
|
|
167
161
|
"react:build": "cd react && npm run build",
|
|
168
162
|
"sync:build": "rimraf cordova\\www && xcopy react\\dist cordova\\www /E /H /C /I",
|