A cli project starter/helper to get up and running with Knex.js projects.
npm i -g knexup
# or
yarn global add knexup
This should be the first thing when using knexup
in an existing project.
This generates the knexup config file in the project. Open the config file and edit/confirm your preferred knex
location (knexDir
). This is where knex files and other featured helpers will be generated.
Generates files and installs dependencies for working with knex.js in an existing project.
Generates TableInit schema-creation helper objects for each table specified via the -t | --table
flag. The
"table-init" sub-command argument can be omitted also, in which case the arguments after that will serve as the tables
input.
The examples below will generate a TableInit helper object for the "user" table.
knexup table-init user
knexup -t user
Bootstrap a new project for working with knex.js.
- Pass the
-d, --databaseClient
flag to specify which database client driver dependency to install. You can specify any client supported by Knex. - Pass the
-p, --path
flag to specify the path where the project should be created. If not specified, it defaults to the current directory in which the command is run.
See help info
Options:
-p, --path <char> Path relative to project root.
-t, --table [tables...] Database table name(s).
-d, --database-client <char> The preferred database client (mysql|postgres|sqlite)
-h, --help display help for command
Commands:
init Initialize a project for Knex development. Generates TableInit migration helper object for table "create" migration. Also creates a knexup config file if it does not exist.
project <projectName> Generate a project based on knex.js
bootstrap Generates files and installs dependencies for working with knex.js.
table-init Generates table-init schema-creation helpers for each table specified via --table
help [command] display help for command
The following runtime dependencies are installed by the knexup project
command:
- knex
- objection
- dotenv
- knexhelpers
- Whichever database connection client is specified in the cli options. Defaults to
sqlite3
The following dev dependencies are auto-installed by the knexup project
command:
The following runtime dependencies are installed by the knexup bootstrap
command:
The following dev dependencies are installed by the knexup bootstrap
command:
See changelogs here