
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@godigit/auto-generate
Advanced tools
- auto create table by config JSON file. - encrypt your database connection. - auto import SQL file.
*** This package can be only use with @godigit/master-data package.
Those are 3 key you need to write config JSON file:
{
    "module_name": "customer",
    "table": {
        "tb_name": "customer",
        "tb_fields": {
            "customer_id": {
                "type": "number",
                "length": 11,
                "auto_increment": true,
                "require": true,
                "is_primary": true,
                "not_param": true
            },
            "customer_firstname": {
                "type": "text",
                "length": 360,
                "require": true
            },
            "customer_lastname": {
                "type": "text",
                "length": 320,
                "require": true
            },
            "created_date": {
                "type": "datetime",
                "length": 11,
                "require": false,
                "default": "current_timestamp",
                "not_param": true
            },
            "created_by": {
                "type": "text",
                "length": 100,
                "require": false
            },
            "updated_date": {
                "type": "datetime",
                "length": 11,
                "require": false,
                "default": "current_timestamp on update current_timestamp",
                "not_param": true
            },
            "updated_by": {
                "type": "text",
                "length": 100,
                "require": false
            }
        }
    },
    "route": "/customer"
}
const path = require("path");
const AutoGenerate = require('./src/auto-generate');
// db config
const db = {
    host: "localhost",
    user: "root",
    password: "",
    port: 3306,
    database: "temp"
};
// Module Path 
const moduleGeneratePath = path.join(__dirname, "module");          // folder path are consist config JSON files to generate.
const moduleGenerateConfigPath = path.join(__dirname, "config");    // folder path to export config sql statement to use with master-data package 
// SQL path 
const sqlFolderPath = path.join(__dirname, "sql");      // folder path are consist SQL file
// Postman path
const postmanPath = path.join(__dirname, "collection"); // folder path to export postman collection file
const pathConfig = {
    moduleGeneratePath: moduleGeneratePath, 
    moduleGenerateConfigPath: moduleGenerateConfigPath, 
    sqlFolderPath: sqlFolderPath, 
    postmanPath: postmanPath
};
// encrypt db by cryptr: if isDatabaseEncrypt is True you need to put secretKey for encrypt db
const exportConnectionPath = path.join(__dirname, "config"); // path to export db connection
const option = {
    isDatabaseEncrypt: true,
    secretKey: "XXXXXX",
    tokenSecretKey: "XXXXXX",
    pathToExport: exportConnectionPath
};
// call auto generate function
const autoGenerate = new AutoGenerate(db, pathConfig, option);
autoGenerate.generate((err, res) => {
    console.log(res);
    process.exit();
});
FAQs
- auto create table by config JSON file. - encrypt your database connection. - auto import SQL file.
We found that @godigit/auto-generate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.