-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Headless SXA] Nextjs-SXA empty add-on (#927)
* add nextjs-sxa empty add-on * removed package.json, added placeholder component * changed placeholder component description
- Loading branch information
1 parent
b7b5055
commit cf11cfd
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
packages/create-sitecore-jss/src/initializers/nextjs-sxa/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import path from 'path'; | ||
import { | ||
Initializer, | ||
openPackageJson, | ||
transform, | ||
DEFAULT_APPNAME, | ||
ClientAppArgs, | ||
} from '../../common'; | ||
|
||
export default class NextjsSxaInitializer implements Initializer { | ||
get isBase(): boolean { | ||
return false; | ||
} | ||
|
||
async init(args: ClientAppArgs) { | ||
const pkg = openPackageJson(`${args.destination}\\package.json`); | ||
|
||
// TODO: prompts for SXA | ||
// const answers = await prompt<StyleguideAnswer>(styleguidePrompts, args); | ||
|
||
const mergedArgs = { | ||
...args, | ||
appName: args.appName || pkg?.config?.appName || DEFAULT_APPNAME, | ||
appPrefix: args.appPrefix || pkg?.config?.prefix || false, | ||
}; | ||
|
||
const templatePath = path.resolve(__dirname, '../../templates/nextjs-sxa'); | ||
|
||
await transform(templatePath, mergedArgs); | ||
|
||
const response = { | ||
// TODO: next steps | ||
nextSteps: [], | ||
appName: mergedArgs.appName, | ||
}; | ||
|
||
return response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/create-sitecore-jss/src/templates/nextjs-sxa/src/components/HelloWorld.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* A simple placeholder component. | ||
*/ | ||
const HelloWorld = (): JSX.Element => ( | ||
<div className="contentBlock"> | ||
<p>Hello World</p> | ||
</div> | ||
); | ||
|
||
export default HelloWorld; |