Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Remove "symbol_dollar" and "symbol_hash" archetype variables (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmeuli authored and habansal committed Oct 17, 2019
1 parent df45547 commit 2a068a5
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 90 deletions.
7 changes: 0 additions & 7 deletions src/main/resources/META-INF/maven/archetype-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,5 @@
<validationRegex>^\d+(\.\d+){0,2}(\-SNAPSHOT)?$</validationRegex>
<defaultValue>1.0.0-SNAPSHOT</defaultValue>
</requiredProperty>
<!-- Required HTL replacements -->
<requiredProperty key="symbol_dollar">
<defaultValue>$</defaultValue>
</requiredProperty>
<requiredProperty key="symbol_hash">
<defaultValue>#</defaultValue>
</requiredProperty>
</requiredProperties>
</archetype-descriptor>
17 changes: 9 additions & 8 deletions src/main/resources/archetype-resources/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
${symbol_hash} Initial AEM SPA project template
#set($hash = '#')
${hash} Initial AEM SPA project template

This is a content package for an AEM project set up with the SPA Maven Archetype for AEM (aem-spa-project-archetype).

${symbol_hash}${symbol_hash} Modules of this project:
${hash}${hash} Modules of this project:

* [core](core/): OSGi bundle containing:
* Java classes (e.g. Sling Models, Servlets, business logic)
Expand All @@ -17,13 +18,13 @@ ${symbol_hash}${symbol_hash} Modules of this project:
* [all](all/): All-in-One package


${symbol_hash}${symbol_hash} Build all modules
${hash}${hash} Build all modules

To build all the modules run in the project root directory the following command with Maven:

mvn clean install

${symbol_hash}${symbol_hash}${symbol_hash} Module build order and installation
${hash}${hash}${hash} Module build order and installation

The frontend modules builds and transpiles the es6 javascript source code into a browser friendly 2015 version.
It then creates a client library and copy the built javascript files in the [ui.apps/src/main/content/jcr_root/apps](ui.apps/src/main/content/jcr_root/apps/) module.
Expand All @@ -35,15 +36,15 @@ For ease of the build and installation the following profiles are provided in th
* ``autoInstallPackage`` - installs the package/bundle to an existing AEM author instance
* ``autoInstallPackagePublish`` - installs the package/bundle to an existing AEM publish instance

${symbol_hash}${symbol_hash}${symbol_hash} UberJar
${hash}${hash}${hash} UberJar

This project relies on the unobfuscated AEM 6.4 cq-quickstart. This is publicly available on https://repo.adobe.com

For more details about the UberJar please head over to the
[How to Build AEM Projects using Apache Maven](https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/ht-projects-maven.html)
documentation page.

${symbol_hash}${symbol_hash}${symbol_hash} Install everything
${hash}${hash}${hash} Install everything

In the All-in-One package in [all](all/) there is additional profile available to package all the dependencies into a
single content package and install everything to an existing AEM
Expand All @@ -67,15 +68,15 @@ After deployment you can open the sample content page in your browser:

* Author: http://${aem.host}:${aem.port}${aem.contextPath}/editor.html/content/${projectName}/en.html

${symbol_hash}${symbol_hash} System requirements
${hash}${hash} System requirements

* JDK 1.8 or higher
* Apache Maven 3.5.0 or higher
* Include the [Adobe Public Maven Repository][adobe-public-maven-repo] in your maven settings

It is recommended to set up the local AEM instances with `nosamplecontent` run mode.

${symbol_hash}${symbol_hash} Maven settings
${hash}${hash} Maven settings

The project comes with the auto-public repository configured. To setup the repository in your Maven settings, refer to:

Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/archetype-resources/react-app/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@

${symbol_hash}${symbol_hash} Running the development server
#set($hash = '#')
${hash}${hash} Running the development server
```
npm run start
```
This will open the local dev server on port 3000. You can navigate then to `http://localhost:3000/content/${projectName}/en/home.html`
where `REACT_APP_API_HOST` points to your AEM instance.

${symbol_hash}${symbol_hash}${symbol_hash}${symbol_hash} Your requests to AEM are failing
Most probably this is due to CORS rejection, so you might want to either configure AEM to accept CORS or bypass it from the browser if you are doing local development.
${hash}${hash}${hash}${hash} Your requests to AEM are failing
Most probably this is due to CORS rejection, so you might want to either configure AEM to accept CORS or bypass it from the browser if you are doing local development.
Also assure that your request to the AEM instance is authorized.

${symbol_hash}${symbol_hash}${symbol_hash}${symbol_hash} Authorize your requests
* Instantiate a CustomModelClient such as [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources/react-app/src/server/CustomModelClient.js)
when initializing the [ModelManager in src/index.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/index.js${symbol_hash}L42)
* If necessary adapt the Authorization header in [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/server/CustomModelClient.js${symbol_hash}L21)
${hash}${hash}${hash}${hash} Authorize your requests
* Instantiate a CustomModelClient such as [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources/react-app/src/server/CustomModelClient.js)
when initializing the [ModelManager in src/index.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/index.js${hash}L42)
* If necessary adapt the Authorization header in [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/server/CustomModelClient.js${hash}L21)

${symbol_hash}${symbol_hash}${symbol_hash}${symbol_hash} Update the CORS configuration of the AEM instance
${hash}${hash}${hash}${hash} Update the CORS configuration of the AEM instance
1. Navigate to the Configuration Manager on the AEM instance at http://localhost:4502/system/console/configMgr
2. Look for the configuration: Adobe Granite Cross-Origin Resource Sharing Policy
3. Create a new configuration with the following additional values:
* Allowed Origins: http://localhost:3000
* Supported Headers: Authorization
* Allowed Methods: OPTIONS

${symbol_hash}${symbol_hash}${symbol_hash}${symbol_hash} Your images don't show up
${hash}${hash}${hash}${hash} Your images don't show up
Most probably the images are having relative paths, and because we are not on AEM they won't exist on this server.
Quick fix would be to force the AEM absolute path on the images from the image component
17 changes: 9 additions & 8 deletions src/main/resources/archetype-resources/react-app/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#set($hash = '#')
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

${symbol_hash}${symbol_hash} Available Scripts
${hash}${hash} Available Scripts

In the project directory, you can run:

${symbol_hash}${symbol_hash}${symbol_hash} `npm start`
${hash}${hash}${hash} `npm start`

Runs the app in the development mode by proxying the JSON model from a local AEM instance running at http://localhost:4502.

Expand All @@ -16,16 +17,16 @@ This assumes that the entire project has been deployed to AEM at least once.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.

${symbol_hash}${symbol_hash}${symbol_hash} `npm test`
${hash}${hash}${hash} `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

${symbol_hash}${symbol_hash}${symbol_hash} `npm run test:debug`
See the section about [debugging tests](https://facebook.github.io/create-react-app/docs/debugging-tests) for more
${hash}${hash}${hash} `npm run test:debug`
See the section about [debugging tests](https://facebook.github.io/create-react-app/docs/debugging-tests) for more
information.

${symbol_hash}${symbol_hash}${symbol_hash} `npm run build`
${hash}${hash}${hash} `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
Expand All @@ -35,7 +36,7 @@ Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

${symbol_hash}${symbol_hash}${symbol_hash} `npm run eject`
${hash}${hash}${hash} `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

Expand All @@ -45,7 +46,7 @@ Instead, it will copy all the configuration files and the transitive dependencie

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

${symbol_hash}${symbol_hash} Learn More
${hash}${hash} Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<!--/*
Custom footer
*/-->
<sly data-sly-use.clientLib="${symbol_dollar}{'/libs/granite/sightly/templates/clientlib.html'}"></sly>
<sly data-sly-test="${symbol_dollar}{wcmmode.edit || wcmmode.preview}"
data-sly-call="${symbol_dollar}{clientLib.js @ categories='cq.authoring.pagemodel.messaging'}"></sly>
<sly data-sly-call="${symbol_dollar}{clientLib.js @ categories='${projectName}-${optionFrontend}'}"></sly>
#set($dollar = '$')
<sly
data-sly-use.clientLib="${dollar}{'/libs/granite/sightly/templates/clientlib.html'}"
></sly>
<sly
data-sly-test="${dollar}{wcmmode.edit || wcmmode.preview}"
data-sly-call="${dollar}{clientLib.js @ categories='cq.authoring.pagemodel.messaging'}"
></sly>
<sly
data-sly-call="${dollar}{clientLib.js @ categories='${projectName}-${optionFrontend}'}"
></sly>
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
<!--/*
Custom Headerlibs
*/-->
<meta property="cq:datatype" data-sly-test="${symbol_dollar}{wcmmode.edit || wcmmode.preview}" content="JSON"/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.edit}" content="edit"/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.preview}" content="preview"/>
<meta property="cq:pagemodel_root_url" data-sly-use.page="${package}.models.HierarchyPage" content="${page.rootUrl}"/>
#set($dollar = '$')
<meta
property="cq:datatype"
data-sly-test="${dollar}{wcmmode.edit || wcmmode.preview}"
content="JSON"
/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.edit}" content="edit" />
<meta
property="cq:wcmmode"
data-sly-test="${wcmmode.preview}"
content="preview"
/>
<meta
property="cq:pagemodel_root_url"
data-sly-use.page="${package}.models.HierarchyPage"
content="${page.rootUrl}"
/>
<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html">
<sly data-sly-call="${symbol_dollar}{clientlib.css @ categories='${projectName}-${optionFrontend}'}"/>
</sly>
<sly
data-sly-call="${dollar}{clientlib.css @ categories='${projectName}-${optionFrontend}'}"
></sly>
</sly>
2 changes: 0 additions & 2 deletions src/test/resources/projects/angular/archetype.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ optionFrontend=angular
projectName=test-spa-angular-project
projectTitle=Test SPA Angular Project
componentGroup=Test Spa ComponentGroup
symbol_dollar=$
symbol_hash=#
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<!--/*
Custom footer
*/-->
<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"></sly>
<sly data-sly-test="${wcmmode.edit || wcmmode.preview}"
data-sly-call="${clientLib.js @ categories='cq.authoring.pagemodel.messaging'}"></sly>
<sly data-sly-call="${clientLib.js @ categories='test-spa-angular-project-angular'}"></sly>
<sly
data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"
></sly>
<sly
data-sly-test="${wcmmode.edit || wcmmode.preview}"
data-sly-call="${clientLib.js @ categories='cq.authoring.pagemodel.messaging'}"
></sly>
<sly
data-sly-call="${clientLib.js @ categories='test-spa-angular-project-angular'}"
></sly>
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<!--/*
Custom Headerlibs
*/-->
<meta property="cq:datatype" data-sly-test="${wcmmode.edit || wcmmode.preview}" content="JSON"/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.edit}" content="edit"/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.preview}" content="preview"/>
<meta property="cq:pagemodel_root_url" data-sly-use.page="com.adobe.spa.test.projects.models.HierarchyPage" content="${page.rootUrl}"/>
<meta
property="cq:datatype"
data-sly-test="${wcmmode.edit || wcmmode.preview}"
content="JSON"
/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.edit}" content="edit" />
<meta
property="cq:wcmmode"
data-sly-test="${wcmmode.preview}"
content="preview"
/>
<meta
property="cq:pagemodel_root_url"
data-sly-use.page="com.adobe.spa.test.projects.models.HierarchyPage"
content="${page.rootUrl}"
/>
<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html">
<sly data-sly-call="${clientlib.css @ categories='test-spa-angular-project-angular'}"/>
</sly>
<sly
data-sly-call="${clientlib.css @ categories='test-spa-angular-project-angular'}"
></sly>
</sly>
2 changes: 0 additions & 2 deletions src/test/resources/projects/react/archetype.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ optionFrontend=react
projectName=test-spa-react-project
projectTitle=Test SPA React Project
componentGroup=Test Spa ComponentGroup
symbol_dollar=$
symbol_hash=#
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## Running the development server
```
npm run start
Expand All @@ -7,13 +6,13 @@ This will open the local dev server on port 3000. You can navigate then to `http
where `REACT_APP_API_HOST` points to your AEM instance.

#### Your requests to AEM are failing
Most probably this is due to CORS rejection, so you might want to either configure AEM to accept CORS or bypass it from the browser if you are doing local development.
Most probably this is due to CORS rejection, so you might want to either configure AEM to accept CORS or bypass it from the browser if you are doing local development.
Also assure that your request to the AEM instance is authorized.

#### Authorize your requests
* Instantiate a CustomModelClient such as [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources/react-app/src/server/CustomModelClient.js)
* Instantiate a CustomModelClient such as [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources/react-app/src/server/CustomModelClient.js)
when initializing the [ModelManager in src/index.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/index.js#L42)
* If necessary adapt the Authorization header in [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/server/CustomModelClient.js#L21)
* If necessary adapt the Authorization header in [src/server/CustomModelClient.js](https://github.com/adobe/aem-spa-project-archetype/blob/master/src/main/resources/archetype-resources//react-app/src/server/CustomModelClient.js#L21)

#### Update the CORS configuration of the AEM instance
1. Navigate to the Configuration Manager on the AEM instance at http://localhost:4502/system/console/configMgr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run test:debug`
See the section about [debugging tests](https://facebook.github.io/create-react-app/docs/debugging-tests) for more
See the section about [debugging tests](https://facebook.github.io/create-react-app/docs/debugging-tests) for more
information.

### `npm run build`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<!--/*
Custom footer
*/-->
<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"></sly>
<sly data-sly-test="${wcmmode.edit || wcmmode.preview}"
data-sly-call="${clientLib.js @ categories='cq.authoring.pagemodel.messaging'}"></sly>
<sly data-sly-call="${clientLib.js @ categories='test-spa-react-project-react'}"></sly>
<sly
data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"
></sly>
<sly
data-sly-test="${wcmmode.edit || wcmmode.preview}"
data-sly-call="${clientLib.js @ categories='cq.authoring.pagemodel.messaging'}"
></sly>
<sly
data-sly-call="${clientLib.js @ categories='test-spa-react-project-react'}"
></sly>
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<!--/*
Custom Headerlibs
*/-->
<meta property="cq:datatype" data-sly-test="${wcmmode.edit || wcmmode.preview}" content="JSON"/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.edit}" content="edit"/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.preview}" content="preview"/>
<meta property="cq:pagemodel_root_url" data-sly-use.page="com.adobe.spa.test.projects.models.HierarchyPage" content="${page.rootUrl}"/>
<meta
property="cq:datatype"
data-sly-test="${wcmmode.edit || wcmmode.preview}"
content="JSON"
/>
<meta property="cq:wcmmode" data-sly-test="${wcmmode.edit}" content="edit" />
<meta
property="cq:wcmmode"
data-sly-test="${wcmmode.preview}"
content="preview"
/>
<meta
property="cq:pagemodel_root_url"
data-sly-use.page="com.adobe.spa.test.projects.models.HierarchyPage"
content="${page.rootUrl}"
/>
<sly data-sly-use.clientlib="/libs/granite/sightly/templates/clientlib.html">
<sly data-sly-call="${clientlib.css @ categories='test-spa-react-project-react'}"/>
</sly>
<sly
data-sly-call="${clientlib.css @ categories='test-spa-react-project-react'}"
></sly>
</sly>

0 comments on commit 2a068a5

Please sign in to comment.