Skip to content

A Hello World project to demonstrate the Cene programming language.

License

Notifications You must be signed in to change notification settings

era-platform/cene-scaffold

Repository files navigation

Cene Scaffold

CI

This project is an exercise in using the Cene programming language. It implements a "hello world" level of functionality covering a few different ways of using Cene. Cene controls the build logic, the Web server logic, and the Web client logic.

In general, there are two ways to run Cene programs: A Cene program can transform an input directory into an output directory, and in the process it can create JavaScript code. Then that JavaScript code can be used for whatever purposes JavaScript code is usually good for, but large parts of the behavior of that code can be implemented in Cene.

In this repo, the directory transformation produces two JavaScript files: One is a Node.js server, and the other is meant to be included in client-side web code via a <script> tag. The Node.js server serves the client-side code.

This repo also demonstrates how a program can be built from multiple .cene files.

Setup

To install, you'll need Node.js and npm. This repository also depends on specific npm packages (namely cene and express), but the npm install commands below can take care of those.

To obtain build dependencies and run a build:

$ npm install

To run a build again:

$ npm run build

The build will create a dist/ directory, as well as an intermediate build/ directory. For this project, the dist/ directory itself is a project with dependencies of its own. To obtain server dependencies and start the Node.js server:

$ cd dist/
$ npm install
$ node server.js

Then you can visit the site served at localhost:8080. The page displays a "Hello, client!" message by constructing some DOM nodes with the JS FFI.

Why two installations

You may wonder why we're installing additional dependencies after a build step rather than just installing them up front. We're doing this to demonstrate that Cene and its dependencies (npm and Node.js) are only incidental details of Cene's implementation, and they're not necessarily related to the needs of a specific Cene project. For instance, a Cene project could use some other package manager like Maven or RubyGems.

That said, Cene is currently focused on making JavaScript, Node.js, and npm easy to develop for, because that's the kind of development that will help Cene's implementation itself. Some Cene codebases may opt not to be as strict about the language/source/output distinction as this one is.

About this project

This project is released under the MIT license. See LICENSE.txt.

About

A Hello World project to demonstrate the Cene programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published