-
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
cleanup #45
cleanup #45
Conversation
I'd remove both if we are not using them since the idea is to clean up the codebase and make everything easier to understand (code & instructions) If at some point we decide that we need any of the two... we can come back to this PR and add it back! |
lgtm!
As I understand it already worked before this pr, when it was added to
on
Agree |
Ohh actually if you remove
Yup agree will remove it in this PR itself 🙌 |
Got it, thanks! I didn't notice that |
contributors/RFC-extensions.md
Outdated
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.
What if we change this filename to core-extensions
or something like that? So then we can create external-extensions
for extensions that will live in other repos. Or are we planning to put all of them together 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.
voting for first option
src/tasks/copy-template-files.ts
Outdated
const isPackageJson = isPackageJsonRegex.test(fileName); | ||
const isYarnLock = isYarnLockRegex.test(fileName); | ||
const isNextGenerated = isNextGeneratedRegex.test(fileName); | ||
|
||
const skipAlways = isTemplate || isPackageJson; | ||
const skipDevOnly = isYarnLock || isNextGenerated; | ||
const shouldSkip = skipAlways || (isDev && skipDevOnly); | ||
|
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.
Trying to understand this.
- why were we not copying package.json before?
dev
is not important anymore 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.
Ohh my bad actually I planned to write a comment on why did I remove all this and forgot about it but here is description:
So basically this function copies "base" dir into user mentioned path.
why were we not copying package.json before?
We were ignore package.json here because just below this copyOrLink
func we were using mergePackageJson
to merge package.json's :
create-eth/src/tasks/copy-template-files.ts
Lines 57 to 62 in 6a3afc7
const basePackageJsonPaths = findFilesRecursiveSync(basePath, path => isPackageJsonRegex.test(path)); | |
basePackageJsonPaths.forEach(packageJsonPath => { | |
const partialPath = packageJsonPath.split(basePath)[1]; | |
mergePackageJson(path.join(targetDir, partialPath), path.join(basePath, partialPath), isDev); | |
}); |
I have removed this part in this PR since:
- "base" dir is the first dir copied to user mentioned path.
- which means the user mentioned path is empty.
- So we don't need merging of package.json at all. we could just copy the whole "base" dir to user mentioned path directly except template files. (hence we are not skipping package.json in
copyOrLink
func in this PR)
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.
dev
is not important anymore here?
I initially thought it was not needed since we have removed "nextjs/generated" but just updated the logic and added it back so that we don't symlink yarn.lock
and packages/nextjs/contracts/deployedContracts.ts
since both are reproducible and we don't want to commit them while creating extension.
src/utils/extensions-tree.ts
Outdated
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.
Haven't removed this file it's just rename checkout #45 (comment)
// 2. Add "parent" extensions (set via config.json#extend field) | ||
options.extensions = expandExtensions(options); |
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.
We no more need this since we are not allowing extending extension anymore
Summary:
copy-template-files.ts
Basic flow on how CLI works:
cli.ts
parseArgumentsIntoOptions
parses argument which are explicitly mentioned by user (like--install
etc)promptForMissingOptions
, it does multiple jobs:config.ts
are in proper formatconfig.ts
filetemplates/extensions/nextORM
which has two extensions in that folder :temapltes/extensions/nextDB/extensions/primsa
andteamplates/extensions/nextDB/extensions/drizzle
prisma
&drizzle
insidenextORM
extension so it will ask the user to select one of them or noneNested extensions
traverseExtensions
which is present inextensions-tree.ts
traverseExtensions
also setsextensionDict
(extension descriptor) basically metadata about extension for eg in above nextORM case :{name: 'nextORM', subExtensions: ['prisma', 'drizzle'] }
and also the extending extensionsawait traverseExtensions(...)
at end of fileimport { extensionDict } from "./extensions-tree";
it will set theextensionDict
with the metadata of extension which we use all over the places especially incopy-template-files.ts
filemain.ts
this file has pretty intuitive straight line flow, the imp file here iscopy-template-files.ts
cc @carletex, I didn't remove the
Nested extensions
and extending extensions (point 3 from above notes) logic in this PR, was thinking to do it in another PR just incase if we plan to add similar functionality back. But please let me know if we should do it in this PR itself !Currently both
Nested extensions
and extending extensions are not used at all and also doesn't work with external extensions.I think we could completely remove extending extensions but I see some value in
Nested extensions
and we can make it work for external extensions with minor tweaks