From b39c01fda101c6242bfab87f3c34dddbce4f58d7 Mon Sep 17 00:00:00 2001 From: Eason Date: Fri, 28 Nov 2025 16:31:45 +0800 Subject: [PATCH 1/5] refactor: update answer keys in integration helpers for consistency - Changed answer keys from uppercase to camelCase in integration-helpers.ts for better readability and consistency. - Updated corresponding test assertions in cli.test.ts to reflect the new key names. --- .../src/__tests__/cli.test.ts | 6 +++--- .../src/test-utils/integration-helpers.ts | 19 +++++++++---------- .../test-utils/integration-helpers.ts | 19 +++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/packages/create-gen-app-test/src/__tests__/cli.test.ts b/packages/create-gen-app-test/src/__tests__/cli.test.ts index 0464e0c..44ef1cf 100644 --- a/packages/create-gen-app-test/src/__tests__/cli.test.ts +++ b/packages/create-gen-app-test/src/__tests__/cli.test.ts @@ -50,15 +50,15 @@ describe("CLI integration via create-gen-app-test harness", () => { expect(fs.existsSync(pkgPath)).toBe(true); const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8")); - expect(pkg.name).toBe(answers.PACKAGE_IDENTIFIER); - expect(pkg.license).toBe(answers.LICENSE); + expect(pkg.name).toBe(answers.packageIdentifier); + expect(pkg.license).toBe(answers.license); const licenseContent = fs.readFileSync( path.join(workspace.outputDir, "LICENSE"), "utf8" ); expect(licenseContent).toContain("MIT License"); - expect(licenseContent).toContain(answers.USERFULLNAME); + expect(licenseContent).toContain(answers.fullName); } finally { cleanupWorkspace(workspace); } diff --git a/packages/create-gen-app-test/src/test-utils/integration-helpers.ts b/packages/create-gen-app-test/src/test-utils/integration-helpers.ts index 596f1e4..a9bb77f 100644 --- a/packages/create-gen-app-test/src/test-utils/integration-helpers.ts +++ b/packages/create-gen-app-test/src/test-utils/integration-helpers.ts @@ -31,17 +31,16 @@ export function buildAnswers( ): Record { const safeSuffix = suffix.replace(/[^a-z0-9]/gi, "-").toLowerCase(); return { - USERFULLNAME: `Test User ${suffix}`, - USEREMAIL: `tester-${safeSuffix}@example.com`, - MODULENAME: `Test Module ${suffix}`, - MODULEDESC: `Integration test module ${suffix}`, - REPONAME: `integration-${safeSuffix}`, - USERNAME: `tester-${safeSuffix}`, - ACCESS: "public", - LICENSE: "MIT", - PACKAGE_IDENTIFIER: `integration-${safeSuffix}`, + fullName: `Test User ${suffix}`, + email: `tester-${safeSuffix}@example.com`, + moduleName: `integration-${safeSuffix}`, + moduleDesc: `Integration test module ${suffix}`, + repoName: `integration-${safeSuffix}`, + username: `tester-${safeSuffix}`, + access: "public", + license: "MIT", + packageIdentifier: `integration-${safeSuffix}`, ...overrides, }; } - diff --git a/packages/create-gen-app/test-utils/integration-helpers.ts b/packages/create-gen-app/test-utils/integration-helpers.ts index 86cd85e..c8642c3 100644 --- a/packages/create-gen-app/test-utils/integration-helpers.ts +++ b/packages/create-gen-app/test-utils/integration-helpers.ts @@ -31,16 +31,15 @@ export function buildAnswers( ): Record { const safeSuffix = suffix.replace(/[^a-z0-9]/gi, "-").toLowerCase(); return { - USERFULLNAME: `Test User ${suffix}`, - USEREMAIL: `tester-${safeSuffix}@example.com`, - MODULENAME: `Test Module ${suffix}`, - MODULEDESC: `Integration test module ${suffix}`, - REPONAME: `integration-${safeSuffix}`, - USERNAME: `tester-${safeSuffix}`, - ACCESS: "public", - LICENSE: "MIT", - PACKAGE_IDENTIFIER: `integration-${safeSuffix}`, + fullName: `Test User ${suffix}`, + email: `tester-${safeSuffix}@example.com`, + moduleName: `integration-${safeSuffix}`, + moduleDesc: `Integration test module ${suffix}`, + repoName: `integration-${safeSuffix}`, + username: `tester-${safeSuffix}`, + access: "public", + license: "MIT", + packageIdentifier: `integration-${safeSuffix}`, ...overrides, }; } - From c663db329579c894476493a94ad7afc87a7aa048 Mon Sep 17 00:00:00 2001 From: Eason Date: Fri, 28 Nov 2025 16:39:31 +0800 Subject: [PATCH 2/5] refactor: remove ignored patterns handling from extract logic - Eliminated the handling of ignored path patterns and content tokens from the extractVariables function. - Updated the Questions interface to remove the optional ignore property. - Removed related test cases that checked for ignored patterns in the extraction process. --- .../__tests__/create-gen.test.ts | 35 ----- .../create-gen-app/src/template/extract.ts | 134 ++---------------- packages/create-gen-app/src/types.ts | 1 - 3 files changed, 14 insertions(+), 156 deletions(-) diff --git a/packages/create-gen-app/__tests__/create-gen.test.ts b/packages/create-gen-app/__tests__/create-gen.test.ts index fda728b..1a80510 100644 --- a/packages/create-gen-app/__tests__/create-gen.test.ts +++ b/packages/create-gen-app/__tests__/create-gen.test.ts @@ -564,39 +564,4 @@ module.exports = { }); }); - it("should respect ignore patterns from questions", async () => { - const ignoredDir = path.join(testTempDir, "__tests__"); - fs.mkdirSync(ignoredDir); - fs.writeFileSync( - path.join(ignoredDir, "example.txt"), - "This file has ____ignored____ variable" - ); - fs.writeFileSync( - path.join(testTempDir, ".questions.json"), - JSON.stringify({ - ignore: ["__tests__"], - questions: [], - }) - ); - - const result = await extractVariables(testTempDir); - - expect(result.fileReplacers.map((r) => r.variable)).not.toContain("tests"); - expect(result.contentReplacers.map((r) => r.variable)).not.toContain( - "IGNORED" - ); - }); - - it("should skip default ignored content tokens", async () => { - fs.writeFileSync( - path.join(testTempDir, "jest.config.js"), - "// Match both __tests__ and colocated test files" - ); - - const result = await extractVariables(testTempDir); - - expect(result.contentReplacers.map((r) => r.variable)).not.toContain( - "tests" - ); - }); }); diff --git a/packages/create-gen-app/src/template/extract.ts b/packages/create-gen-app/src/template/extract.ts index 512248a..52c92cb 100644 --- a/packages/create-gen-app/src/template/extract.ts +++ b/packages/create-gen-app/src/template/extract.ts @@ -30,24 +30,18 @@ export async function extractVariables( const contentReplacers: ContentReplacer[] = []; const fileReplacerVars = new Set(); const contentReplacerVars = new Set(); - + const projectQuestions = await loadProjectQuestions(templateDir); - const ignoredPathPatterns = new Set(projectQuestions?.ignore ?? []); - const ignoredContentTokens = buildIgnoredContentTokens(projectQuestions); - await walkDirectory(templateDir, async (filePath) => { const relativePath = path.relative(templateDir, filePath); - if (shouldIgnore(relativePath, ignoredPathPatterns)) { - return; - } - + if ( relativePath === ".questions.json" || relativePath === ".questions.js" ) { return; } - + const matches = relativePath.matchAll(VARIABLE_PATTERN); for (const match of matches) { const varName = match[1]; @@ -62,11 +56,8 @@ export async function extractVariables( }); } } - - const contentVars = await extractFromFileContent( - filePath, - ignoredContentTokens - ); + + const contentVars = await extractFromFileContent(filePath); for (const varName of contentVars) { if (!contentReplacerVars.has(varName)) { contentReplacerVars.add(varName); @@ -94,41 +85,36 @@ export async function extractVariables( * @returns Set of variable names found in the file */ async function extractFromFileContent( - filePath: string, - ignoredTokens: Set + filePath: string ): Promise> { const variables = new Set(); - + return new Promise((resolve) => { const stream = fs.createReadStream(filePath, { encoding: "utf8" }); let buffer = ""; - + stream.on("data", (chunk: string | Buffer) => { buffer += chunk.toString(); - + const lines = buffer.split("\n"); buffer = lines.pop() || ""; // Keep the last incomplete line in buffer - + for (const line of lines) { const matches = line.matchAll(VARIABLE_PATTERN); for (const match of matches) { - if (!shouldIgnoreContent(match[0], ignoredTokens)) { variables.add(match[1]); - } } } }); - + stream.on("end", () => { const matches = buffer.matchAll(VARIABLE_PATTERN); for (const match of matches) { - if (!shouldIgnoreContent(match[0], ignoredTokens)) { variables.add(match[1]); - } } resolve(variables); }); - + stream.on("error", () => { resolve(variables); }); @@ -145,10 +131,10 @@ async function walkDirectory( callback: (filePath: string) => Promise ): Promise { const entries = fs.readdirSync(dir, { withFileTypes: true }); - + for (const entry of entries) { const fullPath = path.join(dir, entry.name); - + if (entry.isDirectory()) { await walkDirectory(fullPath, callback); } else if (entry.isFile()) { @@ -194,98 +180,6 @@ async function loadProjectQuestions( return null; } -function shouldIgnore( - relativePath: string, - ignoredPatterns: Set -): boolean { - if (ignoredPatterns.size === 0) { - return false; - } - const normalized = relativePath.split(path.sep).join("/"); - const segments = normalized.split("/"); - - for (const pattern of ignoredPatterns) { - const normalizedPattern = pattern.split(path.sep).join("/"); - - if (normalizedPattern === normalized) { - return true; - } - - if (!normalizedPattern.includes("/")) { - if (segments.includes(normalizedPattern)) { - return true; - } - continue; - } - - if (normalizedPattern.startsWith("**/")) { - const suffix = normalizedPattern.slice(3); - if (normalized.endsWith(suffix)) { - return true; - } - continue; - } - - if (normalizedPattern.endsWith("/**")) { - const prefix = normalizedPattern.slice(0, -3); - if (normalized === prefix || normalized.startsWith(`${prefix}/`)) { - return true; - } - continue; - } - - if (normalized.startsWith(`${normalizedPattern}/`)) { - return true; - } - } - return false; -} - -const DEFAULT_IGNORED_CONTENT_TOKENS = ["tests", "snapshots"]; - -function shouldIgnoreContent( - match: string, - ignoredTokens: Set -): boolean { - if (ignoredTokens.size === 0) { - return false; - } - const token = match.slice( - PLACEHOLDER_BOUNDARY.length, - -PLACEHOLDER_BOUNDARY.length - ); - return ignoredTokens.has(token); -} - -function buildIgnoredContentTokens(projectQuestions: Questions | null): Set { - const tokens = new Set(DEFAULT_IGNORED_CONTENT_TOKENS); - if (projectQuestions?.ignore) { - for (const entry of projectQuestions.ignore) { - const normalized = normalizePlaceholder(entry); - if (normalized) { - tokens.add(normalized); - } - } - } - return tokens; -} - -function normalizePlaceholder(entry: string): string | null { - if ( - entry.startsWith(PLACEHOLDER_BOUNDARY) && - entry.endsWith(PLACEHOLDER_BOUNDARY) - ) { - return entry.slice( - PLACEHOLDER_BOUNDARY.length, - -PLACEHOLDER_BOUNDARY.length - ); - } - if (entry.startsWith("__") && entry.endsWith("__")) { - return entry.slice(2, -2); - } - return entry || null; -} - /** * Normalize questions by ensuring all required fields have default values * @param questions - Questions object to normalize diff --git a/packages/create-gen-app/src/types.ts b/packages/create-gen-app/src/types.ts index b81e155..845b955 100644 --- a/packages/create-gen-app/src/types.ts +++ b/packages/create-gen-app/src/types.ts @@ -7,7 +7,6 @@ import { Question } from 'inquirerer'; */ export interface Questions { questions: Question[]; - ignore?: string[]; } /** From 72d78b4ba3cc5c13560058ae0610ea53194de721 Mon Sep 17 00:00:00 2001 From: Eason Date: Fri, 28 Nov 2025 16:55:51 +0800 Subject: [PATCH 3/5] feat: enhance license handling with new utility functions - Added utility functions to find license values, authors, and emails from user answers. - Refactored license file generation to utilize the new functions for improved readability and maintainability. - Removed the deprecated getAnswer function to streamline the codebase. --- packages/create-gen-app/src/licenses.ts | 42 +++++++++++++++++++ .../create-gen-app/src/template/replace.ts | 36 +++++----------- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/packages/create-gen-app/src/licenses.ts b/packages/create-gen-app/src/licenses.ts index 5cf736d..0bd508d 100644 --- a/packages/create-gen-app/src/licenses.ts +++ b/packages/create-gen-app/src/licenses.ts @@ -14,6 +14,18 @@ type LicenseTemplateMap = Record; let cachedTemplates: LicenseTemplateMap | null = null; export type SupportedLicense = string; +export const LICENSE_VALUE_KEYS = ["LICENSE", "license"]; +export const LICENSE_AUTHOR_KEYS = [ + "USERFULLNAME", + "AUTHOR", + "AUTHORFULLNAME", + "USERNAME", + "fullName", + "author", + "authorFullName", + "userName", +]; +export const LICENSE_EMAIL_KEYS = ["USEREMAIL", "EMAIL", "email", "userEmail"]; export function isSupportedLicense(name: string): name is SupportedLicense { if (!name) { @@ -58,6 +70,24 @@ export function listSupportedLicenses(): string[] { return Object.keys(loadLicenseTemplates()); } +export function findLicenseValue( + answers: Record +): string | undefined { + return getAnswerValue(answers, LICENSE_VALUE_KEYS); +} + +export function findLicenseAuthor( + answers: Record +): string | undefined { + return getAnswerValue(answers, LICENSE_AUTHOR_KEYS); +} + +export function findLicenseEmail( + answers: Record +): string | undefined { + return getAnswerValue(answers, LICENSE_EMAIL_KEYS); +} + function loadLicenseTemplates(): LicenseTemplateMap { if (cachedTemplates) { return cachedTemplates; @@ -106,3 +136,15 @@ function findTemplatesDir(): string | null { return null; } +function getAnswerValue( + answers: Record, + keys: string[] +): string | undefined { + for (const key of keys) { + const value = answers?.[key]; + if (typeof value === "string" && value.trim() !== "") { + return value; + } + } + return undefined; +} diff --git a/packages/create-gen-app/src/template/replace.ts b/packages/create-gen-app/src/template/replace.ts index f00f2c6..169d172 100644 --- a/packages/create-gen-app/src/template/replace.ts +++ b/packages/create-gen-app/src/template/replace.ts @@ -4,7 +4,13 @@ import { Transform } from 'stream'; import { pipeline } from 'stream/promises'; import { ExtractedVariables } from '../types'; -import { renderLicense, isSupportedLicense } from '../licenses'; +import { + renderLicense, + isSupportedLicense, + findLicenseAuthor, + findLicenseEmail, + findLicenseValue, +} from '../licenses'; /** * Replace variables in all files in the template directory @@ -85,7 +91,7 @@ async function ensureLicenseFile( outputDir: string, answers: Record ): Promise { - const licenseValue = getAnswer(answers, ["LICENSE", "license"]); + const licenseValue = findLicenseValue(answers); if (typeof licenseValue !== 'string' || licenseValue.trim() === '') { return; } @@ -99,19 +105,10 @@ async function ensureLicenseFile( } const author = - getAnswer(answers, [ - "USERFULLNAME", - "AUTHOR", - "AUTHORFULLNAME", - "USERNAME", - "fullName", - "author", - "authorFullName", - "userName", - ]) ?? "Unknown Author"; + findLicenseAuthor(answers) ?? "Unknown Author"; const email = - getAnswer(answers, ["USEREMAIL", "EMAIL", "email", "userEmail"]) ?? ""; + findLicenseEmail(answers) ?? ""; const content = renderLicense(selectedLicense, { author: String(author), @@ -130,19 +127,6 @@ async function ensureLicenseFile( ); } -function getAnswer( - answers: Record, - keys: string[] -): string | undefined { - for (const key of keys) { - const value = answers?.[key]; - if (typeof value === "string" && value.trim() !== "") { - return value; - } - } - return undefined; -} - /** * Replace variables in a file using streams * @param sourcePath - Source file path From b624e45b8c30be20edbe55ce3b6b2bdc0a56e289 Mon Sep 17 00:00:00 2001 From: Eason Date: Fri, 28 Nov 2025 18:20:46 +0800 Subject: [PATCH 4/5] refactor: improve CLI override handling in project prompts - Updated test cases to require exact CLI override names and prevent mapping of similar substring overrides. - Refactored promptUser function to streamline answer merging and removed unnecessary functions related to identifier matching. - Enhanced clarity in variable mapping by ensuring undefined values are handled correctly. --- .../__tests__/create-gen.test.ts | 10 +- .../create-gen-app/src/template/prompt.ts | 119 +----------------- 2 files changed, 10 insertions(+), 119 deletions(-) diff --git a/packages/create-gen-app/__tests__/create-gen.test.ts b/packages/create-gen-app/__tests__/create-gen.test.ts index 1a80510..5e8bfa7 100644 --- a/packages/create-gen-app/__tests__/create-gen.test.ts +++ b/packages/create-gen-app/__tests__/create-gen.test.ts @@ -284,7 +284,7 @@ module.exports = { ); }); - it("should map CLI overrides with similar names to project questions", async () => { + it("should require exact CLI override names", async () => { const { Inquirerer } = require("inquirerer"); const mockPrompt = jest.fn().mockResolvedValue({}); @@ -312,10 +312,11 @@ module.exports = { await promptUser(extractedVariables, argv, false); const passedArgv = mockPrompt.mock.calls[0][0]; - expect(passedArgv.fullName).toBe("CLI User"); + expect(passedArgv.fullName).toBeUndefined(); + expect(passedArgv.USERFULLNAME).toBe("CLI User"); }); - it("should match CLI overrides sharing substrings", async () => { + it("should not map CLI overrides sharing substrings", async () => { const { Inquirerer } = require("inquirerer"); const mockPrompt = jest.fn().mockResolvedValue({}); @@ -343,7 +344,8 @@ module.exports = { await promptUser(extractedVariables, argv, false); const passedArgv = mockPrompt.mock.calls[0][0]; - expect(passedArgv.description).toBe("CLI description"); + expect(passedArgv.description).toBeUndefined(); + expect(passedArgv.MODULEDESC).toBe("CLI description"); }); it("should hydrate template variables from alias answers", async () => { diff --git a/packages/create-gen-app/src/template/prompt.ts b/packages/create-gen-app/src/template/prompt.ts index a9ee9f0..aceaf18 100644 --- a/packages/create-gen-app/src/template/prompt.ts +++ b/packages/create-gen-app/src/template/prompt.ts @@ -93,11 +93,10 @@ export async function promptUser( try { const promptAnswers = await prompter.prompt(preparedArgv, questions); - const mergedAnswers = { + return { ...argv, ...promptAnswers, }; - return expandAnswersForVariables(mergedAnswers, extractedVariables); } finally { if (typeof (prompter as any).close === "function") { (prompter as any).close(); @@ -122,121 +121,11 @@ function mapArgvToQuestions( continue; } - const matchValue = findMatchingArgValue(name, argvEntries); - if (matchValue !== null) { - prepared[name] = matchValue; - } - } - - return prepared; -} - -function findMatchingArgValue( - targetName: string, - argvEntries: [string, any][] -): any | null { - const normalizedTarget = normalizeIdentifier(targetName); - - for (const [key, value] of argvEntries) { - if (value === undefined || value === null) { - continue; - } - - if (key === targetName) { - return value; - } - - const normalizedKey = normalizeIdentifier(key); - if (identifiersMatch(normalizedTarget, normalizedKey)) { - return value; - } - } - - return null; -} - -function normalizeIdentifier(value: string): string { - return value.replace(/[^a-z0-9]/gi, "").toLowerCase(); -} - -function identifiersMatch(a: string, b: string): boolean { - if (a === b) { - return true; - } - if (a.includes(b) || b.includes(a)) { - return true; - } - return hasSignificantOverlap(a, b); -} - -function hasSignificantOverlap(a: string, b: string): boolean { - const minLength = 4; - if (a.length < minLength || b.length < minLength) { - return false; - } - - const shorter = a.length <= b.length ? a : b; - const longer = shorter === a ? b : a; - - for (let i = 0; i <= shorter.length - minLength; i++) { - const slice = shorter.slice(i, i + minLength); - if (longer.includes(slice)) { - return true; - } - } - - return false; -} - -function expandAnswersForVariables( - answers: Record, - extractedVariables: ExtractedVariables -): Record { - const expanded = { ...answers }; - const variables = collectVariableNames(extractedVariables); - const answerEntries = Object.entries(expanded).map(([key, value]) => ({ - key, - value, - normalized: normalizeIdentifier(key), - })); - - for (const variable of variables) { - if (expanded[variable] !== undefined) { - continue; - } - - const normalizedVar = normalizeIdentifier(variable); - const match = answerEntries.find(({ normalized }) => - identifiersMatch(normalizedVar, normalized) - ); - + const match = argvEntries.find(([key]) => key === name); if (match) { - expanded[variable] = match.value; - answerEntries.push({ - key: variable, - value: match.value, - normalized: normalizedVar, - }); + prepared[name] = match[1]; } } - return expanded; -} - -function collectVariableNames( - extractedVariables: ExtractedVariables -): Set { - const names = new Set(); - for (const replacer of extractedVariables.fileReplacers) { - names.add(replacer.variable); - } - for (const replacer of extractedVariables.contentReplacers) { - names.add(replacer.variable); - } - if (extractedVariables.projectQuestions) { - for (const question of extractedVariables.projectQuestions.questions) { - names.add(normalizeQuestionName(question.name)); - } - } - return names; + return prepared; } From 1769f3092bfb583a554a0145c423c5d071d09709 Mon Sep 17 00:00:00 2001 From: Eason Date: Mon, 1 Dec 2025 10:38:02 +0800 Subject: [PATCH 5/5] test: refine template variable hydration and update integration test descriptions - Updated test case to clarify that overlapping template variables should not be hydrated implicitly. - Adjusted assertions to ensure that the expected behavior aligns with the new logic. - Enhanced integration helper functions to include a description field for better test clarity. - Updated snapshot tests to reflect changes in package.json descriptions and repository URLs for consistency. --- .../cached-template.test.ts.snap | 36 ++++++++----------- packages/create-gen-app-test/src/cli.ts | 4 ++- .../src/test-utils/integration-helpers.ts | 2 +- .../__tests__/create-gen.test.ts | 4 +-- .../test-utils/integration-helpers.ts | 1 + 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/packages/create-gen-app-test/src/__tests__/__snapshots__/cached-template.test.ts.snap b/packages/create-gen-app-test/src/__tests__/__snapshots__/cached-template.test.ts.snap index bd4cf99..03abe40 100644 --- a/packages/create-gen-app-test/src/__tests__/__snapshots__/cached-template.test.ts.snap +++ b/packages/create-gen-app-test/src/__tests__/__snapshots__/cached-template.test.ts.snap @@ -16,33 +16,29 @@ exports[`cached template integration tests first clone with variable replacement "package.json": { "author": "Test User test ", "bugs": { - "url": "https://github.com/Test User test/Test User test/issues", + "url": "https://github.com/tester-test/integration-test/issues", }, - "description": "Test Module test", + "description": "Integration test module test", "devDependencies": { - "pgsql-test": "^2.13.2", + "makage": "0.1.8", + "pgsql-test": "^2.14.12", }, - "homepage": "https://github.com/Test User test/Test User test", + "homepage": "https://github.com/tester-test/integration-test", "keywords": [], "license": "MIT", "name": "integration-test", - "pnpm": { - "overrides": { - "graphql": "14.7.0", - }, - }, "publishConfig": { "access": "public", "directory": "dist", }, "repository": { "type": "git", - "url": "https://github.com/Test User test/Test User test", + "url": "https://github.com/tester-test/integration-test", }, "scripts": { "lint": "eslint . --fix", "test": "jest", - "test:watch": "jest --watch", + "test:watch": "makage test --watch deploy --ext sql", }, "version": "0.0.1", }, @@ -65,33 +61,29 @@ exports[`cached template integration tests second clone from cache should snapsh "package.json": { "author": "Test User cached ", "bugs": { - "url": "https://github.com/Test User cached/Test User cached/issues", + "url": "https://github.com/tester-cached/integration-cached/issues", }, - "description": "Test Module cached", + "description": "Integration test module cached", "devDependencies": { - "pgsql-test": "^2.13.2", + "makage": "0.1.8", + "pgsql-test": "^2.14.12", }, - "homepage": "https://github.com/Test User cached/Test User cached", + "homepage": "https://github.com/tester-cached/integration-cached", "keywords": [], "license": "MIT", "name": "integration-cached", - "pnpm": { - "overrides": { - "graphql": "14.7.0", - }, - }, "publishConfig": { "access": "public", "directory": "dist", }, "repository": { "type": "git", - "url": "https://github.com/Test User cached/Test User cached", + "url": "https://github.com/tester-cached/integration-cached", }, "scripts": { "lint": "eslint . --fix", "test": "jest", - "test:watch": "jest --watch", + "test:watch": "makage test --watch deploy --ext sql", }, "version": "0.0.1", }, diff --git a/packages/create-gen-app-test/src/cli.ts b/packages/create-gen-app-test/src/cli.ts index b5b36ec..131279d 100644 --- a/packages/create-gen-app-test/src/cli.ts +++ b/packages/create-gen-app-test/src/cli.ts @@ -208,7 +208,9 @@ export async function runCli( const answerOverrides = extractAnswerOverrides(args); const noTty = Boolean( - args["no-tty"] ?? (args as Record).noTty + args["no-tty"] ?? + (args as Record).noTty ?? + (args as Record).tty === false ); // Use the createFromTemplate function which will use the same cache diff --git a/packages/create-gen-app-test/src/test-utils/integration-helpers.ts b/packages/create-gen-app-test/src/test-utils/integration-helpers.ts index a9bb77f..bf0adcd 100644 --- a/packages/create-gen-app-test/src/test-utils/integration-helpers.ts +++ b/packages/create-gen-app-test/src/test-utils/integration-helpers.ts @@ -35,6 +35,7 @@ export function buildAnswers( email: `tester-${safeSuffix}@example.com`, moduleName: `integration-${safeSuffix}`, moduleDesc: `Integration test module ${suffix}`, + description: `Integration test module ${suffix}`, repoName: `integration-${safeSuffix}`, username: `tester-${safeSuffix}`, access: "public", @@ -43,4 +44,3 @@ export function buildAnswers( ...overrides, }; } - diff --git a/packages/create-gen-app/__tests__/create-gen.test.ts b/packages/create-gen-app/__tests__/create-gen.test.ts index 5e8bfa7..a76e999 100644 --- a/packages/create-gen-app/__tests__/create-gen.test.ts +++ b/packages/create-gen-app/__tests__/create-gen.test.ts @@ -378,7 +378,7 @@ module.exports = { expect(answers.fullName).toBe("Prompted User"); }); - it("should hydrate overlapping template variables from answers", async () => { + it("should not hydrate overlapping template variables implicitly", async () => { const { Inquirerer } = require("inquirerer"); const mockPrompt = jest.fn().mockResolvedValue({ description: "Prompted description", @@ -406,7 +406,7 @@ module.exports = { const answers = await promptUser(extractedVariables, {}, false); expect(answers.description).toBe("Prompted description"); - expect(answers.moduleDesc).toBe("Prompted description"); + expect(answers.moduleDesc).toBeUndefined(); }); }); diff --git a/packages/create-gen-app/test-utils/integration-helpers.ts b/packages/create-gen-app/test-utils/integration-helpers.ts index c8642c3..bf0adcd 100644 --- a/packages/create-gen-app/test-utils/integration-helpers.ts +++ b/packages/create-gen-app/test-utils/integration-helpers.ts @@ -35,6 +35,7 @@ export function buildAnswers( email: `tester-${safeSuffix}@example.com`, moduleName: `integration-${safeSuffix}`, moduleDesc: `Integration test module ${suffix}`, + description: `Integration test module ${suffix}`, repoName: `integration-${safeSuffix}`, username: `tester-${safeSuffix}`, access: "public",