Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core-web/libs/sdk/create-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"inquirer": "^13.0.1",
"ora": "^9.0.0",
"ts-results": "^3.3.0",
"tslib": "^2.3.0"
"tslib": "^2.3.0",
"cfonts": "^3.3.1"
}
}
69 changes: 50 additions & 19 deletions core-web/libs/sdk/create-app/src/asks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,31 @@ import type { SupportedFrontEndFrameworks } from './types';
* Ask interactively if framework not specified
*/
export async function askFramework(): Promise<SupportedFrontEndFrameworks> {
const ans = await inquirer.prompt<{ frameworks: SupportedFrontEndFrameworks[] }>([
const ans = await inquirer.prompt<{ frameworks: SupportedFrontEndFrameworks }>([
{
type: 'checkbox',
type: 'select',
name: 'frameworks',
message: 'Select the frontend framework:',
choices: FRAMEWORKS_CHOICES,
validate(selected) {
if (selected.length === 0) return 'Please select at least one framework.';
return true;
}
message: 'Select your frontend framework:',
choices: FRAMEWORKS_CHOICES
}
]);

// Return the first selected framework (checkbox returns array)
return ans.frameworks[0];
return ans.frameworks;
}
/**
* Ask user name of the project
*/
export async function askProjectName() {
const ans = await inquirer.prompt([
{
type: 'input',
name: 'projectName',
message: 'What is your project name ?',
default: `my-dotcms-app`
}
]);
return ans.projectName;
}

/**
Expand All @@ -36,7 +46,7 @@ export async function askDirectory() {
{
type: 'input',
name: 'directory',
message: 'Project directory:',
message: 'Where should we create your project?',
default: `.`
}
]);
Expand All @@ -51,7 +61,7 @@ export async function askDotcmsCloudUrl() {
{
type: 'input',
name: 'url',
message: 'DotCMS instance URL:',
message: 'dotCMS instance URL:',
default: `https://demo.dotcms.com`
}
]);
Expand All @@ -74,13 +84,14 @@ export async function askUserNameForDotcmsCloud() {
}

/**
* Ask user the username of the dotCMS instance
* Ask user the ulsername of the dotCMS instance
*/
export async function askPasswordForDotcmsCloud() {
const ans = await inquirer.prompt([
{
type: 'input',
type: 'password',
name: 'password',
mask: '•',
message: 'Password:',
default: `admin`
}
Expand All @@ -93,16 +104,36 @@ export async function askPasswordForDotcmsCloud() {
* Example:
* user enters: "y/n"
*/
// export async function askCloudOrLocalInstance(): Promise<boolean> {
// const ans = await inquirer.prompt([
// {
// type: 'confirm',
// name: 'confirm',
// message: `Running dotCMS in the cloud? If not, no worries — select No to spin up dotCMS using Docker.`,
// default: false
// }
// ]);
// return ans.confirm;
// }
//
/**
* Ask if the user has cloud or want to set local
*/
export async function askCloudOrLocalInstance(): Promise<boolean> {
const ans = await inquirer.prompt([
const ans = await inquirer.prompt<{ isCloud: boolean }>([
{
type: 'confirm',
name: 'confirm',
message: `Running dotCMS in the cloud? If not, no worries — select No to spin up dotCMS using Docker.`,
default: false
type: 'select',
name: 'isCloud',
message: 'Do you have an exsisting dotCMS instance?',
choices: [
{ name: 'Yes - I have a dotCMS instance URL', value: true },
{ name: 'No - Spin up dotCMS locally with Docker', value: false }
]
}
]);
return ans.confirm;

// Return the first selected framework (checkbox returns array)
return ans.isCloud;
}

/**
Expand Down
127 changes: 127 additions & 0 deletions core-web/libs/sdk/create-app/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,130 @@ export const FRAMEWORKS_CHOICES: FrameworkChoices[] = [
{ name: 'Angular', value: 'angular' },
{ name: 'Angular (SSR)', value: 'angular-ssr' }
];

export const NEXTJS_DEPENDENCIES: string[] = [
'@dotcms/client',
'@dotcms/experiments',
'@dotcms/react',
'@dotcms/types',
'@dotcms/uve',
'@tinymce/tinymce-react',
'next',
'react',
'react-dom'
];

export const NEXTJS_DEPENDENCIES_DEV: string[] = [
'@tailwindcss/postcss',
'@tailwindcss/typography',
'eslint',
'eslint-config-next',
'postcss',
'prettier',
'tailwindcss'
];

export const ASTRO_DEPENDENCIES: string[] = [
'@astrojs/check',
'@astrojs/react',
'@astrojs/ts-plugin',
'@astrojs/vercel',
'@dotcms/client',
'@dotcms/react',
'@dotcms/types',
'@dotcms/uve',
'@tailwindcss/typography',
'@tailwindcss/vite',
'@tinymce/tinymce-react',
'@types/react',
'@types/react-dom',
'astro',
'dotenv',
'react',
'react-dom',
'tailwindcss',
'typescript'
];

export const ASTRO_DEPENDENCIES_DEV: string[] = [
'@types/node',
'prettier',
'prettier-plugin-astro'
];

export const ANGULAR_DEPENDENCIES: string[] = [
'@angular/animations',
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/forms',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@dotcms/angular',
'@dotcms/client',
'@dotcms/types',
'@dotcms/uve',
'rxjs',
'tslib',
'zone.js'
];

export const ANGULAR_DEPENDENCIES_DEV: string[] = [
'@angular/build',
'@angular/cli',
'@angular/compiler-cli',
'@tailwindcss/typography',
'@types/jasmine',
'autoprefixer',
'jasmine-core',
'karma',
'karma-chrome-launcher',
'karma-coverage',
'karma-jasmine',
'karma-jasmine-html-reporter',
'postcss',
'tailwindcss',
'typescript'
];

export const ANGULAR_SSR_DEPENDENCIES: string[] = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/forms',
'@angular/platform-browser',
'@angular/platform-server',
'@angular/router',
'@angular/ssr',
'@dotcms/angular',
'@dotcms/client',
'@dotcms/types',
'@dotcms/uve',
'@tailwindcss/postcss',
'@types/dotenv',
'dotenv',
'express',
'postcss',
'rxjs',
'tailwindcss',
'tslib',
'zone.js'
];

export const ANGULAR_SSR_DEPENDENCIES_DEV: string[] = [
'@angular/build',
'@angular/cli',
'@angular/compiler-cli',
'@tailwindcss/typography',
'@types/express',
'@types/jasmine',
'@types/node',
'jasmine-core',
'karma',
'karma-chrome-launcher',
'karma-coverage',
'karma-jasmine',
'karma-jasmine-html-reporter',
'typescript'
];
13 changes: 13 additions & 0 deletions core-web/libs/sdk/create-app/src/git/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,16 @@ export async function downloadDockerCompose(directory: string) {

await downloadFile(dockerUrl, dockerComposePath);
}

export async function moveDockerComposeOneLevelUp(directory: string) {
const sourcePath = path.join(directory, 'docker-compose.yml');
const targetPath = path.join(directory, '..', 'docker-compose.yml');
await fs.rename(sourcePath, targetPath);
}

export async function moveDockerComposeBack(directory: string) {
const sourcePath = path.join(directory, '..', 'docker-compose.yml');
const targetPath = path.join(directory, 'docker-compose.yml');

await fs.rename(sourcePath, targetPath);
}
Loading