@vira-ui/cli 0.3.0-alpha → 0.3.2-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 +77 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -137,10 +137,16 @@ async function createProjectStructure(projectPath, template) {
137
137
  dependencies: {
138
138
  "@vira-ui/core": "^0.3.0-alpha",
139
139
  "@vira-ui/ui": "^0.3.0-alpha",
140
+ "lucide-react": "^0.400.0",
140
141
  },
141
142
  devDependencies: {
142
143
  "@vira-ui/babel-plugin": "^0.3.0-alpha",
144
+ "@vitejs/plugin-react": "^4.2.0",
143
145
  "@types/node": "^20.10.0",
146
+ "@types/react": "^18.2.0",
147
+ "@types/react-dom": "^18.2.0",
148
+ "react": "^18.2.0",
149
+ "react-dom": "^18.2.0",
144
150
  "typescript": "^5.3.0",
145
151
  "vite": "^5.0.0",
146
152
  },
@@ -153,7 +159,6 @@ async function createProjectStructure(projectPath, template) {
153
159
  module: "ESNext",
154
160
  lib: ["ES2020", "DOM", "DOM.Iterable"],
155
161
  jsx: "react-jsx",
156
- jsxImportSource: "@vira-ui/core",
157
162
  moduleResolution: "bundler",
158
163
  resolveJsonModule: true,
159
164
  allowJs: true,
@@ -162,6 +167,10 @@ async function createProjectStructure(projectPath, template) {
162
167
  esModuleInterop: true,
163
168
  skipLibCheck: true,
164
169
  forceConsistentCasingInFileNames: true,
170
+ paths: {
171
+ "@vira-ui/ui": ["./node_modules/@vira-ui/ui/src"],
172
+ "@vira-ui/core": ["./node_modules/@vira-ui/core/src"],
173
+ },
165
174
  },
166
175
  include: ["src"],
167
176
  };
@@ -169,16 +178,23 @@ async function createProjectStructure(projectPath, template) {
169
178
  // vite.config.ts
170
179
  const viteConfig = `import { defineConfig } from 'vite';
171
180
  import react from '@vitejs/plugin-react';
172
- import vira from '@vira-ui/babel-plugin';
181
+ import path from 'path';
173
182
 
174
183
  export default defineConfig({
175
184
  plugins: [
176
185
  react({
177
- babel: {
178
- plugins: [vira],
179
- },
186
+ // Babel plugins can be added here if needed
187
+ // babel: {
188
+ // plugins: [['@vira-ui/babel-plugin', {}]],
189
+ // },
180
190
  }),
181
191
  ],
192
+ resolve: {
193
+ alias: {
194
+ '@vira-ui/ui': path.resolve(__dirname, 'node_modules/@vira-ui/ui/src/index.ts'),
195
+ '@vira-ui/core': path.resolve(__dirname, 'node_modules/@vira-ui/core/src/index.ts'),
196
+ },
197
+ },
182
198
  });
183
199
  `;
184
200
  await fs.writeFile(path.join(projectPath, "vite.config.ts"), viteConfig);
@@ -197,22 +213,71 @@ export default defineConfig({
197
213
  </html>
198
214
  `;
199
215
  await fs.writeFile(path.join(projectPath, "index.html"), indexHtml);
216
+ // src/index.css
217
+ const indexCss = `* {
218
+ margin: 0;
219
+ padding: 0;
220
+ box-sizing: border-box;
221
+ }
222
+
223
+ body {
224
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
225
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
226
+ sans-serif;
227
+ -webkit-font-smoothing: antialiased;
228
+ -moz-osx-font-smoothing: grayscale;
229
+ }
230
+
231
+ #root {
232
+ min-height: 100vh;
233
+ }
234
+ `;
235
+ await fs.writeFile(path.join(projectPath, "src", "index.css"), indexCss);
200
236
  // src/main.tsx
201
- const mainTsx = `import { render } from '@vira-ui/core';
237
+ const mainTsx = `import React from 'react';
238
+ import ReactDOM from 'react-dom/client';
202
239
  import { App } from './App';
240
+ import './index.css';
203
241
 
204
- const root = document.getElementById('root');
205
- if (root) {
206
- render(<App />, root);
242
+ const rootElement = document.getElementById('root');
243
+ if (rootElement) {
244
+ ReactDOM.createRoot(rootElement).render(
245
+ React.createElement(React.StrictMode, null,
246
+ React.createElement(App)
247
+ )
248
+ );
207
249
  }
208
250
  `;
209
251
  await fs.writeFile(path.join(projectPath, "src", "main.tsx"), mainTsx);
210
252
  // src/App.tsx
211
- const appTsx = `import { createElement } from '@vira-ui/core';
253
+ const appTsx = `import React from 'react';
254
+ import { Button } from '@vira-ui/ui';
212
255
 
213
256
  export function App() {
214
- return createElement('div', { className: 'app' },
215
- createElement('h1', null, 'Welcome to Vira!')
257
+ return React.createElement('div', {
258
+ style: {
259
+ padding: '2rem',
260
+ maxWidth: '800px',
261
+ margin: '0 auto'
262
+ }
263
+ },
264
+ React.createElement('h1', {
265
+ style: {
266
+ fontSize: '2rem',
267
+ fontWeight: 'bold',
268
+ marginBottom: '1rem'
269
+ }
270
+ }, 'Welcome to Vira!'),
271
+ React.createElement('p', {
272
+ style: {
273
+ marginBottom: '1rem',
274
+ color: '#666'
275
+ }
276
+ }, 'Start building your amazing app with Vira UI.'),
277
+ React.createElement(Button, {
278
+ preset: 'primary',
279
+ onClick: () => alert('Hello from Vira!')
280
+ }, 'Get Started')
216
281
  );
217
282
  }
218
283
  `;
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.2-alpha",
4
4
  "description": "CLI tool for ViraJS project generation",
5
5
  "author": "Vira Team",
6
6
  "license": "MIT",