-
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 + getMetadata.ts + manifest.json #145
base: main
Are you sure you want to change the base?
Conversation
Hey port can you share the repo(extension) where you have the |
Could you please take a look at this table? We added it recently. Looks like you can use a raw object instead of a stringified and maybe simplify some logic |
Hey thanks for the comments, and I somehow did not receive a notif about Shiv's comment. So here is the repo: Maybe we should remove include, exclude and paths and keep the other two? lol this was difficult, lmk if i did anything wrong here |
Update it please, params of extension are different from this pr
Thinking without checking, but I think this should work
where |
Thanks! Could you please check again to see if i got it right? @rin-st I have also updated the example args file |
Thanks @portdeveloper ! Added some comments. Also, you can test resulting template for example with this defaults
|
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.
Lgtm! But don't merge it for now, let's wait also Shiv or Carlos
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.
Umm @portdeveloper I think you forgot to update https://github.com/portdeveloper/test-tsconfig-ext/blob/main/extension/packages/nextjs/tsconfig.json.args.mjs ?
I am just trying to understand what extra tsConfig things we need and maybe we can set them as default in main SE-2 (for eg last time we switched "moduleResolution": "Bundler"
by default in SE-2 for better working with all extensions)
Also I think you are working on pwa extension right, so maybe can you add all the required .template.mjs
in this PR itself?
@technophile-04 And there doesn't seem to be anything an extension-builder can add besides more plugins and more compiler options? I have updated https://github.com/portdeveloper/test-tsconfig-ext/blob/main/extension/packages/nextjs/tsconfig.json.args.mjs too |
yeah true lol there not other options to add, also for pwa do you need any other more template file like |
We also need these:
Should I get the manifest.json and getMetadata in this PR as well? |
Yes could you do that please? Regarding this :
I think we need to update main SE-2 repo with Thanks @portdeveloper!! |
Sorry for the continued confusion on this. I think that won't be necessary! Because I am using the Let me quickly update that as well. |
Ohh I see! I think last time I tried using PS: I am replying to my own comment because Port replied to og comment by editing it 🤣 |
I am never gonna work under the sun again :(((((( i was like why does it say technophile there this should be a bug lmaooo |
Hey just added a commit for the manifest.json file, and hopefully I am not editing anyone's message hehe. args.mjs i used to test things: Had to make iconPath optional as that is not needed in the pwa template. |
Honestly, I don't understand how to templatize getMetadata.ts and how to use stringify. I am so confused lol |
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 |
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.
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.
Ohh yeah makes sense! So people need to pas export const iconPath = ''
to omit that field.
What if people forgot to add export const iconPath = ''
but also have icons
in their template, will it still work as expected?
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.
https://github.com/portdeveloper/test-everything
yes i tested it with this extension which has all the args mjs files for the changed files in this PR
@@ -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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh yeah makes sense, my bad. Can we have an corresponding args.mjs file for this file?
I don't see it in https://github.com/portdeveloper/manifest-test
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.
export const titleTemplate = "%s | My PWA App"
export const extraIcons = {
shortcut: "/favicon.ico",
apple: [{ url: "/icons/apple-touch-icon.png", sizes: "180x180" }]
}
export const extraMetadata = {
applicationName: 'title',
manifest: "/manifest.json",
appleWebApp: {
capable: true,
statusBarStyle: "default",
title: 'title'
},
formatDetection: {
telephone: false
}
}
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.
https://github.com/portdeveloper/test-everything Here is a repo with all the changed files.
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.
Forgive me if i get this wrong but then it cannot read baseUrl (If we stringify the return)
If I understand it right you can theoretically do (writing it without trying)
return {
metadataBase: new Url(baseUrl),
...${stringify({title: ..., description: ... , openGraph: .., twitter: ..})},
etc
but since that part is always the same I think it's ok that it already stringifyed
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.
@@ -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 ') : ''} |
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.
have you tried ...${stringify(extraIcons[0]}
here?
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.
Does not work since there is no object there, the "..." just gets transferred to the created file
}, | ||
${extraMetadata[0] ? Object.entries(extraMetadata[0]).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join(',\n ') : ''} |
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.
same here but with extraMetadata[0]
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.
Description
Added a template for
tsconfig.json
file to the project templates.Changes
tsconfig.json
template file, removed tsconfig.jsonTesting
Here is a repo with all the changed file args
https://github.com/portdeveloper/test-everything
To-Do