+3
-3
| { | ||
| "name": "pgpm", | ||
| "version": "5.8.2", | ||
| "version": "5.8.3", | ||
| "author": "Constructive <developers@constructive.io>", | ||
@@ -51,3 +51,3 @@ "description": "PostgreSQL Package Manager - Database migration and package management CLI", | ||
| "@pgpmjs/env": "^2.33.0", | ||
| "@pgpmjs/export": "^1.8.3", | ||
| "@pgpmjs/export": "^1.8.4", | ||
| "@pgpmjs/logger": "^2.18.0", | ||
@@ -81,3 +81,3 @@ "@pgpmjs/slice": "^0.5.0", | ||
| ], | ||
| "gitHead": "12818db1a9b212cb2bf2b879f4bf1c5b1991d075" | ||
| "gitHead": "31f7cd3d3cc28cf069056eae5b2a0d4198d154a1" | ||
| } |
| import { Inquirerer } from 'inquirerer'; | ||
| export default function runWorkspaceSetup(argv: Partial<Record<string, any>>, prompter: Inquirerer): Promise<{ | ||
| cwd: string; | ||
| }>; |
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.default = runWorkspaceSetup; | ||
| const fs_1 = __importDefault(require("fs")); | ||
| const path_1 = __importDefault(require("path")); | ||
| const core_1 = require("@pgpmjs/core"); | ||
| const inquirerer_1 = require("inquirerer"); | ||
| const utils_1 = require("../../utils"); | ||
| const DEFAULT_MOTD = ` | ||
| | _ _ | ||
| === |.===. '\\-//\` | ||
| (o o) {}o o{} (o o) | ||
| ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- | ||
| `; | ||
| async function runWorkspaceSetup(argv, prompter) { | ||
| const workspaceQuestions = [ | ||
| { | ||
| name: 'name', | ||
| message: 'Enter workspace name', | ||
| required: true, | ||
| type: 'text' | ||
| } | ||
| ]; | ||
| const answers = await prompter.prompt(argv, workspaceQuestions); | ||
| const { cwd = process.cwd() } = argv; | ||
| const targetPath = path_1.default.join(cwd, (0, core_1.sluggify)(answers.name)); | ||
| // Prevent double-echoed keystrokes by closing our prompter before template prompts. | ||
| prompter.close(); | ||
| const templateRepo = argv.repo ?? core_1.DEFAULT_TEMPLATE_REPO; | ||
| // Don't set default template - let scaffoldTemplate use metadata-driven resolution | ||
| const template = (argv.template); | ||
| // Register workspace.dirname resolver so boilerplate templates can use it via defaultFrom/setFrom | ||
| // This provides the intended workspace directory name before the folder is created | ||
| const dirName = path_1.default.basename(targetPath); | ||
| (0, inquirerer_1.registerDefaultResolver)('workspace.dirname', () => dirName); | ||
| const dir = argv.dir; | ||
| await (0, core_1.scaffoldTemplate)({ | ||
| fromPath: template ?? 'workspace', | ||
| outputDir: targetPath, | ||
| templateRepo, | ||
| branch: argv.fromBranch, | ||
| dir, | ||
| answers: { | ||
| ...argv, | ||
| ...answers, | ||
| workspaceName: answers.name | ||
| }, | ||
| toolName: core_1.DEFAULT_TEMPLATE_TOOL_NAME, | ||
| noTty: (0, utils_1.isNoTtyRequested)(argv), | ||
| cwd, | ||
| prompter | ||
| }); | ||
| // Check for .motd file and print it, or use default ASCII art | ||
| const motdPath = path_1.default.join(targetPath, '.motd'); | ||
| let motd = DEFAULT_MOTD; | ||
| if (fs_1.default.existsSync(motdPath)) { | ||
| try { | ||
| motd = fs_1.default.readFileSync(motdPath, 'utf8'); | ||
| fs_1.default.unlinkSync(motdPath); | ||
| } | ||
| catch { | ||
| // Ignore errors reading/deleting .motd | ||
| } | ||
| } | ||
| process.stdout.write(motd); | ||
| if (!motd.endsWith('\n')) { | ||
| process.stdout.write('\n'); | ||
| } | ||
| const relPath = path_1.default.relative(process.cwd(), targetPath); | ||
| process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`); | ||
| return { ...argv, ...answers, cwd: targetPath }; | ||
| } |
| import fs from 'fs'; | ||
| import path from 'path'; | ||
| import { DEFAULT_TEMPLATE_REPO, DEFAULT_TEMPLATE_TOOL_NAME, scaffoldTemplate, sluggify } from '@pgpmjs/core'; | ||
| import { registerDefaultResolver } from 'inquirerer'; | ||
| import { isNoTtyRequested } from '../../utils'; | ||
| const DEFAULT_MOTD = ` | ||
| | _ _ | ||
| === |.===. '\\-//\` | ||
| (o o) {}o o{} (o o) | ||
| ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- | ||
| `; | ||
| export default async function runWorkspaceSetup(argv, prompter) { | ||
| const workspaceQuestions = [ | ||
| { | ||
| name: 'name', | ||
| message: 'Enter workspace name', | ||
| required: true, | ||
| type: 'text' | ||
| } | ||
| ]; | ||
| const answers = await prompter.prompt(argv, workspaceQuestions); | ||
| const { cwd = process.cwd() } = argv; | ||
| const targetPath = path.join(cwd, sluggify(answers.name)); | ||
| // Prevent double-echoed keystrokes by closing our prompter before template prompts. | ||
| prompter.close(); | ||
| const templateRepo = argv.repo ?? DEFAULT_TEMPLATE_REPO; | ||
| // Don't set default template - let scaffoldTemplate use metadata-driven resolution | ||
| const template = (argv.template); | ||
| // Register workspace.dirname resolver so boilerplate templates can use it via defaultFrom/setFrom | ||
| // This provides the intended workspace directory name before the folder is created | ||
| const dirName = path.basename(targetPath); | ||
| registerDefaultResolver('workspace.dirname', () => dirName); | ||
| const dir = argv.dir; | ||
| await scaffoldTemplate({ | ||
| fromPath: template ?? 'workspace', | ||
| outputDir: targetPath, | ||
| templateRepo, | ||
| branch: argv.fromBranch, | ||
| dir, | ||
| answers: { | ||
| ...argv, | ||
| ...answers, | ||
| workspaceName: answers.name | ||
| }, | ||
| toolName: DEFAULT_TEMPLATE_TOOL_NAME, | ||
| noTty: isNoTtyRequested(argv), | ||
| cwd, | ||
| prompter | ||
| }); | ||
| // Check for .motd file and print it, or use default ASCII art | ||
| const motdPath = path.join(targetPath, '.motd'); | ||
| let motd = DEFAULT_MOTD; | ||
| if (fs.existsSync(motdPath)) { | ||
| try { | ||
| motd = fs.readFileSync(motdPath, 'utf8'); | ||
| fs.unlinkSync(motdPath); | ||
| } | ||
| catch { | ||
| // Ignore errors reading/deleting .motd | ||
| } | ||
| } | ||
| process.stdout.write(motd); | ||
| if (!motd.endsWith('\n')) { | ||
| process.stdout.write('\n'); | ||
| } | ||
| const relPath = path.relative(process.cwd(), targetPath); | ||
| process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`); | ||
| return { ...argv, ...answers, cwd: targetPath }; | ||
| } |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
46
-4.17%482740
-1.16%150
-1.96%11405
-1.28%Updated