create-sitecore-jss 22.3.0-canary.12 → 22.3.0-canary.14

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.
Files changed (33) hide show
  1. package/dist/InitializerFactory.js +2 -2
  2. package/dist/common/processes/transform.js +8 -8
  3. package/dist/common/prompts/base.js +1 -1
  4. package/dist/common/utils/helpers.js +1 -1
  5. package/dist/initializers/angular-sxp/index.js +1 -1
  6. package/dist/initializers/angular-xmcloud/index.js +1 -1
  7. package/dist/initializers/nextjs/prompts.js +1 -1
  8. package/dist/initializers/nextjs-multisite/index.js +1 -1
  9. package/dist/initializers/nextjs-styleguide/index.js +1 -1
  10. package/dist/initializers/nextjs-styleguide-tracking/index.js +1 -1
  11. package/dist/initializers/nextjs-sxa/index.js +1 -1
  12. package/dist/initializers/nextjs-xmcloud/index.js +1 -1
  13. package/dist/templates/angular/package.json +4 -4
  14. package/dist/templates/angular/src/tsconfig.app.json +1 -2
  15. package/dist/templates/angular/src/tsconfig.server.json +1 -2
  16. package/dist/templates/angular/tsconfig.json +1 -0
  17. package/dist/templates/nextjs/.eslintrc +6 -1
  18. package/dist/templates/nextjs/package.json +6 -6
  19. package/dist/templates/nextjs/scripts/config/index.ts +1 -1
  20. package/dist/templates/nextjs/scripts/config/plugins/scjssconfig.ts +1 -0
  21. package/dist/templates/nextjs/scripts/generate-component-builder/index.ts +1 -1
  22. package/dist/templates/nextjs/scripts/scaffold-component/index.ts +1 -1
  23. package/dist/templates/nextjs/scripts/utils.ts +1 -1
  24. package/dist/templates/nextjs/tsconfig.json +1 -0
  25. package/dist/templates/nextjs-styleguide/src/lib/sitemap-fetcher/plugins/disconnected-sitemap-service.ts +1 -1
  26. package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/content-styles.ts +1 -1
  27. package/dist/templates/node-headless-ssr-experience-edge/package.json +1 -1
  28. package/dist/templates/node-headless-ssr-proxy/package.json +2 -2
  29. package/dist/templates/node-xmcloud-proxy/package.json +1 -1
  30. package/dist/templates/react/.eslintrc +2 -0
  31. package/dist/templates/react/package.json +1 -1
  32. package/dist/templates/vue/package.json +1 -1
  33. package/package.json +9 -9
@@ -46,10 +46,10 @@ class InitializerFactory {
46
46
  }
47
47
  create(name) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
49
- var _a;
50
49
  try {
51
- const { default: Initializer } = yield (_a = path_1.default.resolve(this.rootPath, 'initializers', name, 'index'), Promise.resolve().then(() => __importStar(require(_a))));
50
+ const { default: Initializer } = yield Promise.resolve(`${path_1.default.resolve(this.rootPath, 'initializers', name, 'index')}`).then(s => __importStar(require(s)));
52
51
  return new Initializer();
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
53
  }
54
54
  catch (error) {
55
55
  return undefined;
@@ -151,7 +151,7 @@ const diffFiles = (sourceFileContent, targetFilePath) => __awaiter(void 0, void
151
151
  return answer.choice;
152
152
  });
153
153
  exports.diffFiles = diffFiles;
