cli formatting fixes

This commit is contained in:
2025-08-04 01:58:11 +02:00
parent 9b154df1a8
commit 3f09e74f43
2 changed files with 13 additions and 9 deletions

View File

@@ -125,12 +125,12 @@ async function main() {
task: async () => { task: async () => {
const __dirname = path.dirname(new URL(import.meta.url).pathname); const __dirname = path.dirname(new URL(import.meta.url).pathname);
const templateDir = path.resolve(__dirname, 'template'); const templateDir = path.resolve(__dirname, 'template');
// Ensure root directory exists with proper permissions // Ensure root directory exists with proper permissions
await fs.ensureDir(rootDir); await fs.ensureDir(rootDir);
try { try {
await fs.copy(templateDir, rootDir, { await fs.copy(templateDir, rootDir, {
overwrite: true, overwrite: true,
errorOnExist: false, errorOnExist: false,
preserveTimestamps: false preserveTimestamps: false
@@ -138,7 +138,7 @@ async function main() {
} catch (error) { } catch (error) {
throw new Error(`Failed to copy template files: ${error.message}`); throw new Error(`Failed to copy template files: ${error.message}`);
} }
// Rename gitignore files to .gitignore (dotfiles get lost in npm packages) // Rename gitignore files to .gitignore (dotfiles get lost in npm packages)
async function renameGitignoreFiles(dir) { async function renameGitignoreFiles(dir) {
try { try {
@@ -146,7 +146,7 @@ async function main() {
for (const item of items) { for (const item of items) {
const itemPath = path.join(dir, item); const itemPath = path.join(dir, item);
const stat = await fs.stat(itemPath); const stat = await fs.stat(itemPath);
if (stat.isDirectory()) { if (stat.isDirectory()) {
await renameGitignoreFiles(itemPath); await renameGitignoreFiles(itemPath);
} else if (item === 'gitignore') { } else if (item === 'gitignore') {
@@ -158,7 +158,7 @@ async function main() {
throw new Error(`Failed to rename gitignore files: ${error.message}`); throw new Error(`Failed to rename gitignore files: ${error.message}`);
} }
} }
await renameGitignoreFiles(rootDir); await renameGitignoreFiles(rootDir);
return 'Template copied!'; return 'Template copied!';
}, },
@@ -267,7 +267,7 @@ async function main() {
title: `${color.blue('🗄️ Setting up production dataset for Sanity CMS')}`, title: `${color.blue('🗄️ Setting up production dataset for Sanity CMS')}`,
task: async () => { task: async () => {
if (!(await fs.pathExists(studioDir))) throw new Error(`Studio directory not found at ${studioDir}`); if (!(await fs.pathExists(studioDir))) throw new Error(`Studio directory not found at ${studioDir}`);
try { try {
await runCommand(pmx, ['sanity', 'dataset', 'create', 'production'], studioDir); await runCommand(pmx, ['sanity', 'dataset', 'create', 'production'], studioDir);
return 'Production dataset created successfully'; return 'Production dataset created successfully';
@@ -360,7 +360,11 @@ async function main() {
if (org) { if (org) {
const githubUrl = `https://github.com/new?name=${kebabName}&owner=${org}&visibility=private&description=${encodeURIComponent('This website was built using the official Lumify starter template for building with Sveltekit, Sanity, Bun, and Shadcn UI — bundled into a NX monorepo.')}`; const githubUrl = `https://github.com/new?name=${kebabName}&owner=${org}&visibility=private&description=${encodeURIComponent('This website was built using the official Lumify starter template for building with Sveltekit, Sanity, Bun, and Shadcn UI — bundled into a NX monorepo.')}`;
p.note( p.note(
`Please create a new GitHub repository named\n\`${kebabName}\` under \`${org}\` at:\n\n${color.cyan(githubUrl)}\n\nThe browser will open for you.`, `Please create a new GitHub repository:\n\n` +
`${color.bold('Repository:')} ${color.cyan(kebabName)}\n` +
`${color.bold('Organization:')} ${color.cyan(org)}\n\n` +
`${color.dim('Opening GitHub in your browser...')}\n` +
`${color.dim('Repository details will be pre-filled.')}`,
'GitHub Setup Required' 'GitHub Setup Required'
); );
await runCommand('xdg-open', [githubUrl], process.cwd()); await runCommand('xdg-open', [githubUrl], process.cwd());

View File

@@ -1,6 +1,6 @@
{ {
"name": "@lumify-systems/template-sanity", "name": "@lumify-systems/template-sanity",
"version": "2.1.1", "version": "2.1.2",
"publishConfig": { "publishConfig": {
"access": "restricted", "access": "restricted",
"registry": "https://npm.pkg.github.com" "registry": "https://npm.pkg.github.com"