Jianghu-init Tool

12003

jianghu-init is the official command-line tool of the JianghuJS framework, designed to simplify and accelerate the creation of JianghuJS projects and pages. It provides functionality for quickly generating project scaffolds and page templates. Below are the main commands provided by jianghu-init:

  • jianghu-init project: Instantly generate a template project to help you quickly start a new project.
  • jianghu-init page: Easily create template pages to save time and maintain structural consistency.
  • jianghu-init json: Develop pages using JSON for improved efficiency and maintainability.
  • jianghu-init component: Generate common application components, such as a JSON editor or operation history.
  • jianghu-init script: Generate commonly used script files, such as sorting resourceIds or exporting SQL.

Installation

  • Install
  1. # Install with npm
  2. npm install -g @jianghujs/jianghu-init@latest
  3. # Install with yarn
  4. yarn global add @jianghujs/jianghu-init@latest --registry=http://registry.npmmirror.com
  • Check version
  1. # With npm
  2. npm list @jianghujs/jianghu-init -g
  3. # 3.2.4+ allows version check
  4. jianghu-init -v
  • Command help
  1. # 3.2.4+ allows help check
  2. jianghu-init -h

jianghu-init project

Quickly generate a template project:

  • jianghu-init project ./test01
  • jianghu-init project --type=basic ./test01

jianghu-init01.png
jianghu-init05.png

Parameter Value Example
type 1table-crud (project name) --type 1table-crud
dbIp database ip --dbIp 127.0.2
dbPort database port --dbPort 3306
dbUser database user --dbUser root
dbPass database password --dbPass 123456

jianghu-init page

Quickly generate a template page:

  • jianghu-init page
  • jianghu-init page --type=1table-page

jianghu-init02.png
jianghu-init03.png
jianghu-init04.png

Parameter Value Example
type 1table-page (page type) --type 1table-page

jianghu-init json

👉 More details about jianghu-init json 👈

  • Run jianghu-init json to create a student.json file.
  • Run jianghu-init json dev to enable JSON development mode for automatic page updates.

jianghu-init06.png
jianghu-init07.png
jianghu-init08.png
jianghu-init09.png

Parameter Value Example
generateType Generate type [ page / component ] --generateType page
pageType File type [ page / component ] --pageType page
table Select table --table student
pageId database user --pageId studentManagement

jianghu-init component

Generate application management-related pages:

  • jianghu-init component

    • json-editor-component: JSON editor component
    • attachment-component: File attachment component
    • tableRecordHistory-component: Data history component

jianghu-init10.png
jianghu-init11.png

Parameter Value Example
type component type --type json-editor

jianghu-init script

  • jianghu-init script

    • initSqlToResourceList - Convert init.sql to init-json resouceList
    • updateResourceId - Update _resource table IDs by pageId for easier sorting and viewing
    • updateJhId - Update jhId in system tables
    • htmlToInitJson - Convert HTML files into init-json configuration files
    • dumpSqlFile - Export database tables as SQL files
    • exportProjectDocs - Export current project directory structure and system tables as Markdown documents

jianghu-init13.png
jianghu-init12.png

Parameter Value Example
type script type --type initSqlToResourceList