Skip to content
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

feat: v1 implementation of create-permissionless-app CLI #96

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Commits on Jan 25, 2024

  1. feat(cli): bootstrap the new cli package & add the CLI module

    Add a new CLI module located at `src/cli/index.ts` to encapsulate all CLI-related functionality. This module includes prompts for project configuration, bundler, paymaster, signer, and account system selection. Additionally, it provides the `runCli` function for handling CLI interactions.
    
    This commit includes some new files, mainly:
    - `src/cli/index.ts`
    - `src/utils/validateAppName.ts`
    - `src/utils/general.ts`
    - `src/constants.ts`
    - `src/utils/logger.ts`
    SouravInsights committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    9ca1ada View commit details
    Browse the repository at this point in the history
  2. feat(cli): add project scaffolding and boilerplate selection

    This commit adds new modules and functionality for scaffolding our Permissionless applications and selecting boilerplate files based on user input.
    
    ### Notable changes:
    
    #### `selectBoilerplate.ts`:
    - Introduces the `selectBoilerplate` function to handle the selection of boilerplate files.
    - Defines helper functions for copying files and overwriting file content.
    - Accesses the base & extras dir and selects specific files based on bundler, paymaster, signer, and account system.
    
    #### `scaffoldProject.ts`:
    - Implements the `scaffoldProject` function for bootstrapping the base Permissionless application.
    - Provides options to clear the directory, overwrite conflicting files, or abort installation based on existing directory status.
    - Copies the entire `template/base` directory to the target directory and displays appropriate success or error messages.
    
    #### `createProject.ts`:
    - Defines the `createProject` function for orchestrating the entire project creation process.
    - Calls `scaffoldProject` to bootstrap the base application and `selectBoilerplate` to choose boilerplate based on user options.
    - Returns the project directory path.
    
    #### `src/index.ts`:
    - Integrates the new modules into the main CLI script.
    - Extracts user preferences from CLI input using `runCli` and invokes `createProject` with the selected options.
    - Writes the project name to the `package.json` file.
    
    Known issue: There are a couple of bugs in the first attempt of the `selectBoilerplate` method, which need further investigation and correction.
    SouravInsights committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    088a943 View commit details
    Browse the repository at this point in the history
  3. chore(cli): add project template and boilerplate

    This commit adds a template directory that serves as a foundational structure for the generated Permissionless app, providing a starting point for development.
    
    **base:** This directory contains the common essential files and structure for the final boilerplate.
    
    - **extras:** This directory extends the base functionality by providing boilerplate configurations for specific choices, such as:
      - Bundler configurations (`bundler` directory), e.g., 'pimlico'.
      - Paymaster configurations (`paymaster` directory), e.g., 'pimlico'.
      - Signer configurations (`signers` directory), e.g., 'privy'.
        - Signer-specific hooks (`hooks` directory) for different account systems.
        - Signer-specific components (`components` directory), e.g., 'PrivyAuth'.
      - Additional page content for specific signers (`pages` directory), e.g., '_app/with-privy.tsx', 'index/with-privy.tsx'.
    SouravInsights committed Jan 25, 2024
    Configuration menu
    Copy the full SHA
    20c5ceb View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2024

  1. refactor: improve file selection logic and error handling in boilerpl…

    …ate setup
    
    this commit introduces enhancements to the `selectBoilerplate.ts` file, focusing on the methods responsible for file selection and setup. The modifications include:
    
    - fixed the file path resolution & implemented robust error handling mechanisms in the all these methods: `selectBundlerConfigFile`, `selectPaymasterConfigFile`, `selectSignerConfigFile`, `selectAppFile`, `selectIndexFile`, and `selectSignerHooks`.
    - added detailed logging to provide clear information in case of missing files or unsuccessful file copying.
    SouravInsights committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    0450c83 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2024

  1. Configuration menu
    Copy the full SHA
    d535a38 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2024

  1. Configuration menu
    Copy the full SHA
    04aa5a7 View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2024

  1. feat: Add installDependencies helper function and detectPackageManage…

    …r utility
    
    Added two new functions to enhance the project setup process:
    - `installDependencies`: A standalone helper function to install project dependencies based on the detected package manager (npm, yarn, pnpm, bun).
    - `detectPackageManager`: A utility function to detect the package manager being used in the current environment.
    
    These additions improve the user experience by automatically handling dependency installation using the appropriate package manager and providing flexibility in supporting multiple package managers.
    SouravInsights committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    17ab29b View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2024

  1. Configuration menu
    Copy the full SHA
    c76089b View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2024

  1. use sepolia

    SouravInsights committed Feb 10, 2024
    Configuration menu
    Copy the full SHA
    f1f0191 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fad3ee4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f0afd6c View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2024

  1. Configuration menu
    Copy the full SHA
    f401b4a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eaaf9ed View commit details
    Browse the repository at this point in the history
  3. refactor: rename the modules to & use appropriate env

    - rename the module from `bundlerClient` to `pimlicoBundlerConfig`
    - rename the module from `pimlicoPaymaster ` to `pimlicoPaymasterConfig `
    - use `NEXT_PUBLIC_PIMLICO_BUNDLER_RPC_HOST`  env instead of directly passing the rpc host
    SouravInsights committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    0ba4f4f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6e2c3e9 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5382730 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    15bdf3e View commit details
    Browse the repository at this point in the history
  7. feat: introduce 'updateIndexFile' utility function

    This commit adds a new utility function called 'updateIndexFile' to dynamically update/create the index.ts files in the target directory. The function ensures that import & export statements are correctly appended to the index.ts files whenever new files are copied based on the selected options.
    SouravInsights committed Feb 13, 2024
    Configuration menu
    Copy the full SHA
    847a496 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2024

  1. fix: resolve premature exit while installing packages

    Changes:
    
    - Introduced `runInstallCommand` function for executing package manager install commands with spinner animations.
    - Refactored `installDependencies` function to orchestrate the installation process, including directory handling, package manager detection, and error logging.
    - Improved error handling and logging messages for better user feedback.
    SouravInsights committed Feb 14, 2024
    Configuration menu
    Copy the full SHA
    2cb3853 View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2024

  1. refactor: replace console.log with Ora spinner for better feedback

    - replaced console.log statements with Ora spinner messages for better user feedback during boilerplate setup
    - utilized chalk for colored and formatted success and failure messages
    - removed unnecessary console logs
    SouravInsights committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    c6b52db View commit details
    Browse the repository at this point in the history
  2. feat: add new CLI prompt for package manager install confirmation

    This commit introduces a new feature to the CLI module in `src/cli/index.ts`. Specifically, it adds a new interactive prompt that allows users to confirm whether they want the CLI to run the package manager's install command.
    
    It also adds new CLI flags:
       - `--noInstall`: Allows users to explicitly skip running the package manager's install command.
       - `-y, --default`: Offers an option to bypass the CLI and utilize default settings for bootstrapping a new permissionless app.
    SouravInsights committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    b50cd69 View commit details
    Browse the repository at this point in the history
  3. chore: include post-setup guidance in src/index.ts

    - Added informative next steps for users after CLI execution.
    - Included some thank you note and apology message for beta issues.
    - Added a Telegram invitation link for users for feedback & potential issues.
    SouravInsights committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    9f9fc9e View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2024

  1. fix import issue

    SouravInsights authored Feb 19, 2024
    Configuration menu
    Copy the full SHA
    92bc182 View commit details
    Browse the repository at this point in the history

