dox 3.1.1
dox: ^3.1.1 copied to clipboard
This is a cli tool to generate migration, model and to handle database migration with dox framework. It support up and down methods to control migration version.
3.1.1 #
- Change:
dox make:serializernow makes the file inlib/app/serializers/(before:lib/app/http/serializers/). Serializers are used by more than HTTP (MCP, websocket). The model import in the file is now a package import:package:<app>/app/models/<name>/<name>.model.dart. The app name comes frompubspec.yaml. Without a name, the command prints a message and stops (same asdox make:factory).
3.1.0 #
- New:
dox queue:clear [queue],dox queue:restartanddox queue:prune-failed [--hours=N]. They runbin/queue.dart clear|restart|prune-failed. They need a dox_queue that has these commands.dox help queue:worknow also lists--backoff,--max-jobs,--max-timeand--memory. - Fix: another
doxcan delete.dart_tool/dox/commands.dartwhile this run reads it. This run crashed then. Now it writes the file again from the cache and goes on. - Fix: an unknown command in an app with package commands (like an app with dox_queue) now exits with code 1. Before, it printed "Could not find a command" and exited with 0. An app that already has
.dart_tool/dox/commands.dartgets the new file on the next run. - Fix: the model from
dox make:modelhas nounintended_html_in_doc_commentinfo any more. The<String>[...]example in its doc comment is now in backticks. - New: package commands. A package (or the app) adds
doxcommands with thedox: commands:key in its pubspec.yaml, likedox: {commands: package:dox_queue/commands.dart}.dox <name>finds them when the name is not a built-in command. It reads.dart_tool/package_config.json, writes.dart_tool/dox/commands.dart, and runs it withdart run. The exit code of the command is the exit code ofdox. The file is written again only when package_config.json or a pubspec.yaml change. - A built-in command always wins. Two packages with the same command name print an error (exit code 1). A bad
dox: commands:key prints a warning, and the other packages still work. dox helplists the package commands, one group per package.dox help <name>shows one package command. Outside an app, or when no package has commands, it does not start Dart.- An unknown command now also prints a hint about the
dox: commands:key. dox migrate(and the othermigration:*commands) now makesbin/migrate.dartwhen it is missing anddb/migrationhas Dart migrations, then goes on. Before, it stopped with "bin/migrate.dart is missing". So a migration that a package command wrote (likedox queue:table) runs withdox migrate.- The commands are found in an app inside a pub workspace too. A member finds the workspace root from
.dart_tool/pub/workspace_ref.json(so a glob likeapps/*works). - The file is also written again when the pubspec.yaml of any package changes (like a path dependency), with no
dart pub get. A run with warnings (like a commands library that is not there yet) is not cached, so a fix counts on the next run. The files are written with write-then-rename. - A
dox: commands:value must be a plain path likepackage:<name>/<path>.dart(no.., no quotes). Else the package is skipped with a warning. - Only the packages that the app uses count (from
.dart_tool/package_graph.json). In a pub workspace, an app does not see the commands of other members. - A commands library that is removed after the cache was made is skipped with a warning on the next run. The other packages still work.
dox help <name>says when more than one command has that name.- When a package command throws,
doxprints the error and its stack trace, and exits with code 1. - Now depends on
cryptoandyamldirectly (they were already used through other packages). - Safety:
dox migration:fresh,migration:resetandmigration:refreshdrop all tables. WhenAPP_ENV=productionand stdin is a terminal, they now ask first. Any answer other thanystops with exit code 1.--forceskips the question. Without a terminal (CI, deploy scripts) they print a warning and run as before. - Fix:
doxexited with code 0 when there was no command, the command was unknown, the arguments were wrong, or the command threw. Now it exits with code 1, so scripts and CI see the failure. - Fix:
dox make:model Postwrote@DoxModel(), so the ORM read the tablepost. Butmake:model Post -mmakes the tableposts. Now the model always gets the same plural table:@DoxModel(table: 'posts'). - The
make:modelstub now has an emptyfillablelist with a comment. A model is guarded by default, socreate(req.body)throwsMassAssignmentExceptionuntil you list the columns there. dox serve --port=8080(or any other unknown option) was ignored with no message. Now it prints a warning that says to setAPP_PORTin.env(or runAPP_PORT=8080 dox serve). The server still starts, as before.- Safety:
dox migration:rollbacknow has the same production check asmigration:fresh. WhenAPP_ENV=productionand stdin is a terminal, it asks first.--forceskips the question, likemigration:rollback --step=2 --force. dox migrate --force(and the othermigration:*commands without the check) still takes--forcewith no error. It does nothing there and is not passed on tobin/migrate.dart.- Safety:
dox key:generatechangesAPP_KEY, which logs out every user. WhenAPP_ENV=productionand stdin is a terminal, it now asks first, likemigration:fresh. Any answer other thanystops with exit code 1 and changes nothing.--forceskips the question. Without a terminal (CI, deploy scripts) it prints a warning and changes the key as before. Outside production it works as before. - New:
dox key:generate --showprints a new key and writes nothing. An unknown option is still ignored, as before, but now it prints a warning to stderr, soKEY=$(dox key:generate --show)holds only the key. - Fix:
dox migration:rollback --step 2(with a space) was rejected. Now it works, like--step=2.--stepgiven twice (like--step=2 --step=3) used the last value with no message. Now it prints an error and exits with code 1. - Fix: the
dox servewarning for an unknown option always saidAPP_PORT=8080. Now it shows the port of--port=<number>, likeAPP_PORT=3000for--port=3000. Any other option still shows 8080.
3.0.1 #
- Fix: when only
dox servegot SIGTERM or SIGINT (eg.kill <pid>from a script), the server andbuild_runner watchit started kept running and held the port. Now dox stops them first, waits up to 5 seconds, then exits. Ctrl+C in a terminal already worked.
3.0.0 #
- The CLI moved to its own repo: dartondox/dox-cli. It is the same code.
3.0.0-rc.2 #
- Fix:
dox createanddox updatesorted pre-releases only by their number, so3.0.0-alpha.17looked newer than3.0.0-rc.1.dox createthen cloned the alpha.17 template. Now the label counts first: alpha < beta < rc < stable. - Only the CLI has this version. The other Dox packages stay at 3.0.0-rc.1.
3.0.0-rc.1 #
- Fix:
dox make:jobwrote abin/queue.dartthat did not compile. It calledQueueWorker(jobs: ...), butQueueWorkerhas nojobsparameter. It now writes the same file as the app template:QueueWorker(app: appConfig). - Fix: the job that
dox make:jobwrites showedX(userId: 1).dispatch()in its comment. The class has nouserId. The comment now showsX().dispatch(). - Fix:
dox db:seed --class UserSeeder(with a space) was refused. Both--class=UserSeederand--class UserSeederwork now. - Fix:
dox make:middlewarewroteextends IDoxMiddleware. It now writesimplements IDoxMiddleware, like the docs and the built-in middleware. dox buildalso leaves the SQLite lock files of dox_migration (*.sqlite.lock,*.sqlite3.lock,*.db.lock) out ofbuild/bundle/db.
3.0.0-alpha.17 #
- Uses dox_migration 3.0.0-alpha.12.
dox make:controller -r: thedestroystub shows how to give a 404 whendelete()deletes 0 rows.
3.0.0-alpha.16 #
- Version bump only, to match the other packages.
3.0.0-alpha.15 #
dox make:dto CreateBlognow writeslib/app/http/dtos/create_blog/create_blog.dto.dart. Each DTO has its own folder, like models. The.dto.g.dartfile is made next to it.
3.0.0-alpha.14 #
- Fix:
dox make:migrationrun more than once in the same second gave files with the same timestamp. Then the run order depended only on the name, which could break foreign keys. Now each new migration (.dartor.sql) sorts after every file already indb/migration. When needed, it uses the newest time plus 1 second.
3.0.0-alpha.13 #
- Version bump only, to match the other packages.
3.0.0-alpha.12 #
- Version bump only, to match the other packages.
3.0.0-alpha.11 #
dox buildalso buildsbin/queue.dartandbin/schedule.dartwhen they exist, tobuild/bundle/bin/queueandbuild/bundle/bin/schedule. Before, the worker and the scheduler had no production binary.- Fix:
dox buildcopied the local SQLite database (db/dox.sqlite, with its-waland-shmfiles) intobuild/bundle/db, so dev data went to production. SQLite files are now left out. dox --helpanddox -hshow the help, likedox help.
3.0.0-alpha.10 #
make:*is now the main name of every generator:make:controller,make:middleware,make:dto,make:serializerandmake:model, likemake:migration,make:factoryandmake:seeder. Thecreate:*names still work as aliases.- New
dox make:job <name>: makeslib/app/jobs/<name>.job.dartandbin/queue.dartwhen it is missing. It prints a hint to adddox_queueand to runbuild_runner. - New
dox queue:work,queue:failed,queue:retry,queue:forgetandqueue:flush: runbin/queue.dartwith the same flags. - New
dox schedule:work,schedule:run,schedule:listandschedule:test <name>: runbin/schedule.dart. - These commands pass the terminal through, send SIGINT and SIGTERM to the app script so a worker can stop by itself, and return its exit code. When the script is missing they print how to set it up.
3.0.0-alpha.9 #
dox make:controller(create:controller) writes@Inject()above the class, and no global controller instance. The file shows the typed route to use. The command says to runbuild_runner.- New
dox make:factory <model>: makesdb/factories/<model>.factory.dart. - New
dox make:seeder <name>: makesdb/seeders/<name>.seeder.dart, writes the seeder listdb/seeders/seeders.dartand makesbin/seed.dartwhen it is missing. - New
dox db:seed [--class=<name>]: runsbin/seed.dart. The default seeder isDatabaseSeeder. - New
dox migration:fresh(ormigrate:fresh): drops all tables, then runs all migrations. --seedaftermigration:run,migration:refreshormigration:freshruns the seeders when the migrations end well.
3.0.0-alpha.8 #
- Version bump only, to match the other packages.
3.0.0-alpha.7 #
- Breaking:
create:controllerno longer takes-ws. Dox uses Socket.IO for realtime now. See the Socket.IO docs for a namespace class. - Security:
dox createnow copies.env.exampleto.envand writes a new randomAPP_KEY. Before, every new app used the same public key from the template. You no longer runcp .env.example .env. - The
.env.exampleof the CLI has an emptyAPP_KEY. Rundox key:generateto set one.
3.0.0-alpha.6 #
- Fix:
dox key:generatedropped.envlines with more than one=(likeDATABASE_URL=postgres://u:p@h/db?sslmode=require). It also dropped comment lines. Now it only changes theAPP_KEYline. Every other line stays as it is. - Fix:
dox createcrashed withFailed to decode data using encoding 'utf-8'when the template had a binary file (for exampledb/dox.sqlite-shm). It now skips files that are not UTF-8 text. It only writes a file when its content changes.
3.0.0-alpha.5 #
- Fix:
dox create my_appwithout--versioncrashed with aRangeError. - Fix:
dox createpicked the GitHub "latest" template release, which skips pre-releases. During the 3.x alpha that gave the old 2.x template. It now takes the newest template with the same major version as the CLI. - Fix:
dox env:generatereadKEY=3000 # noteas text, not as anint. A#after a space is now a comment. - Fix:
dox updateran a plaindart pub global activate dox, which skips pre-releases. During the 3.x alpha it installed the old 2.x CLI. It now installs the newest version with the same major version as the CLI, from the pub.dev version list.
3.0.0-alpha.4 #
- Version bump only, to match the other packages.
3.0.0-alpha.3 #
- Version bump only, to match the other packages.
3.0.0-alpha.2 #
- Fix:
dox buildno longer passes--delete-conflicting-outputsto build_runner (it was removed and printed a warning). - Needs Dart 3.13 or newer.
- All dependencies updated to their latest versions.
dox buildnow runsdart build cli(AOT, with build hooks). The output isbuild/bundle/. Start it withcd build/bundle && ./bin/server.- New
dox create:dto <name>: makeslib/app/http/dtos/<name>.dto.dart.dox create:requestis removed. dox create:controller -rusesint idfor the resource methods.- New
dox openapi:generate [dir]. It runs the app'sbin/openapi.dartand writesopenapi.jsonandopenapi.yaml(defaultstorage/openapi). - New
dox env:generate: makeslib/config/env.dart(the typed env class) from.env.example. - New
dox env:check: loads the typed env and prints every missing or bad key (exit code 1).
3.0.0-alpha.1 #
- Version 3 of Dox. All Dox packages now share one version.
- Needs Dart 3.6 or newer.
- See the release notes for all main changes.
- Generated models import
package:dox_orm/dox_orm.dart.
2.0.1 #
- bug fix on dox create command
2.0.0 #
- Release stable version v2.0
2.0.0-alpha.3 #
- Fix migration issue
2.0.0-alpha.2 #
- Add option to create project with specific version
2.0.0-alpha.1 #
- Compatible with core version 2
1.1.1 #
- handle migration with dox_migration
- set default migration file with .sql
1.0.55 #
- Add command to create serializer
- Add help option
1.0.54 #
- update request template
- Add help option
1.0.53 #
- Added command to create form request
dox create:request Blog
1.0.52 #
- Added command to create websocket controller
1.0.51 #
- Initial version.