adobe / aem-project-archetype

Maven template to create best-practice websites on AEM.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
Apache License 2.0
547 stars 426 forks source link

Cannot create a project with decoupled frontend #1018

Closed Giwayume closed 1 year ago

Giwayume commented 1 year ago

Expected Behaviour

Project generation completes successfully.

Actual Behaviour

Exception in thread "main" Assertion Failed:
assert new File(rootDir, "ui.frontend.$optionFrontendModule").renameTo(new File(rootDir, "ui.frontend"))

Reproduce Scenario (including but not limited to)

Generating a project archetype with decoupled frontend.

Steps to Reproduce

Windows 10; Open a command prompt by running it as administrator. Run the command:

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \
 -D archetypeGroupId=com.adobe.aem \
 -D archetypeArtifactId=aem-project-archetype \
 -D archetypeVersion=39 \
 -D appTitle="SPA Site" \
 -D appId="spasite" \
 -D groupId="com.spasite" \
 -D frontendModule="decoupled"

Platform and Version

Plugin 3.2.1 Windows 10 64 bit MVN 3.8.7 Java 1.8.0_202

Logs taken while reproducing problem

Exception in thread "main" Assertion Failed:
assert new File(rootDir, "ui.frontend.$optionFrontendModule").renameTo(new File(rootDir, "ui.frontend"))
kevinolivar commented 1 year ago

Hi @Giwayume,

AFAIK, you can only use the following values 'general', 'react' or 'angular'.

UPDATE: On develop branch, it actually states you can use 'decoupled',

Includes a Webpack frontend build module that generates the client libraries (can be general or none for regular sites; can be angular, react or decoupled for a Single Page App that implements the [SPA Editor](https://docs.adobe.com/content/help/en/experience-manager-65/developing/headless/spas/spa-overview.html).

It was also added here https://github.com/adobe/aem-project-archetype/pull/1002.

However, a bit confusing but checking

I don't see the option 'decoupled' anymore. Are those branches still used? Or is develop the current production?

I also found this https://github.com/adobe/aem-react-spa but there is an issue running the mvn command. The archetype version is '40' even though latest release is '39'.

Also, maybe the 'decoupled' is preferrably aem-react-spa?

@Buuhuu @vladbailescu if you could help, that'd be great!

buuhuu commented 1 year ago

You are right, the latest release of the archetype is 39 and #1002 has not yet been released. I don't know where the release/40 branch is coming from. Seems like we haven't updated master since a while. @vladbailescu can you point us to the current branching strategy of the archetype?

the aem-react-spa sample command was added with the next release version in mind, hence it uses the not yet released version 40.

You could install the archetype locally by cloning this repository and running mvn clean install. Then create a project with a decoupled frontend using

mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \
 -D archetypeGroupId=com.adobe.aem \
 -D archetypeArtifactId=aem-project-archetype \
 -D archetypeVersion=40-SNAPSHOT \
 -D appTitle="SPA Site" \
 -D appId="spasite" \
 -D groupId="com.spasite" \
 -D frontendModule="decoupled"
Giwayume commented 1 year ago

Alright. I guess the confusion is why the main branch on aem-react-spa has a readme that references in-development version of the archetype

kevinolivar commented 1 year ago

@Buuhuu awesome thanks for your prompt reply!

kevinolivar commented 1 year ago

@Buuhuu @vladbailescu Sorry to 'revive' this thread but what the difference between decoupled and remote spa (https://github.com/adobe/aem-nextjs-template)? Is there a release date regarding this decoupled version? What is this exactly if not same as remote spa?

Giwayume commented 1 year ago

Remote SPA is just any app that implements the interface necessary to be integrated into the SPA editor. (Reads page model.json, adds data-cq attributes for the editor to identify components on the page, listens to editor update events on the window for changes to the model).

Decoupled is a setup to use the AEMaaCS Frontend Pipeline