Skip to content

Commit

Permalink
[React] Use the app name as the prefix value for templates (#811)
Browse files Browse the repository at this point in the history
* Add prefix to component names and templates

* Add replacePrefix function to cli package

* Update CHANGELOG

* Update AppRoute import in ConnectedDemo component

* Update definitions files to use uppercase for templates

* Refactor replacePrefix and tests

* Add prefix as flag to jss create nextjs

* Fix graphql:update for react sample

* Apply prefix to react templates and components

* update graphql fragment types

* Add prefix arg to jss-create react

* Undo accidental commit

* Revert component names

* Remove prefix from component names - data folder

* Prep definitions for new template implementation - templateName

* Wrap prefix arg in Boolean constructor

* Update nextjs sample GraphQLIntrospectionResult

* Fix space in ContentBlock name

* Update react GraphQLFragmentTypes

* Update parsing of prefix arg in jss-create - next and react

* Remove parsing boolean from prefix from sitecore-jss-cli
  • Loading branch information
CobyPear authored Sep 13, 2021
1 parent 5d05439 commit 65669a6
Show file tree
Hide file tree
Showing 43 changed files with 640 additions and 623 deletions.
4 changes: 1 addition & 3 deletions packages/sitecore-jss-cli/src/create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ export function replacePrefix(
prefix: string,
withPrefix?: boolean
) {
const value: boolean = withPrefix === true ? true : false;

if (!value) {
if (!withPrefix) {
console.log(chalk.cyan('Removing template prefix...'));
const prefixWithHyphen = prefix + '-';
glob
Expand Down
2 changes: 1 addition & 1 deletion samples/nextjs/jss-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const { execSync } = require('child_process');
module.exports = function createJssProject(argv, nextSteps) {
console.log(`Executing create script: ${__filename}...`);

applyNameToProject(__dirname, argv.name, argv.hostName, 'JssNextWeb', argv.prefix);
applyNameToProject(__dirname, argv.name, argv.hostName, 'JssNextWeb', argv.prefix === 'true');

if (!argv.fetchWith || !argv.prerender) {
nextSteps.push(
Expand Down
Loading

0 comments on commit 65669a6

Please sign in to comment.