-
Notifications
You must be signed in to change notification settings - Fork 0
Add workspace resolver support and update create-gen-app tests for new boilerplates #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
f5109d7
a163592
093284b
9be6fd0
a87c903
904986c
964a13c
e22132a
0f42eb3
5f482a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,8 @@ import * as path from "path"; | |
|
|
||
| import { cloneRepo, extractVariables, promptUser, replaceVariables } from "create-gen-app"; | ||
|
|
||
| const DEFAULT_REPO = "https://github.com/launchql/pgpm-boilerplates/"; | ||
| const DEFAULT_DIRECTORY = "."; | ||
| const DEFAULT_REPO = "https://github.com/constructive-io/pgpm-boilerplates/"; | ||
| const DEFAULT_DIRECTORY = "default"; | ||
|
||
| const OUTPUT_DIR = "./test-output"; | ||
|
|
||
| const argv = minimist(process.argv.slice(2), { | ||
|
|
@@ -116,4 +116,3 @@ async function main() { | |
|
|
||
| main(); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,16 +9,16 @@ import minimist, { ParsedArgs } from "minimist"; | |
| import { CacheManager, GitCloner, checkNpmVersion } from "create-gen-app"; | ||
| import { createFromTemplate } from './index'; | ||
|
|
||
| const DEFAULT_REPO = "https://github.com/launchql/pgpm-boilerplates.git"; | ||
| const DEFAULT_PATH = "."; | ||
| const DEFAULT_REPO = "https://github.com/constructive-io/pgpm-boilerplates.git"; | ||
| const DEFAULT_PATH = "default"; | ||
|
||
| const DEFAULT_OUTPUT_FALLBACK = "create-gen-app-output"; | ||
| const DEFAULT_TOOL_NAME = "create-gen-app-test"; | ||
| const DEFAULT_TTL = 604800000; // 1 week | ||
| const DEFAULT_TTL_DAYS = DEFAULT_TTL / (24 * 60 * 60 * 1000); | ||
|
|
||
| // Import package.json for version | ||
| import * as createGenPackageJson from "create-gen-app/package.json"; | ||
| const PACKAGE_NAME = createGenPackageJson.name ?? "@launchql/cli"; | ||
| const PACKAGE_NAME = createGenPackageJson.name ?? "@constructive/cli"; | ||
|
||
| const PACKAGE_VERSION = createGenPackageJson.version ?? "0.0.0"; | ||
|
|
||
| const RESERVED_ARG_KEYS = new Set([ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,16 @@ import * as path from "path"; | |
|
|
||
| export const TEST_REPO = | ||
| process.env.CREATE_GEN_TEST_REPO ?? | ||
| "https://github.com/launchql/pgpm-boilerplates.git"; | ||
| "https://github.com/constructive-io/pgpm-boilerplates.git"; | ||
| export const TEST_BRANCH = | ||
| process.env.CREATE_GEN_TEST_BRANCH ?? "license"; | ||
| process.env.CREATE_GEN_TEST_BRANCH ?? "main"; | ||
| export const TEST_TEMPLATE_DIR = | ||
| process.env.CREATE_GEN_TEST_BASE_PATH ?? "default"; | ||
|
||
| export const TEST_TEMPLATE = | ||
| process.env.CREATE_GEN_TEST_TEMPLATE ?? "module"; | ||
| export const TEST_TEMPLATE_PATH = | ||
| process.env.CREATE_GEN_TEST_TEMPLATE_PATH ?? | ||
| path.join(TEST_TEMPLATE_DIR, TEST_TEMPLATE); | ||
|
|
||
| export interface TempWorkspace { | ||
| baseDir: string; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -747,6 +747,19 @@ Inquirerer comes with several built-in resolvers ready to use: | |
| | `date.now` | ISO timestamp | `"2025-11-23T15:30:45.123Z"` | | ||
| | `date.timestamp` | Unix timestamp (ms) | `"1732375845123"` | | ||
|
|
||
| #### Workspace (nearest package.json) | ||
|
|
||
| | Resolver | Description | Example Output | | ||
| |----------|-------------|----------------| | ||
| | `workspace.name` | Repo slug from `repository` URL (fallback: `package.json` `name`) | `"dev-utils"` | | ||
| | `workspace.repo.name` | Repo name from `repository` URL | `"dev-utils"` | | ||
| | `workspace.repo.organization` | Repo org/owner from `repository` URL | `"constructive-io"` | | ||
| | `workspace.organization.name` | Alias for `workspace.repo.organization` | `"constructive-io"` | | ||
| | `workspace.license` | License field from `package.json` | `"MIT"` | | ||
| | `workspace.author` | Author name from `package.json` | `"Constructive"` | | ||
| | `workspace.author.name` | Author name from `package.json` | `"Constructive"` | | ||
| | `workspace.author.email` | Author email from `package.json` | `"[email protected]"` | | ||
|
||
|
|
||
| ### Priority Order | ||
|
|
||
| When resolving default values, inquirerer follows this priority: | ||
|
|
@@ -1047,4 +1060,4 @@ const handler: CommandHandler = async (argv, prompter) => { | |
|
|
||
| const cli = new CLI(handler, options); | ||
| await cli.run(); | ||
| ``` | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't default be
., and in our repo, we're setting it todefaultbecause we have the folder there?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We originally hardcoded default to stop CI failures after the boilerplate repo moved templates under default/ and the dev harness didn’t read .boilerplates.json. Now the CLI auto-detects the base dir from that file (fallback .), so CI stays green without the hardcoded path