business-eem-modules
v1.0.34
Published
React.js modules package for BusinessEEM - automatically installs react frontend modules
Maintainers
Readme
React BusinessEEM Modules
A package for React.js that automatically installs frontend modules into your BusinessEEM project structure this npm package copies React modules to BusinessEEM/react/src/modules/.
Features
- 🚀 Automatic Installation: Copies modules on
npm install - 🔄 Easy Updates: Update modules with a single command
- 📦 Laravel-like Behavior: Works similar to Laravel packages
- 🎯 Structured Organization: Maintains clean module structure
- 💾 Backup Support: Creates backups during updates
- 📋 Version Tracking: Tracks installed versions and modules
Installation
Install the package in your BusinessEEM project:
npm install business-eem-modulesThe package will automatically:
- Create the
BusinessEEM/react/src/modules/directory structure - Copy all frontend modules from the package
- Set up configuration tracking
Project Structure
After installation, your project will have:
your-project/
├── BusinessEEM/
│ └── react/
│ └── src/
│ └── modules/
│ ├── pages/
│ │ ├── Inventory/
│ │ │ ├── index.js
│ │ │ └── form.js
│ │ └── Lands/
│ │ ├── index.js
│ │ └── form.js
│ ├── routes.js
│ └── .business-eem-modules.json (config file)Available Modules
This package includes the following React modules:
Inventory Module
- Inventory Component (
pages/Inventory/index.js): Main inventory listing component - Inventory Form (
pages/Inventory/form.js): Form component for inventory management
Lands Module
- Lands Component (
pages/Lands/index.js): Main lands listing component - Lands Form (
pages/Lands/form.js): Form component for lands management
Routes Configuration
- Routes (
routes.js): Pre-configured routing for all modules
Usage
After installation, you can import and use the modules in your React application:
// Import individual components
import Inventory from './BusinessEEM/react/src/modules/pages/Inventory';
import InventoryForm from './BusinessEEM/react/src/modules/pages/Inventory/form';
import Lands from './BusinessEEM/react/src/modules/pages/Lands';
import LandsForm from './BusinessEEM/react/src/modules/pages/Lands/form';
// Or import the complete routes configuration
import routes from './BusinessEEM/react/src/modules/routes';Example Route Integration
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import moduleRoutes from './BusinessEEM/react/src/modules/routes';
function App() {
return (
<Router>
<Routes>
{moduleRoutes.map((route, index) => (
<Route
key={index}
path={route.route}
element={route.component}
/>
))}
</Routes>
</Router>
);
}
export default App;Updating Modules
To update the modules to the latest version:
npm run update-modulesThis will:
- Create a backup of existing modules
- Install the latest module versions
- Show a summary of changes (updated, new, or removed modules)
- Preserve your project structure
Configuration
The package creates a .business-eem-modules.json file in the modules directory to track:
- Package version
- Installation date
- List of installed modules
Example configuration:
{
"packageName": "react-business-eem-modules",
"installedAt": "2024-01-15T10:30:00.000Z",
"version": "1.0.0",
"modules": ["Inventory", "Lands"]
}Development
Package Structure
react-business-eem-modules/
├── frontend/ # Source modules (copied to target)
│ ├── pages/
│ │ ├── Inventory/
│ │ └── Lands/
│ └── routes.js
├── scripts/ # Installation scripts
│ ├── install.js # Post-install script
│ └── update.js # Update script
├── package.json
└── README.mdPublishing Updates
- Update the version in
package.json - Modify modules in the
frontend/directory - Publish to npm:
npm publish
Custom Installation Path
If you need to change the target installation path, modify the findTargetDirectory() method in scripts/install.js.
Requirements
- Node.js >= 12.0.0
- React >= 16.8.0
- A project with the BusinessEEM directory structure
Dependencies
fs-extra: For file system operationschalk: For colored console output
Troubleshooting
Installation Issues
- Target directory not found: Ensure your project has the correct structure or the package can create it
- Permission errors: Run with appropriate permissions or check directory permissions
- Module conflicts: Check if existing modules conflict with package modules
Update Issues
- Backup failed: Ensure write permissions in the target directory
- Version conflicts: Check the
.business-eem-modules.jsonfile for version information
Support
For issues and questions:
- Check the configuration file:
.business-eem-modules.json - Review the installation logs
- Ensure proper project structure
License
MIT License - see LICENSE file for details.
Note: This package is designed to work with BusinessEEM project structure. Modify the target paths in the installation scripts if you need different directory structures. "# businesseemmodules"
