create-content-sdk-app 1.3.0-canary.9 → 1.4.0-canary.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/README.md +5 -5
- package/dist/bin.js +119 -119
- package/dist/common/base/Initializer.js +2 -2
- package/dist/common/base/args.js +2 -2
- package/dist/common/base/prompts.js +7 -7
- package/dist/common/index.js +18 -18
- package/dist/common/processes/install.js +55 -55
- package/dist/common/processes/next.js +63 -63
- package/dist/common/processes/transform.js +115 -115
- package/dist/common/utils/cmd.js +53 -53
- package/dist/common/utils/helpers.js +80 -80
- package/dist/index.js +6 -6
- package/dist/initialize.js +71 -71
- package/dist/initializers/nextjs/args.js +2 -2
- package/dist/initializers/nextjs/index.js +30 -30
- package/dist/initializers/nextjs/prompts.js +26 -26
- package/dist/initializers/nextjs-app-router (beta)/args.js +2 -2
- package/dist/initializers/nextjs-app-router (beta)/index.js +30 -30
- package/dist/initializers/nextjs-app-router (beta)/prompts.js +26 -26
- package/dist/templates/nextjs/.env.remote.example +2 -1
- package/dist/templates/nextjs/CLAUDE.md +170 -170
- package/dist/templates/nextjs/README.md +7 -7
- package/dist/templates/nextjs/copilot-instructions.md +170 -170
- package/dist/templates/nextjs/package.json +5 -5
- package/dist/templates/nextjs/src/middleware.ts +21 -11
- package/dist/templates/nextjs-app-router (beta)/.env.remote.example +2 -1
- package/dist/templates/nextjs-app-router (beta)/.sitecore/import-map.server.ts +60 -0
- package/dist/templates/nextjs-app-router (beta)/CLAUDE.md +271 -271
- package/dist/templates/nextjs-app-router (beta)/README.md +7 -7
- package/dist/templates/nextjs-app-router (beta)/copilot-instructions.md +271 -271
- package/dist/templates/nextjs-app-router (beta)/gitignore +2 -0
- package/dist/templates/nextjs-app-router (beta)/package.json +5 -5
- package/dist/templates/nextjs-app-router (beta)/src/Layout.tsx +9 -3
- package/dist/templates/nextjs-app-router (beta)/src/Providers.tsx +9 -17
- package/dist/templates/nextjs-app-router (beta)/src/app/[site]/[locale]/[[...path]]/page.tsx +1 -5
- package/dist/templates/nextjs-app-router (beta)/src/app/api/editing/config/route.ts +2 -0
- package/dist/templates/nextjs-app-router (beta)/src/app/api/editing/render/route.ts +1 -1
- package/dist/templates/nextjs-app-router (beta)/src/middleware.ts +12 -1
- package/package.json +2 -2
- package/dist/templates/nextjs-app-router (beta)/src/DesignLibraryLayout.tsx +0 -7
- /package/dist/templates/nextjs-app-router (beta)/.sitecore/{import-map.ts → import-map.client.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Sitecore Content SDK Initializer
|
|
2
|
-
|
|
3
|
-
This module is provided as a part of Sitecore Content SDK. It contains templates for Sitecore Content SDK sample applications.
|
|
4
|
-
|
|
5
|
-
[Documentation](https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html)
|
|
1
|
+
# Sitecore Content SDK Initializer
|
|
2
|
+
|
|
3
|
+
This module is provided as a part of Sitecore Content SDK. It contains templates for Sitecore Content SDK sample applications.
|
|
4
|
+
|
|
5
|
+
[Documentation](https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html)
|
package/dist/bin.js
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.main = exports.promptDestination = exports.getDestination = exports.parseArgs = void 0;
|
|
16
|
-
const fs_1 = __importDefault(require("fs"));
|
|
17
|
-
const path_1 = require("path");
|
|
18
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
20
|
-
const initialize_1 = require("./initialize");
|
|
21
|
-
const minimist_1 = __importDefault(require("minimist"));
|
|
22
|
-
const common_1 = require("./common");
|
|
23
|
-
const parseArgs = () => {
|
|
24
|
-
// parse any command line arguments passed into `npx create-content-sdk-app`
|
|
25
|
-
// to pass to the generator prompts and skip them.
|
|
26
|
-
// useful for CI and testing purposes
|
|
27
|
-
const options = {
|
|
28
|
-
boolean: ['force', 'noInstall', 'yes', 'silent'],
|
|
29
|
-
string: ['destination', 'template'],
|
|
30
|
-
default: {},
|
|
31
|
-
};
|
|
32
|
-
const args = (0, minimist_1.default)(process.argv.slice(2), options);
|
|
33
|
-
// we need to coerce string parameters in minimist above (to prevent string options without a value e.g. `--template` from coming in as a boolean `true`).
|
|
34
|
-
// however, coersion will result in an empty string and inquirer will treat this as a valid answer value (and not prompt!).
|
|
35
|
-
// we need to go back through and remove these to prevent this.
|
|
36
|
-
options.string.forEach((key) => {
|
|
37
|
-
args[key] === '' && delete args[key];
|
|
38
|
-
});
|
|
39
|
-
return args;
|
|
40
|
-
};
|
|
41
|
-
exports.parseArgs = parseArgs;
|
|
42
|
-
const getDestination = (args, template) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
-
if (!template) {
|
|
44
|
-
throw new Error('Unable to get destinations, provided template is empty');
|
|
45
|
-
}
|
|
46
|
-
// validate/gather destination
|
|
47
|
-
// remove the (beta) from the template name
|
|
48
|
-
const defaultBaseDestination = `${process.cwd()}${path_1.sep}${template.replace(' (beta)', '')}`;
|
|
49
|
-
let destination = args.destination;
|
|
50
|
-
if (!destination) {
|
|
51
|
-
destination = args.yes
|
|
52
|
-
? defaultBaseDestination
|
|
53
|
-
: yield (0, exports.promptDestination)('Where would you like your new app created?', defaultBaseDestination);
|
|
54
|
-
}
|
|
55
|
-
return destination;
|
|
56
|
-
});
|
|
57
|
-
exports.getDestination = getDestination;
|
|
58
|
-
const promptDestination = (prompt, defaultDestination) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
return (yield inquirer_1.default.prompt({
|
|
60
|
-
type: 'input',
|
|
61
|
-
name: 'destination',
|
|
62
|
-
message: prompt,
|
|
63
|
-
default: () => defaultDestination,
|
|
64
|
-
})).destination;
|
|
65
|
-
});
|
|
66
|
-
exports.promptDestination = promptDestination;
|
|
67
|
-
const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
var _a;
|
|
69
|
-
let template = '';
|
|
70
|
-
// check if template was provided
|
|
71
|
-
if (((_a = args._) === null || _a === void 0 ? void 0 : _a.length) > 0 && args._[0] !== undefined) {
|
|
72
|
-
// use positional parameter
|
|
73
|
-
template = args._[0];
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// use --template arg
|
|
77
|
-
template = args.template || '';
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
// validate template
|
|
81
|
-
const allTemplates = (0, common_1.getAllTemplates)();
|
|
82
|
-
if (!template || !allTemplates.includes(template)) {
|
|
83
|
-
if (args.yes) {
|
|
84
|
-
throw new Error(`No or unknown template provided: '${template}'`);
|
|
85
|
-
}
|
|
86
|
-
if (template) {
|
|
87
|
-
console.log(chalk_1.default.yellow(`Unknown template provided: '${template}'...`));
|
|
88
|
-
}
|
|
89
|
-
const answer = yield inquirer_1.default.prompt({
|
|
90
|
-
type: 'list',
|
|
91
|
-
name: 'template',
|
|
92
|
-
message: 'Which template would you like to create?',
|
|
93
|
-
choices: allTemplates,
|
|
94
|
-
default: 'nextjs',
|
|
95
|
-
});
|
|
96
|
-
template = answer.template;
|
|
97
|
-
}
|
|
98
|
-
const destination = yield (0, exports.getDestination)(args, template);
|
|
99
|
-
if (!args.force && fs_1.default.existsSync(destination) && fs_1.default.readdirSync(destination).length > 0) {
|
|
100
|
-
if (args.yes) {
|
|
101
|
-
throw new Error(`Directory '${destination}' not empty. To overwrite it, use the --force flag.`);
|
|
102
|
-
}
|
|
103
|
-
const answer = yield inquirer_1.default.prompt({
|
|
104
|
-
type: 'confirm',
|
|
105
|
-
name: 'continue',
|
|
106
|
-
message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
|
|
107
|
-
});
|
|
108
|
-
if (!answer.continue) {
|
|
109
|
-
process.exit();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
yield (0, initialize_1.initialize)(template, Object.assign(Object.assign({}, args), { destination, template }));
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
console.log(chalk_1.default.red('An error occurred:', error));
|
|
116
|
-
process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
exports.main = main;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.main = exports.promptDestination = exports.getDestination = exports.parseArgs = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = require("path");
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
20
|
+
const initialize_1 = require("./initialize");
|
|
21
|
+
const minimist_1 = __importDefault(require("minimist"));
|
|
22
|
+
const common_1 = require("./common");
|
|
23
|
+
const parseArgs = () => {
|
|
24
|
+
// parse any command line arguments passed into `npx create-content-sdk-app`
|
|
25
|
+
// to pass to the generator prompts and skip them.
|
|
26
|
+
// useful for CI and testing purposes
|
|
27
|
+
const options = {
|
|
28
|
+
boolean: ['force', 'noInstall', 'yes', 'silent'],
|
|
29
|
+
string: ['destination', 'template'],
|
|
30
|
+
default: {},
|
|
31
|
+
};
|
|
32
|
+
const args = (0, minimist_1.default)(process.argv.slice(2), options);
|
|
33
|
+
// we need to coerce string parameters in minimist above (to prevent string options without a value e.g. `--template` from coming in as a boolean `true`).
|
|
34
|
+
// however, coersion will result in an empty string and inquirer will treat this as a valid answer value (and not prompt!).
|
|
35
|
+
// we need to go back through and remove these to prevent this.
|
|
36
|
+
options.string.forEach((key) => {
|
|
37
|
+
args[key] === '' && delete args[key];
|
|
38
|
+
});
|
|
39
|
+
return args;
|
|
40
|
+
};
|
|
41
|
+
exports.parseArgs = parseArgs;
|
|
42
|
+
const getDestination = (args, template) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
if (!template) {
|
|
44
|
+
throw new Error('Unable to get destinations, provided template is empty');
|
|
45
|
+
}
|
|
46
|
+
// validate/gather destination
|
|
47
|
+
// remove the (beta) from the template name
|
|
48
|
+
const defaultBaseDestination = `${process.cwd()}${path_1.sep}${template.replace(' (beta)', '')}`;
|
|
49
|
+
let destination = args.destination;
|
|
50
|
+
if (!destination) {
|
|
51
|
+
destination = args.yes
|
|
52
|
+
? defaultBaseDestination
|
|
53
|
+
: yield (0, exports.promptDestination)('Where would you like your new app created?', defaultBaseDestination);
|
|
54
|
+
}
|
|
55
|
+
return destination;
|
|
56
|
+
});
|
|
57
|
+
exports.getDestination = getDestination;
|
|
58
|
+
const promptDestination = (prompt, defaultDestination) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
return (yield inquirer_1.default.prompt({
|
|
60
|
+
type: 'input',
|
|
61
|
+
name: 'destination',
|
|
62
|
+
message: prompt,
|
|
63
|
+
default: () => defaultDestination,
|
|
64
|
+
})).destination;
|
|
65
|
+
});
|
|
66
|
+
exports.promptDestination = promptDestination;
|
|
67
|
+
const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
var _a;
|
|
69
|
+
let template = '';
|
|
70
|
+
// check if template was provided
|
|
71
|
+
if (((_a = args._) === null || _a === void 0 ? void 0 : _a.length) > 0 && args._[0] !== undefined) {
|
|
72
|
+
// use positional parameter
|
|
73
|
+
template = args._[0];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// use --template arg
|
|
77
|
+
template = args.template || '';
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
// validate template
|
|
81
|
+
const allTemplates = (0, common_1.getAllTemplates)();
|
|
82
|
+
if (!template || !allTemplates.includes(template)) {
|
|
83
|
+
if (args.yes) {
|
|
84
|
+
throw new Error(`No or unknown template provided: '${template}'`);
|
|
85
|
+
}
|
|
86
|
+
if (template) {
|
|
87
|
+
console.log(chalk_1.default.yellow(`Unknown template provided: '${template}'...`));
|
|
88
|
+
}
|
|
89
|
+
const answer = yield inquirer_1.default.prompt({
|
|
90
|
+
type: 'list',
|
|
91
|
+
name: 'template',
|
|
92
|
+
message: 'Which template would you like to create?',
|
|
93
|
+
choices: allTemplates,
|
|
94
|
+
default: 'nextjs',
|
|
95
|
+
});
|
|
96
|
+
template = answer.template;
|
|
97
|
+
}
|
|
98
|
+
const destination = yield (0, exports.getDestination)(args, template);
|
|
99
|
+
if (!args.force && fs_1.default.existsSync(destination) && fs_1.default.readdirSync(destination).length > 0) {
|
|
100
|
+
if (args.yes) {
|
|
101
|
+
throw new Error(`Directory '${destination}' not empty. To overwrite it, use the --force flag.`);
|
|
102
|
+
}
|
|
103
|
+
const answer = yield inquirer_1.default.prompt({
|
|
104
|
+
type: 'confirm',
|
|
105
|
+
name: 'continue',
|
|
106
|
+
message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
|
|
107
|
+
});
|
|
108
|
+
if (!answer.continue) {
|
|
109
|
+
process.exit();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
yield (0, initialize_1.initialize)(template, Object.assign(Object.assign({}, args), { destination, template }));
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.log(chalk_1.default.red('An error occurred:', error));
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
exports.main = main;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/common/base/args.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.baseAppPrompts = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A base set of CLI prompts for the app
|
|
6
|
-
*/
|
|
7
|
-
exports.baseAppPrompts = [];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseAppPrompts = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A base set of CLI prompts for the app
|
|
6
|
+
*/
|
|
7
|
+
exports.baseAppPrompts = [];
|
package/dist/common/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lintFix = exports.installPackages = exports.nextSteps = exports.transform = exports.removeFile = exports.getAllTemplates = exports.writeJsonFile = exports.openJsonFile = exports.isDevEnvironment = exports.baseAppPrompts = void 0;
|
|
4
|
-
var prompts_1 = require("./base/prompts");
|
|
5
|
-
Object.defineProperty(exports, "baseAppPrompts", { enumerable: true, get: function () { return prompts_1.baseAppPrompts; } });
|
|
6
|
-
var helpers_1 = require("./utils/helpers");
|
|
7
|
-
Object.defineProperty(exports, "isDevEnvironment", { enumerable: true, get: function () { return helpers_1.isDevEnvironment; } });
|
|
8
|
-
Object.defineProperty(exports, "openJsonFile", { enumerable: true, get: function () { return helpers_1.openJsonFile; } });
|
|
9
|
-
Object.defineProperty(exports, "writeJsonFile", { enumerable: true, get: function () { return helpers_1.writeJsonFile; } });
|
|
10
|
-
Object.defineProperty(exports, "getAllTemplates", { enumerable: true, get: function () { return helpers_1.getAllTemplates; } });
|
|
11
|
-
Object.defineProperty(exports, "removeFile", { enumerable: true, get: function () { return helpers_1.removeFile; } });
|
|
12
|
-
var transform_1 = require("./processes/transform");
|
|
13
|
-
Object.defineProperty(exports, "transform", { enumerable: true, get: function () { return transform_1.transform; } });
|
|
14
|
-
var next_1 = require("./processes/next");
|
|
15
|
-
Object.defineProperty(exports, "nextSteps", { enumerable: true, get: function () { return next_1.nextSteps; } });
|
|
16
|
-
var install_1 = require("./processes/install");
|
|
17
|
-
Object.defineProperty(exports, "installPackages", { enumerable: true, get: function () { return install_1.installPackages; } });
|
|
18
|
-
Object.defineProperty(exports, "lintFix", { enumerable: true, get: function () { return install_1.lintFix; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lintFix = exports.installPackages = exports.nextSteps = exports.transform = exports.removeFile = exports.getAllTemplates = exports.writeJsonFile = exports.openJsonFile = exports.isDevEnvironment = exports.baseAppPrompts = void 0;
|
|
4
|
+
var prompts_1 = require("./base/prompts");
|
|
5
|
+
Object.defineProperty(exports, "baseAppPrompts", { enumerable: true, get: function () { return prompts_1.baseAppPrompts; } });
|
|
6
|
+
var helpers_1 = require("./utils/helpers");
|
|
7
|
+
Object.defineProperty(exports, "isDevEnvironment", { enumerable: true, get: function () { return helpers_1.isDevEnvironment; } });
|
|
8
|
+
Object.defineProperty(exports, "openJsonFile", { enumerable: true, get: function () { return helpers_1.openJsonFile; } });
|
|
9
|
+
Object.defineProperty(exports, "writeJsonFile", { enumerable: true, get: function () { return helpers_1.writeJsonFile; } });
|
|
10
|
+
Object.defineProperty(exports, "getAllTemplates", { enumerable: true, get: function () { return helpers_1.getAllTemplates; } });
|
|
11
|
+
Object.defineProperty(exports, "removeFile", { enumerable: true, get: function () { return helpers_1.removeFile; } });
|
|
12
|
+
var transform_1 = require("./processes/transform");
|
|
13
|
+
Object.defineProperty(exports, "transform", { enumerable: true, get: function () { return transform_1.transform; } });
|
|
14
|
+
var next_1 = require("./processes/next");
|
|
15
|
+
Object.defineProperty(exports, "nextSteps", { enumerable: true, get: function () { return next_1.nextSteps; } });
|
|
16
|
+
var install_1 = require("./processes/install");
|
|
17
|
+
Object.defineProperty(exports, "installPackages", { enumerable: true, get: function () { return install_1.installPackages; } });
|
|
18
|
+
Object.defineProperty(exports, "lintFix", { enumerable: true, get: function () { return install_1.lintFix; } });
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.lintFix = exports.installPackages = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const cmd_1 = require("../utils/cmd");
|
|
10
|
-
const helpers_1 = require("../utils/helpers");
|
|
11
|
-
/**
|
|
12
|
-
* Executes packages installation, depending on the environment
|
|
13
|
-
* @param {string} projectFolder path to the app folder
|
|
14
|
-
* @param {boolean} [silent] suppress logs
|
|
15
|
-
*/
|
|
16
|
-
const installPackages = (projectFolder, silent) => {
|
|
17
|
-
silent || console.log(chalk_1.default.cyan('Installing packages...'));
|
|
18
|
-
if ((0, helpers_1.isDevEnvironment)(projectFolder)) {
|
|
19
|
-
silent || console.log(chalk_1.default.yellow('Detected development environment.'));
|
|
20
|
-
(0, cmd_1.run)('yarn', ['install'], {
|
|
21
|
-
cwd: projectFolder,
|
|
22
|
-
encoding: 'utf8',
|
|
23
|
-
env: Object.assign(Object.assign({}, process.env), { NODE_NO_WARNINGS: '1' }),
|
|
24
|
-
}, silent);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
(0, cmd_1.run)('npm', ['install', '--loglevel=error'], {
|
|
28
|
-
cwd: projectFolder,
|
|
29
|
-
encoding: 'utf8',
|
|
30
|
-
}, silent);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
exports.installPackages = installPackages;
|
|
34
|
-
/**
|
|
35
|
-
* Fixes possible linting issues
|
|
36
|
-
* @param {string} projectFolder path to the app folder
|
|
37
|
-
* @param {boolean} [silent] suppress logs
|
|
38
|
-
*/
|
|
39
|
-
const lintFix = (projectFolder, silent) => {
|
|
40
|
-
var _a;
|
|
41
|
-
const pkg = getPackageJson(projectFolder);
|
|
42
|
-
if (!((_a = pkg === null || pkg === void 0 ? void 0 : pkg.scripts) === null || _a === void 0 ? void 0 : _a.lint)) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
silent || console.log(chalk_1.default.cyan('Linting app...'));
|
|
46
|
-
(0, cmd_1.run)('npm', ['run', 'lint', '--', '--fix'], {
|
|
47
|
-
cwd: projectFolder,
|
|
48
|
-
encoding: 'utf8',
|
|
49
|
-
}, silent);
|
|
50
|
-
};
|
|
51
|
-
exports.lintFix = lintFix;
|
|
52
|
-
const getPackageJson = (projectFolder) => {
|
|
53
|
-
const packagePath = path_1.default.join(projectFolder, 'package.json');
|
|
54
|
-
return (0, helpers_1.openJsonFile)(packagePath);
|
|
55
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.lintFix = exports.installPackages = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const cmd_1 = require("../utils/cmd");
|
|
10
|
+
const helpers_1 = require("../utils/helpers");
|
|
11
|
+
/**
|
|
12
|
+
* Executes packages installation, depending on the environment
|
|
13
|
+
* @param {string} projectFolder path to the app folder
|
|
14
|
+
* @param {boolean} [silent] suppress logs
|
|
15
|
+
*/
|
|
16
|
+
const installPackages = (projectFolder, silent) => {
|
|
17
|
+
silent || console.log(chalk_1.default.cyan('Installing packages...'));
|
|
18
|
+
if ((0, helpers_1.isDevEnvironment)(projectFolder)) {
|
|
19
|
+
silent || console.log(chalk_1.default.yellow('Detected development environment.'));
|
|
20
|
+
(0, cmd_1.run)('yarn', ['install'], {
|
|
21
|
+
cwd: projectFolder,
|
|
22
|
+
encoding: 'utf8',
|
|
23
|
+
env: Object.assign(Object.assign({}, process.env), { NODE_NO_WARNINGS: '1' }),
|
|
24
|
+
}, silent);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
(0, cmd_1.run)('npm', ['install', '--loglevel=error'], {
|
|
28
|
+
cwd: projectFolder,
|
|
29
|
+
encoding: 'utf8',
|
|
30
|
+
}, silent);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.installPackages = installPackages;
|
|
34
|
+
/**
|
|
35
|
+
* Fixes possible linting issues
|
|
36
|
+
* @param {string} projectFolder path to the app folder
|
|
37
|
+
* @param {boolean} [silent] suppress logs
|
|
38
|
+
*/
|
|
39
|
+
const lintFix = (projectFolder, silent) => {
|
|
40
|
+
var _a;
|
|
41
|
+
const pkg = getPackageJson(projectFolder);
|
|
42
|
+
if (!((_a = pkg === null || pkg === void 0 ? void 0 : pkg.scripts) === null || _a === void 0 ? void 0 : _a.lint)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
silent || console.log(chalk_1.default.cyan('Linting app...'));
|
|
46
|
+
(0, cmd_1.run)('npm', ['run', 'lint', '--', '--fix'], {
|
|
47
|
+
cwd: projectFolder,
|
|
48
|
+
encoding: 'utf8',
|
|
49
|
+
}, silent);
|
|
50
|
+
};
|
|
51
|
+
exports.lintFix = lintFix;
|
|
52
|
+
const getPackageJson = (projectFolder) => {
|
|
53
|
+
const packagePath = path_1.default.join(projectFolder, 'package.json');
|
|
54
|
+
return (0, helpers_1.openJsonFile)(packagePath);
|
|
55
|
+
};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.nextSteps = void 0;
|
|
16
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
-
/**
|
|
18
|
-
* Logs app creation completion message and next steps
|
|
19
|
-
* @param {string} appName application name for the new app
|
|
20
|
-
* @param {string} nextStepsText next steps to be performed after app is created
|
|
21
|
-
*/
|
|
22
|
-
const nextSteps = (appName, nextStepsText) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
const successMessage = `Content SDK application ${chalk_1.default.green(appName)} is ready!`;
|
|
24
|
-
console.log(chalk_1.default.red(' -/oyhdmNNNNmdhyo/- '));
|
|
25
|
-
console.log(chalk_1.default.red(' :sdMMMMMMMMMMMMMMMMMMMMds: '));
|
|
26
|
-
console.log(chalk_1.default.red(' :yNMMMMMMMMMMMMMMMMMMMMMMMMMMNy: '));
|
|
27
|
-
console.log(chalk_1.default.red(' /mMMMMMMMMMNdyo+//://+shmMMMMMMMMMm/ '));
|
|
28
|
-
console.log(chalk_1.default.red(' :mMMMMMMMMh+. `:smMMMMMMMm: '));
|
|
29
|
-
console.log(chalk_1.default.red(' `yMMMMMMMm+` :yMMMMMMMs` '));
|
|
30
|
-
console.log(chalk_1.default.red(' `dMMMMMMN/ .hMMMMMMd` '));
|
|
31
|
-
console.log(chalk_1.default.red(' `mMMMMMMh` -s/+MMMMMMd` '));
|
|
32
|
-
console.log(chalk_1.default.red(' yMMMMMMh `:yNMMMs/MMMMMMy '));
|
|
33
|
-
console.log(chalk_1.default.red(' :MMMMMMm` `hMMMMMMMsoMMMMMM-'));
|
|
34
|
-
console.log(chalk_1.default.red(' yMMMMMM/ dMMMMMMM:mMMMMMy'));
|
|
35
|
-
console.log(chalk_1.default.red(' NMMMMMN` oMyossss:sMMMMMm'));
|
|
36
|
-
console.log(chalk_1.default.red(' MMMMMMN yM:NMMMMyoMMMMMN'));
|
|
37
|
-
console.log(chalk_1.default.red(' mMMMMMM` :Md+MMMMMoyMMMMMm'));
|
|
38
|
-
console.log(chalk_1.default.red(' yMMMMMM+ :NN+NMMMMM-NMMMMMy'));
|
|
39
|
-
console.log(chalk_1.default.red(' :MMMMMMN:- `sMdyMNymMMosMMMMMM-'));
|
|
40
|
-
console.log(chalk_1.default.red(' yMMMMMMd/o` .oNdhmMhhMmh++MMMMMMy '));
|
|
41
|
-
console.log(chalk_1.default.red(' `dMMMMMMm+do.- ./oyhhhNNhyNMMNosMMMMMMd` '));
|
|
42
|
-
console.log(chalk_1.default.red(' `dMMMMMMMssNdhsoo+/+oyyyydMmhhhMMMNs+mMMMMMMd` '));
|
|
43
|
-
console.log(chalk_1.default.red(' `yMMMMMMMNyydMNddddddddddhmMMMMho+dMMMMMMMy` '));
|
|
44
|
-
console.log(chalk_1.default.red(' :mMMMMMMMMmhhhdNMMMMMMMMmhssohMMMMMMMMm: '));
|
|
45
|
-
console.log(chalk_1.default.red(' /mMMMMMMMMMMNdhyyyyyyyhmMMMMMMMMMMm/ '));
|
|
46
|
-
console.log(chalk_1.default.red(' :yNMMMMMMMMMMMMMMMMMMMMMMMMMMNy: '));
|
|
47
|
-
console.log(chalk_1.default.red(' :sdMMMMMMMMMMMMMMMMMMMMds: '));
|
|
48
|
-
console.log(chalk_1.default.red(' `-/oyhdmNNNNmdhyo/- '));
|
|
49
|
-
console.log();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.nextSteps = void 0;
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
/**
|
|
18
|
+
* Logs app creation completion message and next steps
|
|
19
|
+
* @param {string} appName application name for the new app
|
|
20
|
+
* @param {string} nextStepsText next steps to be performed after app is created
|
|
21
|
+
*/
|
|
22
|
+
const nextSteps = (appName, nextStepsText) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const successMessage = `Content SDK application ${chalk_1.default.green(appName)} is ready!`;
|
|
24
|
+
console.log(chalk_1.default.red(' -/oyhdmNNNNmdhyo/- '));
|
|
25
|
+
console.log(chalk_1.default.red(' :sdMMMMMMMMMMMMMMMMMMMMds: '));
|
|
26
|
+
console.log(chalk_1.default.red(' :yNMMMMMMMMMMMMMMMMMMMMMMMMMMNy: '));
|
|
27
|
+
console.log(chalk_1.default.red(' /mMMMMMMMMMNdyo+//://+shmMMMMMMMMMm/ '));
|
|
28
|
+
console.log(chalk_1.default.red(' :mMMMMMMMMh+. `:smMMMMMMMm: '));
|
|
29
|
+
console.log(chalk_1.default.red(' `yMMMMMMMm+` :yMMMMMMMs` '));
|
|
30
|
+
console.log(chalk_1.default.red(' `dMMMMMMN/ .hMMMMMMd` '));
|
|
31
|
+
console.log(chalk_1.default.red(' `mMMMMMMh` -s/+MMMMMMd` '));
|
|
32
|
+
console.log(chalk_1.default.red(' yMMMMMMh `:yNMMMs/MMMMMMy '));
|
|
33
|
+
console.log(chalk_1.default.red(' :MMMMMMm` `hMMMMMMMsoMMMMMM-'));
|
|
34
|
+
console.log(chalk_1.default.red(' yMMMMMM/ dMMMMMMM:mMMMMMy'));
|
|
35
|
+
console.log(chalk_1.default.red(' NMMMMMN` oMyossss:sMMMMMm'));
|
|
36
|
+
console.log(chalk_1.default.red(' MMMMMMN yM:NMMMMyoMMMMMN'));
|
|
37
|
+
console.log(chalk_1.default.red(' mMMMMMM` :Md+MMMMMoyMMMMMm'));
|
|
38
|
+
console.log(chalk_1.default.red(' yMMMMMM+ :NN+NMMMMM-NMMMMMy'));
|
|
39
|
+
console.log(chalk_1.default.red(' :MMMMMMN:- `sMdyMNymMMosMMMMMM-'));
|
|
40
|
+
console.log(chalk_1.default.red(' yMMMMMMd/o` .oNdhmMhhMmh++MMMMMMy '));
|
|
41
|
+
console.log(chalk_1.default.red(' `dMMMMMMm+do.- ./oyhhhNNhyNMMNosMMMMMMd` '));
|
|
42
|
+
console.log(chalk_1.default.red(' `dMMMMMMMssNdhsoo+/+oyyyydMmhhhMMMNs+mMMMMMMd` '));
|
|
43
|
+
console.log(chalk_1.default.red(' `yMMMMMMMNyydMNddddddddddhmMMMMho+dMMMMMMMy` '));
|
|
44
|
+
console.log(chalk_1.default.red(' :mMMMMMMMMmhhhdNMMMMMMMMmhssohMMMMMMMMm: '));
|
|
45
|
+
console.log(chalk_1.default.red(' /mMMMMMMMMMMNdhyyyyyyyhmMMMMMMMMMMm/ '));
|
|
46
|
+
console.log(chalk_1.default.red(' :yNMMMMMMMMMMMMMMMMMMMMMMMMMMNy: '));
|
|
47
|
+
console.log(chalk_1.default.red(' :sdMMMMMMMMMMMMMMMMMMMMds: '));
|
|
48
|
+
console.log(chalk_1.default.red(' `-/oyhdmNNNNmdhyo/- '));
|
|
49
|
+
console.log();
|
|
50
50
|
console.log(chalk_1.default.white(`
|
|
51
51
|
____ ___ _ _ _____ _____ _ _ _____ ____ ____ _ __
|
|
52
52
|
/ ___/ _ \\| \\ | |_ _| ____| \\ | |_ _| / ___|| _ \\| |/ /
|
|
53
53
|
| | | | | | \\| | | | | _| | \\| | | |____\\___ \\| | | | ' /
|
|
54
54
|
| |__| |_| | |\\ | | | | |___| |\\ | | |_____|__) | |_| | . \\
|
|
55
55
|
\\____\\___/|_| \\_| |_| |_____|_| \\_| |_| |____/|____/|_|\\_\\
|
|
56
|
-
`));
|
|
57
|
-
console.log();
|
|
58
|
-
console.log(successMessage);
|
|
59
|
-
console.log();
|
|
60
|
-
console.log(chalk_1.default.yellow('Next steps:'));
|
|
61
|
-
if (nextStepsText) {
|
|
62
|
-
console.log(nextStepsText);
|
|
63
|
-
}
|
|
64
|
-
console.log('* Enable source control (i.e. git init) (optional)');
|
|
65
|
-
console.log('* Check out the Content SDK documentation at https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html');
|
|
66
|
-
console.log();
|
|
67
|
-
console.log(chalk_1.default.green('Enjoy!'));
|
|
68
|
-
});
|
|
69
|
-
exports.nextSteps = nextSteps;
|
|
56
|
+
`));
|
|
57
|
+
console.log();
|
|
58
|
+
console.log(successMessage);
|
|
59
|
+
console.log();
|
|
60
|
+
console.log(chalk_1.default.yellow('Next steps:'));
|
|
61
|
+
if (nextStepsText) {
|
|
62
|
+
console.log(nextStepsText);
|
|
63
|
+
}
|
|
64
|
+
console.log('* Enable source control (i.e. git init) (optional)');
|
|
65
|
+
console.log('* Check out the Content SDK documentation at https://doc.sitecore.com/xmc/en/developers/content-sdk/index.html');
|
|
66
|
+
console.log();
|
|
67
|
+
console.log(chalk_1.default.green('Enjoy!'));
|
|
68
|
+
});
|
|
69
|
+
exports.nextSteps = nextSteps;
|