JSPM

  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q47540F
  • License GPL-3.0-only

ATA.js is a programmatic life cycle system for Javascript and typescript.

Package Exports

  • ata.js
  • ata.js/Core/Ata.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ata.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ATA.JS Javascript Life Cycle System

Overview

ata.js is a Node.js-based module that enables the creation and management of complex project structures with modular components, executing tasks within a root and restricted context. This system allows developers to easily initiate, configure, and execute projects in a highly modular and efficient way, leveraging a flexible core system.

The architecture is designed to support different project "modes" and component-based loading, providing a robust environment where different parts of the system are modular and can depend on each other.

Features

  • Modular Components: The system is organized into various modules such as App, Controller, Config, Core, Service, DB, and others.
  • Project Modes: Projects are initialized with an environment variable defining the mode (default: "Run").
  • Component Hierarchy: Modules are loaded and initialized in a hierarchical structure. Each module can expose its own functions, and depending on the mode, they can be initialized or configured differently.
  • Root and Restricted Access: Certain modules like Controller have root-level access, allowing them to execute commands freely. Other modules like Service have restricted access, with the capability to use only certain functions exposed by higher-level modules.
  • Promise-based Execution: Each module can handle asynchronous tasks using promises, providing a way to manage success (OK(…)) and failure (NO(…)) outcomes.

Installation And Usage

To install and use ata.js, run the following command in your terminal:

npm install -g ata.js

Create A Project

npx ata.init

This will initialize the project and set up the necessary configuration files. During the initialization process, you will be prompted to enter the project and a few other details.

An Example Project Structure

Once initialized, your project will follow a modular structure. The base project will look like the following:

an-example-project/
 ├── App/
 ├── Config/
 ├── Constant/
 ├── Controller/
 ├── Core/
 ├── DataBase/
 ├── Document/
 ├── Extension/
 ├── InterFace/
 ├── Job/
 ├── Library/
 ├── Log/
 ├── Mod/
 ├── Service/
 └── Source/

Here are the main directories and their purposes (for details, click note links on each explanation):

  • Application: Contains the core application logic. details
  • Config: Holds configuration files and environment settings. details
  • Constant: Stores constant values used throughout the application. details
  • Controller: Manages the logic for specific components, can have root access to the system. details
  • Core: The central system, including execution and multi-threading management. details
  • DataBase: Database interactions and management. details
  • Document: The documents are that we wrote and automatic generated by the system. details
  • Extension: Additional functionality that can be added to the system. details
  • Interface: Holds the interfaces for communication between components. details
  • Job: The starter script is used for each thread. details
  • Library: Core utilities and shared resources. details
  • Log: Logging system for keeping track of events and errors. details
  • Mod: the files include system start settings for running mod. details
  • Service: Provides additional services, often used for external computations or handling specific logic. details
  • Source: The source files of the project. details

Commands

Initialization

npx ata.init

This command will initialize a new project and set up the necessary modules.

Run The Project

npx ata.run

This command starts the project on the current folder with the configuration defined during initialization.

Test The Project

npx ata.test

Run this command to execute tests and verify that everything is functioning as expected.

Run The Project On Electron

npx ata.electron

Launch the Electron-based UI for the project (if applicable). This command starts the project on the current folder with the configuration with electron support defined during initialization.

Developing

// Example Controller

Setup(()=>{
    // executed once immidiately
    const core = Project.Core.Add("THREAD-" + index, { // calling a core thread
        Name: "THREAD1",
        Commands: ["node"],
        Environment: { index:1 }
    });

    core.Execute(); // run the thread


});

Loop(()=>{
    // cycles every second
});

const Name = "Example";
const Fonk = ()=>{
    //...
};

if(Name === Module.Name /*"Example"*/) OK("Correct"); // make ready the module
else NO("Name Definition Error");

return{
    Name: Name,
    Fonk: Fonk
};

Project Flow

  • Initialization: The project is first initialized using the ata.init command, which configures the base structure.
  • Modular Loading: Based on the specified mode, the relevant modules are loaded in a hierarchical manner.
  • Execution: Modules interact with each other via the core system, and asynchronous tasks are handled with promises.
  • Root and Restricted Access: Modules like Controller can execute commands with full access, while modules like Service are restricted in terms of what they can do.

Contribution

Feel free to fork the repository, submit pull requests, and contribute to the development of ata.js. Make sure to follow the standard code conventions and write tests for new features.


License

This project is licensed under the MIT License - see the LICENSE file for details.