ZoneGFX build system pt. 1

ZoneGFX

ZoneGFX leverages NPM + TypeScript Compiler API to implement an ecosystem based on Cargo (from Rust), but using different coding conventions.

Status

I've not released the SDK for people to use yet. Right now missing Git dependencies + registry, but the TypeScript build system is done, and includes workspace support. We are still missing ESDoc, EScript APIs, language server and the ZoneGFX runtime, as well as certain CLI commands.

There are build scripts too, but they don't run yet since the runtime isn't ready.

Getting started

  1. Bash commands:
zgfx new com.example.hello-world
  1. Edit src/Main.es
//import * as zoneDS from "zone.ds";
import { AX } from "com.example.secondary";
// reflexive + item module
import { JointType } from "com.example.hello-world.enum::JointType";

/*
// app
export default function Main(): zoneDS.Node {
    return (
        <></>
    );
}
*/
  1. Add src/enum/JointType.es
//
export type JointType =
    | "a"
    | "b";
  1. Now, run this Bash:
cd com.example.hello-world
zgfx new --lib secondary
  1. Now, edit secondary/zonegfx.toml (just for changing the package ID)
[package]
id = "com.example.secondary"
version = "0.1.0"
authors = ["paulwalker <paulwalker@gmail.com>"]

[compiler-options]
  1. Now edit secondary/src/__mod__.es:
//
export const A = 10;
  1. Now edit zonegfx.toml from com.example.hello-world to add a dependency to com.example.secondary.
cd .. # com.example.hello-world/

zonegfx.toml:

[workspace]
members = ["secondary"]

[package]
id = "com.example.hello-world"
version = "0.1.0"
authors = ["paulwalker <paulwalker@gmail.com>"]

[dependencies]
"com.example.secondary" = { path = "secondary" }

[compiler-options]
main-component = "src/Main.es"

[application]
framerate = 60
background = "#fff"
  1. Now, let's type-check (i.e. install dependencies and build sources):
zgfx esc check

Result:

image

File tree:

com.example.hello-world
├── secondary
│   ├── src
│   │   └── __mod__.es
│   └── zonegfx.toml
├── src
│   ├── enum
│   │   └── JointType.es
│   └── Main.es
├── target                # build artifacts
│   └── pkg
│       └── dist
│           └── local
│               ├── com.example.hello-world
│               │   ├── last-build.conf
│               │   └── src
│               │       ├── enum
│               │       │   └── JointType.es # the .es you see here are .d.ts
│               │       └── Main.es
│               ├── com.example.secondary
│               │   ├── last-build.conf
│               │   └── src
│               │       └── __mod__.es
│               ├── mocha
│               │   └── src
│               │       └── __mod__.es
│               └── zone # there are also .js, but they are emitted only in other commands.
│                   └── src
│                       ├── ds
│                       │   └── __mod__.es
│                       └── __mod__.es
├── zonegfx.lock
└── zonegfx.toml