feat: add platform-specific configuration and build system
- Add Android configuration with notification channels and WorkManager - Add iOS configuration with BGTaskScheduler and notification categories - Add platform-specific build scripts and bundle size checking - Add API change detection and type checksum validation - Add release notes generation and chaos testing scripts - Add Vite configuration for TimeSafari-specific builds - Add Android notification channels XML configuration - Update package.json with new build scripts and dependencies Platforms: Android (WorkManager + SQLite), iOS (BGTaskScheduler + Core Data), Electron (Desktop notifications)
This commit is contained in:
112
vite.config.ts
Normal file
112
vite.config.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* Vite Configuration for TimeSafari Daily Notification Plugin
|
||||
*
|
||||
* Integrates with TimeSafari PWA's Vite build system for optimal
|
||||
* tree-shaking, SSR safety, and platform-specific builds.
|
||||
*
|
||||
* @author Matthew Raymer
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
|
||||
export default defineConfig({
|
||||
// Plugin-specific configuration
|
||||
plugins: [],
|
||||
|
||||
// Build configuration
|
||||
build: {
|
||||
// Library mode for plugin distribution
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'src/index.ts'),
|
||||
name: 'TimeSafariDailyNotification',
|
||||
fileName: (format) => `timesafari-daily-notification.${format}.js`,
|
||||
formats: ['es', 'cjs', 'umd']
|
||||
},
|
||||
|
||||
// Rollup options for fine-grained control
|
||||
rollupOptions: {
|
||||
// External dependencies (not bundled)
|
||||
external: [
|
||||
'@capacitor/core',
|
||||
'@capacitor/android',
|
||||
'@capacitor/ios',
|
||||
'@capacitor/web'
|
||||
],
|
||||
|
||||
// Output configuration
|
||||
output: {
|
||||
// Global variable name for UMD build
|
||||
globals: {
|
||||
'@capacitor/core': 'CapacitorCore',
|
||||
'@capacitor/android': 'CapacitorAndroid',
|
||||
'@capacitor/ios': 'CapacitorIOS',
|
||||
'@capacitor/web': 'CapacitorWeb'
|
||||
},
|
||||
|
||||
// Asset file names
|
||||
assetFileNames: (assetInfo) => {
|
||||
if (assetInfo.name === 'style.css') return 'timesafari-daily-notification.css';
|
||||
return assetInfo.name || 'asset';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Source maps for debugging
|
||||
sourcemap: true,
|
||||
|
||||
// Minification
|
||||
minify: 'terser',
|
||||
|
||||
// Target environment
|
||||
target: 'es2015'
|
||||
},
|
||||
|
||||
// Development server configuration
|
||||
server: {
|
||||
port: 3000,
|
||||
host: true,
|
||||
cors: true
|
||||
},
|
||||
|
||||
// Preview server configuration
|
||||
preview: {
|
||||
port: 3001,
|
||||
host: true,
|
||||
cors: true
|
||||
},
|
||||
|
||||
// Define global constants
|
||||
define: {
|
||||
__PLUGIN_VERSION__: JSON.stringify(process.env.npm_package_version || '1.0.0'),
|
||||
__BUILD_TIME__: JSON.stringify(new Date().toISOString())
|
||||
},
|
||||
|
||||
// Resolve configuration
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src'),
|
||||
'@examples': resolve(__dirname, 'examples'),
|
||||
'@tests': resolve(__dirname, 'src/__tests__')
|
||||
}
|
||||
},
|
||||
|
||||
// Optimize dependencies
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'@capacitor/core'
|
||||
],
|
||||
exclude: [
|
||||
'@capacitor/android',
|
||||
'@capacitor/ios'
|
||||
]
|
||||
},
|
||||
|
||||
// Test configuration
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['./tests/setup.ts']
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user