diff --git a/README.md b/README.md index c273524..81511d7 100644 --- a/README.md +++ b/README.md @@ -3,426 +3,26 @@ [![CI](https://github.com/bertdeblock/gember/workflows/CI/badge.svg)](https://github.com/bertdeblock/gember/actions?query=workflow%3ACI) [![NPM Version](https://badge.fury.io/js/%40bertdeblock%2Fgember.svg)](https://badge.fury.io/js/%40bertdeblock%2Fgember) -Generate components, helpers, modifiers and services in v1/v2 apps/addons. - -ℹ️ Only supports `.gjs` (default) and `.gts` files for components. +Generators for Ember apps and addons. ## Installation -
- npm - -```shell -npm install -D @bertdeblock/gember -``` - -
- -
- deno - -```shell -deno add -D @bertdeblock/gember -``` - -
- -
- bun - -```shell -bun add -D @bertdeblock/gember -``` - -
- -
- pnpm - ```shell pnpm add -D @bertdeblock/gember ``` -
- -
- yarn - -```shell -yarn add -D @bertdeblock/gember -``` - -
- ## Usage -### gember +List all generators: ```shell -Generate components, helpers, modifiers and services in v1/v2 apps/addons. (gember v1.4.0) - -USAGE `gember acceptance-test|component|component-test|controller|controller-test|helper|helper-test|modifier|modifier-test|route|route-test|service|service-test|util|util-test` - -COMMANDS - - `acceptance-test` Generate a new acceptance-test - `component` Generate a new component - `component-test` Generate a new component-test - `controller` Generate a new controller - `controller-test` Generate a new controller-test - `helper` Generate a new helper - `helper-test` Generate a new helper-test - `modifier` Generate a new modifier - `modifier-test` Generate a new modifier-test - `route` Generate a new route - `route-test` Generate a new route-test - `service` Generate a new service - `service-test` Generate a new service-test - `util` Generate a new util - `util-test` Generate a new util-test - -Use `gember --help` for more information about a command. +pnpm gember --help ``` -### acceptance-test +List all options for a specific generator: ```shell -Generate a new acceptance-test (acceptance-test) - -USAGE `acceptance-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The acceptance-test's name - -OPTIONS - - `--copy` Copy the generated acceptance-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the acceptance-test generator in - `-d, --destroy` Destroy a acceptance-test by name - `--log` Log the generated acceptance-test to the console, instead of writing it to disk - `--path` Generate a acceptance-test at a custom path, e.g. `--path=src/-private` - `-ts, --typescript` Generate a `.ts` acceptance-test, instead of a `.js` acceptance-test - -``` - -### component - -```shell -Generate a new component (component) - -USAGE `component [OPTIONS] ` - -ARGUMENTS - - `NAME` The component's name - -OPTIONS - - `-class, -class-based, --classBased` Generate a `class-based` component, instead of a `template-only` component - `--copy` Copy the generated component to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the component generator in - `-d, --destroy` Destroy a component by name - `--log` Log the generated component to the console, instead of writing it to disk - `--nested` Generate a nested colocated component, e.g. `foo/bar/index.gts` - `--path` Generate a component at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding component-test - `-gts, -ts, --typescript` Generate a `.gts` component, instead of a `.gjs` component - -``` - -### component-test - -```shell -Generate a new component-test (component-test) - -USAGE `component-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The component-test's name - -OPTIONS - - `--copy` Copy the generated component-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the component-test generator in - `-d, --destroy` Destroy a component-test by name - `--log` Log the generated component-test to the console, instead of writing it to disk - `--path` Generate a component-test at a custom path, e.g. `--path=src/-private` - `-gts, -ts, --typescript` Generate a `.gts` component-test, instead of a `.gjs` component-test - -``` - -### controller - -```shell -Generate a new controller (controller) - -USAGE `controller [OPTIONS] ` - -ARGUMENTS - - `NAME` The controller's name - -OPTIONS - - `--copy` Copy the generated controller to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the controller generator in - `-d, --destroy` Destroy a controller by name - `--log` Log the generated controller to the console, instead of writing it to disk - `--path` Generate a controller at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding controller-test - `-ts, --typescript` Generate a `.ts` controller, instead of a `.js` controller - -``` - -### controller-test - -```shell -Generate a new controller-test (controller-test) - -USAGE `controller-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The controller-test's name - -OPTIONS - - `--copy` Copy the generated controller-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the controller-test generator in - `-d, --destroy` Destroy a controller-test by name - `--log` Log the generated controller-test to the console, instead of writing it to disk - `--path` Generate a controller-test at a custom path, e.g. `--path=src/-private` - `-ts, --typescript` Generate a `.ts` controller-test, instead of a `.js` controller-test - -``` - -### helper - -```shell -Generate a new helper (helper) - -USAGE `helper [OPTIONS] ` - -ARGUMENTS - - `NAME` The helper's name - -OPTIONS - - `-class, -class-based, --classBased` Generate a `class-based` helper, instead of a `function-based` helper - `--copy` Copy the generated helper to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the helper generator in - `-d, --destroy` Destroy a helper by name - `--log` Log the generated helper to the console, instead of writing it to disk - `--path` Generate a helper at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding helper-test - `-ts, --typescript` Generate a `.ts` helper, instead of a `.js` helper - -``` - -### helper-test - -```shell -Generate a new helper-test (helper-test) - -USAGE `helper-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The helper-test's name - -OPTIONS - - `--copy` Copy the generated helper-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the helper-test generator in - `-d, --destroy` Destroy a helper-test by name - `--log` Log the generated helper-test to the console, instead of writing it to disk - `--path` Generate a helper-test at a custom path, e.g. `--path=src/-private` - `-gts, -ts, --typescript` Generate a `.gts` helper-test, instead of a `.gjs` helper-test - -``` - -### modifier - -```shell -Generate a new modifier (modifier) - -USAGE `modifier [OPTIONS] ` - -ARGUMENTS - - `NAME` The modifier's name - -OPTIONS - - `-class, -class-based, --classBased` Generate a `class-based` modifier, instead of a `function-based` modifier - `--copy` Copy the generated modifier to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the modifier generator in - `-d, --destroy` Destroy a modifier by name - `--log` Log the generated modifier to the console, instead of writing it to disk - `--path` Generate a modifier at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding modifier-test - `-ts, --typescript` Generate a `.ts` modifier, instead of a `.js` modifier - -``` - -### modifier-test - -```shell -Generate a new modifier-test (modifier-test) - -USAGE `modifier-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The modifier-test's name - -OPTIONS - - `--copy` Copy the generated modifier-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the modifier-test generator in - `-d, --destroy` Destroy a modifier-test by name - `--log` Log the generated modifier-test to the console, instead of writing it to disk - `--path` Generate a modifier-test at a custom path, e.g. `--path=src/-private` - `-gts, -ts, --typescript` Generate a `.gts` modifier-test, instead of a `.gjs` modifier-test - -``` - -### route - -```shell -Generate a new route (route) - -USAGE `route [OPTIONS] ` - -ARGUMENTS - - `NAME` The route's name - -OPTIONS - - `--copy` Copy the generated route to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the route generator in - `-d, --destroy` Destroy a route by name - `--log` Log the generated route to the console, instead of writing it to disk - `--path` Generate a route at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding route-test - `-ts, --typescript` Generate a `.ts` route, instead of a `.js` route - -``` - -### route-test - -```shell -Generate a new route-test (route-test) - -USAGE `route-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The route-test's name - -OPTIONS - - `--copy` Copy the generated route-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the route-test generator in - `-d, --destroy` Destroy a route-test by name - `--log` Log the generated route-test to the console, instead of writing it to disk - `--path` Generate a route-test at a custom path, e.g. `--path=src/-private` - `-ts, --typescript` Generate a `.ts` route-test, instead of a `.js` route-test - -``` - -### service - -```shell -Generate a new service (service) - -USAGE `service [OPTIONS] ` - -ARGUMENTS - - `NAME` The service's name - -OPTIONS - - `--copy` Copy the generated service to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the service generator in - `-d, --destroy` Destroy a service by name - `--log` Log the generated service to the console, instead of writing it to disk - `--path` Generate a service at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding service-test - `-ts, --typescript` Generate a `.ts` service, instead of a `.js` service - -``` - -### service-test - -```shell -Generate a new service-test (service-test) - -USAGE `service-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The service-test's name - -OPTIONS - - `--copy` Copy the generated service-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the service-test generator in - `-d, --destroy` Destroy a service-test by name - `--log` Log the generated service-test to the console, instead of writing it to disk - `--path` Generate a service-test at a custom path, e.g. `--path=src/-private` - `-ts, --typescript` Generate a `.ts` service-test, instead of a `.js` service-test - -``` - -### util - -```shell -Generate a new util (util) - -USAGE `util [OPTIONS] ` - -ARGUMENTS - - `NAME` The util's name - -OPTIONS - - `--copy` Copy the generated util to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the util generator in - `-d, --destroy` Destroy a util by name - `--log` Log the generated util to the console, instead of writing it to disk - `--path` Generate a util at a custom path, e.g. `--path=src/-private` - `--test` Generate a corresponding util-test - `-ts, --typescript` Generate a `.ts` util, instead of a `.js` util - -``` - -### util-test - -```shell -Generate a new util-test (util-test) - -USAGE `util-test [OPTIONS] ` - -ARGUMENTS - - `NAME` The util-test's name - -OPTIONS - - `--copy` Copy the generated util-test to the clipboard, instead of writing it to disk - `--cwd` The current working directory to run the util-test generator in - `-d, --destroy` Destroy a util-test by name - `--log` Log the generated util-test to the console, instead of writing it to disk - `--path` Generate a util-test at a custom path, e.g. `--path=src/-private` - `-ts, --typescript` Generate a `.ts` util-test, instead of a `.js` util-test - +pnpm gember component --help ``` ## Configuration @@ -450,7 +50,8 @@ export default defineConfig(() => ({})); export default defineConfig(async () => ({})); ``` -### Configuration Signature +
+ Configuration Signature ```ts export type Config = { @@ -702,3 +303,5 @@ export type Config = { typescript?: boolean; }; ``` + +
diff --git a/dev/generate-usage.js b/dev/generate-usage.js deleted file mode 100644 index 789cc1f..0000000 --- a/dev/generate-usage.js +++ /dev/null @@ -1,19 +0,0 @@ -import { renderUsage } from "citty"; -// eslint-disable-next-line n/no-missing-import -import { main } from "../dist/cli.js"; - -await generateUsage(main); - -async function generateUsage(commandDef) { - console.log(`### ${commandDef.meta.name}`); - console.log(` -\`\`\`shell -${await renderUsage(commandDef)} -\`\`\``); - - if (commandDef.subCommands) { - for (const subCommand in commandDef.subCommands) { - await generateUsage(commandDef.subCommands[subCommand], commandDef); - } - } -} diff --git a/package.json b/package.json index 1f4089c..00b3573 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bertdeblock/gember", "version": "1.6.0", - "description": "Generate components, helpers, modifiers and services in v1/v2 apps/addons.", + "description": "Generators for Ember apps and addons.", "repository": "https://github.com/bertdeblock/gember", "license": "MIT", "author": "Bert De Block", @@ -26,8 +26,8 @@ "dev": "pnpm build --watch", "format": "prettier . --cache --write", "gember": "GEMBER_CWD=test/output bin/gember.js", - "lint": "concurrently --group --prefix-colors auto \"npm:lint:*(!fix)\"", - "lint:fix": "concurrently --group --prefix-colors auto \"npm:lint:*:fix\"", + "lint": "concurrently --group --prefix-colors auto \"pnpm:lint:*(!fix)\"", + "lint:fix": "concurrently --group --prefix-colors auto \"pnpm:lint:*:fix\"", "lint:format": "prettier . --cache --check", "lint:js": "eslint . --cache", "lint:types": "tsc --noEmit",