@vira-ui/cli 0.3.0-alpha → 0.3.1-alpha

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/dist/index.js +65 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -140,7 +140,12 @@ async function createProjectStructure(projectPath, template) {
140
140
  },
141
141
  devDependencies: {
142
142
  "@vira-ui/babel-plugin": "^0.3.0-alpha",
143
+ "@vitejs/plugin-react": "^4.2.0",
143
144
  "@types/node": "^20.10.0",
145
+ "@types/react": "^18.2.0",
146
+ "@types/react-dom": "^18.2.0",
147
+ "react": "^18.2.0",
148
+ "react-dom": "^18.2.0",
144
149
  "typescript": "^5.3.0",
145
150
  "vite": "^5.0.0",
146
151
  },
@@ -169,14 +174,14 @@ async function createProjectStructure(projectPath, template) {
169
174
  // vite.config.ts
170
175
  const viteConfig = `import { defineConfig } from 'vite';
171
176
  import react from '@vitejs/plugin-react';
172
- import vira from '@vira-ui/babel-plugin';
173
177
 
174
178
  export default defineConfig({
175
179
  plugins: [
176
180
  react({
177
- babel: {
178
- plugins: [vira],
179
- },
181
+ // Babel plugins can be added here if needed
182
+ // babel: {
183
+ // plugins: [['@vira-ui/babel-plugin', {}]],
184
+ // },
180
185
  }),
181
186
  ],
182
187
  });
@@ -197,22 +202,71 @@ export default defineConfig({
197
202
  </html>
198
203
  `;
199
204
  await fs.writeFile(path.join(projectPath, "index.html"), indexHtml);
205
+ // src/index.css
206
+ const indexCss = `* {
207
+ margin: 0;
208
+ padding: 0;
209
+ box-sizing: border-box;
210
+ }
211
+
212
+ body {
213
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
214
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
215
+ sans-serif;
216
+ -webkit-font-smoothing: antialiased;
217
+ -moz-osx-font-smoothing: grayscale;
218
+ }
219
+
220
+ #root {
221
+ min-height: 100vh;
222
+ }
223
+ `;
224
+ await fs.writeFile(path.join(projectPath, "src", "index.css"), indexCss);
200
225
  // src/main.tsx
201
- const mainTsx = `import { render } from '@vira-ui/core';
226
+ const mainTsx = `import React from 'react';
227
+ import ReactDOM from 'react-dom/client';
202
228
  import { App } from './App';
229
+ import './index.css';
203
230
 
204
- const root = document.getElementById('root');
205
- if (root) {
206
- render(<App />, root);
231
+ const rootElement = document.getElementById('root');
232
+ if (rootElement) {
233
+ ReactDOM.createRoot(rootElement).render(
234
+ React.createElement(React.StrictMode, null,
235
+ React.createElement(App)
236
+ )
237
+ );
207
238
  }
208
239
  `;
209
240
  await fs.writeFile(path.join(projectPath, "src", "main.tsx"), mainTsx);
210
241
  // src/App.tsx
211
- const appTsx = `import { createElement } from '@vira-ui/core';
242
+ const appTsx = `import React from 'react';
243
+ import { Button } from '@vira-ui/ui';
212
244
 
213
245
  export function App() {
214
- return createElement('div', { className: 'app' },
215
- createElement('h1', null, 'Welcome to Vira!')
246
+ return React.createElement('div', {
247
+ style: {
248
+ padding: '2rem',
249
+ maxWidth: '800px',
250
+ margin: '0 auto'
251
+ }
252
+ },
253
+ React.createElement('h1', {
254
+ style: {
255
+ fontSize: '2rem',
256
+ fontWeight: 'bold',
257
+ marginBottom: '1rem'
258
+ }
259
+ }, 'Welcome to Vira!'),
260
+ React.createElement('p', {
261
+ style: {
262
+ marginBottom: '1rem',
263
+ color: '#666'
264
+ }
265
+ }, 'Start building your amazing app with Vira UI.'),
266
+ React.createElement(Button, {
267
+ preset: 'primary',
268
+ onClick: () => alert('Hello from Vira!')
269
+ }, 'Get Started')
216
270
  );
217
271
  }
218
272
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vira-ui/cli",
3
- "version": "0.3.0-alpha",
3
+ "version": "0.3.1-alpha",
4
4
  "description": "CLI tool for ViraJS project generation",
5
5
  "author": "Vira Team",
6
6
  "license": "MIT",