forked from scaffold-eth/scaffold-eth-2
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add template for tsconfig.json #145
Open
portdeveloper
wants to merge
9
commits into
main
Choose a base branch
from
feat/ts-config-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2783fe3
Add template for tsconfig.json
portdeveloper 7df1a2c
Remove unnecessary params
portdeveloper 944a741
Merge main
portdeveloper a5c1290
Update the template file to use stringify func
portdeveloper f158bb8
Modify template to work with non-existing args
portdeveloper 14ddaf4
Fix bad practices
portdeveloper ec2d358
Delete unnecessary files
portdeveloper e8d6227
Add manifest.json template
portdeveloper 0816599
Add getmetadata template... in a weird way...
portdeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"create-eth": patch | ||
--- | ||
|
||
templates: added template for tsconfig.json file |
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
templates/base/packages/nextjs/public/manifest.json.template.mjs
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,15 @@ | ||
import { stringify, withDefaults } from '../../../../utils.js' | ||
|
||
const contents = ({ name, description, iconPath, extraContent }) => stringify({ | ||
name: name[0], | ||
description: description[0], | ||
...(iconPath[0] && { iconPath: iconPath[0] }), // Only include iconPath if it's provided | ||
...extraContent[0] | ||
}) | ||
|
||
export default withDefaults(contents, { | ||
name: "Scaffold-ETH 2 DApp", | ||
description: "A DApp built with Scaffold-ETH", | ||
iconPath: "logo.svg", | ||
extraContent: [] | ||
}) |
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
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { stringify, withDefaults } from '../../../../../utils.js' | ||
|
||
const contents = ({ titleTemplate, extraIcons, extraMetadata }) => ` | ||
import type { Metadata } from "next"; | ||
|
||
const baseUrl = process.env.VERCEL_PROJECT_PRODUCTION_URL | ||
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` | ||
: `http://localhost:${process.env.PORT || 3000}`; | ||
const titleTemplate = "%s | Scaffold-ETH 2"; | ||
? \`https://\${process.env.VERCEL_PROJECT_PRODUCTION_URL}\` | ||
: \`http://localhost:\${process.env.PORT || 3000}\`; | ||
const titleTemplate = "${titleTemplate[0] || '%s | Scaffold-ETH 2'}"; | ||
|
||
export const getMetadata = ({ | ||
title, | ||
|
@@ -14,7 +17,7 @@ export const getMetadata = ({ | |
description: string; | ||
imageRelativePath?: string; | ||
}): Metadata => { | ||
const imageUrl = `${baseUrl}${imageRelativePath}`; | ||
const imageUrl = \`\${baseUrl}\${imageRelativePath}\`; | ||
|
||
return { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
metadataBase: new URL(baseUrl), | ||
|
@@ -45,6 +48,15 @@ export const getMetadata = ({ | |
}, | ||
icons: { | ||
icon: [{ url: "/favicon.png", sizes: "32x32", type: "image/png" }], | ||
${extraIcons[0] ? Object.entries(extraIcons[0]).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join(',\n ') : ''} | ||
}, | ||
${extraMetadata[0] ? Object.entries(extraMetadata[0]).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join(',\n ') : ''} | ||
}; | ||
}; | ||
` | ||
|
||
export default withDefaults(contents, { | ||
titleTemplate: '', | ||
extraIcons: {}, | ||
extraMetadata: {} | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If extension developer doesn't pass the iconPath it will default to "logo.svg" right? So we don't need this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of icon, we are gonna have icons, like the example below:
https://github.com/serwist/serwist/blob/main/examples/next-web-push/public/manifest.json
So, we don't need the icon if the dev does not provide it.