@getloom/gro v0.107.1
gro
task runner and toolkit extending SvelteKit - grogarden.org
limitations:
- Gro has been actively used since 2019 but it has few users, so you'll likely encounter problems and undesirable limitations -- please open issues!
- Windows won't be supported
about
Gro is a task runner and toolkit extending SvelteKit, Vite, and esbuild for making web frontends, servers, and libraries. It includes:
- task runner that uses the filesystem convention
*.task.ts- lots of common builtin tasks that users can easily override and compose
- tools and patterns for
developing,
building,
testing,
deploying,
and publishing
SvelteKit frontends, Node servers, and libraries
- integrated TypeScript, Svelte, and SvelteKit
- defers to SvelteKit and Vite for the frontend and
@sveltejs/packagefor the library - uses Changesets for versioning and changelogs
- provides a Node loader and
esbuild plugins for the server
- supports importing TypeScript, JSON, and SSR'd Svelte files in tests and tasks
- supports SvelteKit module imports for
$lib,$env, and$appin tasks, tests, Node servers, and other code outside of the SvelteKit frontend, so you can use SvelteKit patterns everywhere (these are best-effort shims, not perfect)
- configurable plugins
to support SvelteKit, auto-restarting Node servers, and other external build processes
- see the Gro config docs and the default config
- see
fuz_templatefor a simple starter project example, and@feltjs/feltfor a more complex example with custom tasks
- testing with
uvu - codegen by convention with
gen- supports automatic type generation by convention with
.schema.files using JSON Schema and json-schema-to-typescript
- supports automatic type generation by convention with
- linting with ESLint
(I also maintain
@feltjs/eslint-config) - formatting with Prettier (it's not always pretty, but it's consistent and it saves a lot of time)
docs
- developing web frontends, servers, and libraries
Taskrunner- builtin tasks list
- testing with
uvu gencode generationpublicpackage features (nonstandard)- full docs index
install
depends on node >=20.10
Typical usage installs @grogarden/gro as a dev dependency:
npm i -D @grogarden/gro
npx groIt's handy to install globally too:
npm i -g @grogarden/gro
grousage
Gro has a task runner that discovers and runs TypeScript modules with the .task. subextension.
Running gro with no args prints the tasks
it finds in the current directory along with its builtin tasks:
gro # prints available tasks - defers to any local gro installationRun a task: gro [name]
View help: gro [name] --help
17 tasks in gro:
build build the project
changeset call changeset with gro patterns
check check that everything is ready to commit
clean remove temporary dev and build files, and optionally prune git branches
commit commit and push to a new branch
deploy deploy to a branch
dev start SvelteKit and other dev plugins
exports write the "exports" property of package.json and copy the file to .well-known
format format source files
gen run code generation scripts
lint run eslint
publish bump version, publish to npm, and git push
release publish and deploy
sync run `gro gen`, `gro exports`, and optionally `npm i` to sync up
test run tests with uvu
typecheck run tsc on the project without emitting any files
upgrade upgrade depsGro matches your CLI input against its filesystem conventions. It tries to do the right thing, where right is helpful but not surprising, with some magic but not too much:
gro # print all available tasks, those matching `src/lib/**/*.task.ts` and Gro's builtins
gro some/dir # list all tasks inside `src/lib/some/dir`
gro some/file # run `src/lib/some/file.task.ts`
gro some/file.task.ts # same as above
gro a # run `src/lib/a.task.ts` if it exists, falling back to Gro's builtin
gro a --help # print info about the "a" task; works for every taskGro has a number of builtin tasks that you can run with the CLI. To learn more see the task docs and the generated task index.
gro dev # start developing in watch mode
gro dev -- vite --port 3003 # forward args by separating sections with --gro build # build everything for productionTesting with uvu,
including shims for SvelteKit modules:
gro test # run all tests for `*.test.ts` files with `uvu`
gro test filepattern1 some.test another.test
gro test -- uvu --forwarded_args 'to uvu'Check all the things:
gro check # does all of the following:
gro typecheck # typecheck JS/TypeScript and Svelte
gro test # run tests
gro gen --check # ensure generated files are current
gro format --check # ensure everything is formatted
gro lint # eslintFor a usage example see the check.yml CI config.
Formatting with prettier:
gro format # format all of the source files using Prettier
gro format --check # check that all source files are formattedCodegen with gen:
gro gen # run codegen for all `*.gen.*` files
gro gen --check # error if any generated files are new or differentTo deploy: (also see src/lib/docs/deploy.md)
gro deploy # build and push to the `deploy` branchTo publish: (also see src/lib/docs/publish.md)
gro publish # flush changeset to changelog, bump version, publish to npm, and git pushEtc:
gro clean # delete all build artifacts from the filesystem
gro clean --sveltekit --nodemodules --git # also deletes dirs and prunes git branches
gro upgrade excluded-dep-1 excluded-dep-2 # npm updates to the latest everythinggro --version # print the Gro versionFor more see src/lib/docs/task.md and src/lib/docs.
develop
npm i
npm run build # build and link `gro` - needed only once
gro build # same as `npm run build` when the `gro` CLI is available
gro test # make sure everything looks good - same as `npm test`
gro test some.test another.test
# use your development version of `gro` locally in another project:
gro build # updates the `gro` CLI, same as `npm run build`
cd ../otherproject
npm link ../gro # from `otherproject/`
gro build # from `../gro` on changescredits 🐢🐢🐢
Gro builds on TypeScript ∙ Svelte ∙ SvelteKit ∙ Vite ∙ esbuild ∙ uvu ∙ mri ∙ chokidar ∙ zod ∙ @grogarden/util ∙ ESLint ∙ Prettier ∙ svelte-check ∙ JSON Schema ∙ json-schema-to-typescript & more
license 🐦
2 years ago