An AI companion component for space-themed Vue applications. This component provides an interactive AI assistant that helps users navigate and interact with your space application.
npm install git+https://github.com/innerpixel/cosmic-companion-ai.git
- Register the plugin in your main.js:
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createTravellerPlugin } from 'cosmic-companion-ai'
const app = createApp(App)
const pinia = createPinia()
app.use(pinia)
app.use(createTravellerPlugin)
app.mount('#app')
- Use the component in your Vue files:
<script setup>
import { TravellerCompanion } from 'cosmic-companion-ai'
</script>
<template>
<TravellerCompanion />
</template>
The package is structured to work optimally with Vite and Vue 3:
cosmic-companion-ai/
├── src/
│ ├── components/
│ │ └── TravellerCompanion.vue
│ ├── stores/
│ │ └── tourStore.js
│ ├── config/
│ │ └── tutorials.js
│ ├── style.css
│ └── index.js
├── package.json
└── vite.config.js
{
"type": "module",
"exports": {
".": {
"import": "./src/index.js",
"require": "./dist/cosmic-companion-ai.umd.cjs"
},
"./style.css": "./src/style.css"
},
"main": "./dist/cosmic-companion-ai.umd.cjs",
"module": "./src/index.js",
"files": [
"dist",
"src"
]
}
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
plugins: [vue()],
build: {
lib: {
entry: resolve(__dirname, 'src/index.js'),
name: 'CosmicCompanionAI',
formats: ['es', 'umd'],
fileName: (format) => `cosmic-companion-ai.${format === 'es' ? 'js' : 'umd.cjs'}`
},
rollupOptions: {
external: ['vue', 'pinia'],
output: {
globals: {
vue: 'Vue',
pinia: 'Pinia'
}
}
}
}
})
The package uses modern ES Module resolution with fallbacks:
- Direct source access during development
- Built files for production
- UMD fallback for CommonJS environments
The plugin is designed as a simple object with an install method:
const createTravellerPlugin = {
install(app) {
app.component('TravellerCompanion', TravellerCompanion)
}
}
Styles are automatically included when importing the component. No need for separate style imports in your application.
-
Module Resolution Errors
- Make sure package.json has correct "exports" field
- Include both "src" and "dist" in "files" field
- Use direct source imports during development
-
Style Loading Issues
- Styles are bundled with the component
- No need for separate style imports
- Vite handles CSS modules automatically
-
Plugin Registration
- Use
app.use(createTravellerPlugin)
notapp.use(createTravellerPlugin())
- Make sure Pinia is registered before the plugin
- Component will be globally available as 'TravellerCompanion'
- Use
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
MIT License - feel free to use in your space adventures!