Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Refer to the README.md for information about this repository.
## Build, Test & Development Commands
Use Node 22+. Run `npm install` at the repo root before touching the CLI. Template work happens inside `template/`: `npm install` for dependencies, `npm run dev` to launch Turbo-powered development, `npm run build` for a production check, `npm run typecheck` for repository-wide TypeScript validation, `npm run test` to execute Vitest suites, and `npm run format` to apply Prettier across Markdown and TypeScript files.

Refer to the @CONTRIBUTING.md file for running the generator locally.

## Coding Style & Naming Conventions
Prettier enforces two-space indentation, single quotes, and trailing commas (`npm run format`). Keep imports auto-organized by the Prettier organize-imports plugin. Use `camelCase` for variables and functions, `PascalCase` for React components and types, and kebab-case for file names (e.g. `generate-data.mjs`). ESLint rules from `template/config/eslint/` run in every workspace, so resolve warnings or document exceptions in-code.

Expand Down
12 changes: 10 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@

To verify the generator before publishing:

1. Run `npm pack` in this repository to produce a tarball (for example `create-tinker-stack-0.2.9.tgz`).
1. Run `npm pack` in this repository to produce a tarball (for example `create-tinker-stack-0.2.11.tgz`).
2. Run the generator from this repository, passing a target directory as a positional argument:

```bash
npx --yes create-tinker-stack@file://$(pwd)/create-tinker-stack-0.2.9.tgz my-project
npx --yes create-tinker-stack@file://$(pwd)/create-tinker-stack-0.2.11.tgz my-project
```

This scaffolds a clean starter into `./my-project` with the example bundles.

The generator prompts for the app title. To run fully non-interactive (for scripts and CI), pass the title as a flag:

```bash
npx --yes create-tinker-stack@file://$(pwd)/create-tinker-stack-0.2.11.tgz --title "My Project" my-project
```

Setting the `CI` environment variable also skips the prompt and falls back to the title `Demo Title`.

The example is placed in `my-project/examples/react-router/` and is independent of the root workspace.

### Notes
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ To generate only specific example templates:
npm create tinker-stack@latest -- --example react-router
```

To run fully non-interactive, pass the app title with `--title` (the only value that is otherwise prompted for):

```bash
npm create tinker-stack@latest -- --title "My App" my-app
```

By default, all available examples are copied into `examples/<name>/` inside the generated project.
They are self-contained and can be deleted without affecting the main workspace.

Expand Down
16 changes: 16 additions & 0 deletions create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function parseCliArgs(argv = process.argv.slice(2)) {
cwd: undefined,
debug: undefined,
install: undefined,
title: undefined,
examples: [],
noExamples: false,
withExample: false
Expand Down Expand Up @@ -54,6 +55,20 @@ function parseCliArgs(argv = process.argv.slice(2)) {
continue;
}

if (arg === '--title') {
const value = argv[i + 1];
if (value && !value.startsWith('-')) {
options.title = value;
i += 1;
}
continue;
}

if (arg.startsWith('--title=')) {
options.title = arg.slice('--title='.length);
continue;
}

if (arg === '--cwd') {
const value = argv[i + 1];
if (value && !value.startsWith('-')) {
Expand Down Expand Up @@ -153,6 +168,7 @@ function normalizeOptions(input = {}) {
return {
...opts,
targetDir: resolvedTargetDir,
title: opts.title ?? cli.title,
debug: Boolean(opts.debug ?? cli.debug),
install: opts.install ?? cli.install ?? true,
cwd: resolvedCwd,
Expand Down
Loading
Loading