154
- const diffAndWriteFiles = ({ rendered, pathToNewFile, answers, }) => __awaiter(void 0, void 0, void 0, function* () {
154
+ const diffAndWriteFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ rendered, pathToNewFile, answers, }) {
155
155
  const targetFilePath = (0, exports.transformFilename)(pathToNewFile, answers);
156
156
  const choice = yield (0, exports.diffFiles)(rendered, targetFilePath);
157
157
  switch (choice) {
@@ -192,17 +192,17 @@ const populateEjsData = (answers, destination) => {
192
192
  exports.populateEjsData = populateEjsData;
193
193
  /**
194
194
  * Handles each template file and applies ejs renderer, also:
195
- * * determines files for copy
196
- * * determines files for skip
197
- * * if some files already exist:
198
- * * merges package.json files
199
- * * concatenates .env files
200
- * * compares diffs
195
+ * - Determines files for copy.
196
+ * - Determines files for skip.
197
+ * if some files already exist:
198
+ * - merges package.json files
199
+ * - concatenates .env files
200
+ * - compares diffs
201
201
  * @param {string} templatePath path to the template
202
202
  * @param {BaseArgs} answers CLI arguments
203
203
  * @param {TransformOptions} options custom options
204
204
  */
205
- const transform = (templatePath, answers, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
205
+ const transform = (templatePath_1, answers_1, ...args_1) => __awaiter(void 0, [templatePath_1, answers_1, ...args_1], void 0, function* (templatePath, answers, options = {}) {
206
206
  const { isFileForCopy, isFileForSkip, fileForCopyRegExp = FILE_FOR_COPY_REGEXP } = options;
207
207
  const destinationPath = path_1.default.resolve(answers.destination);
208
208
  if (!answers.appPrefix) {
@@ -9,7 +9,7 @@ var FetchWith;
9
9
  (function (FetchWith) {
10
10
  FetchWith["GraphQL"] = "GraphQL";
11
11
  FetchWith["REST"] = "REST";
12
- })(FetchWith = exports.FetchWith || (exports.FetchWith = {}));
12
+ })(FetchWith || (exports.FetchWith = FetchWith = {}));
13
13
  /**
14
14
  * Default app name for the new app
15
15
  */
@@ -90,7 +90,7 @@ const openJsonFile = (jsonFilePath) => {
90
90
  exports.openJsonFile = openJsonFile;
91
91
  /**
92
92
  * Creates a .json file and inserts provided data
93
- * @param {Object} data data to be written into the .json file
93
+ * @param {object} data data to be written into the .json file
94
94
  * @param {string} jsonFilePath a path to a file.
95
95
  */
96
96
  const writeJsonFile = (data, jsonFilePath) => {
@@ -43,8 +43,8 @@ class AngularSxpInitializer {
43
43
  return false;
44
44
  }
45
45
  init(args) {
46
- var _a, _b;
47
46
  return __awaiter(this, void 0, void 0, function* () {
47
+ var _a, _b;
48
48
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
49
49
  const answers = yield inquirer_1.default.prompt(common_1.sxpPrompts, args);
50
50
  const styleguideAnswers = yield inquirer_1.default.prompt(common_1.styleguidePrompts, args);
@@ -45,8 +45,8 @@ class AngularXmCloudInitializer {
45
45
  return false;
46
46
  }
47
47
  init(args) {
48
- var _a, _b, _c, _d;
49
48
  return __awaiter(this, void 0, void 0, function* () {
49
+ var _a, _b, _c, _d;
50
50
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
51
51
  const addInitializers = [];
52
52
  // angular-xmcloud requires node-xmcloud-proxy
@@ -10,7 +10,7 @@ var Prerender;
10
10
  (function (Prerender) {
11
11
  Prerender["SSG"] = "SSG";
12
12
  Prerender["SSR"] = "SSR";
13
- })(Prerender = exports.Prerender || (exports.Prerender = {}));
13
+ })(Prerender || (exports.Prerender = Prerender = {}));
14
14
  const DEFAULT_PRERENDER = Prerender.SSG;
15
15
  // still need sxp prompts here until sitecore/config is no longer added to xmc app
16
16
  exports.prompts = [
@@ -39,8 +39,8 @@ class NextjsMultisiteInitializer {
39
39
  return false;
40
40
  }
41
41
  init(args) {
42
- var _a, _b;
43
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ var _a, _b;
44
44
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
45
45
  const mergedArgs = Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false });
46
46
  const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-multisite');
@@ -44,8 +44,8 @@ class NextjsStyleguideInitializer {
44
44
  return false;
45
45
  }
46
46
  init(args) {
47
- var _a, _b;
48
47
  return __awaiter(this, void 0, void 0, function* () {
48
+ var _a, _b;
49
49
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
50
50
  const answers = yield inquirer_1.default.prompt(common_1.styleguidePrompts, args);
51
51
  const mergedArgs = Object.assign(Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false }), answers);
@@ -39,8 +39,8 @@ class NextjsStyleguideInitializer {
39
39
  return false;
40
40
  }
41
41
  init(args) {
42
- var _a, _b, _c, _d, _e, _f;
43
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ var _a, _b, _c, _d, _e, _f;
44
44
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
45
45
  const mergedArgs = Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false });
46
46
  const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-styleguide-tracking');
@@ -39,8 +39,8 @@ class NextjsSxaInitializer {
39
39
  return false;
40
40
  }
41
41
  init(args) {
42
- var _a, _b, _c, _d;
43
42
  return __awaiter(this, void 0, void 0, function* () {
43
+ var _a, _b, _c, _d;
44
44
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
45
45
  // TODO: prompts for SXA
46
46
  // const answers = await prompt<StyleguideAnswer>(styleguidePrompts, args);
@@ -40,8 +40,8 @@ class NextjsXMCloudInitializer {
40
40
  return false;
41
41
  }
42
42
  init(args) {
43
- var _a, _b, _c, _d;
44
43
  return __awaiter(this, void 0, void 0, function* () {
44
+ var _a, _b, _c, _d;
45
45
  const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
46
46
  const mergedArgs = Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false });
47
47
  const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-xmcloud');
@@ -83,9 +83,9 @@
83
83
  "@sitecore-jss/sitecore-jss-dev-tools": "~22.3.0-canary",
84
84
  "@types/jasmine": "~3.6.7",
85
85
  "@types/jasminewd2": "~2.0.8",
86
- "@types/node": "~20.14.10",
87
- "@typescript-eslint/eslint-plugin": "^7.16.0",
88
- "@typescript-eslint/parser": "^7.16.0",
86
+ "@types/node": "~22.9.0",
87
+ "@typescript-eslint/eslint-plugin": "^8.14.0",
88
+ "@typescript-eslint/parser": "^8.14.0",
89
89
  "chalk": "~4.1.0",
90
90
  "chokidar": "^3.5.2",
91
91
  "codelyzer": "~6.0.1",
@@ -110,6 +110,6 @@
110
110
  "npm-run-all": "~4.1.5",
111
111
  "protractor": "^7.0.0",
112
112
  "ts-node": "~10.9.2",
113
- "typescript": "~5.2.2"
113
+ "typescript": "~5.4.0"
114
114
  }
115
115
  }
@@ -3,8 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "../out-tsc/app",
5
5
  "baseUrl": "./",
6
- "newLine": "LF",
7
- "types": []
6
+ "newLine": "LF"
8
7
  },
9
8
  "lib": [
10
9
  "esnext.asynciterable"
@@ -5,8 +5,7 @@
5
5
  "baseUrl": "./",
6
6
  "target": "ES2022",
7
7
  "module": "commonjs",
8
- "newLine": "LF",
9
- "types": []
8
+ "newLine": "LF"
10
9
  },
11
10
  "lib": [
12
11
  "esnext.asynciterable"
@@ -20,6 +20,7 @@
20
20
  "noUnusedLocals": true,
21
21
  "noUnusedParameters": true,
22
22
  "newLine": "LF",
23
+ "types": ["node"],
23
24
  "typeRoots": ["node_modules/@types"],
24
25
  "lib": ["es2018", "dom", "esnext.asynciterable"],
25
26
  "paths": {
@@ -19,7 +19,12 @@
19
19
  "@next/next/no-img-element": "off", // Don't force next/image
20
20
  "jsx-a11y/alt-text": ["warn", { "elements": ["img"] }], // Don't force alt for <Image/> (sourced from Sitecore media)
21
21
  "no-unused-vars": "off",
22
- "@typescript-eslint/no-unused-vars": "error",
22
+ "@typescript-eslint/no-unused-vars": [
23
+ "error",
24
+ {
25
+ "caughtErrorsIgnorePattern": "."
26
+ }
27
+ ],
23
28
  "@typescript-eslint/no-explicit-any": "error",
24
29
  "jsx-quotes": ["error", "prefer-double"]
25
30
  }
@@ -28,7 +28,7 @@
28
28
  "@sitecore-jss/sitecore-jss-nextjs": "~22.3.0-canary",
29
29
  "graphql": "~15.8.0",
30
30
  "graphql-tag": "^2.12.6",
31
- "next": "^14.2.7",
31
+ "next": "^14.2.18",
32
32
  "next-localization": "^0.12.0",
33
33
  "react": "^18.2.0",
34
34
  "react-dom": "^18.2.0",
@@ -45,17 +45,17 @@
45
45
  "@graphql-typed-document-node/core": "^3.2.0",
46
46
  "@sitecore-jss/sitecore-jss-cli": "~22.3.0-canary",
47
47
  "@sitecore-jss/sitecore-jss-dev-tools": "~22.3.0-canary",
48
- "@types/node": "^20.14.2",
48
+ "@types/node": "^22.9.0",
49
49
  "@types/react": "^18.2.22",
50
50
  "@types/react-dom": "^18.0.5",
51
- "@typescript-eslint/eslint-plugin": "^5.49.0",
52
- "@typescript-eslint/parser": "^5.49.0",
51
+ "@typescript-eslint/eslint-plugin": "^8.14.0",
52
+ "@typescript-eslint/parser": "^8.14.0",
53
53
  "chalk": "~4.1.2",
54
54
  "chokidar": "~3.5.3",
55
55
  "constant-case": "^3.0.4",
56
56
  "cross-env": "~7.0.3",
57
57
  "dotenv-flow": "^4.1.0",
58
- "eslint": "^8.32.0",
58
+ "eslint": "^8.56.0",
59
59
  "eslint-config-next": "^13.1.5",
60
60
  "eslint-config-prettier": "^8.6.0",
61
61
  "eslint-plugin-prettier": "^4.2.1",
@@ -66,7 +66,7 @@
66
66
  "prettier": "^2.8.3",
67
67
  "ts-node": "^10.9.1",
68
68
  "tsconfig-paths": "^4.1.2",
69
- "typescript": "~4.9.4",
69
+ "typescript": "~5.4.0",
70
70
  "yaml-loader": "^0.8.0"
71
71
  },
72
72
  "scripts": {
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/no-var-requires
1
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
2
2
  const plugins = require('scripts/temp/config-plugins');
3
3
  import { JssConfig } from 'lib/config';
4
4
 
@@ -12,6 +12,7 @@ class ScJssConfigPlugin implements ConfigPlugin {
12
12
  async exec(config: JssConfig) {
13
13
  let scJssConfig;
14
14
  try {
15
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
15
16
  scJssConfig = require('scjssconfig.json');
16
17
  } catch (e) {
17
18
  return config;
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line @typescript-eslint/no-var-requires
1
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
2
2
  const plugins = require('scripts/temp/generate-component-builder-plugins');
3
3
  import { PackageDefinition, ComponentFile } from '@sitecore-jss/sitecore-jss-dev-tools';
4
4
 
@@ -23,7 +23,7 @@ generatePlugins({
23
23
  Edit this script if you wish to use your own conventions for component storage in your JSS app.
24
24
  */
25
25
 
26
- // eslint-disable-next-line @typescript-eslint/no-var-requires
26
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
27
27
  const plugins = require('scripts/temp/scaffold-component-plugins');
28
28
 
29
29
  export interface ScaffoldComponentPluginConfig {
@@ -40,7 +40,7 @@ export function getItems<Item>(settings: {
40
40
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
41
41
  const name = item.name.match(fileFormat)![1];
42
42
  items.push(resolveItem(path, name));
43
- cb && cb(name);
43
+ if (cb) cb(name);
44
44
  }
45
45
  });
46
46
 
@@ -10,6 +10,7 @@
10
10
  "react": ["node_modules/react"]
11
11
  },
12
12
  "target": "es5",
13
+ "types": ["node"],
13
14
  "lib": ["dom", "dom.iterable", "esnext"],
14
15
  "allowJs": true,
15
16
  "skipLibCheck": true,
@@ -19,7 +19,7 @@ class DisconnectedSitemapServicePlugin implements SitemapFetcherPlugin {
19
19
  if (process.env.JSS_MODE !== constants.JSS_MODE.DISCONNECTED) return null;
20
20
 
21
21
  try {
22
- // eslint-disable-next-line @typescript-eslint/no-var-requires
22
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
23
23
  const manifest = require('sitecore/manifest/sitecore-import.json');
24
24
 
25
25
  return manifest;
@@ -14,7 +14,7 @@ class ContentStylesPlugin implements Plugin {
14
14
  config.sitecoreEdgeUrl
15
15
  );
16
16
 
17
- contentStyles && props.headLinks.push(contentStyles);
17
+ if (contentStyles) props.headLinks.push(contentStyles);
18
18
 
19
19
  return props;
20
20
  }
@@ -28,7 +28,7 @@
28
28
  "@types/compression": "^1.7.2",
29
29
  "@types/express": "^4.17.17",
30
30
  "ts-node": "^10.9.1",
31
- "typescript": "~4.9.5"
31
+ "typescript": "~5.6.3"
32
32
  },
33
33
  "private": true
34
34
  }
@@ -31,9 +31,9 @@
31
31
  "@types/compression": "^1.7.2",
32
32
  "@types/express": "^4.17.17",
33
33
  "@types/memory-cache": "^0.2.2",
34
- "@types/node": "^20.14.2",
34
+ "@types/node": "^22.9.0",
35
35
  "ts-node": "^10.9.1",
36
- "typescript": "~4.9.5"
36
+ "typescript": "~5.6.3"
37
37
  },
38
38
  "private": true
39
39
  }
@@ -21,6 +21,6 @@
21
21
  "@types/compression": "^1.7.2",
22
22
  "@types/express": "^4.17.17",
23
23
  "ts-node": "^10.9.1",
24
- "typescript": "~4.9.5"
24
+ "typescript": "~5.6.3"
25
25
  }
26
26
  }
@@ -14,6 +14,8 @@
14
14
  "ecmaFeatures": {
15
15
  "jsx": true
16
16
  },
17
+ //prevent 'ImportDeclaration should appear when the mode is ES6' error when running lint
18
+ "ecmaVersion": 13,
17
19
  "babelOptions": {
18
20
  "presets": ["@babel/preset-react"]
19
21
  }
@@ -64,7 +64,7 @@
64
64
  "cross-spawn": "^7.0.3",
65
65
  "del-cli": "^5.0.0",
66
66
  "dotenv": "^16.0.3",
67
- "eslint": "^8.28.0",
67
+ "eslint": "^8.56.0",
68
68
  "eslint-config-prettier": "^8.5.0",
69
69
  "eslint-plugin-import": "^2.26.0",
70
70
  "eslint-plugin-prettier": "^4.2.1",
@@ -74,7 +74,7 @@
74
74
  "constant-case": "^3.0.4",
75
75
  "cross-env": "~7.0.3",
76
76
  "dotenv": "^16.0.3",
77
- "eslint": "^8.32.0",
77
+ "eslint": "^8.56.0",
78
78
  "eslint-plugin-prettier": "^5.0.0",
79
79
  "eslint-plugin-vue": "~9.9.0",
80
80
  "eslint-plugin-yaml": "^0.5.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sitecore-jss",
3
- "version": "22.3.0-canary.12",
3
+ "version": "22.3.0-canary.14",
4
4
  "description": "Sitecore JSS initializer",
5
5
  "bin": "./dist/index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  "coverage": "nyc npm test"
13
13
  },
14
14
  "engines": {
15
- "node": ">=20"
15
+ "node": ">=22"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
@@ -49,19 +49,19 @@
49
49
  "@types/inquirer": "^9.0.3",
50
50
  "@types/minimist": "^1.2.2",
51
51
  "@types/mocha": "^10.0.1",
52
- "@types/node": "^20.14.2",
53
- "@types/sinon": "10.0.6",
54
- "@types/sinon-chai": "^3.2.9",
52
+ "@types/node": "^22.9.0",
53
+ "@types/sinon": "17.0.3",
54
+ "@types/sinon-chai": "^4.0.0",
55
55
  "chai": "^4.3.7",
56
56
  "chokidar": "^3.5.3",
57
57
  "del-cli": "^5.0.0",
58
- "eslint": "^8.32.0",
58
+ "eslint": "^8.56.0",
59
59
  "mocha": "^10.2.0",
60
60
  "nyc": "^15.1.0",
61
- "sinon": "^15.0.1",
61
+ "sinon": "^18.0.0",
62
62
  "sinon-chai": "^3.7.0",
63
63
  "ts-node": "^10.9.1",
64
- "typescript": "~4.9.5"
64
+ "typescript": "~5.6.3"
65
65
  },
66
- "gitHead": "5a151c7d8a44adf6c7fc3c389d57712558a450aa"
66
+ "gitHead": "dd85f30b4ef0381291b94d869d56b7929ab9ba85"
67
67
  }