Skip to content

onlinelaser/vue-test

Repository files navigation

bombino-vue-bare

Template used in bombino

NOTE: This repo should not be git cloned directly because it has breaking placeholder values and will not run on it's own.

# Node and bombino are required
npm install -g bombino

# In any valid CEP extension folder:
# (e.g. <USERNAME>/AppData/Roaming/CEP/extensions)
bombino

No setup required for:


Commands

This panel comes with 5 commands baked in (see details here):

  • npm run help - A full list of the commands available and descriptions.
  • npm run switch - Reports whether in developer or production context and can switch automatically.
  • npm run update - Reports current version of panel in manifest and prompts to update Major, Minor, or Micro.
  • npm run register - Reports the current user data (if any) and prompts to save new info to be used in certificates.
  • npm run sign - Automatically stages and signs the extension, placing it in a ./archive directory within the current panel.

Filetree for panel:

Base panel results in clean and simple Single File Component infrastructure. CSInterface exists on the level of App.vue and is accessible anywhere via this.app.csInterface (this.$root.$children[0].csInterface).

📁 your-panel-name
  |__ :file_folder: CSXS
         |__ :page_facing_up: manifest.xml
  |__ :file_folder: public
         |__ :page_facing_up: CSInterface.js
         |__ :page_facing_up: index.html (Production: used with npm run build)
         |__ :page_facing_up: index-dev.html (Development: used with npm run serve)
  |__ :file_folder: src
         |__ :file_folder: components
                |__ :page_facing_up: HelloWorld.vue
         |__ :page_facing_up: App.vue
         |__ :page_facing_up: main.js
  |__ :page_facing_up: .debug
  |__ :page_facing_up: .gitignore
  |__ :page_facing_up: package.json
  |__ :page_facing_up: package-lock.json
  |__ :page_facing_up: vue.config.js (Avoids file not found errors in index.html after npm run build)


Contexts

You can automate this by using npm run switch. In case you need to do it manually:

For development

  • Ensure index-dev.html is uncommented in CSXS/manifest.xml
  <Resources>
    <MainPath>./public/index-dev.html</MainPath>
    <!-- <MainPath>./dist/index.html</MainPath> -->
  • Run npm run serve in the terminal at the project root
  • Launch host application and find in Window > Extensions

Panel now updates in real time and recompiles every time you save in VSCode

For production

  • Ensure dist/index.html is uncommented in CSXS/manifest.xml
  <Resources>
    <!-- <MainPath>./public/index-dev.html</MainPath> -->
    <MainPath>./dist/index.html</MainPath>
  • Run npm run build in the terminal at the project root
  • Launch host application and find in Window > Extensions

Panel is now ready to sign and certify or be used on any client


Getting Started

You don't need to understand Node, npm packages, Vue CLI-3 or webpack to use these templates, it's a good starting point to avoid all the pitfalls in having your own functional panel using them.

I was very overwhelmed when I first jumped to Single File Components rather than using Vue's CDN and writing everything in one .js file. Afterall, this looks gigantic and there are a ton of cryptic files, but after some practice and troubleshooting how to setup the environment, it's incredibly powerful to use and can be much simpler than gigantic .js files with 10k+ worth of code!

For the most part, you don't need to alter or modify any file/folder not shown below:

📁 your-panel-name
  |__ :file_folder: CSXS
         |__ :page_facing_up: manifest.xml
           • Changes have been made to include node context. See the README in ./CSXS
  |__ :file_folder: public
           • Any files/folders contained here will be automatically bundled in ./dist/ after npm run build
           • You can include any assets (.pngs, scripts, etc) here or src for use in the panel
         |__ :page_facing_up: CSInterface.js
         |__ :page_facing_up: index.html (Production: used with npm run build)
         |__ :page_facing_up: index-dev.html (Development: used with npm run serve)
  |__ :file_folder: src
           • This is your development folder, you can place any number of components or files here
         |__ :file_folder: components
                |__ :page_facing_up: HelloWorld.vue
                        • This is a placeholder component for the main content of your panel
         |__ :page_facing_up: App.vue
                 • This is the main entry point of your panel
                 • You cannot change this from a <div> of #app. Add your own components inside it instead of modifying it directly.


Common errors:

require is not a function/defined

  • If wanting to use require() or process in both Developer and Production, you need to assign them manually in each .vue file (due to being nested in an iframe) like so:
const require = cep_node.require || require;
const fs = require("fs"); // Now available in both

Panel is not updating

  • Adding or reorganizing components may cause hot reloading to fail. Many times you will be warned of this in CEF debug's console, fix this by hitting ^C in your active terminal to Terminae batch job, then run npm run serve once more and refresh the panel.

Page Not Found (cannot find page at localhost:#### displays in panel)

  • Must run npm run serve and have the App running at: -Local / -Network message in your terminal
  • If you launched the app before running npm run serve, click the localhost URL inside the panel's error message

Panel is white or blank

  • Check your CEF client via localhost:#### for an error thrown in your code which breaks the panel's rendering
  • If in Production context and receiving 404 errors in your index.html, ensure your dist/index.html's script tags have src attributes such as src=./filepath or src=filepath instead of src=/filepath (leading slash is default but will break, should be fixed via vue.config.js)

Sign/Certify is failing

  • Including hidden files and repositories in your ZXP/ZIP will cause a misleading error message. Be sure to delete hidden items such as node_modules/, .git/, and any other hidden files/folders prior to your sign/certify.

About

Demo for Tom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published