create-sitecore-jss 22.2.0-canary.1 → 22.2.0-canary.3
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/dist/bin.js +69 -28
- package/dist/common/processes/install.js +9 -2
- package/dist/common/processes/transform.js +7 -2
- package/dist/init-runner.js +12 -8
- package/dist/initializers/angular/index.js +16 -0
- package/dist/initializers/angular/prompts.js +22 -1
- package/dist/initializers/angular-sxp/index.js +56 -0
- package/dist/initializers/angular-xmcloud/index.js +56 -0
- package/dist/initializers/node-xmcloud-proxy/index.js +32 -0
- package/dist/templates/angular/.env +5 -3
- package/dist/templates/angular/README.md +5 -45
- package/dist/templates/angular/angular.json +1 -6
- package/dist/templates/angular/package.json +5 -15
- package/dist/templates/angular/proxy.conf.js +5 -23
- package/dist/templates/angular/scripts/bootstrap.ts +5 -24
- package/dist/templates/angular/scripts/config/index.ts +28 -0
- package/dist/templates/angular/scripts/config/plugins/computed.ts +21 -0
- package/dist/templates/angular/scripts/config/plugins/fallback.ts +23 -0
- package/dist/templates/angular/scripts/config/plugins/package-json.ts +22 -0
- package/dist/templates/angular/scripts/config/plugins/scjssconfig.ts +29 -0
- package/dist/templates/angular/scripts/generate-config.ts +53 -73
- package/dist/templates/angular/scripts/generate-plugins.ts +28 -0
- package/dist/templates/angular/scripts/temp/gitignore +2 -0
- package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +4 -2
- package/dist/templates/angular/server.bundle.ts +19 -1
- package/dist/templates/angular/src/app/app.module.ts +0 -2
- package/dist/templates/angular/src/app/components/app-components.shared.module.ts +4 -19
- package/dist/templates/angular/src/app/jss-context.server-side.service.ts +0 -2
- package/dist/templates/angular/src/app/lib/config.ts +16 -0
- package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +21 -13
- package/dist/templates/angular/src/app/lib/layout-service-factory.ts +20 -12
- package/dist/templates/angular/src/app/routing/layout/layout.component.html +1 -1
- package/dist/templates/angular/src/app/routing/layout/layout.component.ts +1 -2
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.html +5 -6
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +1 -2
- package/dist/templates/angular/src/app/routing/routing.module.ts +14 -21
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.html +1 -0
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.ts +7 -0
- package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +8 -0
- package/dist/templates/angular/src/graphql-fragment-types.ts +0 -95
- package/dist/templates/angular/tsconfig.json +7 -2
- package/dist/templates/angular-sxp/package.json +12 -0
- package/dist/templates/angular-sxp/proxy.conf.js +43 -0
- package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +27 -0
- package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +35 -0
- package/dist/templates/{angular → angular-sxp}/src/app/jss-data-fetcher.service.ts +3 -1
- package/dist/templates/angular-sxp/src/app/routing/navigation/navigation.component.html +23 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.html +3 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +9 -0
- package/dist/templates/{angular/src/app/routing → angular-sxp/src/app/routing/scripts}/visitor-identification/visitor-identification.component.ts +9 -3
- package/dist/templates/angular-sxp/src/graphql-fragment-types.ts +219 -0
- package/dist/templates/angular-xmcloud/.env +8 -0
- package/dist/templates/angular-xmcloud/package.json +10 -0
- package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +23 -0
- package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/lib/config.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory.ts +44 -0
- package/dist/templates/node-xmcloud-proxy/.env +8 -0
- package/dist/templates/node-xmcloud-proxy/README.md +36 -0
- package/dist/templates/node-xmcloud-proxy/package.json +25 -0
- package/dist/templates/node-xmcloud-proxy/src/config.ts +19 -0
- package/dist/templates/node-xmcloud-proxy/src/index.ts +161 -0
- package/dist/templates/node-xmcloud-proxy/src/types.ts +59 -0
- package/dist/templates/node-xmcloud-proxy/tsconfig.json +22 -0
- package/package.json +2 -2
- /package/dist/templates/angular/src/app/lib/{client-factory.ts → graphql-client-factory.ts} +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/component-content/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/dictionary/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/dictionary/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/files/jss.pdf +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/img/jss_logo.png +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/img/sc_logo.png +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/custom-route-type/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/scripts/disconnected-mode-proxy.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/scripts/lint-yml.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/config/{{appName}}.config +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/component-content.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Reuse.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs-Tab.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Multilingual.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Section.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/content-block.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-connected-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.graphql +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-layout.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-angular-lazy-loading.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-component-params.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-custom-route-type.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-edit-frame.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-checkbox.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-content-list.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-custom.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-date.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-file.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-image.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-item-link.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-link.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-number.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-rich-text.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-text.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-route-fields.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-sitecore-context.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-tracking.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/config.js +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/content.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/dictionary.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/placeholders.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/routes.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-content-list-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-edit-frame-list-item-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-item-link-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/pipelines/example.patch.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.graphql +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +0 -0
package/dist/bin.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.main = exports.parseArgs = void 0;
|
|
38
|
+
exports.main = exports.promptDestination = exports.getDestinations = exports.parseArgs = void 0;
|
|
39
39
|
const fs_1 = __importDefault(require("fs"));
|
|
40
40
|
const path_1 = __importStar(require("path"));
|
|
41
41
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -43,13 +43,22 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
43
43
|
const init_runner_1 = require("./init-runner");
|
|
44
44
|
const minimist_1 = __importDefault(require("minimist"));
|
|
45
45
|
const common_1 = require("./common");
|
|
46
|
+
const proxyAppMatcher = /node-.+-proxy/g;
|
|
46
47
|
const parseArgs = () => {
|
|
47
48
|
// parse any command line arguments passed into `init sitecore-jss`
|
|
48
49
|
// to pass to the generator prompts and skip them.
|
|
49
50
|
// useful for CI and testing purposes
|
|
50
51
|
const options = {
|
|
51
52
|
boolean: ['appPrefix', 'force', 'noInstall', 'yes', 'silent', 'prePushHook'],
|
|
52
|
-
string: [
|
|
53
|
+
string: [
|
|
54
|
+
'appName',
|
|
55
|
+
'destination',
|
|
56
|
+
'proxyAppDestination',
|
|
57
|
+
'templates',
|
|
58
|
+
'hostName',
|
|
59
|
+
'fetchWith',
|
|
60
|
+
'language',
|
|
61
|
+
],
|
|
53
62
|
default: { prePushHook: null },
|
|
54
63
|
};
|
|
55
64
|
const args = (0, minimist_1.default)(process.argv.slice(2), options);
|
|
@@ -62,6 +71,50 @@ const parseArgs = () => {
|
|
|
62
71
|
return args;
|
|
63
72
|
};
|
|
64
73
|
exports.parseArgs = parseArgs;
|
|
74
|
+
const getDestinations = (args, templates) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
if (templates.length === 0) {
|
|
76
|
+
throw new Error('Unable to get destinations, provided templates are empty');
|
|
77
|
+
}
|
|
78
|
+
// validate/gather destinations
|
|
79
|
+
const defaultBaseDestination = `${process.cwd()}${args.appName ? path_1.sep + args.appName : `${path_1.sep}${templates[0]}`}`;
|
|
80
|
+
let destination = args.destination;
|
|
81
|
+
if (!destination) {
|
|
82
|
+
destination = args.yes
|
|
83
|
+
? defaultBaseDestination
|
|
84
|
+
: yield (0, exports.promptDestination)('Where would you like your new app created?', defaultBaseDestination);
|
|
85
|
+
}
|
|
86
|
+
// work with node-proxy destination if needed
|
|
87
|
+
const proxyApp = templates.find((template) => template.match(proxyAppMatcher));
|
|
88
|
+
if (proxyApp) {
|
|
89
|
+
const defaultProxyDestination = proxyApp && `${process.cwd()}${path_1.sep}${proxyApp}`;
|
|
90
|
+
let proxyAppDestination = args.proxyAppDestination;
|
|
91
|
+
if (!proxyAppDestination) {
|
|
92
|
+
proxyAppDestination = args.yes
|
|
93
|
+
? defaultProxyDestination
|
|
94
|
+
: yield (0, exports.promptDestination)('Where would you like your proxy app created?', defaultProxyDestination);
|
|
95
|
+
}
|
|
96
|
+
while (proxyAppDestination === destination) {
|
|
97
|
+
proxyAppDestination = yield (0, exports.promptDestination)('Proxy app and base app cannot be located in the same folder. Please input another path for proxy', defaultProxyDestination);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
destination,
|
|
101
|
+
proxyAppDestination,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
destination,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
exports.getDestinations = getDestinations;
|
|
109
|
+
const promptDestination = (prompt, defaultDestination) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
+
return (yield inquirer_1.default.prompt({
|
|
111
|
+
type: 'input',
|
|
112
|
+
name: 'destination',
|
|
113
|
+
message: prompt,
|
|
114
|
+
default: () => defaultDestination,
|
|
115
|
+
})).destination;
|
|
116
|
+
});
|
|
117
|
+
exports.promptDestination = promptDestination;
|
|
65
118
|
const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
119
|
let templates = [];
|
|
67
120
|
// check if templates were provided
|
|
@@ -99,36 +152,24 @@ const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
99
152
|
});
|
|
100
153
|
templates.push(answer.template);
|
|
101
154
|
}
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (args.
|
|
107
|
-
destination = defaultDestination;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
155
|
+
const destinations = yield (0, exports.getDestinations)(args, templates);
|
|
156
|
+
for (const destination of [destinations.destination, destinations.proxyAppDestination]) {
|
|
157
|
+
if (!destination)
|
|
158
|
+
continue;
|
|
159
|
+
if (!args.force && fs_1.default.existsSync(destination) && fs_1.default.readdirSync(destination).length > 0) {
|
|
110
160
|
const answer = yield inquirer_1.default.prompt({
|
|
111
|
-
type: '
|
|
112
|
-
name: '
|
|
113
|
-
message: '
|
|
114
|
-
default: () => defaultDestination,
|
|
161
|
+
type: 'confirm',
|
|
162
|
+
name: 'continue',
|
|
163
|
+
message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
|
|
115
164
|
});
|
|
116
|
-
|
|
165
|
+
if (!answer.continue) {
|
|
166
|
+
process.exit();
|
|
167
|
+
}
|
|
117
168
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const answer = yield inquirer_1.default.prompt({
|
|
121
|
-
type: 'confirm',
|
|
122
|
-
name: 'continue',
|
|
123
|
-
message: `Directory '${destination}' not empty. Are you sure you want to continue?`,
|
|
124
|
-
});
|
|
125
|
-
if (!answer.continue) {
|
|
126
|
-
process.exit();
|
|
169
|
+
else {
|
|
170
|
+
args.force = true;
|
|
127
171
|
}
|
|
128
172
|
}
|
|
129
|
-
else {
|
|
130
|
-
args.force = true;
|
|
131
|
-
}
|
|
132
173
|
if (!args.yes) {
|
|
133
174
|
if (args.prePushHook === null) {
|
|
134
175
|
const answer = yield inquirer_1.default.prompt({
|
|
@@ -146,7 +187,7 @@ const main = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
146
187
|
}
|
|
147
188
|
}
|
|
148
189
|
try {
|
|
149
|
-
yield (0, init_runner_1.initRunner)(templates.slice(), Object.assign(Object.assign({}, args), {
|
|
190
|
+
yield (0, init_runner_1.initRunner)(templates.slice(), Object.assign(Object.assign(Object.assign({}, args), destinations), { templates }));
|
|
150
191
|
}
|
|
151
192
|
catch (error) {
|
|
152
193
|
console.log(chalk_1.default.red('An error occurred: ', error));
|
|
@@ -47,8 +47,7 @@ exports.installPackages = installPackages;
|
|
|
47
47
|
*/
|
|
48
48
|
const lintFix = (projectFolder, silent) => {
|
|
49
49
|
var _a;
|
|
50
|
-
const
|
|
51
|
-
const pkg = (0, helpers_1.openPackageJson)(packagePath);
|
|
50
|
+
const pkg = getPackageJson(projectFolder);
|
|
52
51
|
if (!((_a = pkg === null || pkg === void 0 ? void 0 : pkg.scripts) === null || _a === void 0 ? void 0 : _a.lint)) {
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
@@ -65,6 +64,10 @@ exports.lintFix = lintFix;
|
|
|
65
64
|
* @param {boolean} [silent] suppress logs
|
|
66
65
|
*/
|
|
67
66
|
const installPrePushHook = (destination, silent) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
const pkg = getPackageJson(destination);
|
|
68
|
+
if (!(pkg === null || pkg === void 0 ? void 0 : pkg.scripts) || !pkg.scripts['install-pre-push-hook']) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
68
71
|
silent || console.log(chalk_1.default.cyan('Installing pre-push hook...'));
|
|
69
72
|
yield new Promise((resolve, reject) => {
|
|
70
73
|
(0, child_process_1.exec)(`cd ${destination} && git init && npm run install-pre-push-hook`, (err) => {
|
|
@@ -80,3 +83,7 @@ const installPrePushHook = (destination, silent) => __awaiter(void 0, void 0, vo
|
|
|
80
83
|
});
|
|
81
84
|
});
|
|
82
85
|
exports.installPrePushHook = installPrePushHook;
|
|
86
|
+
const getPackageJson = (projectFolder) => {
|
|
87
|
+
const packagePath = path_1.default.join(projectFolder, 'package.json');
|
|
88
|
+
return (0, helpers_1.openPackageJson)(packagePath);
|
|
89
|
+
};
|
|
@@ -194,13 +194,18 @@ exports.diffAndWriteFiles = diffAndWriteFiles;
|
|
|
194
194
|
*/
|
|
195
195
|
const transform = (templatePath, answers, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
196
196
|
const { isFileForCopy, isFileForSkip, fileForCopyRegExp = FILE_FOR_COPY_REGEXP } = options;
|
|
197
|
-
|
|
197
|
+
let destination = undefined;
|
|
198
|
+
// allow proxy app to be installed separately alongside base app
|
|
199
|
+
if (templatePath.match(/.*node-.+-proxy$/g)) {
|
|
200
|
+
destination = answers.proxyAppDestination;
|
|
201
|
+
}
|
|
202
|
+
const destinationPath = path_1.default.resolve(destination || answers.destination);
|
|
198
203
|
if (!answers.appPrefix) {
|
|
199
204
|
answers.appPrefix = false;
|
|
200
205
|
}
|
|
201
206
|
// pass in helper to answers object
|
|
202
207
|
const ejsData = Object.assign(Object.assign({}, answers), { helper: {
|
|
203
|
-
isDev: (0, helpers_1.isDevEnvironment)(answers.destination),
|
|
208
|
+
isDev: (0, helpers_1.isDevEnvironment)(destination || answers.destination),
|
|
204
209
|
getPascalCaseName: helpers_1.getPascalCaseName,
|
|
205
210
|
getAppPrefix: helpers_1.getAppPrefix,
|
|
206
211
|
} });
|
package/dist/init-runner.js
CHANGED
|
@@ -67,14 +67,18 @@ const initRunner = (initializers, args) => __awaiter(void 0, void 0, void 0, fun
|
|
|
67
67
|
});
|
|
68
68
|
yield runner(initializers);
|
|
69
69
|
(0, common_1.saveConfiguration)(args.templates, path_1.default.resolve(`${args.destination}${path_1.sep}package.json`));
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
for (const destination of [args.destination, args.proxyAppDestination]) {
|
|
71
|
+
if (!destination)
|
|
72
|
+
continue;
|
|
73
|
+
// final steps (install, lint, etc)
|
|
74
|
+
if (!args.noInstall) {
|
|
75
|
+
(0, common_1.installPackages)(destination, args.silent);
|
|
76
|
+
(0, common_1.lintFix)(destination, args.silent);
|
|
77
|
+
}
|
|
78
|
+
// install pre-push hook if user opts-in
|
|
79
|
+
if (args.prePushHook) {
|
|
80
|
+
yield (0, common_1.installPrePushHook)(destination, args.silent);
|
|
81
|
+
}
|
|
78
82
|
}
|
|
79
83
|
if (!args.silent) {
|
|
80
84
|
(0, common_1.nextSteps)(appName || '', nextStepsArr);
|
|
@@ -27,9 +27,25 @@ class AngularInitializer {
|
|
|
27
27
|
const mergedArgs = Object.assign(Object.assign({}, args), answers);
|
|
28
28
|
const templatePath = path_1.default.resolve(__dirname, '../../templates/angular');
|
|
29
29
|
yield (0, common_1.transform)(templatePath, mergedArgs);
|
|
30
|
+
const addInitializers = [];
|
|
31
|
+
if (answers.xmcloud) {
|
|
32
|
+
if (!args.templates.includes('angular-xmcloud')) {
|
|
33
|
+
addInitializers.push('angular-xmcloud');
|
|
34
|
+
}
|
|
35
|
+
if (!args.templates.includes('node-xmcloud-proxy')) {
|
|
36
|
+
addInitializers.push('node-xmcloud-proxy');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// invoke default non-XMC init
|
|
41
|
+
if (!args.templates.includes('angular-sxp') && !args.templates.includes('angular-xmcloud')) {
|
|
42
|
+
addInitializers.push('angular-sxp');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
30
45
|
const response = {
|
|
31
46
|
nextSteps: [`* Connect to Sitecore with ${chalk_1.default.green('jss setup')} (optional)`],
|
|
32
47
|
appName: answers.appName,
|
|
48
|
+
initializers: addInitializers,
|
|
33
49
|
};
|
|
34
50
|
return response;
|
|
35
51
|
});
|
|
@@ -2,4 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prompts = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
|
-
exports.prompts = [
|
|
5
|
+
exports.prompts = [
|
|
6
|
+
...common_1.clientAppPrompts,
|
|
7
|
+
{
|
|
8
|
+
type: 'confirm',
|
|
9
|
+
name: 'xmcloud',
|
|
10
|
+
message: 'Are you building for Sitecore XM Cloud?',
|
|
11
|
+
default: false,
|
|
12
|
+
when: (answers) => {
|
|
13
|
+
// don't prompt if --yes or angular-xmcloud template was specified
|
|
14
|
+
if (answers.yes) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
else if (answers.templates.includes('angular-xmcloud') &&
|
|
18
|
+
!answers.templates.includes('angular-sxp')) {
|
|
19
|
+
answers.xmcloud = true;
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
...common_1.styleguidePrompts,
|
|
26
|
+
];
|
|
@@ -0,0 +1,56 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const path_1 = __importStar(require("path"));
|
|
36
|
+
const common_1 = require("../../common");
|
|
37
|
+
class AngularSxpInitializer {
|
|
38
|
+
get isBase() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
init(args) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const pkg = (0, common_1.openPackageJson)(`${args.destination}${path_1.sep}package.json`);
|
|
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
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/angular-sxp');
|
|
47
|
+
yield (0, common_1.transform)(templatePath, mergedArgs);
|
|
48
|
+
const response = {
|
|
49
|
+
nextSteps: [],
|
|
50
|
+
appName: mergedArgs.appName,
|
|
51
|
+
};
|
|
52
|
+
return response;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = AngularSxpInitializer;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const path_1 = __importStar(require("path"));
|
|
36
|
+
const common_1 = require("../../common");
|
|
37
|
+
class AngularXmCloudInitializer {
|
|
38
|
+
get isBase() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
init(args) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const pkg = (0, common_1.openPackageJson)(`${args.destination}${path_1.sep}package.json`);
|
|
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
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/angular-xmcloud');
|
|
47
|
+
yield (0, common_1.transform)(templatePath, mergedArgs);
|
|
48
|
+
const response = {
|
|
49
|
+
nextSteps: [],
|
|
50
|
+
appName: args.appName || common_1.DEFAULT_APPNAME,
|
|
51
|
+
};
|
|
52
|
+
return response;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = AngularXmCloudInitializer;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 common_1 = require("../../common");
|
|
17
|
+
class AngularXmCloudInitializer {
|
|
18
|
+
get isBase() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
init(args) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const templatePath = path_1.default.resolve(__dirname, '../../templates/node-xmcloud-proxy');
|
|
24
|
+
yield (0, common_1.transform)(templatePath, args);
|
|
25
|
+
const response = {
|
|
26
|
+
appName: 'node-xmcloud-proxy',
|
|
27
|
+
};
|
|
28
|
+
return response;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = AngularXmCloudInitializer;
|
|
@@ -21,11 +21,13 @@ GRAPH_QL_ENDPOINT=
|
|
|
21
21
|
# Uses your `package.json` config `appName` if empty.
|
|
22
22
|
SITECORE_SITE_NAME=
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
DEFAULT_LANGUAGE=
|
|
26
|
-
|
|
24
|
+
<% if (!locals.xmcloud) { -%>
|
|
27
25
|
# The way in which layout and dictionary data is fetched from Sitecore
|
|
28
26
|
FETCH_WITH=<%- fetchWith %>
|
|
27
|
+
<% } -%>
|
|
28
|
+
|
|
29
|
+
# Your default app language.
|
|
30
|
+
DEFAULT_LANGUAGE=
|
|
29
31
|
|
|
30
32
|
# Sitecore JSS npm packages utilize the debug module for debug logging.
|
|
31
33
|
# https://www.npmjs.com/package/debug
|
|
@@ -3,51 +3,11 @@
|
|
|
3
3
|
<!---
|
|
4
4
|
@TODO: Update to next version docs before release
|
|
5
5
|
-->
|
|
6
|
-
[Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-angular.html)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## App setup
|
|
10
|
-
|
|
11
|
-
1. `npm install`
|
|
12
|
-
1. `npm install -g @sitecore-jss/sitecore-jss-cli`
|
|
13
|
-
1. `jss setup`
|
|
14
|
-
|
|
15
|
-
> This setup is optional to get started with development, as it assumes you have Sitecore installed.
|
|
16
|
-
>
|
|
17
|
-
> If you answer "yes", you would need to provide the path to your Sitecore installation's "Website" folder.
|
|
18
|
-
|
|
19
|
-
## Development server
|
|
20
|
-
|
|
21
|
-
Run `jss start`.
|
|
22
|
-
|
|
23
|
-
The app will be built and webpack server will be started. So it's expected that the browser will open with `http://localhost:3000` and familiar default welcome content is rendered.
|
|
24
|
-
|
|
25
|
-
The app will automatically reload if you change any of the source files.
|
|
26
|
-
|
|
27
|
-
When running the development server, it automatically sets up a sitecore mock server configures a proxy that forwards all requests to `/sitecore` to that sitecore mock server. Check `proxy.conf.js` to see mock server and proxy implementation.
|
|
28
|
-
|
|
29
|
-
### Congratulations!
|
|
30
6
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## App deployment
|
|
34
|
-
|
|
35
|
-
### Pre-requisites
|
|
36
|
-
|
|
37
|
-
1. Sitecore instance has JSS packages installed.
|
|
38
|
-
1. Sitecore is configured for this JSS app.
|
|
39
|
-
|
|
40
|
-
### Steps
|
|
41
|
-
|
|
42
|
-
Run `jss deploy package`.
|
|
43
|
-
|
|
44
|
-
This step will:
|
|
45
|
-
|
|
46
|
-
* Run the production bundle of your app.
|
|
47
|
-
* Generate the app manifest.
|
|
48
|
-
* Generate a package with the manifest and production bundle.
|
|
49
|
-
* Install the package over HTTP on your Sitecore instance.
|
|
7
|
+
[Documentation (Experience Platform)](https://doc.sitecore.com/xp/en/developers/hd/22/sitecore-headless-development/sitecore-javascript-rendering-sdk--jss--for-angular.html)
|
|
50
8
|
|
|
51
|
-
|
|
9
|
+
<!---
|
|
10
|
+
@TODO: Verify the link for angular xmcloud when documentation is ready
|
|
11
|
+
-->
|
|
52
12
|
|
|
53
|
-
|
|
13
|
+
[Documentation (XM Cloud)](https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-javascript-rendering-sdk--jss--for-angular.html)
|
|
@@ -49,12 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"baseHref": "/",
|
|
51
51
|
"aot": true,
|
|
52
|
-
"
|
|
53
|
-
"You might want to adjust the optimization entry to workaround a bug with bootstrap warnings caused by Angular",
|
|
54
|
-
"The warnings may occur during build and when running connected mode. Check below for possible fixes.",
|
|
55
|
-
"https://github.com/ng-bootstrap/ng-bootstrap/issues/4306"
|
|
56
|
-
],
|
|
57
|
-
"optimization": "true",
|
|
52
|
+
"optimization": true,
|
|
58
53
|
"outputHashing": "all",
|
|
59
54
|
"sourceMap": false,
|
|
60
55
|
"namedChunks": false,
|
|
@@ -15,18 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"ng": "ng",
|
|
18
|
-
"lint
|
|
19
|
-
"lint": "ng lint <%- appName %> --fix && npm run lint:yml",
|
|
18
|
+
"lint": "ng lint <%- appName %> --fix",
|
|
20
19
|
"e2e": "ng e2e",
|
|
21
20
|
"jss": "jss",
|
|
22
|
-
"start": "cross-env-shell JSS_MODE=disconnected \"npm-run-all --serial bootstrap --parallel start:angular start:proxy start:watch-components\"",
|
|
23
21
|
"start:connected": "npm-run-all --serial bootstrap start:angular start:watch-components",
|
|
24
|
-
"build": "npm-run-all --serial bootstrap
|
|
25
|
-
"scaffold": "ng generate @sitecore-jss/sitecore-jss-angular-schematics:jss-component",
|
|
22
|
+
"build": "npm-run-all --serial bootstrap build:client build:server",
|
|
23
|
+
"scaffold": "ng generate @sitecore-jss/sitecore-jss-angular-schematics:jss-component --no-manifest",
|
|
26
24
|
"start:angular": "ng serve -o",
|
|
27
|
-
"start:proxy": "ts-node --project src/tsconfig.webpack-server.json scripts/disconnected-mode-proxy.ts",
|
|
28
25
|
"start:watch-components": "ts-node --project src/tsconfig.webpack-server.json scripts/generate-component-factory.ts --watch",
|
|
29
|
-
"build:client": "cross-env-shell ng build --base-href $npm_package_config_sitecoreDistPath/browser/ --output-path=$npm_package_config_buildArtifactsPath/browser/",
|
|
26
|
+
"build:client": "cross-env-shell ng build --configuration=production --base-href $npm_package_config_sitecoreDistPath/browser/ --output-path=$npm_package_config_buildArtifactsPath/browser/",
|
|
30
27
|
"build:server": "cross-env-shell ng run <%- appName %>:server:production --output-path=$npm_package_config_buildArtifactsPath",
|
|
31
28
|
"postbuild:server": "move-cli ./dist/main.js ./dist/server.bundle.js",
|
|
32
29
|
"bootstrap": "ts-node --project src/tsconfig.webpack-server.json scripts/bootstrap.ts",
|
|
@@ -66,7 +63,6 @@
|
|
|
66
63
|
"core-js": "~3.37.1",
|
|
67
64
|
"graphql": "15.5.0",
|
|
68
65
|
"graphql-tag": "~2.11.0",
|
|
69
|
-
"lodash": "^4.17.21",
|
|
70
66
|
"rxjs": "~7.8.1",
|
|
71
67
|
"tslib": "^2.6.3",
|
|
72
68
|
"zone.js": "~0.14.7"
|
|
@@ -91,23 +87,18 @@
|
|
|
91
87
|
"@types/node": "~20.14.10",
|
|
92
88
|
"@typescript-eslint/eslint-plugin": "^7.16.0",
|
|
93
89
|
"@typescript-eslint/parser": "^7.16.0",
|
|
94
|
-
"body-parser": "~1.20.2",
|
|
95
90
|
"chalk": "~4.1.0",
|
|
96
91
|
"chokidar": "^3.5.2",
|
|
97
92
|
"codelyzer": "~6.0.1",
|
|
98
93
|
"constant-case": "^3.0.4",
|
|
99
|
-
"cookie-parser": "~1.4.5",
|
|
100
94
|
"cross-env": "~7.0.3",
|
|
101
95
|
"del-cli": "^5.0.0",
|
|
102
96
|
"dotenv": "^16.0.0",
|
|
103
97
|
"dotenv-webpack": "^7.1.0",
|
|
104
|
-
"enhanced-resolve": "5.7.0",
|
|
105
98
|
"eslint": "^8.56.0",
|
|
106
99
|
"eslint-plugin-import": "2.29.1",
|
|
107
100
|
"eslint-plugin-jsdoc": "48.7.0",
|
|
108
101
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
109
|
-
"express": "~4.17.1",
|
|
110
|
-
"fs-extra": "~9.1.0",
|
|
111
102
|
"isomorphic-fetch": "^3.0.0",
|
|
112
103
|
"jasmine-core": "~3.7.1",
|
|
113
104
|
"jasmine-spec-reporter": "~6.0.0",
|
|
@@ -121,7 +112,6 @@
|
|
|
121
112
|
"npm-run-all": "~4.1.5",
|
|
122
113
|
"protractor": "^7.0.0",
|
|
123
114
|
"ts-node": "~10.9.2",
|
|
124
|
-
"typescript": "~5.2.2"
|
|
125
|
-
"yaml-lint": "^1.2.4"
|
|
115
|
+
"typescript": "~5.2.2"
|
|
126
116
|
}
|
|
127
117
|
}
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
When the app runs in
|
|
3
|
-
the app copies of the Sitecore APIs it depends on (layout service, dictionary service, content service)
|
|
4
|
-
to talk to so that the app can run using the locally defined disconnected data.
|
|
5
|
-
|
|
6
|
-
When the app runs in connected mode, Sitecore is present and some of the requests should be
|
|
2
|
+
When the app runs in connected mode, some of the requests should be
|
|
7
3
|
proxied to the Sitecore API
|
|
8
|
-
|
|
9
|
-
This is accomplished by spinning up a small Express server that mocks the APIs, and then
|
|
10
|
-
telling angular-cli to proxy requests to the API paths to this express instance.
|
|
11
|
-
|
|
12
|
-
See /scripts/disconnected-mode-proxy.ts for the proxy API server configuration.
|
|
13
4
|
*/
|
|
14
|
-
const constants = require('@sitecore-jss/sitecore-jss-angular/cjs').constants;
|
|
15
5
|
const environment = require('./src/environments/environment.js').environment;
|
|
16
6
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const PROXY_CONFIG = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED ? [
|
|
20
|
-
{
|
|
21
|
-
context: ['/data', '/sitecore'],
|
|
22
|
-
target: `http://localhost:${port}`,
|
|
23
|
-
secure: false,
|
|
24
|
-
},
|
|
25
|
-
] : [
|
|
7
|
+
const PROXY_CONFIG = [
|
|
26
8
|
{
|
|
27
9
|
context: [
|
|
28
10
|
// API endpoints
|
|
@@ -30,12 +12,12 @@ const PROXY_CONFIG = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED ?
|
|
|
30
12
|
// media items
|
|
31
13
|
'/-',
|
|
32
14
|
// visitor identification
|
|
33
|
-
'/layouts'
|
|
15
|
+
'/layouts',
|
|
34
16
|
],
|
|
35
17
|
target: environment.sitecoreApiHost,
|
|
36
18
|
secure: false,
|
|
37
|
-
changeOrigin: true
|
|
38
|
-
}
|
|
19
|
+
changeOrigin: true,
|
|
20
|
+
},
|
|
39
21
|
];
|
|
40
22
|
|
|
41
23
|
module.exports = PROXY_CONFIG;
|