Home - PaleScript/bootimage GitHub Wiki

Table of contents

Bootimage

Bootimage

A Console-based os created with nodejs.

Installation

Install bootimage globally and into your workspace

npm install --location=global bootimage && npm install bootimage

Create your os

Before working on the os file initialize a workspace by running

bootimage init

This will initialize a workspace and you will get these files

- src
bootimage.json
bootimage_init.ini
package.json

lets first check out the bootimage.json which what is needed to edit

{
   "name": "example-os",
   "version": "1.0.0",
   "main": "",
}

Here is the default bootimage.json file
All you need is to edit the "main" and the "name" to start working on the project
"main" will point to the src directory if empty, add a file and makesure its pointed to the right file.

{ "name": "example-os", "version": "1.0.0", "main": "main.js", }

To Create your os start by importing the module

const bootimage = require("bootimage");

Then create the class that it gonna be your os runner

class MyOS extends bootimage.Bootimage {

}

module.exports = MyOS;

Create the constructor and override the run function

class MyOS extends bootimage.Bootimage {

   constructor() {
      super(options);
   }

   run() {}
}

Lets tell our logger to say hi in the os

// in the run method
this.getLogger().info("Hi");

and run your project by running

bootimage run

And boom, You're os is running perfectly fine.

Create your os in TS

You can create your os in typescript but there is slight changes that you have to create.

in bootimage.json update the main to point to the main.ts file or whatever you want to call it, but make sure it ends with .ts

{
   "name": "example-os",
   "version": "1.0.0",
   "main": "main.ts",
}

now create the main file with the same name set in the bootimage.json main in the src.
Once you have created that file you gonna have to export a default class that extends bootimage

import { Bootimage } from "bootimage";

export default class myOS extends Bootimage {

}

Override the run method and log out something to the os and boom everything works.