Skip to content

Commit

Permalink
Merge branch 'develop' into develop-regression-external-img
Browse files Browse the repository at this point in the history
  • Loading branch information
DriftingSands committed Mar 8, 2022
2 parents 8dba14b + ae1538e commit fcc6afc
Show file tree
Hide file tree
Showing 132 changed files with 6,717 additions and 4,135 deletions.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aem-site-template-tailwind",
"version": "1.23.12",
"version": "1.24.2",
"description": "AEM Site Template built with Tailwind CSS. Includes an easy-to-remove Wireframe Theme as an example of best-practices for theming site templates",
"license": "MIT License, Copyright 2022 headwire.com",
"scripts": {
Expand All @@ -18,10 +18,11 @@
"stub": "aem-site-template-builder stub"
},
"devDependencies": {
"@adobe/aem-site-template-builder": "^2.3.0",
"@adobe/aem-site-template-builder": "^2.3.1",
"@prettier/plugin-xml": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"dotenv": "^16.0.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
Expand Down
94 changes: 94 additions & 0 deletions redeploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const fs = require("fs");
const startTime = Date.now();
const child_process = require("child_process");
const packageJSON = JSON.parse(fs.readFileSync("./package.json"));

const AEM_URL = process.env.AEM_URL;
const SITE_NAME = process.env.AEM_SITE;
// Need to make a way for this to exist throughout the entire example content
const TMPL_NAME = packageJSON.name;
const CREDENTIALS = process.env.CREDENTIALS || "admin:admin";
let VERSION = packageJSON.version;
let [major, minor, patch] = packageJSON.version.split(".");

const deletePreviousZip = () => {
if (fs.existsSync(`./${TMPL_NAME}-${VERSION}.zip`))
runCmd(`rm ${TMPL_NAME}-${VERSION}.zip`);
else console.log(`Could not find or delete ${TMPL_NAME}-${VERSION}.zip`);
};

const updatePackageJSON = () => {
packageJSON.version = [major, minor, parseInt(patch) + 1]
.join(".")
.toString();
fs.writeFileSync("./package.json", JSON.stringify(packageJSON, null, 2));
console.log(
`Package.json updated to v${packageJSON.version} from v${VERSION}`
);
VERSION = packageJSON.version;
};

const runCmd = (cmd, log) => {
const resp = child_process.execSync(cmd);
const result = resp.toString("UTF8");
if (log) console.log(result);
return result;
};

const log = (msg) => {
console.log(`\n\n${"~".repeat(120)}`);
console.log(` ${msg}`);
console.log("~".repeat(120));
};

log(`Removing Site Configurations - /conf/${SITE_NAME}`);
runCmd(
`curl -u ${CREDENTIALS} -F ':operation=delete' ${AEM_URL}/conf/${SITE_NAME}`
);
log(`Removing DAM Content - /content/dam/${SITE_NAME}`);
runCmd(
`curl -u ${CREDENTIALS} -F ':operation=delete' ${AEM_URL}/content/dam/${SITE_NAME}`
);
log(
`Removing Experience Fragments - ${AEM_URL}/content/experience-fragments/${SITE_NAME}`
);
runCmd(
`curl -u ${CREDENTIALS} -F ':operation=delete' ${AEM_URL}/content/experience-fragments/${SITE_NAME}`
);
log(`Removing Content - /content/${SITE_NAME}`);
runCmd(
`curl -u ${CREDENTIALS} -F ':operation=delete' ${AEM_URL}/content/${SITE_NAME}`
);
log(
`Removing Site Template - /conf/global/site-templates/${TMPL_NAME}-${VERSION}`
);
runCmd(
`curl -u ${CREDENTIALS} -F ':operation=delete' ${AEM_URL}/conf/global/site-templates/${TMPL_NAME}-${VERSION}`
);
log(`Removing Previous Zip File ${TMPL_NAME}-${VERSION}.zip`);
deletePreviousZip();
log(`Updating package.json with new versioning`);
updatePackageJSON();
log(`Building Site Template v${VERSION}`);
runCmd(`npm run build`, true);
log(`Deploying ${TMPL_NAME}-${VERSION}.zip to ${AEM_URL}`);
runCmd(
`curl -u ${CREDENTIALS} -F file=@${TMPL_NAME}-${VERSION}.zip ${AEM_URL}/bin/wcm/site-template/import`
);
log(`Re-generatinig '${SITE_NAME}' site from template`);
runCmd(
`curl -u ${CREDENTIALS} -F 'cmd=createSiteFromSiteTemplate' -F 'operation=asyncCreateSiteFromSiteTemplate' -F '_charset_=utf-8' -F 'siteTemplate=/conf/global/site-templates/${TMPL_NAME}-${VERSION}' -F 'siteTitle=${SITE_NAME}' ${AEM_URL}/bin/asynccommand`
);
log(
`Successfully redeployed Site Template v${VERSION} in ${
(Date.now() - startTime) / 1000
}s`
);
// /bin/asynccommand
// cmd: createSiteFromSiteTemplate
// operation: asyncCreateSiteFromSiteTemplate
// _charset_: utf-8
// siteTitle: aem-site-template-tailwind
// siteName:
// path: aem-site-template-tailwind
// siteTemplatePath: /conf/global/site-templates/aem-site-template-tailwind-1.23.21
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jcr:root
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Page"
>
<cfm />
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jcr:root
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Page"
>
<models />
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jcr:root
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Page"
>
<jcr:content jcr:primaryType="nt:unstructured" />
<blog-post />
<contributor />
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8" ?>
<jcr:root
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:granite="http://www.adobe.com/jcr/granite/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Template"
allowedPaths="[/content/entities(/.*)?]"
ranking="{Long}100"
>
<jcr:content
cq:scaffolding="/conf/aem-site-template-tailwind/settings/dam/cfm/models/blog-post/jcr:content/model"
cq:templateType="/libs/settings/dam/cfm/model-types/fragment"
jcr:primaryType="cq:PageContent"
jcr:title="Blog Post"
sling:resourceSuperType="dam/cfm/models/console/components/data/entity"
sling:resourceType="dam/cfm/models/console/components/data/entity/default"
status="enabled"
>
<metadata jcr:primaryType="nt:unstructured" />
<model
cq:targetPath="/content/entities"
jcr:primaryType="cq:PageContent"
sling:resourceType="wcm/scaffolding/components/scaffolding"
dataTypesConfig="/mnt/overlay/settings/dam/cfm/models/formbuilderconfig/datatypes"
maxGeneratedOrder="20"
>
<cq:dialog
jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog"
>
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"
>
<items
jcr:primaryType="nt:unstructured"
maxGeneratedOrder="26"
>
<_x0031_646412355783
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Title"
listOrder="21"
maxlength="255"
metaType="text-single"
name="title"
renderReadOnly="false"
required="on"
showEmptyInReadOnly="true"
valueType="string"
>
<granite:data jcr:primaryType="nt:unstructured" />
</_x0031_646412355783>
<_x0031_646412541876
jcr:primaryType="nt:unstructured"
sling:resourceType="dam/cfm/models/editor/components/datatypes/datepicker"
displayedFormat="YYYY-MM-DD HH:mm"
emptyText="[YYYY-MM-DD HH:mm,YYYY-MM-DD HH:mm:ss]"
fieldLabel="Publish Date"
listOrder="25"
metaType="date"
name="publishDate"
renderReadOnly="false"
showEmptyInReadOnly="true"
type="datetime"
valueFormat="YYYY-MM-DD[T]HH:mm:ss.000Z"
valueType="calendar/datetime"
>
<granite:data
jcr:primaryType="nt:unstructured"
typeHint="Date"
/>
</_x0031_646412541876>
<_x0031_646412430864
jcr:primaryType="nt:unstructured"
sling:resourceType="dam/cfm/admin/components/authoring/contenteditor/multieditor"
cfm-element="Description"
checked="false"
default-mime-type="text/html"
listOrder="24"
metaType="text-multi"
name="description"
renderReadOnly="false"
showEmptyInReadOnly="true"
valueType="string/multiline"
/>
<_x0031_646412555746
jcr:primaryType="nt:unstructured"
sling:resourceType="dam/cfm/models/editor/components/fragmentreference"
allowNew="{Boolean}true"
fieldLabel="Contributor"
filter="hierarchy"
fragmentmodelreference="/conf/aem-site-template-tailwind/settings/dam/cfm/models/contributor"
listOrder="26"
metaType="fragment-reference"
name="contributor"
nameSuffix="contentReference"
renderReadOnly="false"
showEmptyInReadOnly="true"
valueType="string/content-fragment"
>
<field jcr:primaryType="nt:unstructured" />
<granite:data jcr:primaryType="nt:unstructured" />
</_x0031_646412555746>
<_x0031_646412406301
jcr:primaryType="nt:unstructured"
sling:resourceType="dam/cfm/models/editor/components/contentreference"
fieldLabel="Featured Image"
filter="hierarchy"
listOrder="23"
metaType="reference"
name="featuredImage"
nameSuffix="contentReference"
renderReadOnly="false"
showEmptyInReadOnly="true"
showThumbnail="true"
validation="[cfm.validation.contenttype.image,cfm.validation.contenttype.video]"
valueType="string/reference"
>
<granite:data
jcr:primaryType="nt:unstructured"
showThumbnail="true"
thumbnail-validation="cfm.validation.thumbnail.show"
/>
</_x0031_646412406301>
<_x0031_646412377697
jcr:primaryType="nt:unstructured"
sling:resourceType="dam/cfm/admin/components/authoring/contenteditor/multieditor"
cfm-element="Blog Content"
checked="false"
default-mime-type="text/html"
listOrder="22"
metaType="text-multi"
name="blogContent"
renderReadOnly="false"
required="on"
showEmptyInReadOnly="true"
valueType="string/multiline"
/>
</items>
</content>
</cq:dialog>
</model>
</jcr:content>
</jcr:root>
Loading

0 comments on commit fcc6afc

Please sign in to comment.