This is a Vue CLI plugin for integrating with SF. It automates the setup of the "Mainframe" environment by downloading necessary assets and configuring your Vue project to use them during development and build.
- Automated Mainframe Setup: Automatically downloads and extracts the
mainframe_xpublic.zipfrom a specified URL. - Webpack Configuration: Injects the Mainframe's
index.htmlas the template and sets up asset copying. - Seamless Integration: Wraps standard
vue-cli-servicecommands.
npm install --save-dev vue-cli-plugin-sfCreate a sf.config.js file in the root of your project to configure the plugin.
// <projectRoot>/sf.config.js
module.exports = {
/**
* Pages folder name relative to `<projectRoot>/src` directory.
* Example: If your pages are in `src/views`, set this to 'views'.
*/
pagesFolder: 'views',
/**
* Base URL for the Mainframe zip file.
* The plugin will look for `${mainFrameUrl}/mainframe_xpublic.zip`.
*/
mainFrameUrl: 'https://example.com'
}After installation and configuration, you can use the standard Vue CLI commands. The plugin wraps these commands to perform its setup tasks.
vue-cli-service serveWhat it does:
- Reads
sf.config.js. - Downloads
mainframe_xpublic.zipfrom the configuredmainFrameUrltonode_modules/.cache/mainframe_xpublic.zip. - Extracts the zip to
node_modules/.cache/mainframe. - Updates the Webpack configuration to:
- Use the extracted
index.htmlas the HTML template. - Copy the extracted Mainframe assets to the output directory.
- Use the extracted
- Starts the standard Vue development server.
vue-cli-service buildWhat it does:
- Executes the build process (currently wraps the standard build command).
The plugin expects a standard Vue CLI project structure.
my-project/
├── sf.config.js # Plugin configuration
├── package.json
├── src/
│ ├── views/ # (Or whatever you configured as pagesFolder)
│ └── ...
└── ...
The plugin uses node_modules/.cache to store the downloaded Mainframe assets, ensuring they are available for the build process without cluttering your source control.