create-content-sdk-app 1.3.0-canary.7 → 1.3.0
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/.cursor/rules/general.mdc +81 -81
- package/dist/templates/nextjs/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs/.cursor/rules/project-setup.mdc +100 -100
- package/dist/templates/nextjs/.cursor/rules/sitecore.mdc +147 -147
- package/dist/templates/nextjs/.env.container.example +27 -27
- package/dist/templates/nextjs/.env.remote.example +45 -44
- package/dist/templates/nextjs/.gitattributes +11 -11
- package/dist/templates/nextjs/.prettierrc +8 -8
- package/dist/templates/nextjs/.vscode/extensions.json +8 -8
- package/dist/templates/nextjs/.vscode/launch.json +15 -15
- package/dist/templates/nextjs/.windsurfrules +183 -183
- package/dist/templates/nextjs/CLAUDE.md +170 -170
- package/dist/templates/nextjs/LICENSE.txt +202 -202
- package/dist/templates/nextjs/LLMs.txt +179 -179
- package/dist/templates/nextjs/README.md +7 -7
- package/dist/templates/nextjs/copilot-instructions.md +170 -170
- package/dist/templates/nextjs/eslint.config.mjs +81 -81
- package/dist/templates/nextjs/gitignore +28 -28
- package/dist/templates/nextjs/package.json +68 -68
- package/dist/templates/nextjs/sitecore.config.ts.example +38 -38
- package/dist/templates/nextjs/src/middleware.ts +16 -7
- package/dist/templates/nextjs/tsconfig.json +40 -40
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/app-router-setup.mdc +116 -116
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/general.mdc +80 -80
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/javascript.mdc +112 -112
- package/dist/templates/nextjs-app-router (beta)/.cursor/rules/sitecore.mdc +171 -171
- package/dist/templates/nextjs-app-router (beta)/.env.container.example +27 -27
- package/dist/templates/nextjs-app-router (beta)/.env.remote.example +45 -44
- package/dist/templates/nextjs-app-router (beta)/.gitattributes +11 -11
- package/dist/templates/nextjs-app-router (beta)/.sitecore/import-map.server.ts +60 -0
- package/dist/templates/nextjs-app-router (beta)/.windsurfrules +287 -287
- package/dist/templates/nextjs-app-router (beta)/CLAUDE.md +271 -271
- package/dist/templates/nextjs-app-router (beta)/LLMs.txt +236 -236
- 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)/eslint.config.mjs +29 -29
- package/dist/templates/nextjs-app-router (beta)/gitignore +31 -29
- package/dist/templates/nextjs-app-router (beta)/package.json +54 -54
- package/dist/templates/nextjs-app-router (beta)/postcss.config.mjs +5 -5
- package/dist/templates/nextjs-app-router (beta)/sitecore.config.ts.example +38 -38
- 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/app/globals.css +1 -1
- package/dist/templates/nextjs-app-router (beta)/src/middleware.ts +12 -1
- package/dist/templates/nextjs-app-router (beta)/tsconfig.json +48 -48
- package/package.json +73 -74
- package/LICENSE.MD +0 -202
- 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/dist/initialize.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.getInitializer = exports.initialize = void 0;
|
|
49
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
50
|
-
const path_1 = __importStar(require("path"));
|
|
51
|
-
const common_1 = require("./common");
|
|
52
|
-
const initialize = (template, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
const initializer = yield (0, exports.getInitializer)(template);
|
|
54
|
-
args.silent || console.log(chalk_1.default.cyan(`Initializing '${template}'...`));
|
|
55
|
-
const response = yield initializer.init(args);
|
|
56
|
-
// final steps (install, lint)
|
|
57
|
-
if (!args.noInstall) {
|
|
58
|
-
(0, common_1.installPackages)(args.destination, args.silent);
|
|
59
|
-
(0, common_1.lintFix)(args.destination, args.silent);
|
|
60
|
-
}
|
|
61
|
-
if (!args.silent) {
|
|
62
|
-
const pkg = (0, common_1.openJsonFile)(path_1.default.resolve(`${args.destination}${path_1.sep}package.json`));
|
|
63
|
-
(0, common_1.nextSteps)(pkg.name, response.nextSteps);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
exports.initialize = initialize;
|
|
67
|
-
const getInitializer = (template) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
const { default: Initializer } = yield Promise.resolve(`${path_1.default.resolve(__dirname, 'initializers', template, 'index')}`).then(s => __importStar(require(s)));
|
|
69
|
-
return new Initializer();
|
|
70
|
-
});
|
|
71
|
-
exports.getInitializer = getInitializer;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.getInitializer = exports.initialize = void 0;
|
|
49
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
50
|
+
const path_1 = __importStar(require("path"));
|
|
51
|
+
const common_1 = require("./common");
|
|
52
|
+
const initialize = (template, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const initializer = yield (0, exports.getInitializer)(template);
|
|
54
|
+
args.silent || console.log(chalk_1.default.cyan(`Initializing '${template}'...`));
|
|
55
|
+
const response = yield initializer.init(args);
|
|
56
|
+
// final steps (install, lint)
|
|
57
|
+
if (!args.noInstall) {
|
|
58
|
+
(0, common_1.installPackages)(args.destination, args.silent);
|
|
59
|
+
(0, common_1.lintFix)(args.destination, args.silent);
|
|
60
|
+
}
|
|
61
|
+
if (!args.silent) {
|
|
62
|
+
const pkg = (0, common_1.openJsonFile)(path_1.default.resolve(`${args.destination}${path_1.sep}package.json`));
|
|
63
|
+
(0, common_1.nextSteps)(pkg.name, response.nextSteps);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
exports.initialize = initialize;
|
|
67
|
+
const getInitializer = (template) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const { default: Initializer } = yield Promise.resolve(`${path_1.default.resolve(__dirname, 'initializers', template, 'index')}`).then(s => __importStar(require(s)));
|
|
69
|
+
return new Initializer();
|
|
70
|
+
});
|
|
71
|
+
exports.getInitializer = getInitializer;
|
|
@@ -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,30 +1,30 @@
|
|
|
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
|
-
const path_1 = __importDefault(require("path"));
|
|
16
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
-
const prompts_1 = require("./prompts");
|
|
18
|
-
const common_1 = require("../../common");
|
|
19
|
-
class NextjsInitializer {
|
|
20
|
-
init(args) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const answers = yield inquirer_1.default.prompt(prompts_1.prompts, args);
|
|
23
|
-
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs');
|
|
24
|
-
yield (0, common_1.transform)(templatePath, Object.assign(Object.assign({}, args), answers));
|
|
25
|
-
const response = {};
|
|
26
|
-
return response;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = NextjsInitializer;
|
|
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
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
+
const prompts_1 = require("./prompts");
|
|
18
|
+
const common_1 = require("../../common");
|
|
19
|
+
class NextjsInitializer {
|
|
20
|
+
init(args) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const answers = yield inquirer_1.default.prompt(prompts_1.prompts, args);
|
|
23
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs');
|
|
24
|
+
yield (0, common_1.transform)(templatePath, Object.assign(Object.assign({}, args), answers));
|
|
25
|
+
const response = {};
|
|
26
|
+
return response;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = NextjsInitializer;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prompts = exports.Prerender = void 0;
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
var Prerender;
|
|
6
|
-
(function (Prerender) {
|
|
7
|
-
Prerender["SSG"] = "SSG";
|
|
8
|
-
Prerender["SSR"] = "SSR";
|
|
9
|
-
})(Prerender || (exports.Prerender = Prerender = {}));
|
|
10
|
-
const DEFAULT_PRERENDER = Prerender.SSG;
|
|
11
|
-
exports.prompts = [
|
|
12
|
-
...common_1.baseAppPrompts,
|
|
13
|
-
{
|
|
14
|
-
type: 'list',
|
|
15
|
-
name: 'prerender',
|
|
16
|
-
message: 'How would you like to prerender your application?',
|
|
17
|
-
choices: Object.values(Prerender),
|
|
18
|
-
default: DEFAULT_PRERENDER,
|
|
19
|
-
when: (answers) => {
|
|
20
|
-
if (answers.yes && !answers.prerender) {
|
|
21
|
-
answers.prerender = DEFAULT_PRERENDER;
|
|
22
|
-
}
|
|
23
|
-
return !answers.prerender;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prompts = exports.Prerender = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
var Prerender;
|
|
6
|
+
(function (Prerender) {
|
|
7
|
+
Prerender["SSG"] = "SSG";
|
|
8
|
+
Prerender["SSR"] = "SSR";
|
|
9
|
+
})(Prerender || (exports.Prerender = Prerender = {}));
|
|
10
|
+
const DEFAULT_PRERENDER = Prerender.SSG;
|
|
11
|
+
exports.prompts = [
|
|
12
|
+
...common_1.baseAppPrompts,
|
|
13
|
+
{
|
|
14
|
+
type: 'list',
|
|
15
|
+
name: 'prerender',
|
|
16
|
+
message: 'How would you like to prerender your application?',
|
|
17
|
+
choices: Object.values(Prerender),
|
|
18
|
+
default: DEFAULT_PRERENDER,
|
|
19
|
+
when: (answers) => {
|
|
20
|
+
if (answers.yes && !answers.prerender) {
|
|
21
|
+
answers.prerender = DEFAULT_PRERENDER;
|
|
22
|
+
}
|
|
23
|
+
return !answers.prerender;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
@@ -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,30 +1,30 @@
|
|
|
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
|
-
const path_1 = __importDefault(require("path"));
|
|
16
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
-
const prompts_1 = require("./prompts");
|
|
18
|
-
const common_1 = require("../../common");
|
|
19
|
-
class NextjsAppRouterInitializer {
|
|
20
|
-
init(args) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const answers = yield inquirer_1.default.prompt(prompts_1.prompts, args);
|
|
23
|
-
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-app-router (beta)');
|
|
24
|
-
yield (0, common_1.transform)(templatePath, Object.assign(Object.assign({}, args), answers));
|
|
25
|
-
const response = {};
|
|
26
|
-
return response;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = NextjsAppRouterInitializer;
|
|
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
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
17
|
+
const prompts_1 = require("./prompts");
|
|
18
|
+
const common_1 = require("../../common");
|
|
19
|
+
class NextjsAppRouterInitializer {
|
|
20
|
+
init(args) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const answers = yield inquirer_1.default.prompt(prompts_1.prompts, args);
|
|
23
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-app-router (beta)');
|
|
24
|
+
yield (0, common_1.transform)(templatePath, Object.assign(Object.assign({}, args), answers));
|
|
25
|
+
const response = {};
|
|
26
|
+
return response;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = NextjsAppRouterInitializer;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prompts = exports.Prerender = void 0;
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
var Prerender;
|
|
6
|
-
(function (Prerender) {
|
|
7
|
-
Prerender["SSG"] = "SSG";
|
|
8
|
-
Prerender["SSR"] = "SSR";
|
|
9
|
-
})(Prerender || (exports.Prerender = Prerender = {}));
|
|
10
|
-
const DEFAULT_PRERENDER = Prerender.SSG;
|
|
11
|
-
exports.prompts = [
|
|
12
|
-
...common_1.baseAppPrompts,
|
|
13
|
-
{
|
|
14
|
-
type: 'list',
|
|
15
|
-
name: 'prerender',
|
|
16
|
-
message: 'How would you like to prerender your application?',
|
|
17
|
-
choices: Object.values(Prerender),
|
|
18
|
-
default: DEFAULT_PRERENDER,
|
|
19
|
-
when: (answers) => {
|
|
20
|
-
if (answers.yes && !answers.prerender) {
|
|
21
|
-
answers.prerender = DEFAULT_PRERENDER;
|
|
22
|
-
}
|
|
23
|
-
return !answers.prerender;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prompts = exports.Prerender = void 0;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
var Prerender;
|
|
6
|
+
(function (Prerender) {
|
|
7
|
+
Prerender["SSG"] = "SSG";
|
|
8
|
+
Prerender["SSR"] = "SSR";
|
|
9
|
+
})(Prerender || (exports.Prerender = Prerender = {}));
|
|
10
|
+
const DEFAULT_PRERENDER = Prerender.SSG;
|
|
11
|
+
exports.prompts = [
|
|
12
|
+
...common_1.baseAppPrompts,
|
|
13
|
+
{
|
|
14
|
+
type: 'list',
|
|
15
|
+
name: 'prerender',
|
|
16
|
+
message: 'How would you like to prerender your application?',
|
|
17
|
+
choices: Object.values(Prerender),
|
|
18
|
+
default: DEFAULT_PRERENDER,
|
|
19
|
+
when: (answers) => {
|
|
20
|
+
if (answers.yes && !answers.prerender) {
|
|
21
|
+
answers.prerender = DEFAULT_PRERENDER;
|
|
22
|
+
}
|
|
23
|
+
return !answers.prerender;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Core coding principles for your Sitecore project
|
|
3
|
-
alwaysApply: true
|
|
4
|
-
globs: []
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# General Coding Principles
|
|
8
|
-
|
|
9
|
-
## Universal Standards
|
|
10
|
-
|
|
11
|
-
DRY Principle:
|
|
12
|
-
|
|
13
|
-
- Don't Repeat Yourself - extract common functionality
|
|
14
|
-
- Create reusable utilities and helper functions
|
|
15
|
-
- Use composition over inheritance
|
|
16
|
-
- Share types and interfaces across modules
|
|
17
|
-
|
|
18
|
-
SOLID Principles:
|
|
19
|
-
|
|
20
|
-
- Single Responsibility: each function/class has one purpose
|
|
21
|
-
- Open/Closed: extend functionality through composition
|
|
22
|
-
- Dependency Inversion: depend on abstractions, not implementations
|
|
23
|
-
|
|
24
|
-
Code Clarity:
|
|
25
|
-
|
|
26
|
-
- Write self-documenting code with clear intent
|
|
27
|
-
- Use meaningful names that express business concepts
|
|
28
|
-
- Prefer explicit over implicit behavior
|
|
29
|
-
- Make dependencies and requirements obvious
|
|
30
|
-
|
|
31
|
-
## Architecture Patterns
|
|
32
|
-
|
|
33
|
-
Modular Design:
|
|
34
|
-
|
|
35
|
-
- Organize code into focused, cohesive modules
|
|
36
|
-
- Minimize coupling between modules
|
|
37
|
-
- Use clear interfaces between layers
|
|
38
|
-
- Follow established patterns consistently
|
|
39
|
-
|
|
40
|
-
Data Flow:
|
|
41
|
-
|
|
42
|
-
- Prefer unidirectional data flow
|
|
43
|
-
- Validate inputs at system boundaries
|
|
44
|
-
- Transform data at appropriate layers
|
|
45
|
-
- Handle errors close to their source
|
|
46
|
-
|
|
47
|
-
Testing:
|
|
48
|
-
|
|
49
|
-
- Write testable code with minimal dependencies
|
|
50
|
-
- Use dependency injection for better testability
|
|
51
|
-
- Mock external services and side effects
|
|
52
|
-
- Test behavior, not implementation details
|
|
53
|
-
|
|
54
|
-
## Development Standards
|
|
55
|
-
|
|
56
|
-
Version Control:
|
|
57
|
-
|
|
58
|
-
- Write descriptive commit messages
|
|
59
|
-
- Keep commits focused and atomic
|
|
60
|
-
- Use branching strategies appropriate to team size
|
|
61
|
-
- Review code before merging
|
|
62
|
-
|
|
63
|
-
Documentation:
|
|
64
|
-
|
|
65
|
-
- Document public APIs and interfaces
|
|
66
|
-
- Include usage examples for complex functionality
|
|
67
|
-
- Keep documentation close to code
|
|
68
|
-
- Update documentation with code changes
|
|
69
|
-
|
|
70
|
-
Performance:
|
|
71
|
-
|
|
72
|
-
- Optimize for readability first, performance second
|
|
73
|
-
- Profile before optimizing
|
|
74
|
-
- Cache expensive operations appropriately
|
|
75
|
-
- Consider memory usage and cleanup
|
|
76
|
-
|
|
77
|
-
Referenced:
|
|
78
|
-
@src/components/
|
|
79
|
-
@src/lib/
|
|
80
|
-
@package.json
|
|
81
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Core coding principles for your Sitecore project
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
globs: []
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# General Coding Principles
|
|
8
|
+
|
|
9
|
+
## Universal Standards
|
|
10
|
+
|
|
11
|
+
DRY Principle:
|
|
12
|
+
|
|
13
|
+
- Don't Repeat Yourself - extract common functionality
|
|
14
|
+
- Create reusable utilities and helper functions
|
|
15
|
+
- Use composition over inheritance
|
|
16
|
+
- Share types and interfaces across modules
|
|
17
|
+
|
|
18
|
+
SOLID Principles:
|
|
19
|
+
|
|
20
|
+
- Single Responsibility: each function/class has one purpose
|
|
21
|
+
- Open/Closed: extend functionality through composition
|
|
22
|
+
- Dependency Inversion: depend on abstractions, not implementations
|
|
23
|
+
|
|
24
|
+
Code Clarity:
|
|
25
|
+
|
|
26
|
+
- Write self-documenting code with clear intent
|
|
27
|
+
- Use meaningful names that express business concepts
|
|
28
|
+
- Prefer explicit over implicit behavior
|
|
29
|
+
- Make dependencies and requirements obvious
|
|
30
|
+
|
|
31
|
+
## Architecture Patterns
|
|
32
|
+
|
|
33
|
+
Modular Design:
|
|
34
|
+
|
|
35
|
+
- Organize code into focused, cohesive modules
|
|
36
|
+
- Minimize coupling between modules
|
|
37
|
+
- Use clear interfaces between layers
|
|
38
|
+
- Follow established patterns consistently
|
|
39
|
+
|
|
40
|
+
Data Flow:
|
|
41
|
+
|
|
42
|
+
- Prefer unidirectional data flow
|
|
43
|
+
- Validate inputs at system boundaries
|
|
44
|
+
- Transform data at appropriate layers
|
|
45
|
+
- Handle errors close to their source
|
|
46
|
+
|
|
47
|
+
Testing:
|
|
48
|
+
|
|
49
|
+
- Write testable code with minimal dependencies
|
|
50
|
+
- Use dependency injection for better testability
|
|
51
|
+
- Mock external services and side effects
|
|
52
|
+
- Test behavior, not implementation details
|
|
53
|
+
|
|
54
|
+
## Development Standards
|
|
55
|
+
|
|
56
|
+
Version Control:
|
|
57
|
+
|
|
58
|
+
- Write descriptive commit messages
|
|
59
|
+
- Keep commits focused and atomic
|
|
60
|
+
- Use branching strategies appropriate to team size
|
|
61
|
+
- Review code before merging
|
|
62
|
+
|
|
63
|
+
Documentation:
|
|
64
|
+
|
|
65
|
+
- Document public APIs and interfaces
|
|
66
|
+
- Include usage examples for complex functionality
|
|
67
|
+
- Keep documentation close to code
|
|
68
|
+
- Update documentation with code changes
|
|
69
|
+
|
|
70
|
+
Performance:
|
|
71
|
+
|
|
72
|
+
- Optimize for readability first, performance second
|
|
73
|
+
- Profile before optimizing
|
|
74
|
+
- Cache expensive operations appropriately
|
|
75
|
+
- Consider memory usage and cleanup
|
|
76
|
+
|
|
77
|
+
Referenced:
|
|
78
|
+
@src/components/
|
|
79
|
+
@src/lib/
|
|
80
|
+
@package.json
|
|
81
|
+
|