Add project guidelines document and adjust VITE_COMMIT_HASH handling
- Introduced `.junie/guidelines.md` to outline project setup, code conventions, and structure. - Updated `env.d.ts` and `vite.config.js` to standardize `VITE_COMMIT_HASH` usage.
This commit is contained in:
@@ -0,0 +1,77 @@
|
|||||||
|
# Project Guidelines
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
This repository contains a Vue 3 single-page application built with Vite. It powers dashboard-style pages and modules such as bookings and POS flows. The UI is primarily styled with Bulma. The app leverages libraries like FullCalendar and Chart.js for scheduling and analytics.
|
||||||
|
|
||||||
|
- Tech stack: Vue 3, Vite 5, Vue Router, Vuex, Bulma, FullCalendar, Chart.js
|
||||||
|
- Notable integrations: toast notifications, QR/Barcode utilities, and PWA/devtools plugins
|
||||||
|
- Target: modern browsers and mobile WebView contexts
|
||||||
|
|
||||||
|
Local development
|
||||||
|
- Requirements: Node.js 18+ (recommended to match Vite 5), npm 9+
|
||||||
|
- Install dependencies: `npm install`
|
||||||
|
- Start dev server: `npm run dev` (default at http://localhost:5173)
|
||||||
|
|
||||||
|
Build and preview
|
||||||
|
- Production build: `npm run build` (output in `dist/`)
|
||||||
|
- Preview build locally: `npm run preview`
|
||||||
|
|
||||||
|
Testing
|
||||||
|
- Framework: WebdriverIO (wdio) with Vite service; Appium available for mobile testing
|
||||||
|
- Common commands:
|
||||||
|
- `npm run wdio` — run test suite per `wdio.conf.js`
|
||||||
|
- `npm run test:mobile` — run tests excluding Safari
|
||||||
|
- `npm run test:android` — run Android-targeted specs
|
||||||
|
- Prerequisites for mobile tests may include Android SDK/emulator or iOS tooling and Appium drivers
|
||||||
|
|
||||||
|
Environment configuration
|
||||||
|
- Place environment variables in `.env.*` files (Vite loads `VITE_`-prefixed vars into the client)
|
||||||
|
|
||||||
|
See the sections below for code style and detailed project structure.
|
||||||
|
|
||||||
|
## Code Style and Conventions
|
||||||
|
|
||||||
|
### Vue Components
|
||||||
|
|
||||||
|
- Use PascalCase for component names (e.g., `UserProfile.vue`)
|
||||||
|
- Implement Single File Components (SFC) pattern
|
||||||
|
- Keep components focused and single-responsibility
|
||||||
|
- Use composition API for new components
|
||||||
|
- Document component props and events
|
||||||
|
|
||||||
|
### JavaScript/TypeScript
|
||||||
|
|
||||||
|
- Use ES6+ features
|
||||||
|
- Maintain consistent naming conventions (camelCase for variables/methods)
|
||||||
|
- Document complex logic with clear comments
|
||||||
|
- Use TypeScript for type safety when possible
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
### Root Directory Structure
|
||||||
|
|
||||||
|
- `/src` - Source code files
|
||||||
|
- `/assets` - Static assets (images, fonts, etc.)
|
||||||
|
- `/components` - Reusable Vue components
|
||||||
|
- `/views` - Page components
|
||||||
|
- `/router` - Vue Router configuration
|
||||||
|
- `/store` - Vuex store modules
|
||||||
|
- `/services` - API and external service integrations
|
||||||
|
- `/utils` - Utility functions and helpers
|
||||||
|
- `/styles` - Global styles and variables
|
||||||
|
|
||||||
|
### Configuration Files
|
||||||
|
|
||||||
|
- `vite.config.js` - Vite configuration
|
||||||
|
- `.env.*` - Environment variables
|
||||||
|
- `package.json` - Project dependencies and scripts
|
||||||
|
- `jsconfig.json` - JavaScript/TypeScript tooling and path aliases
|
||||||
|
|
||||||
|
### File Naming Conventions
|
||||||
|
|
||||||
|
- Components: PascalCase (e.g., `UserProfile.vue`)
|
||||||
|
- Utilities: camelCase (e.g., `formatDate.js`)
|
||||||
|
- Store modules: camelCase (e.g., `userStore.js`)
|
||||||
|
- Style files: kebab-case (e.g., `main-styles.scss`)
|
||||||
|
- Test files: `*.spec.js` or `*.test.js`
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_BUILD_DATE: string,
|
readonly VITE_BUILD_DATE: string,
|
||||||
readonly VITE_APP_VERSION: string,
|
readonly VITE_APP_VERSION: string,
|
||||||
readonly VITE_GIT_COMMIT_HASH: string,
|
readonly VITE_COMMIT_HASH: string,
|
||||||
readonly VITE_IS_DEV: string,
|
readonly VITE_IS_DEV: string,
|
||||||
}
|
}
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
define: {
|
define: {
|
||||||
'import.meta.env.VITE_BUILD_DATE': JSON.stringify(new Date().toISOString()),
|
'import.meta.env.VITE_BUILD_DATE': JSON.stringify(new Date().toISOString()),
|
||||||
'import.meta.env.VITE_APP_VERSION': JSON.stringify(process.env.APP_VERSION || '0.0.0'),
|
'import.meta.env.VITE_APP_VERSION': JSON.stringify(process.env.APP_VERSION || '0.0.0'),
|
||||||
'import.meta.env.VITE_COMMIT_HASH': JSON.stringify(process.env.COMMIT_HASH || 'dev'),
|
'import.meta.env.VITE_COMMIT_HASH': JSON.stringify(commit),
|
||||||
// Tip: import.meta.env.DEV/PROD are available at runtime
|
// Tip: import.meta.env.DEV/PROD are available at runtime
|
||||||
'import.meta.env.VITE_IS_DEV': JSON.stringify(!isProd),
|
'import.meta.env.VITE_IS_DEV': JSON.stringify(!isProd),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user