create-sitecore-jss 20.0.0-canary.78
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/LICENSE.MD +202 -0
- package/dist/InitializerFactory.js +49 -0
- package/dist/common/Initializer.js +2 -0
- package/dist/common/args/base.js +2 -0
- package/dist/common/args/styleguide.js +2 -0
- package/dist/common/prompts/base.js +40 -0
- package/dist/common/prompts/styleguide.js +28 -0
- package/dist/common/steps/index.js +13 -0
- package/dist/common/steps/install.js +46 -0
- package/dist/common/steps/next.js +60 -0
- package/dist/common/steps/transform.js +185 -0
- package/dist/common/utils/cmd.js +39 -0
- package/dist/common/utils/helpers.js +92 -0
- package/dist/index.js +91 -0
- package/dist/init-runner.js +50 -0
- package/dist/initializers/nextjs/args.js +2 -0
- package/dist/initializers/nextjs/index.js +65 -0
- package/dist/initializers/nextjs/prompts.js +19 -0
- package/dist/initializers/nextjs/remove-dev-dependencies.js +24 -0
- package/dist/initializers/nextjs-styleguide/index.js +49 -0
- package/dist/templates/nextjs/.env +49 -0
- package/dist/templates/nextjs/.eslintrc +25 -0
- package/dist/templates/nextjs/.gitattributes +11 -0
- package/dist/templates/nextjs/.gitignore +33 -0
- package/dist/templates/nextjs/.graphql-let.yml +10 -0
- package/dist/templates/nextjs/.prettierignore +1 -0
- package/dist/templates/nextjs/.prettierrc +8 -0
- package/dist/templates/nextjs/LICENSE.txt +202 -0
- package/dist/templates/nextjs/README.md +3 -0
- package/dist/templates/nextjs/next-env.d.ts +6 -0
- package/dist/templates/nextjs/next.config.js +56 -0
- package/dist/templates/nextjs/package.json +88 -0
- package/dist/templates/nextjs/public/favicon.ico +0 -0
- package/dist/templates/nextjs/public/sc_logo.svg +20 -0
- package/dist/templates/nextjs/scripts/bootstrap.ts +40 -0
- package/dist/templates/nextjs/scripts/fetch-graphql-introspection-data.ts +49 -0
- package/dist/templates/nextjs/scripts/generate-component-factory.ts +95 -0
- package/dist/templates/nextjs/scripts/generate-config.ts +85 -0
- package/dist/templates/nextjs/scripts/generate-plugins.ts +103 -0
- package/dist/templates/nextjs/scripts/scaffold-component.ts +89 -0
- package/dist/templates/nextjs/scripts/templates/component-factory.ts +119 -0
- package/dist/templates/nextjs/scripts/templates/component-src.ts +27 -0
- package/dist/templates/nextjs/scripts/utils.ts +59 -0
- package/dist/templates/nextjs/sitecore/config/{{appName}}.config +151 -0
- package/dist/templates/nextjs/src/Layout.tsx +53 -0
- package/dist/templates/nextjs/src/Navigation.tsx +27 -0
- package/dist/templates/nextjs/src/NotFound.tsx +19 -0
- package/dist/templates/nextjs/src/assets/app.css +28 -0
- package/dist/templates/nextjs/src/components/ContentBlock.tsx +24 -0
- package/dist/templates/nextjs/src/lib/component-props/index.ts +23 -0
- package/dist/templates/nextjs/src/lib/data-fetcher.ts +16 -0
- package/dist/templates/nextjs/src/lib/dictionary-service-factory.ts +30 -0
- package/dist/templates/nextjs/src/lib/layout-service-factory.ts +25 -0
- package/dist/templates/nextjs/src/lib/next-config/plugins/graphql.js +32 -0
- package/dist/templates/nextjs/src/lib/next-config/plugins/monorepo.js +27 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/index.ts +50 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/plugins/componentProps.ts +38 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/plugins/normalMode.ts +75 -0
- package/dist/templates/nextjs/src/lib/page-props-factory/plugins/previewMode.ts +27 -0
- package/dist/templates/nextjs/src/lib/page-props.ts +16 -0
- package/dist/templates/nextjs/src/lib/sitemap-fetcher/index.ts +25 -0
- package/dist/templates/nextjs/src/lib/sitemap-fetcher/plugins/graphqlSitemapService.ts +36 -0
- package/dist/templates/nextjs/src/pages/404.tsx +5 -0
- package/dist/templates/nextjs/src/pages/[[...path]].tsx +91 -0
- package/dist/templates/nextjs/src/pages/_app.tsx +19 -0
- package/dist/templates/nextjs/src/pages/_error.tsx +35 -0
- package/dist/templates/nextjs/src/pages/api/editing/data/[key].ts +24 -0
- package/dist/templates/nextjs/src/pages/api/editing/render.ts +30 -0
- package/dist/templates/nextjs/src/temp/.gitignore +3 -0
- package/dist/templates/nextjs/src/temp/GraphQLIntrospectionResult.json +22216 -0
- package/dist/templates/nextjs/tsconfig.json +42 -0
- package/dist/templates/nextjs/tsconfig.scripts.json +6 -0
- package/dist/templates/nextjs-styleguide/data/component-content/.gitignore +0 -0
- package/dist/templates/nextjs-styleguide/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +9 -0
- package/dist/templates/nextjs-styleguide/data/content/.gitignore +0 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ContentListField/Item1/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ContentListField/Item2/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ItemLinkField/Item1/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/content/Styleguide/ItemLinkField/Item2/en.yml +6 -0
- package/dist/templates/nextjs-styleguide/data/dictionary/en.yml +4 -0
- package/dist/templates/nextjs-styleguide/data/dictionary/{{language}}.yml +4 -0
- package/dist/templates/nextjs-styleguide/data/media/files/jss.pdf +0 -0
- package/dist/templates/nextjs-styleguide/data/media/img/jss_logo.png +0 -0
- package/dist/templates/nextjs-styleguide/data/media/img/sc_logo.png +0 -0
- package/dist/templates/nextjs-styleguide/data/routes/en.yml +63 -0
- package/dist/templates/nextjs-styleguide/data/routes/graphql/en.yml +27 -0
- package/dist/templates/nextjs-styleguide/data/routes/graphql/sample-1/en.yml +9 -0
- package/dist/templates/nextjs-styleguide/data/routes/graphql/sample-2/en.yml +9 -0
- package/dist/templates/nextjs-styleguide/data/routes/styleguide/custom-route-type/en.yml +12 -0
- package/dist/templates/nextjs-styleguide/data/routes/styleguide/en.yml +246 -0
- package/dist/templates/nextjs-styleguide/data/routes/styleguide/{{language}}.yml +25 -0
- package/dist/templates/nextjs-styleguide/data/routes/{{language}}.yml +4 -0
- package/dist/templates/nextjs-styleguide/package.json +13 -0
- package/dist/templates/nextjs-styleguide/scripts/disconnected-mode-proxy.ts +48 -0
- package/dist/templates/nextjs-styleguide/scripts/scaffold-component.ts +130 -0
- package/dist/templates/nextjs-styleguide/scripts/templates/component-manifest.ts +30 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/component-content.sitecore.ts +117 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/ContentBlock.sitecore.ts +19 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Checkbox.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-ContentList.sitecore.ts +32 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Custom.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Date.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-File.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Image.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-ItemLink.sitecore.ts +32 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Link.sitecore.ts +25 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Number.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-RichText.sitecore.ts +28 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/fields/Styleguide-FieldUsage-Text.sitecore.ts +28 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-ConnectedDemo.sitecore.ts +18 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-IntegratedDemo.sitecore.graphql +71 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-IntegratedDemo.sitecore.ts +25 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/graphql/GraphQL-Layout.sitecore.ts +15 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-ComponentParams.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-CustomRouteType.sitecore.ts +31 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout-Reuse.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout-Tabs-Tab.sitecore.ts +23 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout-Tabs.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Layout.sitecore.ts +15 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Multilingual.sitecore.ts +26 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-RouteFields.sitecore.ts +22 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Section.sitecore.ts +16 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-SitecoreContext.sitecore.ts +19 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/components/styleguide/Styleguide-Tracking.sitecore.ts +19 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/config.js +5 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/content.sitecore.ts +117 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/dictionary.sitecore.ts +52 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/placeholders.sitecore.ts +21 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/routes.sitecore.ts +88 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/templates/Styleguide-ContentList-Template.sitecore.ts +12 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +20 -0
- package/dist/templates/nextjs-styleguide/sitecore/definitions/templates/Styleguide-ItemLink-Template.sitecore.ts +13 -0
- package/dist/templates/nextjs-styleguide/src/Navigation.tsx +41 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Checkbox.tsx +52 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-ContentList.tsx +58 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Custom.tsx +25 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Date.tsx +55 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-File.tsx +30 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Image.tsx +58 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-ItemLink.tsx +50 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Link.tsx +46 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Number.tsx +34 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-RichText.tsx +35 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Text.tsx +43 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-ConnectedDemo.dynamic.graphql +69 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-ConnectedDemo.dynamic.tsx +148 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-IntegratedDemo.tsx +130 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-Layout.tsx +37 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-ComponentParams.tsx +47 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-CustomRouteType.tsx +37 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Reuse.tsx +45 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs-Tab.tsx +41 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs.tsx +111 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout.tsx +68 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Multilingual.tsx +50 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-RouteFields.tsx +37 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Section.tsx +22 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-SitecoreContext.tsx +25 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Specimen.tsx +41 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Tracking.tsx +341 -0
- package/dist/templates/nextjs-styleguide/src/lib/component-props/styleguide.ts +11 -0
- package/dist/templates/nextjs-styleguide/src/lib/next-config/plugins/disconnected.js +43 -0
- package/dist/templates/nextjs-styleguide/src/lib/next-config/plugins/styleguide.js +10 -0
- package/dist/templates/nextjs-styleguide/src/lib/sitemap-fetcher/plugins/disconnectedSitemapService.ts +46 -0
- package/dist/templates/nextjs-styleguide/src/pages/_app.tsx +33 -0
- package/package.json +61 -0
|
@@ -0,0 +1,39 @@
|
|
|
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.spawnFunc = exports.run = void 0;
|
|
7
|
+
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
8
|
+
/**
|
|
9
|
+
* @param command
|
|
10
|
+
* @param args
|
|
11
|
+
* @param options
|
|
12
|
+
*/
|
|
13
|
+
const run = (command, args, options, silent) => {
|
|
14
|
+
silent || console.log(`> ${command} ${args.join(' ')}`);
|
|
15
|
+
exports.spawnFunc(command, args, options);
|
|
16
|
+
};
|
|
17
|
+
exports.run = run;
|
|
18
|
+
/**
|
|
19
|
+
* @param {string} command
|
|
20
|
+
* @param {string[]} args
|
|
21
|
+
* @param {SpawnSyncOptionsWithStringEncoding} options
|
|
22
|
+
*/
|
|
23
|
+
const spawnFunc = (command, args, options) => {
|
|
24
|
+
const result = cross_spawn_1.default.sync(command, args, Object.assign({ stdio: 'inherit' }, options));
|
|
25
|
+
if (result.signal === 'SIGKILL') {
|
|
26
|
+
console.log('The operation failed because the process exited too early. ' +
|
|
27
|
+
'This probably means the system ran out of memory or someone called ' +
|
|
28
|
+
'`kill -9` on the process.');
|
|
29
|
+
}
|
|
30
|
+
else if (result.signal === 'SIGTERM') {
|
|
31
|
+
console.log('The operation failed because the process exited too early. ' +
|
|
32
|
+
'Someone might have called `kill` or `killall`, or the system could ' +
|
|
33
|
+
'be shutting down.');
|
|
34
|
+
}
|
|
35
|
+
if (result.status && result.status > 0) {
|
|
36
|
+
process.exit(result.status);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.spawnFunc = spawnFunc;
|
|
@@ -0,0 +1,92 @@
|
|
|
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.writeFileToPath = exports.getAppPrefix = exports.getBaseTemplates = exports.sortKeys = exports.writePackageJson = exports.openPackageJson = exports.getPascalCaseName = exports.isDevEnvironment = exports.isJssApp = void 0;
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const InitializerFactory_1 = require("../../InitializerFactory");
|
|
20
|
+
const isJssApp = (template, pkg) => {
|
|
21
|
+
var _a;
|
|
22
|
+
if (((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.sitecoreConfigPath) === undefined) {
|
|
23
|
+
console.log(chalk_1.default.red(`Error: Could not add ${chalk_1.default.yellow(template)} to the current project because it is not a JSS app.`));
|
|
24
|
+
console.log(chalk_1.default.magenta(`${chalk_1.default.yellow('*')} Make sure the path to your JSS app is passed in with the ${chalk_1.default.cyan('--destination flag')}, or is the cwd.`));
|
|
25
|
+
console.log(chalk_1.default.magenta(`${chalk_1.default.yellow('*')} Check that the ${chalk_1.default.cyan('sitecoreConfigPath')} property exists in the ${chalk_1.default.cyan('package.json')}`));
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
};
|
|
30
|
+
exports.isJssApp = isJssApp;
|
|
31
|
+
const isDevEnvironment = (cwd) => {
|
|
32
|
+
const currentPath = path_1.default.resolve(cwd || process.cwd());
|
|
33
|
+
// TODO: is there a better way to detect this?
|
|
34
|
+
const lernaPath = path_1.default.join(currentPath, '..', '..');
|
|
35
|
+
return fs_1.default.existsSync(path_1.default.join(lernaPath, 'lerna.json'));
|
|
36
|
+
};
|
|
37
|
+
exports.isDevEnvironment = isDevEnvironment;
|
|
38
|
+
const getPascalCaseName = (name) => {
|
|
39
|
+
// handle underscores by converting them to hyphens
|
|
40
|
+
const temp = name.replace(/_/g, '-').split('-');
|
|
41
|
+
name = temp.map((item) => (item = item.charAt(0).toUpperCase() + item.slice(1))).join('');
|
|
42
|
+
return name;
|
|
43
|
+
};
|
|
44
|
+
exports.getPascalCaseName = getPascalCaseName;
|
|
45
|
+
const openPackageJson = (pkgPath) => {
|
|
46
|
+
const filePath = path_1.default.resolve(pkgPath !== null && pkgPath !== void 0 ? pkgPath : './package.json');
|
|
47
|
+
try {
|
|
48
|
+
const data = fs_1.default.readFileSync(filePath, 'utf8');
|
|
49
|
+
return data ? JSON.parse(data) : undefined;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.log(chalk_1.default.red(`The following error occurred while trying to read ${filePath}:`));
|
|
53
|
+
console.log(chalk_1.default.red(error));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.openPackageJson = openPackageJson;
|
|
57
|
+
const writePackageJson = (object, pkgPath) => {
|
|
58
|
+
const filePath = path_1.default.resolve(pkgPath !== null && pkgPath !== void 0 ? pkgPath : './package.json');
|
|
59
|
+
try {
|
|
60
|
+
fs_1.default.writeFileSync(filePath, JSON.stringify(object, null, 2), { encoding: 'utf8' });
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.log(chalk_1.default.red(`The following error occurred while trying to write ${filePath}:`));
|
|
64
|
+
console.log(chalk_1.default.red(error));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.writePackageJson = writePackageJson;
|
|
68
|
+
const sortKeys = (obj) => {
|
|
69
|
+
const sorted = {};
|
|
70
|
+
Object.keys(obj)
|
|
71
|
+
.sort()
|
|
72
|
+
.forEach((key) => (sorted[key] = obj[key]));
|
|
73
|
+
return sorted;
|
|
74
|
+
};
|
|
75
|
+
exports.sortKeys = sortKeys;
|
|
76
|
+
const getBaseTemplates = (templatePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
+
const templates = fs_1.default.readdirSync(templatePath, 'utf8');
|
|
78
|
+
const initFactory = new InitializerFactory_1.InitializerFactory();
|
|
79
|
+
const baseTemplates = [];
|
|
80
|
+
for (const template of templates) {
|
|
81
|
+
const res = yield initFactory.create(template);
|
|
82
|
+
(res === null || res === void 0 ? void 0 : res.isBase) && baseTemplates.push(template);
|
|
83
|
+
}
|
|
84
|
+
return baseTemplates;
|
|
85
|
+
});
|
|
86
|
+
exports.getBaseTemplates = getBaseTemplates;
|
|
87
|
+
const getAppPrefix = (appPrefix, appName) => appPrefix ? `${exports.getPascalCaseName(appName)}-` : '';
|
|
88
|
+
exports.getAppPrefix = getAppPrefix;
|
|
89
|
+
const writeFileToPath = (destinationPath, content) => {
|
|
90
|
+
fs_1.default.writeFileSync(destinationPath, content, 'utf8');
|
|
91
|
+
};
|
|
92
|
+
exports.writeFileToPath = writeFileToPath;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
+
const inquirer_1 = require("inquirer");
|
|
20
|
+
const init_runner_1 = require("./init-runner");
|
|
21
|
+
const minimist_1 = __importDefault(require("minimist"));
|
|
22
|
+
const helpers_1 = require("./common/utils/helpers");
|
|
23
|
+
// parse any command line arguments passed into `init sitecore-jss`
|
|
24
|
+
// to pass to the generator prompts and skip them.
|
|
25
|
+
// useful for CI and testing purposes
|
|
26
|
+
const argv = minimist_1.default(process.argv.slice(2), {
|
|
27
|
+
boolean: ['appPrefix', 'force', 'noInstall', 'yes'],
|
|
28
|
+
});
|
|
29
|
+
const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
var _a;
|
|
31
|
+
let templates = [];
|
|
32
|
+
// check if templates were provided
|
|
33
|
+
if (argv._.length > 0 && argv._[0] !== undefined) {
|
|
34
|
+
// use positional parameter
|
|
35
|
+
templates = [argv._[0]];
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// use --templates arg
|
|
39
|
+
templates = ((_a = argv.templates) === null || _a === void 0 ? void 0 : _a.split(',')) || [];
|
|
40
|
+
}
|
|
41
|
+
const baseTemplates = yield helpers_1.getBaseTemplates(path_1.default.resolve(__dirname, 'templates'));
|
|
42
|
+
// validate/gather templates
|
|
43
|
+
if (!templates.length) {
|
|
44
|
+
const answer = yield inquirer_1.prompt({
|
|
45
|
+
type: 'list',
|
|
46
|
+
name: 'template',
|
|
47
|
+
message: 'Which templates would you like to create?',
|
|
48
|
+
choices: baseTemplates,
|
|
49
|
+
default: 'nextjs',
|
|
50
|
+
});
|
|
51
|
+
templates.push(answer.template);
|
|
52
|
+
}
|
|
53
|
+
// validate/gather destination
|
|
54
|
+
const defaultDestination = `${process.cwd()}${argv.appName ? '\\' + argv.appName : `\\${templates[0]}`}`;
|
|
55
|
+
let destination = argv.destination;
|
|
56
|
+
if (!destination) {
|
|
57
|
+
if (argv.yes) {
|
|
58
|
+
destination = defaultDestination;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const answer = yield inquirer_1.prompt({
|
|
62
|
+
type: 'input',
|
|
63
|
+
name: 'destination',
|
|
64
|
+
message: 'Where would you like your new app created?',
|
|
65
|
+
default: () => defaultDestination,
|
|
66
|
+
});
|
|
67
|
+
destination = answer.destination;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!argv.force && fs_1.default.existsSync(destination) && fs_1.default.readdirSync(destination).length > 0) {
|
|
71
|
+
const answer = yield inquirer_1.prompt({
|
|
72
|
+
type: 'confirm',
|
|
73
|
+
name: 'continue',
|
|
74
|
+
message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
|
|
75
|
+
});
|
|
76
|
+
if (!answer.continue) {
|
|
77
|
+
process.exit();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
argv.force = true;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
yield init_runner_1.initRunner(templates, Object.assign(Object.assign({}, argv), { destination, templates }));
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.log(chalk_1.default.red('An error occurred: ', error));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
main();
|
|
@@ -0,0 +1,50 @@
|
|
|
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.initRunner = void 0;
|
|
16
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
17
|
+
const steps_1 = require("./common/steps");
|
|
18
|
+
const InitializerFactory_1 = require("./InitializerFactory");
|
|
19
|
+
const initRunner = (initializers, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
let nextStepsArr = [];
|
|
21
|
+
let appName;
|
|
22
|
+
const initFactory = new InitializerFactory_1.InitializerFactory();
|
|
23
|
+
const runner = (inits) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
var _a;
|
|
25
|
+
for (const init of inits) {
|
|
26
|
+
const initializer = yield initFactory.create(init);
|
|
27
|
+
if (!initializer) {
|
|
28
|
+
throw new RangeError(`Unknown template '${init}'`);
|
|
29
|
+
}
|
|
30
|
+
args.silent || console.log(chalk_1.default.cyan(`Initializing '${init}'...`));
|
|
31
|
+
const response = yield initializer.init(args);
|
|
32
|
+
appName = response.appName;
|
|
33
|
+
nextStepsArr = [...nextStepsArr, ...((_a = response.nextSteps) !== null && _a !== void 0 ? _a : [])];
|
|
34
|
+
// process any (post) initializers
|
|
35
|
+
if (response.initializers && response.initializers.length > 0) {
|
|
36
|
+
yield runner(response.initializers);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
yield runner(initializers);
|
|
41
|
+
// final steps (install, lint, etc)
|
|
42
|
+
if (!args.noInstall) {
|
|
43
|
+
steps_1.installPackages(args.destination, args.silent);
|
|
44
|
+
steps_1.lintFix(args.destination, args.silent);
|
|
45
|
+
}
|
|
46
|
+
if (!args.silent) {
|
|
47
|
+
steps_1.nextSteps(appName || '', nextStepsArr);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
exports.initRunner = initRunner;
|
|
@@ -0,0 +1,65 @@
|
|
|
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 chalk_1 = __importDefault(require("chalk"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const inquirer_1 = require("inquirer");
|
|
18
|
+
const prompts_1 = require("./prompts");
|
|
19
|
+
const steps_1 = require("../../common/steps");
|
|
20
|
+
const helpers_1 = require("../../common/utils/helpers");
|
|
21
|
+
const remove_dev_dependencies_1 = require("./remove-dev-dependencies");
|
|
22
|
+
const base_1 = require("../../common/prompts/base");
|
|
23
|
+
class NextjsInitializer {
|
|
24
|
+
get isBase() {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
init(args) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const defaults = args.yes
|
|
30
|
+
? {
|
|
31
|
+
appName: 'sitecore-jss-nextjs',
|
|
32
|
+
fetchWith: base_1.FetchWith.GraphQL,
|
|
33
|
+
prerender: prompts_1.Prerender.SSG,
|
|
34
|
+
hostName: 'https://cm.jss.localhost',
|
|
35
|
+
appPrefix: false,
|
|
36
|
+
}
|
|
37
|
+
: {};
|
|
38
|
+
const answers = yield inquirer_1.prompt(prompts_1.prompts, Object.assign(Object.assign({}, defaults), args));
|
|
39
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs');
|
|
40
|
+
yield steps_1.transform(templatePath, Object.assign(Object.assign({}, args), answers));
|
|
41
|
+
if (!helpers_1.isDevEnvironment(args.destination)) {
|
|
42
|
+
remove_dev_dependencies_1.removeDevDependencies(args.destination);
|
|
43
|
+
}
|
|
44
|
+
let postInitializers = [];
|
|
45
|
+
// don't prompt for post-initializers if they've already specified
|
|
46
|
+
// multiple via --templates (assume they know what they're doing)
|
|
47
|
+
if (args.templates.length === 1) {
|
|
48
|
+
const postInitAnswer = yield inquirer_1.prompt({
|
|
49
|
+
type: 'checkbox',
|
|
50
|
+
name: 'postInitializers',
|
|
51
|
+
message: 'Would you like to add any post-initializers?',
|
|
52
|
+
choices: ['nextjs-styleguide'],
|
|
53
|
+
});
|
|
54
|
+
postInitializers = postInitAnswer.postInitializers;
|
|
55
|
+
}
|
|
56
|
+
const response = {
|
|
57
|
+
nextSteps: [`* Connect to Sitecore with ${chalk_1.default.green('jss setup')} (optional)`],
|
|
58
|
+
appName: answers.appName,
|
|
59
|
+
initializers: postInitializers,
|
|
60
|
+
};
|
|
61
|
+
return response;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.default = NextjsInitializer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prompts = exports.Prerender = void 0;
|
|
4
|
+
const base_1 = require("../../common/prompts/base");
|
|
5
|
+
var Prerender;
|
|
6
|
+
(function (Prerender) {
|
|
7
|
+
Prerender["SSG"] = "SSG";
|
|
8
|
+
Prerender["SSR"] = "SSR";
|
|
9
|
+
})(Prerender = exports.Prerender || (exports.Prerender = {}));
|
|
10
|
+
exports.prompts = [
|
|
11
|
+
...base_1.clientAppPrompts,
|
|
12
|
+
{
|
|
13
|
+
type: 'list',
|
|
14
|
+
name: 'prerender',
|
|
15
|
+
message: 'How would you like to prerender your application?',
|
|
16
|
+
choices: Object.values(Prerender),
|
|
17
|
+
default: Prerender.SSG,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
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.removeDevDependencies = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const helpers_1 = require("../../common/utils/helpers");
|
|
10
|
+
const removeDevDependencies = (projectPath) => {
|
|
11
|
+
// remove `next-transpile-modules` dependency
|
|
12
|
+
const packagePath = path_1.default.join(projectPath, 'package.json');
|
|
13
|
+
const pkg = helpers_1.openPackageJson(packagePath);
|
|
14
|
+
if (pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies['next-transpile-modules']) {
|
|
15
|
+
delete pkg.devDependencies['next-transpile-modules'];
|
|
16
|
+
helpers_1.writePackageJson(pkg, packagePath);
|
|
17
|
+
}
|
|
18
|
+
// remove monorepo next.config.js plugin
|
|
19
|
+
const monorepoPlugin = path_1.default.join(projectPath, 'src/lib/next-config/plugins/monorepo.js');
|
|
20
|
+
if (fs_1.default.existsSync(monorepoPlugin)) {
|
|
21
|
+
fs_1.default.unlinkSync(monorepoPlugin);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.removeDevDependencies = removeDevDependencies;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 chalk_1 = __importDefault(require("chalk"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const inquirer_1 = require("inquirer");
|
|
18
|
+
const helpers_1 = require("../../common/utils/helpers");
|
|
19
|
+
const index_1 = require("../../common/steps/index");
|
|
20
|
+
const styleguide_1 = require("../../common/prompts/styleguide");
|
|
21
|
+
class NextjsStyleguideInitializer {
|
|
22
|
+
get isBase() {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
init(args) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const pkg = helpers_1.openPackageJson(`${args.destination}\\package.json`);
|
|
29
|
+
if (!args.force && !helpers_1.isJssApp('nextjs-styleguide', pkg)) {
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const defaults = args.yes ? { language: '' } : {};
|
|
33
|
+
const styleguideAnswers = yield inquirer_1.prompt(styleguide_1.styleguidePrompts, defaults);
|
|
34
|
+
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) || 'default', appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false }), styleguideAnswers);
|
|
35
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-styleguide');
|
|
36
|
+
yield index_1.transform(templatePath, mergedArgs, {
|
|
37
|
+
filter: (filePath) => {
|
|
38
|
+
return !!mergedArgs.language || !filePath.endsWith('{{language}}.yml');
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const response = {
|
|
42
|
+
nextSteps: [`* Try out your application with ${chalk_1.default.green('jss start')}`],
|
|
43
|
+
appName: mergedArgs.appName,
|
|
44
|
+
};
|
|
45
|
+
return response;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = NextjsStyleguideInitializer;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# For development purposes, note Next.js supports a .env.local
|
|
2
|
+
# file, which is already configured to be git ignored.
|
|
3
|
+
# Read more about Next.js support of environment variables here:
|
|
4
|
+
# https://nextjs.org/docs/basic-features/environment-variables
|
|
5
|
+
|
|
6
|
+
# The public URL to use for absolute URLs, which are required when
|
|
7
|
+
# the Next.js app is run within the Sitecore Experience Editor.
|
|
8
|
+
# This should match the `serverSideRenderingEngineApplicationUrl`
|
|
9
|
+
# in your Sitecore configuration (see \sitecore\config\<%- appName %>.config).
|
|
10
|
+
# Be sure to update these values accordingly as your public endpoint changes.
|
|
11
|
+
# See https://jss.sitecore.com/docs/fundamentals/services/view-engine
|
|
12
|
+
PUBLIC_URL=http://localhost:3000
|
|
13
|
+
|
|
14
|
+
# To secure the Experience Editor endpoint exposed by your Next.js app
|
|
15
|
+
# (`/api/editing/render` by default), a secret token is used. This (client-side)
|
|
16
|
+
# value must match your server-side value (see \sitecore\config\<%- appName %>.config).
|
|
17
|
+
# We recommend an alphanumeric value of at least 16 characters.
|
|
18
|
+
JSS_EDITING_SECRET=
|
|
19
|
+
|
|
20
|
+
# Your Sitecore API key is needed to build the app. Typically, the API key is
|
|
21
|
+
# defined in `scjssconfig.json` (as `sitecore.apiKey`). This file may not exist
|
|
22
|
+
# when building locally (if you've never run `jss setup`), or when building in a
|
|
23
|
+
# higher environment (since `scjssconfig.json` is ignored from source control).
|
|
24
|
+
# In this case, use this environment variable to provide the value at build time.
|
|
25
|
+
SITECORE_API_KEY=
|
|
26
|
+
|
|
27
|
+
# Your Sitecore API hostname is needed to build the app. Typically, the API host is
|
|
28
|
+
# defined in `scjssconfig.json` (as `sitecore.layoutServiceHost`). This file may
|
|
29
|
+
# not exist when building locally (if you've never run `jss setup`), or when building
|
|
30
|
+
# in a higher environment (since `scjssconfig.json` is ignored from source control).
|
|
31
|
+
# In this case, use this environment variable to provide the value at build time.
|
|
32
|
+
SITECORE_API_HOST=
|
|
33
|
+
|
|
34
|
+
# Your GraphQL Edge endpoint. This is required for Sitecore Experience Edge.
|
|
35
|
+
# For Sitecore XM, this is typically optional. By default, the endpoint is calculated using
|
|
36
|
+
# the resolved Sitecore API hostname + the `graphQLEndpointPath` defined in your `package.json`.
|
|
37
|
+
GRAPH_QL_ENDPOINT=
|
|
38
|
+
|
|
39
|
+
# The way in which layout and dictionary data is fetched from Sitecore
|
|
40
|
+
FETCH_WITH=<%- fetchWith %>
|
|
41
|
+
|
|
42
|
+
# Sitecore JSS npm packages utilize the debug module for debug logging.
|
|
43
|
+
# https://www.npmjs.com/package/debug
|
|
44
|
+
# Set the DEBUG environment variable to 'sitecore-jss:*' to see all logs:
|
|
45
|
+
#DEBUG=sitecore-jss:*
|
|
46
|
+
# Or be selective and show for example only layout service logs:
|
|
47
|
+
#DEBUG=sitecore-jss:layout
|
|
48
|
+
# Or everything BUT layout service logs:
|
|
49
|
+
#DEBUG=sitecore-jss:*,-sitecore-jss:layout
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"extends": [
|
|
4
|
+
"next",
|
|
5
|
+
"next/core-web-vitals",
|
|
6
|
+
"plugin:@typescript-eslint/recommended",
|
|
7
|
+
"prettier/@typescript-eslint",
|
|
8
|
+
"plugin:yaml/recommended",
|
|
9
|
+
"plugin:prettier/recommended"
|
|
10
|
+
],
|
|
11
|
+
"plugins": [
|
|
12
|
+
"@typescript-eslint",
|
|
13
|
+
"prettier",
|
|
14
|
+
"yaml"
|
|
15
|
+
],
|
|
16
|
+
"ignorePatterns": [".generated/**/*", "**/*.d.ts", "**/*.js"],
|
|
17
|
+
"rules": {
|
|
18
|
+
"@next/next/no-img-element": "off", // Don't force next/image (not currently compatible with Sitecore editing)
|
|
19
|
+
"jsx-a11y/alt-text": ["warn", { "elements": ["img"] }], // Don't force alt for <Image/> (sourced from Sitecore media)
|
|
20
|
+
"no-unused-vars": "off",
|
|
21
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
22
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
23
|
+
"jsx-quotes": ["error", "prefer-double"]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Line endings for this repository
|
|
2
|
+
# See: https://help.github.com/en/articles/configuring-git-to-handle-line-endings
|
|
3
|
+
# This should line up with the expectations from .eslintrc
|
|
4
|
+
|
|
5
|
+
# Set the default behavior, in case people don't have core.autocrlf set.
|
|
6
|
+
* text=crlf
|
|
7
|
+
|
|
8
|
+
# Declare files that will always have CRLF line endings on checkout.
|
|
9
|
+
*.ts text eol=crlf
|
|
10
|
+
*.tsx text eol=crlf
|
|
11
|
+
*.js text eol=crlf
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
|
|
6
|
+
# testing
|
|
7
|
+
/coverage
|
|
8
|
+
|
|
9
|
+
# next.js
|
|
10
|
+
/.next*/
|
|
11
|
+
/out/
|
|
12
|
+
|
|
13
|
+
# graphql code generation
|
|
14
|
+
/.generated
|
|
15
|
+
*.graphql.d.ts
|
|
16
|
+
*.graphqls.d.ts
|
|
17
|
+
|
|
18
|
+
# misc
|
|
19
|
+
.DS_Store
|
|
20
|
+
|
|
21
|
+
# local env files
|
|
22
|
+
.env.local
|
|
23
|
+
.env.*.local
|
|
24
|
+
|
|
25
|
+
# Log files
|
|
26
|
+
*.log*
|
|
27
|
+
|
|
28
|
+
# sitecore
|
|
29
|
+
scjssconfig.json
|
|
30
|
+
*.deploysecret.config
|
|
31
|
+
|
|
32
|
+
# vercel
|
|
33
|
+
.vercel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
package.json
|