Skip to content

Instantly share code, notes, and snippets.

@Antonytm
Antonytm / JssFieldsExtender.cs
Last active August 3, 2022 20:47 — forked from IvanLieckens/JssFieldsExtender.cs
Sitecore JSS GraphQL schema extension to output fields in JSS format
using GraphQL.Types;
using Newtonsoft.Json;
using Sitecore.Configuration;
using Sitecore.Data.Items;
using Sitecore.Data.Fields;
using Sitecore.Diagnostics;
using Sitecore.LayoutService.Serialization.FieldSerializers;
using Sitecore.LayoutService.Serialization.ItemSerializers;
using Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer;
using Sitecore.Services.GraphQL.Content.GraphTypes;
@Antonytm
Antonytm / pre-commit.sh
Created August 27, 2022 10:59
Pre-commit Git hook that validates Sitecore serialization
#!/bin/sh
# Pre-commit Git hook
# It runs Sitecore CLI Serialization check
# And doesn't allow to perform commit if serialization is broken
validate=$(dotnet sitecore ser validate)
regex_errors="Errors were detected"
count=$(echo "${validate}" | grep -c "${regex_errors}")
if test $count -gt 0
then
echo "Sitecore serialization errors were detected"
@michaellwest
michaellwest / CurlCMError.ps1
Created January 16, 2023 21:01
Curl the home page when the CM reports unhealthy. For use with Sitecore and Docker.
$containers = docker ps -a --format "table {{.Names}}"
$container = $containers | ConvertFrom-Csv | Where-Object { $_.NAMES -match "-cm" } | Select-Object -First 1 -ExpandProperty NAMES
docker exec $container curl http://cm
@davidisnotnull
davidisnotnull / create-admin-user-optimizely-12.md
Created September 5, 2023 14:32
Creating an admin user in Optimizely 12

Install the EpiServer.Templates package globally

dotnet new install EPiServer.Templates

Then install the optional EpiServer CLI tools

dotnet tool install Episerver.Net.CLI -g --add-source https://nuget.optimizely.com/feed/packages.svc/