@flownet/lib-to-webos
v0.3.9
Published
This project provides a straightforward solution for converting existing web applications into packagable WebOS applications. It simplifies the process of preparing your web app, organizing the required files, and creating the necessary assets for deploym
Downloads
206
Readme
@flownet/lib-to-webos
This project provides a straightforward solution for converting existing web applications into packagable WebOS applications. It simplifies the process of preparing your web app, organizing the required files, and creating the necessary assets for deployment on WebOS devices.
How It Works
The project operates by taking a set of directories and configurations as input. It prepares your web application for WebOS by creating necessary directories, copying source files, and rendering templates. It also generates iOS-style icons and packages everything into the structure expected by WebOS. Finally, it uses the ares-package
tool to bundle your app into an installable package suitable for WebOS.
Key Features
- Template Rendering: Automatically processes and applies templates to your web application code.
- File Management: Manages directories and file copying, ensuring everything is correctly organized in the final package.
- Icon Generation: Produces iOS-style icons for inclusion in the application package.
- Packaged Output: Utilizes the
ares-package
command line tool to compile everything into a ready-to-use WebOS application package.
Conclusion
This project provides a practical and efficient way to convert web applications for use on WebOS devices. It automates many of the tedious steps involved in preparing and packaging web applications, making it easier to deploy your web solutions to a WebOS environment.
Developer Guide for @flownet/lib-to-webos
Overview
The @flownet/lib-to-webos
library is designed to facilitate the preparation and packaging of web applications for deployment on the WebOS platform. With this library, developers can automate the generation of WebOS-compatible packages by rendering templates, managing directories, and creating necessary resources such as icons. The primary function exposed by the library allows developers to streamline the setup and package creation process for their WebOS applications.
Installation
To include @flownet/lib-to-webos
in your project, you can use either npm or yarn. Run one of the following commands in your project directory:
npm install @flownet/lib-to-webos
or
yarn add @flownet/lib-to-webos
Usage
Below is an example of how to use the @flownet/lib-to-webos
library to prepare and package a web application for WebOS deployment.
Preparing and Packaging a WebOS Application
import index from '@flownet/lib-to-webos';
const prepareWebOSPackage = async () => {
const options = {
atom: {}, // Optional: Contains additional metadata (if available)
params: {
name: 'myApp',
entry: 'app/webos',
id: 'com.example.myApp',
title: 'My WebOS Application',
version: '1.0.0',
vendor: 'myCompany',
author: 'Author Name',
description: 'A description of my WebOS application',
},
config: {}, // Optional: Configuration data
src: 'path/to/source/directory', // Source directory containing application code
dest: 'path/to/destination/directory' // Destination directory for output
};
try {
await index(options);
console.log('WebOS application package created successfully!');
} catch (error) {
console.error('Failed to create WebOS package:', error.message);
}
};
prepareWebOSPackage();
Examples
Here is a basic example demonstrating the library's core functionality - converting application resources into a WebOS package.
import fs from 'node:fs';
import path from 'node:path';
import index from '@flownet/lib-to-webos';
const srcDir = path.resolve(__dirname, 'src');
const destDir = path.resolve(__dirname, 'build');
// Ensure source and destination directories exist
if (!fs.existsSync(srcDir)) {
console.error('Source directory does not exist:', srcDir);
process.exit(1);
}
if (!fs.existsSync(destDir)) {
fs.mkdirSync(destDir, { recursive: true });
}
const options = {
params: {
name: 'exampleApp',
id: 'com.example.app',
},
src: srcDir,
dest: destDir
};
index(options)
.then(() => console.log('Packaging completed successfully'))
.catch(err => console.error('Packaging error:', err));
In this example, the library is used to process application files located in the src
directory and package them into a WebOS-compatible format inside the build
directory.
Acknowledgement
This library utilizes components and functionalities from other Flownet libraries like @flownet/lib-render-templates-dir
and @flownet/lib-create-ios-icons
to assist in template rendering and icon creation. These integrations help streamline the process of preparing assets for WebOS deployment.
Input Schema
$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
atom:
type: object
description: Atom configuration and documentation details
params:
type: object
properties:
name:
type: string
default: webos
description: Name of the application
entry:
type: string
default: app/webos
description: Entry point of the application
id:
type: string
default: com.example.webos
description: Application identifier
title:
type: string
default: WebOS App
description: Title of the application
version:
type: string
default: 0.1.0
description: Version of the application
vendor:
type: string
default: flownet.ai
description: Vendor of the application
include_css:
type: boolean
description: Include CSS option from atom documentation
bundle_name:
type: string
description: Name of the bundle
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
package_dir:
type: string
description: Directory for packaging
out_dir:
type: string
description: Output directory
description: Parameters for configuring the application
config:
type: object
description: Configuration options
src:
type: string
description: Source directory path
dest:
type: string
description: Destination directory path
required:
- atom
- params
- config
- src
- dest