@dotcms/create-app 1.2.5-next.1 → 1.2.5-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/index.js +35 -40
- package/src/api/index.js.map +1 -1
- package/src/asks.js +31 -42
- package/src/asks.js.map +1 -1
- package/src/constants/index.js +18 -21
- package/src/constants/index.js.map +1 -1
- package/src/errors/index.js +6 -15
- package/src/errors/index.js.map +1 -1
- package/src/git/index.js +25 -33
- package/src/git/index.js.map +1 -1
- package/src/index.js +95 -99
- package/src/index.js.map +1 -1
- package/src/types/index.js +1 -2
- package/src/utils/index.js +158 -175
- package/src/utils/index.js.map +1 -1
- package/src/utils/validation.js +81 -90
- package/src/utils/validation.js.map +1 -1
package/package.json
CHANGED
package/src/api/index.js
CHANGED
|
@@ -1,80 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const ts_results_1 = require("ts-results");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const errors_1 = require("../errors");
|
|
10
|
-
class DotCMSApi {
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { Ok, Err } from 'ts-results';
|
|
4
|
+
import { DOTCMS_DEMO_SITE, DOTCMS_EMA_CONFIG_API, DOTCMS_TOKEN_API } from '../constants';
|
|
5
|
+
import { FailedToGetDemoSiteIdentifierError, FailedToSetUpUVEConfig } from '../errors';
|
|
6
|
+
export class DotCMSApi {
|
|
11
7
|
/** Get authentication token */
|
|
12
8
|
static async getAuthToken({ payload, url }) {
|
|
13
9
|
const endpoint = url || this.defaultTokenApi;
|
|
14
10
|
try {
|
|
15
|
-
const res = await
|
|
16
|
-
return
|
|
11
|
+
const res = await axios.post(endpoint, payload);
|
|
12
|
+
return Ok(res.data.entity.token);
|
|
17
13
|
}
|
|
18
14
|
catch (err) {
|
|
19
15
|
// Provide specific error messages based on error type
|
|
20
|
-
if (
|
|
16
|
+
if (axios.isAxiosError(err)) {
|
|
21
17
|
if (err.response?.status === 401) {
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
return Err(chalk.red('\n❌ Authentication failed\n\n') +
|
|
19
|
+
chalk.white('Invalid username or password.\n\n') +
|
|
20
|
+
chalk.yellow('Please check your credentials and try again:\n') +
|
|
21
|
+
chalk.white(' • Verify your username is correct\n') +
|
|
22
|
+
chalk.white(' • Ensure your password is correct\n') +
|
|
23
|
+
chalk.white(' • Check if your account is active\n'));
|
|
28
24
|
}
|
|
29
25
|
else if (err.code === 'ECONNREFUSED') {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
return Err(chalk.red('\n❌ Connection refused\n\n') +
|
|
27
|
+
chalk.white(`Could not connect to dotCMS at: ${endpoint}\n\n`) +
|
|
28
|
+
chalk.yellow('Please verify:\n') +
|
|
29
|
+
chalk.white(' • The URL is correct\n') +
|
|
30
|
+
chalk.white(' • The dotCMS instance is running\n') +
|
|
31
|
+
chalk.white(' • There are no firewall issues\n'));
|
|
36
32
|
}
|
|
37
33
|
else if (err.response) {
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
return Err(chalk.red(`\n❌ Server error (${err.response.status})\n\n`) +
|
|
35
|
+
chalk.white('The dotCMS server returned an error.\n') +
|
|
36
|
+
chalk.gray(`Details: ${err.response.statusText || 'Unknown error'}\n`));
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
|
-
return
|
|
44
|
-
|
|
39
|
+
return Err(chalk.red('\n❌ Failed to get authentication token\n\n') +
|
|
40
|
+
chalk.gray(err instanceof Error ? err.message : String(err)));
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
/** Get demo site identifier */
|
|
48
44
|
static async getDemoSiteIdentifier({ siteName, authenticationToken, url }) {
|
|
49
45
|
try {
|
|
50
46
|
const endpoint = (url || this.defaultDemoSiteApi) + siteName;
|
|
51
|
-
const res = await
|
|
47
|
+
const res = await axios.get(endpoint, {
|
|
52
48
|
headers: { Authorization: `Bearer ${authenticationToken}` }
|
|
53
49
|
});
|
|
54
|
-
return
|
|
50
|
+
return Ok(res.data);
|
|
55
51
|
}
|
|
56
52
|
catch (err) {
|
|
57
53
|
console.error('failed to get demo site identifier : ' + JSON.stringify(err));
|
|
58
|
-
return
|
|
54
|
+
return Err(new FailedToGetDemoSiteIdentifierError());
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
/** Setup UVE Config */
|
|
62
58
|
static async setupUVEConfig({ payload, siteId, authenticationToken, url }) {
|
|
63
59
|
try {
|
|
64
60
|
const endpoint = (url || this.defaultUveConfigApi) + siteId;
|
|
65
|
-
const res = await
|
|
61
|
+
const res = await axios.post(endpoint, payload, {
|
|
66
62
|
headers: { Authorization: `Bearer ${authenticationToken}` }
|
|
67
63
|
});
|
|
68
|
-
return
|
|
64
|
+
return Ok(res.data.entity);
|
|
69
65
|
}
|
|
70
66
|
catch (err) {
|
|
71
67
|
console.error('failed to setup UVE config' + JSON.stringify(err));
|
|
72
|
-
return
|
|
68
|
+
return Err(new FailedToSetUpUVEConfig());
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
|
-
|
|
77
|
-
DotCMSApi.
|
|
78
|
-
DotCMSApi.
|
|
79
|
-
DotCMSApi.defaultUveConfigApi = constants_1.DOTCMS_EMA_CONFIG_API;
|
|
72
|
+
DotCMSApi.defaultTokenApi = DOTCMS_TOKEN_API;
|
|
73
|
+
DotCMSApi.defaultDemoSiteApi = DOTCMS_DEMO_SITE;
|
|
74
|
+
DotCMSApi.defaultUveConfigApi = DOTCMS_EMA_CONFIG_API;
|
|
80
75
|
//# sourceMappingURL=index.js.map
|
package/src/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/api/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAe,GAAG,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,kCAAkC,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AASvF,MAAM,OAAO,SAAS;IAKlB,+BAA+B;IAC/B,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EACtB,OAAO,EACP,GAAG,EAIN;QACG,MAAM,QAAQ,GAAG,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC;QAE7C,IAAI,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAuB,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtE,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,sDAAsD;YACtD,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC/B,OAAO,GAAG,CACN,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC;wBACtC,KAAK,CAAC,KAAK,CAAC,mCAAmC,CAAC;wBAChD,KAAK,CAAC,MAAM,CAAC,gDAAgD,CAAC;wBAC9D,KAAK,CAAC,KAAK,CAAC,uCAAuC,CAAC;wBACpD,KAAK,CAAC,KAAK,CA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|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.askDotcmsCloudUrl = askDotcmsCloudUrl;
|
|
7
|
-
exports.askUserNameForDotcmsCloud = askUserNameForDotcmsCloud;
|
|
8
|
-
exports.askPasswordForDotcmsCloud = askPasswordForDotcmsCloud;
|
|
9
|
-
exports.askCloudOrLocalInstance = askCloudOrLocalInstance;
|
|
10
|
-
exports.prepareDirectory = prepareDirectory;
|
|
11
|
-
const tslib_1 = require("tslib");
|
|
12
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
-
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
14
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
15
|
-
const constants_1 = require("./constants");
|
|
16
|
-
const validation_1 = require("./utils/validation");
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { FRAMEWORKS_CHOICES } from './constants';
|
|
5
|
+
import { validateProjectName, validateUrl } from './utils/validation';
|
|
17
6
|
/**
|
|
18
7
|
* Ask interactively if framework not specified
|
|
19
8
|
*/
|
|
20
|
-
async function askFramework() {
|
|
21
|
-
const ans = await
|
|
9
|
+
export async function askFramework() {
|
|
10
|
+
const ans = await inquirer.prompt([
|
|
22
11
|
{
|
|
23
12
|
type: 'select',
|
|
24
13
|
name: 'frameworks',
|
|
25
14
|
message: 'Select your frontend framework:',
|
|
26
|
-
choices:
|
|
15
|
+
choices: FRAMEWORKS_CHOICES
|
|
27
16
|
}
|
|
28
17
|
]);
|
|
29
18
|
// Return the first selected framework (checkbox returns array)
|
|
@@ -32,8 +21,8 @@ async function askFramework() {
|
|
|
32
21
|
/**
|
|
33
22
|
* Ask user name of the project
|
|
34
23
|
*/
|
|
35
|
-
async function askProjectName() {
|
|
36
|
-
const ans = await
|
|
24
|
+
export async function askProjectName() {
|
|
25
|
+
const ans = await inquirer.prompt([
|
|
37
26
|
{
|
|
38
27
|
type: 'input',
|
|
39
28
|
name: 'projectName',
|
|
@@ -41,7 +30,7 @@ async function askProjectName() {
|
|
|
41
30
|
default: `my-dotcms-app`,
|
|
42
31
|
validate: (input) => {
|
|
43
32
|
try {
|
|
44
|
-
|
|
33
|
+
validateProjectName(input);
|
|
45
34
|
return true;
|
|
46
35
|
}
|
|
47
36
|
catch (error) {
|
|
@@ -55,8 +44,8 @@ async function askProjectName() {
|
|
|
55
44
|
/**
|
|
56
45
|
* Ask user where to create the project
|
|
57
46
|
*/
|
|
58
|
-
async function askDirectory() {
|
|
59
|
-
const ans = await
|
|
47
|
+
export async function askDirectory() {
|
|
48
|
+
const ans = await inquirer.prompt([
|
|
60
49
|
{
|
|
61
50
|
type: 'input',
|
|
62
51
|
name: 'directory',
|
|
@@ -69,8 +58,8 @@ async function askDirectory() {
|
|
|
69
58
|
/**
|
|
70
59
|
* Ask user the url of the dotCMS instance
|
|
71
60
|
*/
|
|
72
|
-
async function askDotcmsCloudUrl() {
|
|
73
|
-
const ans = await
|
|
61
|
+
export async function askDotcmsCloudUrl() {
|
|
62
|
+
const ans = await inquirer.prompt([
|
|
74
63
|
{
|
|
75
64
|
type: 'input',
|
|
76
65
|
name: 'url',
|
|
@@ -78,7 +67,7 @@ async function askDotcmsCloudUrl() {
|
|
|
78
67
|
default: `https://demo.dotcms.com`,
|
|
79
68
|
validate: (input) => {
|
|
80
69
|
try {
|
|
81
|
-
|
|
70
|
+
validateUrl(input);
|
|
82
71
|
return true;
|
|
83
72
|
}
|
|
84
73
|
catch (error) {
|
|
@@ -92,8 +81,8 @@ async function askDotcmsCloudUrl() {
|
|
|
92
81
|
/**
|
|
93
82
|
* Ask user the username of the dotCMS instance
|
|
94
83
|
*/
|
|
95
|
-
async function askUserNameForDotcmsCloud() {
|
|
96
|
-
const ans = await
|
|
84
|
+
export async function askUserNameForDotcmsCloud() {
|
|
85
|
+
const ans = await inquirer.prompt([
|
|
97
86
|
{
|
|
98
87
|
type: 'input',
|
|
99
88
|
name: 'username',
|
|
@@ -112,8 +101,8 @@ async function askUserNameForDotcmsCloud() {
|
|
|
112
101
|
/**
|
|
113
102
|
* Ask user the password of the dotCMS instance
|
|
114
103
|
*/
|
|
115
|
-
async function askPasswordForDotcmsCloud() {
|
|
116
|
-
const ans = await
|
|
104
|
+
export async function askPasswordForDotcmsCloud() {
|
|
105
|
+
const ans = await inquirer.prompt([
|
|
117
106
|
{
|
|
118
107
|
type: 'password',
|
|
119
108
|
name: 'password',
|
|
@@ -150,8 +139,8 @@ async function askPasswordForDotcmsCloud() {
|
|
|
150
139
|
/**
|
|
151
140
|
* Ask if the user has cloud or want to set local
|
|
152
141
|
*/
|
|
153
|
-
async function askCloudOrLocalInstance() {
|
|
154
|
-
const ans = await
|
|
142
|
+
export async function askCloudOrLocalInstance() {
|
|
143
|
+
const ans = await inquirer.prompt([
|
|
155
144
|
{
|
|
156
145
|
type: 'select',
|
|
157
146
|
name: 'isCloud',
|
|
@@ -177,10 +166,10 @@ async function askCloudOrLocalInstance() {
|
|
|
177
166
|
* - Example: basePath="/tmp/my-app" + projectName="my-app" → "/tmp/my-app" (not "/tmp/my-app/my-app")
|
|
178
167
|
* - Handles both absolute and relative paths correctly
|
|
179
168
|
*/
|
|
180
|
-
async function prepareDirectory(basePath, projectName) {
|
|
169
|
+
export async function prepareDirectory(basePath, projectName) {
|
|
181
170
|
// Resolve basePath to absolute path for consistent comparison
|
|
182
|
-
const resolvedBasePath =
|
|
183
|
-
const basePathDirName =
|
|
171
|
+
const resolvedBasePath = path.resolve(basePath);
|
|
172
|
+
const basePathDirName = path.basename(resolvedBasePath);
|
|
184
173
|
// Check if basePath already ends with the project name
|
|
185
174
|
// This prevents nested directories like "/tmp/my-app/my-app"
|
|
186
175
|
let targetPath;
|
|
@@ -190,20 +179,20 @@ async function prepareDirectory(basePath, projectName) {
|
|
|
190
179
|
}
|
|
191
180
|
else {
|
|
192
181
|
// User specified parent directory (e.g., "-d /tmp" with projectName="my-app")
|
|
193
|
-
targetPath =
|
|
182
|
+
targetPath = path.resolve(resolvedBasePath, projectName);
|
|
194
183
|
}
|
|
195
184
|
// If path doesn't exist → create
|
|
196
|
-
if (!
|
|
197
|
-
|
|
185
|
+
if (!fs.existsSync(targetPath)) {
|
|
186
|
+
fs.mkdirSync(targetPath, { recursive: true });
|
|
198
187
|
return targetPath;
|
|
199
188
|
}
|
|
200
189
|
// Directory exists → check if empty
|
|
201
|
-
const files =
|
|
190
|
+
const files = fs.readdirSync(targetPath);
|
|
202
191
|
if (files.length === 0) {
|
|
203
192
|
return targetPath; // empty → OK
|
|
204
193
|
}
|
|
205
194
|
// Directory not empty → warn user
|
|
206
|
-
const ans = await
|
|
195
|
+
const ans = await inquirer.prompt([
|
|
207
196
|
{
|
|
208
197
|
type: 'confirm',
|
|
209
198
|
name: 'confirm',
|
|
@@ -216,7 +205,7 @@ async function prepareDirectory(basePath, projectName) {
|
|
|
216
205
|
process.exit(1);
|
|
217
206
|
}
|
|
218
207
|
// Empty directory
|
|
219
|
-
await
|
|
208
|
+
await fs.emptyDir(targetPath);
|
|
220
209
|
return targetPath;
|
|
221
210
|
}
|
|
222
211
|
//# sourceMappingURL=asks.js.map
|
package/src/asks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asks.js","sourceRoot":"","sources":["../../../../../libs/sdk/create-app/src/asks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asks.js","sourceRoot":"","sources":["../../../../../libs/sdk/create-app/src/asks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItE;;GAEG;AACH,MAA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.ASTRO_DEPENDENCIES = exports.NEXTJS_DEPENDENCIES_DEV = exports.NEXTJS_DEPENDENCIES = exports.FRAMEWORKS_CHOICES = exports.FRAMEWORKS = exports.LOCAL_HEALTH_CHECK_RETRIES = exports.CLOUD_HEALTH_CHECK_RETRIES = exports.DOTCMS_DEMO_SITE = exports.DOTCMS_EMA_CONFIG_API = exports.DOTCMS_TOKEN_API = exports.DOTCMS_HEALTH_API = exports.DOTCMS_USER = exports.DOTCMS_HOST = void 0;
|
|
4
|
-
exports.DOTCMS_HOST = 'http://localhost:8082';
|
|
5
|
-
exports.DOTCMS_USER = {
|
|
1
|
+
export const DOTCMS_HOST = 'http://localhost:8082';
|
|
2
|
+
export const DOTCMS_USER = {
|
|
6
3
|
username: 'admin@dotcms.com',
|
|
7
4
|
password: 'admin'
|
|
8
5
|
};
|
|
9
6
|
// USED APIS
|
|
10
7
|
// Note: Using /appconfiguration instead of /probes/alive because the probe endpoints
|
|
11
8
|
// have IP ACL restrictions that block requests from Docker host. See GitHub issue #34509
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export const DOTCMS_HEALTH_API = `${DOTCMS_HOST}/api/v1/appconfiguration`;
|
|
10
|
+
export const DOTCMS_TOKEN_API = `${DOTCMS_HOST}/api/v1/authentication/api-token`;
|
|
11
|
+
export const DOTCMS_EMA_CONFIG_API = `${DOTCMS_HOST}/api/v1/apps/dotema-config-v2/`;
|
|
12
|
+
export const DOTCMS_DEMO_SITE = `${DOTCMS_HOST}/api/v1/site/`;
|
|
16
13
|
// Health check configuration
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export const CLOUD_HEALTH_CHECK_RETRIES = 5; // Retries for cloud instances (faster expected startup)
|
|
15
|
+
export const LOCAL_HEALTH_CHECK_RETRIES = 60; // Retries for local Docker (slower startup)
|
|
19
16
|
// App constants
|
|
20
|
-
|
|
17
|
+
export const FRAMEWORKS = [
|
|
21
18
|
'nextjs',
|
|
22
19
|
'astro',
|
|
23
20
|
'angular',
|
|
24
21
|
'angular-ssr'
|
|
25
22
|
];
|
|
26
|
-
|
|
23
|
+
export const FRAMEWORKS_CHOICES = [
|
|
27
24
|
{ name: 'Next.js', value: 'nextjs' },
|
|
28
25
|
{ name: 'Astro', value: 'astro' },
|
|
29
26
|
{ name: 'Angular', value: 'angular' },
|
|
30
27
|
{ name: 'Angular (SSR)', value: 'angular-ssr' }
|
|
31
28
|
];
|
|
32
|
-
|
|
29
|
+
export const NEXTJS_DEPENDENCIES = [
|
|
33
30
|
'@dotcms/client',
|
|
34
31
|
'@dotcms/experiments',
|
|
35
32
|
'@dotcms/react',
|
|
@@ -40,7 +37,7 @@ exports.NEXTJS_DEPENDENCIES = [
|
|
|
40
37
|
'react',
|
|
41
38
|
'react-dom'
|
|
42
39
|
];
|
|
43
|
-
|
|
40
|
+
export const NEXTJS_DEPENDENCIES_DEV = [
|
|
44
41
|
'@tailwindcss/postcss',
|
|
45
42
|
'@tailwindcss/typography',
|
|
46
43
|
'eslint',
|
|
@@ -49,7 +46,7 @@ exports.NEXTJS_DEPENDENCIES_DEV = [
|
|
|
49
46
|
'prettier',
|
|
50
47
|
'tailwindcss'
|
|
51
48
|
];
|
|
52
|
-
|
|
49
|
+
export const ASTRO_DEPENDENCIES = [
|
|
53
50
|
'@astrojs/check',
|
|
54
51
|
'@astrojs/react',
|
|
55
52
|
'@astrojs/ts-plugin',
|
|
@@ -70,12 +67,12 @@ exports.ASTRO_DEPENDENCIES = [
|
|
|
70
67
|
'tailwindcss',
|
|
71
68
|
'typescript'
|
|
72
69
|
];
|
|
73
|
-
|
|
70
|
+
export const ASTRO_DEPENDENCIES_DEV = [
|
|
74
71
|
'@types/node',
|
|
75
72
|
'prettier',
|
|
76
73
|
'prettier-plugin-astro'
|
|
77
74
|
];
|
|
78
|
-
|
|
75
|
+
export const ANGULAR_DEPENDENCIES = [
|
|
79
76
|
'@angular/animations',
|
|
80
77
|
'@angular/common',
|
|
81
78
|
'@angular/compiler',
|
|
@@ -92,7 +89,7 @@ exports.ANGULAR_DEPENDENCIES = [
|
|
|
92
89
|
'tslib',
|
|
93
90
|
'zone.js'
|
|
94
91
|
];
|
|
95
|
-
|
|
92
|
+
export const ANGULAR_DEPENDENCIES_DEV = [
|
|
96
93
|
'@angular/build',
|
|
97
94
|
'@angular/cli',
|
|
98
95
|
'@angular/compiler-cli',
|
|
@@ -109,7 +106,7 @@ exports.ANGULAR_DEPENDENCIES_DEV = [
|
|
|
109
106
|
'tailwindcss',
|
|
110
107
|
'typescript'
|
|
111
108
|
];
|
|
112
|
-
|
|
109
|
+
export const ANGULAR_SSR_DEPENDENCIES = [
|
|
113
110
|
'@angular/common',
|
|
114
111
|
'@angular/compiler',
|
|
115
112
|
'@angular/core',
|
|
@@ -132,7 +129,7 @@ exports.ANGULAR_SSR_DEPENDENCIES = [
|
|
|
132
129
|
'tslib',
|
|
133
130
|
'zone.js'
|
|
134
131
|
];
|
|
135
|
-
|
|
132
|
+
export const ANGULAR_SSR_DEPENDENCIES_DEV = [
|
|
136
133
|
'@angular/build',
|
|
137
134
|
'@angular/cli',
|
|
138
135
|
'@angular/compiler-cli',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/constants/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/constants/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,QAAQ,EAAE,kBAAkB;IAC5B,QAAQ,EAAE,OAAO;CACpB,CAAC;AAEF,YAAY;AACZ,qFAAqF;AACrF,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,WAAW,0BAA0B,CAAC;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,WAAW,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1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FailedToGetDemoSiteIdentifierError = exports.FailedToSetUpUVEConfig = exports.FailedToGetDotcmsTokenError = exports.FailedToDownloadDockerComposeError = exports.DockerCliNotInstalledError = exports.FailedToCreateFrontendProjectError = void 0;
|
|
4
|
-
class FailedToCreateFrontendProjectError extends Error {
|
|
1
|
+
export class FailedToCreateFrontendProjectError extends Error {
|
|
5
2
|
constructor(framework) {
|
|
6
3
|
super(`Failed to create frontend project for framework: ${framework}. Please check if you have git installed and an active internet connection.`);
|
|
7
4
|
}
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
class DockerCliNotInstalledError extends Error {
|
|
6
|
+
export class DockerCliNotInstalledError extends Error {
|
|
11
7
|
constructor() {
|
|
12
8
|
super(`Please check if Docker CLI installed in you system!`);
|
|
13
9
|
}
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
class FailedToDownloadDockerComposeError extends Error {
|
|
11
|
+
export class FailedToDownloadDockerComposeError extends Error {
|
|
17
12
|
constructor() {
|
|
18
13
|
super(`Failed to download the docker compose file`);
|
|
19
14
|
}
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
class FailedToGetDotcmsTokenError extends Error {
|
|
16
|
+
export class FailedToGetDotcmsTokenError extends Error {
|
|
23
17
|
constructor() {
|
|
24
18
|
super(`Failed to get dotCMS API token. Please make sure if dotCMS container is running.`);
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
|
-
|
|
28
|
-
class FailedToSetUpUVEConfig extends Error {
|
|
21
|
+
export class FailedToSetUpUVEConfig extends Error {
|
|
29
22
|
constructor() {
|
|
30
23
|
super(`Failed to set up UVE configuration in DotCMS.`);
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
|
-
|
|
34
|
-
class FailedToGetDemoSiteIdentifierError extends Error {
|
|
26
|
+
export class FailedToGetDemoSiteIdentifierError extends Error {
|
|
35
27
|
constructor() {
|
|
36
28
|
super(`Failed to get demo site identifier from DotCMS.`);
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
|
-
exports.FailedToGetDemoSiteIdentifierError = FailedToGetDemoSiteIdentifierError;
|
|
40
31
|
//# sourceMappingURL=index.js.map
|
package/src/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/errors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/errors/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IACzD,YAAY,SAAiB;QACzB,KAAK,CACD,oDAAoD,SAAS,6EAA6E,CAC7I,CAAC;IACN,CAAC;CACJ;AAED,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACjD;QACI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACjE,CAAC;CACJ;AAED,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IACzD;QACI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACxD,CAAC;CACJ;AAED,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAClD;QACI,KAAK,CAAC,kFAAkF,CAAC,CAAC;IAC9F,CAAC;CACJ;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7C;QACI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC3D,CAAC;CACJ;AAED,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IACzD;QACI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC7D,CAAC;CACJ"}
|
package/src/git/index.js
CHANGED
|
@@ -1,64 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.moveDockerComposeBack = moveDockerComposeBack;
|
|
7
|
-
const tslib_1 = require("tslib");
|
|
8
|
-
const execa_1 = require("execa");
|
|
9
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
10
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
|
-
const utils_1 = require("../utils");
|
|
12
|
-
const cloneFrontEndSample = async ({ framework, directory }) => {
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { downloadFile } from '../utils';
|
|
5
|
+
export const cloneFrontEndSample = async ({ framework, directory }) => {
|
|
13
6
|
// 1. Clone repository (sparse + blobless)
|
|
14
|
-
await
|
|
7
|
+
await execa('git', ['clone', '--filter=blob:none', '--sparse', 'https://github.com/dotCMS/core.git', '.'], { cwd: directory });
|
|
15
8
|
// 2. Enable sparse checkout & select the folder
|
|
16
|
-
await
|
|
9
|
+
await execa('git', ['sparse-checkout', 'set', `examples/${framework}`], {
|
|
17
10
|
cwd: directory
|
|
18
11
|
});
|
|
19
12
|
// await fs.ensureDir(path.join(directory, framework));
|
|
20
13
|
// 3. Checkout main branch (only the selected folder is downloaded)
|
|
21
|
-
await
|
|
14
|
+
await execa('git', ['checkout', 'main'], {
|
|
22
15
|
cwd: directory
|
|
23
16
|
// stdio: 'inherit'
|
|
24
17
|
});
|
|
25
|
-
const src =
|
|
18
|
+
const src = path.join(directory, 'examples', `${framework}`);
|
|
26
19
|
const dest = directory;
|
|
27
20
|
// const dest = path.join(directory, framework);
|
|
28
21
|
// Ensure framework directory exists
|
|
29
22
|
// await fs.ensureDir(dest);
|
|
30
23
|
// Remove EVERYTHING in repo except the examples folder
|
|
31
|
-
const items = await
|
|
24
|
+
const items = await fs.readdir(directory);
|
|
32
25
|
for (const item of items) {
|
|
33
26
|
if (item !== 'examples') {
|
|
34
|
-
await
|
|
27
|
+
await fs.remove(path.join(directory, item));
|
|
35
28
|
}
|
|
36
29
|
}
|
|
37
30
|
// Copy only the nextjs folder into the framework folder
|
|
38
|
-
await
|
|
31
|
+
await fs.copy(src, dest, { overwrite: true });
|
|
39
32
|
// Remove the remaining examples folder
|
|
40
|
-
const allItems = await
|
|
33
|
+
const allItems = await fs.readdir(directory);
|
|
41
34
|
for (const item of allItems) {
|
|
42
35
|
if (item === 'examples') {
|
|
43
|
-
await
|
|
36
|
+
await fs.remove(path.join(directory, item));
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
39
|
};
|
|
47
|
-
|
|
48
|
-
async function downloadDockerCompose(directory) {
|
|
40
|
+
export async function downloadDockerCompose(directory) {
|
|
49
41
|
// 6. Download docker-compose file
|
|
50
42
|
const dockerUrl = 'https://raw.githubusercontent.com/dotCMS/core/main/docker/docker-compose-examples/single-node-demo-site/docker-compose.yml';
|
|
51
|
-
const dockerComposePath =
|
|
52
|
-
await
|
|
43
|
+
const dockerComposePath = path.join(directory, 'docker-compose.yml');
|
|
44
|
+
await downloadFile(dockerUrl, dockerComposePath);
|
|
53
45
|
}
|
|
54
|
-
async function moveDockerComposeOneLevelUp(directory) {
|
|
55
|
-
const sourcePath =
|
|
56
|
-
const targetPath =
|
|
57
|
-
await
|
|
46
|
+
export async function moveDockerComposeOneLevelUp(directory) {
|
|
47
|
+
const sourcePath = path.join(directory, 'docker-compose.yml');
|
|
48
|
+
const targetPath = path.join(directory, '..', 'docker-compose.yml');
|
|
49
|
+
await fs.rename(sourcePath, targetPath);
|
|
58
50
|
}
|
|
59
|
-
async function moveDockerComposeBack(directory) {
|
|
60
|
-
const sourcePath =
|
|
61
|
-
const targetPath =
|
|
62
|
-
await
|
|
51
|
+
export async function moveDockerComposeBack(directory) {
|
|
52
|
+
const sourcePath = path.join(directory, '..', 'docker-compose.yml');
|
|
53
|
+
const targetPath = path.join(directory, 'docker-compose.yml');
|
|
54
|
+
await fs.rename(sourcePath, targetPath);
|
|
63
55
|
}
|
|
64
56
|
//# sourceMappingURL=index.js.map
|
package/src/git/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/git/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/sdk/create-app/src/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACtC,SAAS,EACT,SAAS,EAIZ,EAAE,EAAE;IACD,0CAA0C;IAC1C,MAAM,KAAK,CACP,KAAK,EACL,CAAC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,oCAAoC,EAAE,GAAG,CAAC,EACtF,EAAE,GAAG,EAAE,SAAS,EAAE,CACrB,CAAC;IAEF,gDAAgD;IAChD,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,iBAAiB,EAAE,KAAK,EAAE,YAAY,SAAS,EAAE,CAAC,EAAE;QACpE,GAAG,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,uDAAuD;IAEvD,mEAAmE;IACnE,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE;QACrC,GAAG,EAAE,SAAS;QACd,mBAAmB;KACtB,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,SAAS,CAAC;IACvB,gDAAgD;IAEhD,oCAAoC;IACpC,4BAA4B;IAE5B,uDAAuD;IACvD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;YACtB,MA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