Commits on Feb 20, 2024

  1. Configuration menu
    Copy the full SHA
    c8ea6e9 View commit details
    Browse the repository at this point in the history
  2. Update bun.lockb

    SouravInsights committed Feb 20, 2024
    Configuration menu
    Copy the full SHA
    bd2d361 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    689192a View commit details
    Browse the repository at this point in the history
  4. Merge pull request #1 from SouravInsights/create-permissionless-app-v1

    add permissionless-app-v1
    SouravInsights authored Feb 20, 2024
    Configuration menu
    Copy the full SHA
    bd06f8a View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2024

  1. Configuration menu
    Copy the full SHA
    8fa9149 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    428844f View commit details
    Browse the repository at this point in the history
  3. fix all the issues with updateIndexFile method

    - ensure that newly created index files include the new module in the export statement.
    - fix the issue where the export statement was appending the new module multiple times in existing index files.
    - corrected the positioning of the export statement to be at the end of the file in both new and existing index files.
    - updated the `updateIndexFile` function to correctly handle both scenarios: creating new index files and updating existing ones.
    - implemented a check to prevent adding the new module to the export statement multiple times if it already exists.
    - tested the changes to ensure correct behavior in both cases of creating new index files and updating existing ones.
    SouravInsights committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    726156f View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2024

  1. Update bun.lockb

    SouravInsights committed Mar 2, 2024
    Configuration menu
    Copy the full SHA
    2cfe133 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Configuration menu
    Copy the full SHA
    2d5f15c View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2024

  1. Configuration menu
    Copy the full SHA
    cf5d93e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    42900ef View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e44945d View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2024

  1. feature: functionality to dynamically generate a .env file

    functionality to dynamically generate a .env file based on user-provided environment variables, ensuring proper configuration for the project.
    SouravInsights committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    e94e393 View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2024

  1. Configuration menu
    Copy the full SHA
    0c2487c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    59effd3 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2024

  1. chore: minor fixes

    SouravInsights committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    fa2147e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    211ea9e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    57a0ff3 View commit details
    Browse the repository at this point in the history
  4. Update bun.lockb

    SouravInsights committed Apr 2, 2024
    Configuration menu
    Copy the full SHA
    f31c01c View commit details
    Browse the repository at this point in the history

Commits on May 27, 2024

  1. feat: add Git utility functions for CLI template generator

    Added several utility functions to enhance Git-related operations in the CLI template generator tool:
    
    1. `isGitInstalled`:
       - Checks if Git is installed by executing `git --version`.
       - Returns a boolean indicating the installation status of Git.
    
    2. `isRootGitRepo`:
       - Determines if the specified directory contains a `.git` subdirectory.
       - Returns a boolean indicating the presence of a `.git` directory.
    
    3. `isInsideGitRepo`:
       - Checks if the current directory or any parent directory contains a `.git` directory.
       - Executes `git rev-parse --is-inside-work-tree` to determine if within a Git repo.
       - Returns a boolean indicating whether a `.git` directory was found.
    
    4. `getGitVersion`:
       - Retrieves the installed Git version by executing `git --version`.
       - Parses and returns the major and minor version numbers.
    
    5. `getDefaultBranch`:
       - Returns the Git config value of `init.defaultBranch`.
       - Defaults to "main" if `init.defaultBranch` is not set.
    
    6. `initializeGit`:
       - Initializes a Git repository in the specified directory.
       - Checks for existing Git installations and configurations.
       - Provides options to overwrite existing Git history or initialize a new repo within an existing worktree.
       - Uses the appropriate Git commands based on the Git version to initialize the repo and set the default branch.
    
    Enhanced user experience by adding prompts and warnings for operations that might affect existing Git repositories. Utilized `execa` for executing shell commands, `fs-extra` for file system operations, and `ora` for spinner animations to provide feedback during the initialization process.
    
    Logging and error handling have been integrated to ensure smooth operations and clear user communication.
    SouravInsights committed May 27, 2024
    Configuration menu
    Copy the full SHA
    f5e771f View commit details
    Browse the repository at this point in the history