lumis v0.1.1
Lumis
Automatically create factory and fake data from typescript interfaces
Please note, this is still very early development and has not been tested in a production envirnoment!
Prerequisites
This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.
$ npm -v && node -v
6.4.1
v8.16.0Table of contents
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Installation
BEFORE YOU INSTALL: please read the prerequisites
To install the library, run:
$ npm install --save-dev lumisOr if you prefer using Yarn:
$ yarn add --dev lumisUsage
To run Lumis on your project, add the command to your package.json scripts:
"script": {
"...": "...",
"lumis": "lumis -f ./src/**/*{.d.ts,.ts}"
}and execute the above script like so:
$ npm run lumis
# or
$ yarn lumisor if you have it installed globally:
$ lumis --files=./**/*.tsExamples
Create the following file, saving the example below inside.
export interface Example {
str: string;
num: number;
literal: {
key1: string;
key2: string;
};
arraySimple: string[];
arrayComplex: Array<{key1: string, key2: number}>;
tupSimple: [string, string, number];
tupComplex: [number, string, {key1: string}];
address: Address;
}
interface Address {
streetName: string;
houseNumber: number;
}Now run your npm command:
$ npm run lumis
# or
$ yarn lumisNow in any other Typescript file in your project, you can get the factory.
import { Example, Address } from 'lumis';
const newExample = Example.create({...});
// note, this is currently being implemented
const fakedExample = Example.fake();Running the tests
$ npm testKnown Bugs
- Nullkeyword isn't being recognised in the looper
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Fork it!
- Create your feature branch:
git checkout -b feat/my-new-feature - Add your changes:
git add . - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :sunglasses:
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Nicholas Mordecai
See also the list of contributors who participated in this project.
License
Apache 2.0 License © Nicholas Mordecai
Notes To Self
- If a nested structure is optional, a config should be set to allow that nested property to be or not to be generated