seed-builder
Advanced tools
Comparing version 0.1.98 to 0.2.0
#! /usr/bin/env node | ||
const exec = require("child_process").execSync; | ||
let dir = __dirname.replace(/ /g, "\\ "); | ||
const idx = require("./index.js"); | ||
const [, , ...args] = process.argv | ||
let command = `${dir}/bin/seed ${args.join(" ")}` | ||
const command = `${idx.getBin()} ${args.join(" ")}` | ||
console.log(exec(command).toString()) |
21
index.js
@@ -0,5 +1,17 @@ | ||
const os = require('os'); | ||
const path = require('path'); | ||
exports.getBin = function getBin(){ | ||
const dir = __dirname.replace(/ /g, "\\ "); | ||
const platform = os.platform(); | ||
switch(platform){ | ||
case "linux": return path.join(dir, "bin", "seed-linux") | ||
case "win32": return path.join(dir, "bin", "seed-windows.exe") | ||
} | ||
return path.join(dir, "bin", "seed-linux") | ||
} | ||
exports.build = function (input, platform, output) { | ||
const exec = require("child_process").execSync; | ||
let dir = __dirname.replace(/ /g, "\\ "); | ||
let command = `${dir}/bin/seed ${input ? "-i " + input : ""} ${platform ? "-p " + platform : ""} ${output ? "-o " + output : ""} ` | ||
const command = `${getBin()} ${input ? "-i " + input : ""} ${platform ? "-p " + platform : ""} ${output ? "-o " + output : ""} ` | ||
try { | ||
@@ -12,6 +24,5 @@ return exec(command).toString(); | ||
exports.export = function (input, modulee, output) { | ||
exports.extend = function (input, modulee, output) { | ||
const exec = require("child_process").execSync; | ||
let dir = __dirname.replace(/ /g, "\\ "); | ||
let command = `${dir}/bin/seed export ${input ? "-i " + input : ""} ${modulee ? "-m " + modulee : ""} ${output ? "-o " + output : ""} ` | ||
const command = `${getBin()} extend ${input ? "-i " + input : ""} ${modulee ? "-m " + modulee : ""} ${output ? "-o " + output : ""} ` | ||
try { | ||
@@ -18,0 +29,0 @@ return exec(command).toString(); |
{ | ||
"name": "seed-builder", | ||
"version": "0.1.98", | ||
"description": "Seed builder", | ||
"version": "0.2.0", | ||
"description": "Code generator library", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "author": "Erick Rivas", |
@@ -1,9 +0,19 @@ | ||
# Seed builder | ||
# Seed Builder | ||
This repository holds the source code of the **seed builder** for the generation of a **Django api & React web** . | ||
## Table of content | ||
## Installation: | ||
- [Description](#description) | ||
- [Installation](#installation) | ||
- [How to use](#how-to-use) | ||
- [Extend modules](#extend-modules) | ||
- [References](#references) | ||
For the latest stable version: | ||
## Description | ||
Seed-builder is a code generator library to facilitate the creation of *boilerplate code* required by django & reactjs applications such as model definitions, CRUD automation, server connections and graphql implementations. | ||
## Installation | ||
To Install the latest stable version. | ||
```bash | ||
@@ -13,22 +23,30 @@ npm install -g seed-builder | ||
## Examples | ||
## How to use | ||
- Build a project | ||
To create or update seed-builder autogenerated files | ||
- Install [StarUML](http://staruml.io/download) & seed-extension ([https://github.com/erick-rivas/seed-staruml](https://github.com/erick-rivas/seed-staruml)). | ||
- Create or edit a model definition file (*SeedModeling.mdj*) and modify the diagram with the rules defined in [seed-extension documentation](https://github.com/erick-rivas/seed-staruml/blob/master/README.md). | ||
- Export diagram as *SeedManifest.json*. | ||
- Run builder. | ||
```bash | ||
seed-builder | ||
``` | ||
``` | ||
> It automatically detect the project settings described in SeedManifest.json and update or create the required files | ||
- Build a project with specific params | ||
```bash | ||
seed-builder build -i ./settings/SeedManifest.json | ||
``` | ||
- Export modules (override) | ||
### Extend modules | ||
In case of extend the functionality of autogenerated resources. Use *seed-builder extend* command, example: | ||
- To extend the functionality of a Django model | ||
```bash | ||
seed-builder export -i SeedManifest.json -m views:__all__ | ||
``` | ||
seed-builder extend -m model:<model_name> | ||
``` | ||
- Show help | ||
```bash | ||
seed-builder -h | ||
``` | ||
## References | ||
For more information about modules, extensions or specific information about each platform, check their respective documentation | ||
- Django Reference ([https://github.com/erick-rivas/django-reference](https://github.com/erick-rivas/django-reference)) | ||
- ReactJs Reference ([https://github.com/erick-rivas/reactjs-reference](https://github.com/erick-rivas/reactjs-reference)) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
19124438
6
33
51
5