create-sitecore-jss 22.6.0-canary.3 → 22.6.0-canary.5
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/templates/nextjs-sxa/src/components/ColumnSplitter.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Container.tsx +5 -5
- package/dist/templates/nextjs-sxa/src/components/Image.tsx +9 -9
- package/dist/templates/nextjs-sxa/src/components/LinkList.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Navigation.tsx +2 -2
- package/dist/templates/nextjs-sxa/src/components/PageContent.tsx +3 -3
- package/dist/templates/nextjs-sxa/src/components/Promo.tsx +3 -3
- package/dist/templates/nextjs-sxa/src/components/RichText.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/RowSplitter.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Title.tsx +2 -2
- package/dist/templates/node-xmcloud-proxy/README.md +60 -51
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ interface ComponentProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const Default = (props: ComponentProps): JSX.Element => {
|
|
14
|
-
const styles = `${props
|
|
14
|
+
const styles = `${props?.params?.GridParameters ?? ''} ${props?.params?.Styles ?? ''}`.trimEnd();
|
|
15
15
|
const columnWidths = [
|
|
16
16
|
props.params.ColumnWidth1,
|
|
17
17
|
props.params.ColumnWidth2,
|
|
@@ -11,12 +11,12 @@ interface ComponentProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const DefaultContainer = (props: ComponentProps): JSX.Element => {
|
|
14
|
-
const containerStyles = props
|
|
15
|
-
const styles = `${props
|
|
16
|
-
const phKey = `container-${props
|
|
17
|
-
const id = props
|
|
14
|
+
const containerStyles = props?.params?.Styles ?? '';
|
|
15
|
+
const styles = `${props?.params?.GridParameters} ${containerStyles}`.trimEnd();
|
|
16
|
+
const phKey = `container-${props?.params?.DynamicPlaceholderId}`;
|
|
17
|
+
const id = props?.params?.RenderingIdentifier;
|
|
18
18
|
const mediaUrlPattern = new RegExp(/mediaurl=\"([^"]*)\"/, 'i');
|
|
19
|
-
let backgroundImage = props
|
|
19
|
+
let backgroundImage = props?.params?.BackgroundImage as string;
|
|
20
20
|
let backgroundStyle: { [key: string]: string } = {};
|
|
21
21
|
|
|
22
22
|
if (backgroundImage && backgroundImage.match(mediaUrlPattern)) {
|
|
@@ -22,7 +22,7 @@ type ImageProps = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const ImageDefault = (props: ImageProps): JSX.Element => (
|
|
25
|
-
<div className={`component image ${props
|
|
25
|
+
<div className={`component image ${props?.params?.styles}`.trimEnd()}>
|
|
26
26
|
<div className="component-content">
|
|
27
27
|
<span className="is-empty-hint">Image</span>
|
|
28
28
|
</div>
|
|
@@ -49,16 +49,16 @@ export const Banner = (props: ImageProps): JSX.Element => {
|
|
|
49
49
|
.replace(`height="${props?.fields?.Image?.value?.height}"`, 'height="100%"'),
|
|
50
50
|
}
|
|
51
51
|
: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
...props.fields.Image,
|
|
53
|
+
value: {
|
|
54
|
+
...props.fields.Image.value,
|
|
55
|
+
style: { width: '100%', height: '100%' },
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<div
|
|
61
|
-
className={`component hero-banner ${props
|
|
61
|
+
className={`component hero-banner ${props?.params?.styles} ${classHeroBannerEmpty}`}
|
|
62
62
|
id={id ? id : undefined}
|
|
63
63
|
>
|
|
64
64
|
<div className="component-content sc-sxa-image-hero-banner" style={backgroundStyle}>
|
|
@@ -76,7 +76,7 @@ export const Default = (props: ImageProps): JSX.Element => {
|
|
|
76
76
|
const id = props.params.RenderingIdentifier;
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
<div className={`component image ${props
|
|
79
|
+
<div className={`component image ${props?.params?.styles}`} id={id ? id : undefined}>
|
|
80
80
|
<div className="component-content">
|
|
81
81
|
{sitecoreContext.pageState === 'edit' || !props.fields.TargetUrl?.value?.href ? (
|
|
82
82
|
<Image />
|
|
@@ -52,7 +52,7 @@ const LinkListItem = (props: LinkListItemProps) => {
|
|
|
52
52
|
|
|
53
53
|
export const Default = (props: LinkListProps): JSX.Element => {
|
|
54
54
|
const datasource = props.fields?.data?.datasource;
|
|
55
|
-
const styles = `component link-list ${props
|
|
55
|
+
const styles = `component link-list ${props?.params?.styles}`.trimEnd();
|
|
56
56
|
const id = props.params.RenderingIdentifier;
|
|
57
57
|
|
|
58
58
|
if (datasource) {
|
|
@@ -52,7 +52,7 @@ export const Default = (props: NavigationProps): JSX.Element => {
|
|
|
52
52
|
const { sitecoreContext } = useSitecoreContext();
|
|
53
53
|
const styles =
|
|
54
54
|
props.params != null
|
|
55
|
-
? `${props.params.GridParameters ?? ''} ${props
|
|
55
|
+
? `${props.params.GridParameters ?? ''} ${props?.params?.Styles ?? ''}`.trimEnd()
|
|
56
56
|
: '';
|
|
57
57
|
const id = props.params != null ? props.params.RenderingIdentifier : null;
|
|
58
58
|
|
|
@@ -110,7 +110,7 @@ export const Default = (props: NavigationProps): JSX.Element => {
|
|
|
110
110
|
const NavigationList = (props: NavigationProps) => {
|
|
111
111
|
const { sitecoreContext } = useSitecoreContext();
|
|
112
112
|
const [active, setActive] = useState(false);
|
|
113
|
-
const classNameList = `${props
|
|
113
|
+
const classNameList = `${props?.fields?.Styles.concat('rel-level' + props.relativeLevel).join(
|
|
114
114
|
' '
|
|
115
115
|
)}`;
|
|
116
116
|
|
|
@@ -23,7 +23,7 @@ type ComponentContentProps = {
|
|
|
23
23
|
const ComponentContent = (props: ComponentContentProps) => {
|
|
24
24
|
const id = props.id;
|
|
25
25
|
return (
|
|
26
|
-
<div className={`component content ${props
|
|
26
|
+
<div className={`component content ${props?.styles}`} id={id ? id : undefined}>
|
|
27
27
|
<div className="component-content">
|
|
28
28
|
<div className="field-content">{props.children}</div>
|
|
29
29
|
</div>
|
|
@@ -37,7 +37,7 @@ export const Default = (props: PageContentProps): JSX.Element => {
|
|
|
37
37
|
|
|
38
38
|
if (!(props.fields && props.fields.Content) && !sitecoreContext?.route?.fields?.Content) {
|
|
39
39
|
return (
|
|
40
|
-
<div className={`component content ${props
|
|
40
|
+
<div className={`component content ${props?.params?.styles}`} id={id ? id : undefined}>
|
|
41
41
|
<div className="component-content">
|
|
42
42
|
<div className="field-content">[Content]</div>
|
|
43
43
|
</div>
|
|
@@ -50,7 +50,7 @@ export const Default = (props: PageContentProps): JSX.Element => {
|
|
|
50
50
|
: sitecoreContext?.route?.fields?.Content) as RichTextField;
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
|
-
<ComponentContent styles={props
|
|
53
|
+
<ComponentContent styles={props?.params?.styles} id={id}>
|
|
54
54
|
<JssRichText field={field} />
|
|
55
55
|
</ComponentContent>
|
|
56
56
|
);
|
|
@@ -21,7 +21,7 @@ type PromoProps = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const PromoDefaultComponent = (props: PromoProps): JSX.Element => (
|
|
24
|
-
<div className={`component promo ${props
|
|
24
|
+
<div className={`component promo ${props?.params?.styles}`}>
|
|
25
25
|
<div className="component-content">
|
|
26
26
|
<span className="is-empty-hint">Promo</span>
|
|
27
27
|
</div>
|
|
@@ -32,7 +32,7 @@ export const Default = (props: PromoProps): JSX.Element => {
|
|
|
32
32
|
const id = props.params.RenderingIdentifier;
|
|
33
33
|
if (props.fields) {
|
|
34
34
|
return (
|
|
35
|
-
<div className={`component promo ${props
|
|
35
|
+
<div className={`component promo ${props?.params?.styles}`} id={id ? id : undefined}>
|
|
36
36
|
<div className="component-content">
|
|
37
37
|
<div className="field-promoicon">
|
|
38
38
|
<JssImage field={props.fields.PromoIcon} />
|
|
@@ -59,7 +59,7 @@ export const WithText = (props: PromoProps): JSX.Element => {
|
|
|
59
59
|
const id = props.params.RenderingIdentifier;
|
|
60
60
|
if (props.fields) {
|
|
61
61
|
return (
|
|
62
|
-
<div className={`component promo ${props
|
|
62
|
+
<div className={`component promo ${props?.params?.styles}`} id={id ? id : undefined}>
|
|
63
63
|
<div className="component-content">
|
|
64
64
|
<div className="field-promoicon">
|
|
65
65
|
<JssImage field={props.fields.PromoIcon} />
|
|
@@ -20,7 +20,7 @@ export const Default = (props: RichTextProps): JSX.Element => {
|
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<div
|
|
23
|
-
className={`component rich-text ${props
|
|
23
|
+
className={`component rich-text ${props?.params?.styles.trimEnd()}`}
|
|
24
24
|
id={id ? id : undefined}
|
|
25
25
|
>
|
|
26
26
|
<div className="component-content">{text}</div>
|
|
@@ -11,7 +11,7 @@ interface ComponentProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const Default = (props: ComponentProps): JSX.Element => {
|
|
14
|
-
const styles = `${props
|
|
14
|
+
const styles = `${props?.params?.GridParameters ?? ''} ${props?.params?.Styles ?? ''}`.trimEnd();
|
|
15
15
|
const rowStyles = [
|
|
16
16
|
props.params.Styles1,
|
|
17
17
|
props.params.Styles2,
|
|
@@ -52,7 +52,7 @@ type ComponentContentProps = {
|
|
|
52
52
|
const ComponentContent = (props: ComponentContentProps) => {
|
|
53
53
|
const id = props.id;
|
|
54
54
|
return (
|
|
55
|
-
<div className={`component title ${props
|
|
55
|
+
<div className={`component title ${props?.styles}`} id={id ? id : undefined}>
|
|
56
56
|
<div className="component-content">
|
|
57
57
|
<div className="field-title">{props.children}</div>
|
|
58
58
|
</div>
|
|
@@ -79,7 +79,7 @@ export const Default = (props: TitleProps): JSX.Element => {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<ComponentContent styles={props
|
|
82
|
+
<ComponentContent styles={props?.params?.styles} id={props?.params?.RenderingIdentifier}>
|
|
83
83
|
<>
|
|
84
84
|
{sitecoreContext.pageEditing ? (
|
|
85
85
|
<Text field={text} />
|
|
@@ -91,64 +91,73 @@ If the operation is successful, you’ll see the following message:
|
|
|
91
91
|
|
|
92
92
|
Follow these steps to deploy your application to Netlify. The deployed site can be used as an editing host in XM Cloud.
|
|
93
93
|
|
|
94
|
-
1. Run `npm init` in the root directory (which contains SPA and Node XM Cloud Proxy app
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
2. Ensure that `<your-proxy-app-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
1. Run `npm init` in the root directory (which contains SPA and Node XM Cloud Proxy app folders) and add the following scripts to package.json:
|
|
95
|
+
```
|
|
96
|
+
"build": "cd ./<your-proxy-app-folder> && npm run build-all && cd ..",
|
|
97
|
+
"install": "cd ./<your-proxy-app-folder> && npm install && npm run install-all && cd .."
|
|
98
|
+
```
|
|
99
|
+
2. Ensure that `<your-proxy-app-folder>/package.json` includes the following commands to handle the build and install steps properly:
|
|
100
|
+
```
|
|
101
|
+
"build-all": "cd ../angular && npm run build && cd ../<your-proxy-app-folder> && tsc",
|
|
102
|
+
"install-all": "cd ../angular && npm i && cd ../<your-proxy-app-folder> && npm i"
|
|
103
|
+
```
|
|
104
104
|
3. Configure `serverless-http`:
|
|
105
|
-
- Install the
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
- Install the serverless-http package :
|
|
106
|
+
- If you're deploying a standalone Angular app with the Node proxy, run the following command inside your proxy app folder:
|
|
107
|
+
```
|
|
108
|
+
npm i serverless-http
|
|
109
|
+
```
|
|
110
|
+
- If you're working within the pnpm setup context of the [xmcloud-foundation-head](https://github.com/sitecorelabs/xmcloud-foundation-head), run the following command inside your proxy app folder:
|
|
111
|
+
```
|
|
112
|
+
pnpm add serverless-http
|
|
113
|
+
```
|
|
114
|
+
- Import serverless-http in `<your-proxy-app-folder>/src/index.ts` file and export the serverless handler:
|
|
110
115
|
```
|
|
111
|
-
|
|
116
|
+
import serverless from 'serverless-http';
|
|
117
|
+
...
|
|
118
|
+
export const handler = serverless(server);
|
|
112
119
|
```
|
|
113
120
|
4. Create a `netlify.toml` file and ensure that the following Netlify configuration is added there:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
- Add the following build command:
|
|
137
|
-
```
|
|
138
|
-
[build]
|
|
139
|
-
command = "npm run build"
|
|
140
|
-
publish = "<your-proxy-app-name>/dist"
|
|
141
|
-
```
|
|
121
|
+
```
|
|
122
|
+
[functions]
|
|
123
|
+
directory = "<your-proxy-app-folder>/src"
|
|
124
|
+
node_bundler = "esbuild"
|
|
125
|
+
included_files = ["<your-proxy-app-folder>/dist/**"]
|
|
126
|
+
[[redirects]]
|
|
127
|
+
from = "/dist/browser/*"
|
|
128
|
+
status = 200
|
|
129
|
+
to = "/browser/:splat"
|
|
130
|
+
[[redirects]]
|
|
131
|
+
from = "/*"
|
|
132
|
+
status = 200
|
|
133
|
+
to = "/.netlify/functions/index/:splat"
|
|
134
|
+
force = true
|
|
135
|
+
[build]
|
|
136
|
+
command = "npm run build"
|
|
137
|
+
publish = "<your-proxy-app-folder>/dist"
|
|
138
|
+
```
|
|
139
|
+
- The `[functions]` section allows the proxy app to be treated as Netlify functions. [Functions Overview](https://docs.netlify.com/functions/overview/)
|
|
140
|
+
- The first `[[redirects]]` section ensures that static assets are accessed properly.
|
|
141
|
+
- The second `[[redirects]]` section means that, by default, redirects aren't applied if a file exists at the same path as the one defined in the `from` property. Setting `force` to `true` ensures the redirect rule takes precedence over existing files, preventing files in the deploy folder from being publicly accessible.
|
|
142
|
+
|
|
142
143
|
5. Create your [Netlify deployment](https://www.netlify.com/blog/2016/09/29/a-step-by-step-guide-deploying-on-netlify/):
|
|
143
144
|
- Set up all your necessary environment variables like `SITECORE_EDGE_CONTEXT_ID`, `SITECORE_SITE_NAME` etc.
|
|
145
|
+
- Configure Netlify to use the latest LTS version of Node.js.
|
|
144
146
|
- Configure your build settings in the Build and Deploy tab under Site configuration.
|
|
145
|
-
- sample configuration:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
- sample configuration for standalone Angular + proxy deployment:
|
|
148
|
+
```
|
|
149
|
+
Base directory: /
|
|
150
|
+
Build command: npm run build
|
|
151
|
+
Publish directory: /proxy/dist
|
|
152
|
+
Functions directory: /proxy/src
|
|
153
|
+
```
|
|
154
|
+
- Sample configuration for use within the context of [xmcloud-foundation-head](https://github.com/sitecorelabs/xmcloud-foundation-head):
|
|
155
|
+
```
|
|
156
|
+
Base directory: /headapps/spa-starters/
|
|
157
|
+
Build command: npm run build
|
|
158
|
+
Publish directory: /headapps/spa-starters/proxy/dist
|
|
159
|
+
Functions directory: /headapps/spa-starters/proxy/src
|
|
160
|
+
```
|
|
152
161
|
NOTE: If `proxy/dist` folder is not picked up properly by Netlify make sure that the `PROXY_BUILD_PATH` env variable is unix style path e.g. `../proxy/dist`
|
|
153
162
|
|
|
154
163
|
### Deploy to Vercel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sitecore-jss",
|
|
3
|
-
"version": "22.6.0-canary.
|
|
3
|
+
"version": "22.6.0-canary.5",
|
|
4
4
|
"description": "Sitecore JSS initializer",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"ts-node": "^10.9.1",
|
|
66
66
|
"typescript": "~5.6.3"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "0a90a403b97540a79f17c2c40c9b961ed22dc5c2"
|
|
69
69
|
}
|