-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
- 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.
|
|
Caution Review the following alerts detected in dependencies. According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. Learn more about Socket for GitHub.
|
- 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.
- Bump version in package.json from 1.1.0 to 1.1.2. - Introduce new event types for analytics tracking: project_created, cli_started, project_creation_failed, foundry_not_installed, and cwd_not_writable. - Update template names and IDs for better clarity and consistency. - Improve error handling and user prompts in project creation process.
- Inform users that the 'metamask-web3auth' template requires a Web3Auth client ID. - Provide instructions on obtaining the client ID and adding it to the .env file.
- Implement a check for pnpm availability during package manager selection. - Prompt the user to install pnpm globally via npm if it is not installed. - Provide error handling for installation failures and user decline scenarios.
- Bump CLI version from 1.1.2 to 1.1.3 in package.json and src/constants/index.ts.
- Change references from @metamask/create-web3-app to @consensys/create-web3-app for consistency with the updated CLI.
…ization command to avoid git commits.
- Bump CLI version from 1.1.3 to 1.1.5 in package.json and src/constants/index.ts.
…stallation - Introduce a function to check if Git is installed and available in the user's PATH. - Update the template cloning process to track an analytics event if Git is not found, providing a user-friendly error message and guidance for installation.
…ructions - Update console logs in the createProject function to provide clearer guidance on running the frontend development server. - Modify the command output to reflect the project name dynamically instead of a static path.
… utils - Correct the spelling of 'PACAKGE_MANAGER_CHOICES' to 'PACKAGE_MANAGER_CHOICES' in src/constants/index.ts. - Update all references to the corrected constant in src/utils/index.ts and src/utils/index.test.ts to ensure consistency.
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-apporcreate-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
quickstartexample, resides as a subdirectory within theMetaMask/metamask-sdk-examplesmonorepo. Standardgit cloneis unsuitable as it would download the entire monorepo.Changes:
This PR refactors the core project creation logic to use templates, specifically integrating
degitfor fetching subdirectories from Git repositories.legacy_code/next.helpers.ts,legacy_code/vite.helpers.ts).src/utils/index.ts(cloneTemplatefunction) to handle template fetching.degitas a dependency.src/constants/templates.tsto support adegitSourceproperty alongside the existingrepo_url. TheNext.js Quickstarttemplate now usesdegitSource: "MetaMask/metamask-sdk-examples/examples/quickstart".cloneTemplateto check if a template usesdegitSourceorrepo_urland uses the appropriate tool (degitorgit cloneviaexecAsync).isDegitTemplate,isGitTemplate) for clarity.promptForOptions,cloneTemplate,initializeMonorepo,createProject) usingvitestinsrc/utils/index.test.ts.fs,inquirer,execAsync, anddegitusingvi.mock.beforeEach.degitandgit clonepaths 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-testmy-degit-testormy-degit-test/packages/site) structure and contents match thequickstartexample from themetamask-sdk-examplesrepo.npm test(oryarn test). All tests should pass.Notes:
repo_urland will be cloned usinggit clone. This can be updated to usedegitif/when a suitable React example is available in the examples monorepo.src/legacy_codefor reference but are no longer used.