cordova-react-vite 3.0.6 → 3.0.8

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.
Files changed (2) hide show
  1. package/execute.js +23 -5
  2. package/package.json +1 -1
package/execute.js CHANGED
@@ -47,9 +47,9 @@ function main() {
47
47
  console.log("📦 create project React (Vite)...");
48
48
  run(`npm create vite@latest react -- --template react-ts`, rootPath);
49
49
  run(`npm install`, path.join(rootPath, "react"));
50
- // install reactt packages
50
+ // install react packages
51
51
  console.log("📦 install aio-cordova in React...");
52
- run(`npm install aio-cordova aio-utils aio-date aio-apis aio-input aio-popup aio-table`, path.join(rootPath, "react"));
52
+ run(`npm install aio-cordova aio-utils aio-date aio-apis aio-input aio-popup aio-table tailwindcss @tailwindcss/vite`, path.join(rootPath, "react"));
53
53
  // add <script src="cordova.js"> to index.html
54
54
  const indexHtmlPath = path.join(rootPath, "react", "index.html");
55
55
  if (fs.existsSync(indexHtmlPath)) {
@@ -83,8 +83,11 @@ const AndroidApp: FC<{cordova:AIOCordova}> = ({cordova}) => {
83
83
  return null;
84
84
  }
85
85
  `;
86
- const appCssPath = path.join(rootPath, "react", "src", "App.css");
87
- const appCssContent = `@font-face {
86
+ const appCssPath = path.join(rootPath, "react", "src", "App.css");
87
+ const appCssContent = `
88
+ @import "tailwindcss";
89
+
90
+ @font-face {
88
91
  font-family: IRANSans-light;
89
92
  font-style: normal;
90
93
  font-weight: 300;
@@ -120,12 +123,22 @@ const appCssContent = `@font-face {
120
123
  body{
121
124
  font-family:IRANSans-light;
122
125
  }`
126
+ const viteConfigPath = path.join(rootPath, "react", "src", "vite.config.ts");
127
+ const viteConfigContent = `
128
+ import { defineConfig } from 'vite'
129
+ import react from '@vitejs/plugin-react'
130
+ import tailwindcss from '@tailwindcss/vite'
131
+ export default defineConfig({
132
+ plugins: [react(),tailwindcss()]
133
+ })`
123
134
 
124
135
  fs.writeFileSync(appTsxPath, appTsxContent, "utf8");
125
136
  console.log("✔ src/App.tsx changed");
126
137
  fs.writeFileSync(appCssPath, appCssContent, "utf8");
127
138
  console.log("✔ src/App.css changed");
128
-
139
+ fs.writeFileSync(viteConfigPath, viteConfigContent, "utf8");
140
+ console.log("✔ src/vite.config.ts changed");
141
+
129
142
  // ---- Cordova ----
130
143
  console.log("creating cordova project");
131
144
  run(`npx cordova create cordova ${cordovaId} "${cordovaName}"`, rootPath);
@@ -134,6 +147,10 @@ body{
134
147
  console.log("add android platform");
135
148
  run(`npx cordova platform add android`, path.join(rootPath, "cordova"));
136
149
 
150
+ // ---- Cordova Plugins ----
151
+ console.log("add cordova plugins...");
152
+ run(`npx cordova plugin add cordova-sqlite-storage`, path.join(rootPath, "cordova"));
153
+
137
154
  // ---- package.json root ----
138
155
  console.log("create root package.json");
139
156
  const rootPkg = {
@@ -146,6 +163,7 @@ body{
146
163
  "cordova:build": "cd cordova && cordova build android",
147
164
  "move:apk": "xcopy cordova\\platforms\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk . /Y",
148
165
  "build": "npm run react:build && npm run sync:build && npm run cordova:build && npm run move:apk",
166
+ "build:apk": "npm run cordova:build && npm run move:apk",
149
167
  "start": "cd react && npm run dev"
150
168
  },
151
169
  devDependencies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-react-vite",
3
- "version": "3.0.6",
3
+ "version": "3.0.8",
4
4
  "description": "CLI to create a full React + Vite + Cordova project with Android platform",
5
5
  "main": "execute.js",
6
6
  "bin": {