chore: disable --templates while we rework them

This commit is contained in:
Alexandre Bodin 2024-06-21 11:31:07 +02:00
parent e7ee24229e
commit bc6069db81
5 changed files with 24 additions and 26 deletions

View File

@ -39,7 +39,7 @@ command
.option('--dbfile <dbfile>', 'Database file path for sqlite')
// templates
.option('--template <templateurl>', 'Specify a Strapi template')
// .option('--template <templateurl>', 'Specify a Strapi template')
.description('create a new application')
.action((directory, options) => {
createStrapiApp(directory, options);
@ -60,7 +60,7 @@ async function createStrapiApp(directory: string | undefined, options: Options)
directory: appDirectory,
useTypescript: true,
packageManager: 'npm',
template: options.template,
// template: options.template,
isQuickstart: options.quickstart,
} as GenerateNewAppOptions;
@ -101,16 +101,16 @@ async function createStrapiApp(directory: string | undefined, options: Options)
}
async function validateOptions(options: Options) {
const programFlags = command
.createHelp()
.visibleOptions(command)
.reduce<Array<string | undefined>>((acc, { short, long }) => [...acc, short, long], [])
.filter(Boolean);
// const programFlags = command
// .createHelp()
// .visibleOptions(command)
// .reduce<Array<string | undefined>>((acc, { short, long }) => [...acc, short, long], [])
// .filter(Boolean);
if (options.template && programFlags.includes(options.template)) {
console.error(`${options.template} is not a valid template`);
process.exit(1);
}
// if (options.template && programFlags.includes(options.template)) {
// console.error(`${options.template} is not a valid template`);
// process.exit(1);
// }
if (options.javascript === true && options.typescript === true) {
console.error('You cannot use both --typescript (--ts) and --javascript (--js) flags together');

View File

@ -12,7 +12,7 @@ export interface Options {
dbpassword?: string;
dbssl?: string;
dbfile?: string;
template?: string;
// template?: string;
typescript?: boolean;
javascript?: boolean;
}

View File

@ -6,7 +6,7 @@ import execa from 'execa';
import stopProcess from './utils/stop-process';
import { trackUsage } from './utils/usage';
import mergeTemplate from './utils/merge-template.js';
// import mergeTemplate from './utils/merge-template.js';
import tryGitInit from './utils/git';
import createPackageJSON from './resources/json/common/package.json';
@ -92,18 +92,18 @@ export default async function createProject(scope: Scope) {
await trackUsage({ event: 'didCopyConfigurationFiles', scope });
// merge template files if a template is specified
const hasTemplate = Boolean(scope.template);
if (hasTemplate) {
try {
await mergeTemplate(scope, rootPath);
} catch (error) {
if (error instanceof Error) {
throw new Error(`⛔️ Template installation failed: ${error.message}`);
}
// const hasTemplate = Boolean(scope.template);
// if (hasTemplate) {
// try {
// await mergeTemplate(scope, rootPath);
// } catch (error) {
// if (error instanceof Error) {
// throw new Error(`⛔️ Template installation failed: ${error.message}`);
// }
throw error;
}
}
// throw error;
// }
// }
} catch (err) {
await fse.remove(scope.rootPath);
throw err;

View File

@ -37,7 +37,6 @@ export const generateNewApp = async (options: Options) => {
template: options.template,
packageJsonStrapi: {
template: options.template,
starter: options.starter,
},
uuid: (process.env.STRAPI_UUID_PREFIX || '') + crypto.randomUUID(),
docker: process.env.DOCKER === 'true',

View File

@ -27,7 +27,6 @@ export interface Options {
runApp?: boolean;
template?: string;
starter?: string;
isQuickstart?: boolean;