@@ -3,30 +3,52 @@ defmodule Mix.Tasks.Phx.Sync.TanstackDb.Docs do
33
44 @ spec short_doc ( ) :: String . t ( )
55 def short_doc do
6- "A short description of your task "
6+ "Convert a Phoenix application to a Tanstack DB based frontend "
77 end
88
99 @ spec example ( ) :: String . t ( )
1010 def example do
11- "mix phx_sync .tanstack_db"
11+ "mix phx.sync .tanstack_db"
1212 end
1313
1414 @ spec long_doc ( ) :: String . t ( )
1515 def long_doc do
1616 """
1717 #{ short_doc ( ) }
1818
19- Longer explanation of your task
19+ This is a very invasive task that does the following:
20+
21+ - Removes `esbuild` with `vite` and removes the Elixir integration with
22+ tailwindcss
23+
24+ - Adds a `package.json` with the required dependencies for `@tanstack/db`,
25+ `@tanstack/router`, `react` and `tailwind`
26+
27+ - Drops in some example routes, schemas, collections and mutation code
28+
29+ - Replaces the default `root.html.heex` layout to one suitable for a
30+ react-based SPA
31+
32+ For this reason we recommend only running this on a fresh Phoenix project
33+ (with `Phoenix.Sync` installed).
2034
2135 ## Example
2236
2337 ```sh
38+ # install igniter.new
39+ mix archive.install hex igniter_new
40+
41+ # create a new phoenix application and install phoenix_sync in `embedded` mode
42+ mix igniter.new my_app --install phoehix_sync --with phx.new --sync-mode embedded
43+
44+ # setup my_app to use tanstack db
2445 #{ example ( ) }
2546 ```
2647
2748 ## Options
2849
29- * `--example-option` or `-e` - Docs for your option
50+ * `--sync-pnpm` - Use `pnpm` as package manager if available (default)
51+ * `--no-sync-pnpm` - Use `npm` as package manager even if `pnpm` is installed
3052 """
3153 end
3254end
@@ -44,31 +66,17 @@ if Code.ensure_loaded?(Igniter) do
4466 @ impl Igniter.Mix.Task
4567 def info ( _argv , _composing_task ) do
4668 % Igniter.Mix.Task.Info {
47- # Groups allow for overlapping arguments for tasks by the same author
48- # See the generators guide for more.
4969 group: :phoenix_sync ,
50- # *other* dependencies to add
51- # i.e `{:foo, "~> 2.0"}`
5270 adds_deps: [ ] ,
53- # *other* dependencies to add and call their associated installers, if they exist
54- # i.e `{:foo, "~> 2.0"}`
5571 installs: [ ] ,
56- # An example invocation
5772 example: __MODULE__ . Docs . example ( ) ,
58- # a list of positional arguments, i.e `[:file]`
5973 positional: [ ] ,
60- # Other tasks your task composes using `Igniter.compose_task`, passing in the CLI argv
61- # This ensures your option schema includes options from nested tasks
6274 composes: [ ] ,
63- # `OptionParser` schema
6475 schema: [ sync_pnpm: :boolean ] ,
65- # Default values for the options in the `schema`
6676 defaults: [
6777 sync_pnpm: true
6878 ] ,
69- # CLI aliases
7079 aliases: [ ] ,
71- # A list of options in the schema that are required
7280 required: [ ]
7381 }
7482 end
0 commit comments