-
-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/template based project creation #3
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
Open
cxalem
wants to merge
14
commits into
main
Choose a base branch
from
feat/template-based-project-creation
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.
Conversation
This file contains hidden or 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
- Updated package.json to include 'degit' and its types. - Modified tsconfig.json to exclude legacy code directories. - Enhanced template handling in constants and utils, allowing for both degit and git templates. - Introduced new project creation helpers for React and Next.js with improved structure. - Added tests for utility functions to ensure proper functionality and error handling. - Created legacy code files for future reference and potential migration.
👀👀 |
- Changed package name from @metamask/create-web3-app to @consensys/create-web3-app. - Updated version in package.json from 1.0.0 to 1.0.3. - Introduced a new optional field for Dynamic Environment ID in ProjectOptions. - Enhanced template handling to include a new MetaMask dynamic template. - Updated utility functions to support the new options and improved error handling. - Added spinner feedback for better user experience during project setup.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
- Removed 'degit' from dependencies and added it back to devDependencies for better organization.
- Updated the validation logic to ensure project names are not only non-empty but also conform to kebab-case format (e.g., my-awesome-project).
- Created a new workflow to automate the release publishing process on pushes to the main branch. - Includes jobs for building the project, uploading artifacts, performing a dry run of the npm publish, and executing the actual publish. - Added steps to retrieve the release version from package.json. - Commented out documentation publishing jobs for future implementation.
- Changed package name from @consensys/create-web3-app to @metamask/create-web3-app. - Updated version from 1.0.6 to 1.0.0. - Added build script to the scripts section. - Introduced publishConfig for npm registry settings.
…xisting versions for other packages
…o streamline project dependencies.
shahbaz17
approved these changes
May 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactor: Use degit for Template Cloning and Add Tests
Context:
The previous CLI implementation manually created project files and injected dependencies after running
create-next-app
orcreate-vite
. This approach was brittle, hard to maintain, and diverged from using standardized templates.The goal is to leverage official example templates directly. The primary target template, the Next.js
quickstart
example, resides as a subdirectory within theMetaMask/metamask-sdk-examples
monorepo. Standardgit clone
is unsuitable as it would download the entire monorepo.Changes:
This PR refactors the core project creation logic to use templates, specifically integrating
degit
for fetching subdirectories from Git repositories.legacy_code/next.helpers.ts
,legacy_code/vite.helpers.ts
).src/utils/index.ts
(cloneTemplate
function) to handle template fetching.degit
as a dependency.src/constants/templates.ts
to support adegitSource
property alongside the existingrepo_url
. TheNext.js Quickstart
template now usesdegitSource: "MetaMask/metamask-sdk-examples/examples/quickstart"
.cloneTemplate
to check if a template usesdegitSource
orrepo_url
and uses the appropriate tool (degit
orgit clone
viaexecAsync
).isDegitTemplate
,isGitTemplate
) for clarity.promptForOptions
,cloneTemplate
,initializeMonorepo
,createProject
) usingvitest
insrc/utils/index.test.ts
.fs
,inquirer
,execAsync
, anddegit
usingvi.mock
.beforeEach
.degit
andgit clone
paths withincloneTemplate
, as well as standalone vs. monorepo project creation flows increateProject
(Not working by now, but will work on testing in following iterations).How to Test:
npm run build
(oryarn build
)npm run link-cli
(oryarn link-cli
)create-web3-app my-degit-test
my-degit-test
ormy-degit-test/packages/site
) structure and contents match thequickstart
example from themetamask-sdk-examples
repo.npm test
(oryarn test
). All tests should pass.Notes:
repo_url
and will be cloned usinggit clone
. This can be updated to usedegit
if/when a suitable React example is available in the examples monorepo.src/legacy_code
for reference but are no longer used.