0.3.6 • Published 9 months ago

@flownet/lib-to-electron v0.3.6

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
9 months ago

@flownet/lib-to-electron

This project provides a set of scripts to help you convert your existing Flownet applications into Electron applications seamlessly. By utilizing this project, developers can package their applications as desktop applications using Electron, allowing them to reach a wider audience beyond the web.

How It Works

The project works by taking your existing Flownet-based web application and preparing it to be packaged as an Electron application. It automates the process of templating, copying necessary files, and setting up the required project directory structure. After setting up, it installs dependencies and builds the application, making it ready for distribution as a desktop application.

Key Features

  • Automatic Templating: Configures your project with a predefined Electron template to ensure consistency and reliability in the setup process.
  • Directory Setup: Automatically creates and cleans necessary directories to avoid conflicts and ensure a smooth packaging process.
  • Dependency Management: Handles the installation of required dependencies specific to the Electron environment.
  • Build Automation: Automates the execution of build scripts to compile the project into an Electron-compatible format.

Conclusion

This utility provides a straightforward way for developers using Flownet to transition their applications into the Electron environment. It simplifies the process of setting up an Electron project, allowing more focus on the development and less on the configuration and setup.

@flownet/lib-to-electron Developer Guide

Overview

The @flownet/lib-to-electron library is designed to streamline the process of building Electron applications. It provides utility functions to set up necessary directories, manage templates, and automate the build process by integrating with shell commands. This library helps developers quickly scaffold and package their Electron apps.

Installation

To add @flownet/lib-to-electron to your project, use npm or yarn:

npm install @flownet/lib-to-electron

Or, if you prefer yarn:

yarn add @flownet/lib-to-electron

Usage

The primary function exported by this library is an asynchronous index function, which you can integrate into your Electron app setup script. This function helps to configure your application’s directories and build processes based on specified parameters.

Real-World Usage Example

Below is a step-by-step example showing how to use the index function in a typical Electron application setup:

  1. Import the library:

    import index from '@flownet/lib-to-electron';
  2. Define the necessary parameters for your project:

    const params = {
      name: "myElectronApp",
      entry: "app/electron",
      id: "com.example.electron",
      version: "1.0.0",
    };
    
    const config = {}; // Add your configuration options if needed
    const src = './src'; // Source directory for your app
    const dest = './build'; // Destination directory for the build
  3. Use the index function:

    async function setup() {
      try {
        await index({ params, config, src, dest });
        console.log('Electron app successfully set up!');
      } catch (error) {
        console.error('Error setting up Electron app:', error);
      }
    }
    
    setup();
  4. Run your setup script to scaffold and build your Electron application.

Examples

Here are some concise code examples to illustrate core functionalities:

Setting Up an Electron Application

import index from '@flownet/lib-to-electron';

const params = {
  name: "myApp",
  entry: "app/main",
  id: "com.example.myapp",
  version: "1.0.0",
};
const src = './source';
const dest = './output';

(async () => {
  try {
    await index({ params, src, dest });
  } catch (error) {
    console.error('Setup failed:', error);
  }
})();

This example demonstrates how to use the index function to prepare an Electron application with specified parameters, source, and destination directories.

Acknowledgements

Special thanks to contributors and any other libraries that indirectly supported the development of this library.

Input Schema

$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
  params:
    type: object
    properties:
      name:
        type: string
        default: electron
        description: The name of the application
      entry:
        type: string
        default: app/electron
        description: Entry point of the application
      id:
        type: string
        default: com.example.electron
        description: Application identifier
      version:
        type: string
        default: 0.1.0
        description: Version of the application
      title:
        type: string
        description: Title of the application
      package_name:
        type: string
        description: Package name of the application
      author:
        type: string
        description: Author of the application
      description:
        type: string
        description: Description of the application
      vendor:
        type: string
        default: flownet.ai
        description: Vendor information
      include_css:
        type: boolean
        description: Indicates if CSS should be included
      bundle_name:
        type: string
        description: Name of the bundle
      package_dir:
        type: string
        description: Directory of the package
      out_dir:
        type: string
        description: Output directory for the package
  config:
    type: object
    description: Configuration object
  src:
    type: string
    description: Source directory path
  dest:
    type: string
    description: Destination directory path
required:
  - params
  - src
  - dest
0.3.6

9 months ago

0.3.5

9 months ago

0.3.2

9 months ago

0.3.4

9 months ago

0.3.3

9 months ago

0.2.10

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.3

9 months ago

0.3.1

9 months ago

0.2.2

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.1

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago