@yisroel/one-way

generator using a geenee template

Usage no npm install needed!

<script type="module">
  import yisroelOneWay from 'https://cdn.skypack.dev/@yisroel/one-way';
</script>

README

code generator based on geenee metadata.

Version Downloads/week License

Geenee Template

Why

A geenee template is normally used for multiple generation of code. To do that, geenee-spell stores a meta directory within the generated code base to allow for regeneration.

But geenee templates are a very powerful tool for one-time creation as well. For instance, you may not want to include a meta directory in your code.

What

A single async function that generates code from a specified geenee template and settings.

Usage

Import the package:

npm i one-way

Set the following in your code:

Then you can call:

const generateCode = require('one-way-ticket')

try {
    await generateCode(
      codeDir, nsInfo, config, templateDir
    )
  } catch (error) {
    throw new Error(`could not generate the code: ${error}`)
  }

Example

Check out the usage in geenee-spell.

Creating Templates

You can create such a template easily from a code base using copykat, or just by following the steps for creating templates.

API

async function generateCode(
  codeDir: string,
  nsInfo: NsInfo,
  config: Configuration,
  templateDir: string,
)

The NsInfo and Configuration types are exposed in magicalstrings.