-
Notifications
You must be signed in to change notification settings - Fork 1
Developing
Here is some information for developers working with this package.
The source code has been written in ES6 modules.
Testing is performed with Zoroaster context-testing framework that allows to reuse testing infrastructure across files. It also has mask tests, where inputs are mapped to the outputs easily.
The documentation is compiled from multiple files with examples and their output using Documentary.
There are some JSX extensions found in the .documentary folder, such as <footer/> that are referenced in markdown files, and compiled into the README file.
The wiki submodule has been created for convenient access to the wiki git. The documentation from documentary-wiki folder will be compiled into the wiki dir, after which changes must be pushed into both places. Documentary can automatically watch updates to the source files, add them to the submodule, and push changes:
yarn wiki -p 'commit message'A binary file is created to execute the package from command line.
There are two entries in the bin property of package.json: the standard path to the executable, and the mnp-dev file which points to the source location. This is here so that it is possible to run the binary locally when developing, without having to build it first.
The project has been compiled with Depack which requires Closure Compiler installed locally. The best way to do it is to install it in the home directory as a node_modules dependency:
cd ~
yarn init
yarn add google-closure-compiler-java
Depack will perform compilation in advanced mode, merging all dependencies together and optimising the code.
The package is built with a 0-dependency regex-based ÀLaMode transpiler that only updates imports and export statements into require calls and module.exports assignments keeping the rest of code as it is.
To flatten the dependency trees, a standard library is created from the main dependencies of this package. The .alamoderc.json file contains the following configuration:
{
"import": {
"stdlib": {
"path": "stdlib",
"packages": ["erte"]
}
}
}This means that the transpiler will rename all imports from packages specified in the packages field to point to the stdlib path.
import { c } from 'erte' // becomes
const { c } = require('../stdlib');The stdlib itself is compiled using Depack by importing all required modules and assigning them to the module.exports:
import { c } from 'erte'
module.exports = {
'c': c,
}Therefore, dependencies that were placed in the stdlib don't have to be specified in the package's dependencies list and can be moved into devDependencies.
| © {{ trademark }} 2019 |