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: added pnpm support #890

Merged
merged 8 commits into from
Jun 28, 2024
Merged

feat: added pnpm support #890

merged 8 commits into from
Jun 28, 2024

Conversation

dbarrosop
Copy link
Member

@dbarrosop dbarrosop commented Jun 27, 2024

PR Type

enhancement, configuration changes


Description

  • Updated the Docker image version for functions from 1.2.0 to 1.3.0.
  • Removed package-lock.json file.
  • Added @swc/core as a dependency in package.json.
  • Added pnpm-lock.yaml file with dependencies and settings.
  • Added tsconfig.json file with TypeScript compiler options.
  • Updated and cleaned up nhost.toml configuration by removing several environment variables and AI-related configurations.
  • Modified local overlay to update environment variable values.

Changes walkthrough 📝

Relevant files
Enhancement
compose.go
Update Docker image version for functions                               

dockercompose/compose.go

  • Updated the Docker image version for functions from 1.2.0 to 1.3.0.
  • +1/-1     
    package.json
    Add @swc/core dependency to package.json                                 

    examples/myproject/functions/package.json

    • Added @swc/core as a dependency.
    +4/-2     
    Configuration changes
    package-lock.json
    Remove package-lock.json file                                                       

    examples/myproject/functions/package-lock.json

    • Removed package-lock.json file.
    +0/-14   
    pnpm-lock.yaml
    Add pnpm-lock.yaml file                                                                   

    examples/myproject/functions/pnpm-lock.yaml

    • Added pnpm-lock.yaml file with dependencies and settings.
    +144/-0 
    tsconfig.json
    Add tsconfig.json file                                                                     

    examples/myproject/functions/tsconfig.json

    • Added tsconfig.json file with TypeScript compiler options.
    +11/-0   
    nhost.toml
    Update and clean up nhost.toml configuration                         

    examples/myproject/nhost/nhost.toml

  • Removed several environment variables and AI-related configurations.
  • Updated global environment variable GREET.
  • +1/-20   
    local.json
    Update local overlay environment variables                             

    examples/myproject/nhost/overlays/local.json

    • Modified local overlay to update environment variable values.
    +8/-3     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @codiumai-pr-agent-pro codiumai-pr-agent-pro bot added dependencies Pull requests that update a dependency file Enhancement configuration changes labels Jun 27, 2024
    Copy link

    codiumai-pr-agent-pro bot commented Jun 27, 2024

    PR Reviewer Guide 🔍

    (Review updated until commit b66385e)

    ⏱️ Estimated effort to review [1-5] 3
    🧪 Relevant tests No
    🔒 Security concerns No
    ⚡ Key issues to review Dependency Management:
    The PR introduces @swc/core as a new dependency and includes a comprehensive pnpm-lock.yaml. It's crucial to ensure that all versions and resolutions specified in the lock file are compatible and do not introduce any breaking changes or conflicts with existing packages.
    Configuration Changes:
    Significant changes have been made to nhost.toml and tsconfig.json. These changes should be reviewed to ensure they align with project standards and do not inadvertently alter the behavior of the application in production or development environments.
    Removal of package-lock.json:
    This file has been removed in favor of pnpm. It's important to ensure that this transition does not affect the reproducibility of builds and that all developers and CI/CD pipelines are updated to use pnpm effectively.

    Copy link

    codiumai-pr-agent-pro bot commented Jun 27, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Confirm the removal of specific configurations and their impact

    Ensure that the removal of environment variables and AI configurations is intentional and
    confirm that it does not affect other parts of the application.

    examples/myproject/nhost/nhost.toml [1]

     [global]
    +[[global.environment]]
    +name = 'GREET_PLAIN'
    +value = 'Sayonara'
     
    +[[global.environment]]
    +name = 'GREET_TYPE'
    +value = '{{ secrets.GREET_TYPE }}'
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Removing environment variables and configurations can have wide-reaching effects. Confirming this change ensures that no critical functionality is inadvertently disrupted.

    9
    ✅ Verify and document the change in HTTP status code
    Suggestion Impact:The commit reverted the HTTP status code from 201 to 200, which aligns with the suggestion to ensure the change was intentional and documented.

    code diff:

    -    res.status(201).json(
    +    res.status(200).json(

    Ensure that changing the HTTP status code from 200 to 201 is intentional and documented,
    as it changes the semantics of the API response.

    examples/myproject/functions/echo.ts [5]

    -res.status(201).json(
    +res.status(200).json(  # If reverting to previous status code
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Changing the HTTP status code can have significant implications on the API's behavior. Ensuring this change is intentional and documented is important for maintaining API consistency.

    7
    Check if '@swc/core' should be in 'devDependencies'

    Verify the addition of '@swc/core' to 'dependencies' instead of 'devDependencies' as it
    might be needed only during development and not in production.

    examples/myproject/functions/package.json [12-13]

    -"dependencies": {
    +"devDependencies": {
       "@swc/core": "^1.6.5"
     }
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: It's important to ensure that dependencies are correctly categorized. '@swc/core' might be needed only during development, so verifying its placement can prevent unnecessary bloat in production.

    6
    Maintainability
    Replace hardcoded version suffix with a constant

    Consider using a constant or a configuration setting for the version suffix '-1.3.0-dev'
    to make future updates easier and the code cleaner.

    dockercompose/compose.go [348]

    -Image: fmt.Sprintf("nhost/functions:%d-1.3.0-dev", *cfg.GetFunctions().GetNode().Version),
    +const versionSuffix = "-1.3.0-dev"
    +Image: fmt.Sprintf("nhost/functions:%d" + versionSuffix, *cfg.GetFunctions().GetNode().Version),
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Using a constant for the version suffix improves maintainability and makes future updates easier. This is a good practice for managing version strings.

    8

    Copy link

    codiumai-pr-agent-pro bot commented Jun 27, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit b66385e)

    Action: build_artifacts (linux, amd64) / artifacts

    Failed stage: Create a new project [❌]

    Failure summary:

    The action failed due to multiple issues:

  • The tar command encountered multiple errors while extracting files, indicating that certain files
    already existed and could not be overwritten or symlinked.
  • The nhost-cli up command failed because the Docker image nhost/functions:18-1.3.0 could not be
    found, leading to the cancellation of other dependent services.
  • The failure to start the Nhost development environment caused the process to exit with status 18,
    and subsequently, the entire action failed with exit code 1.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    1155:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/lib/libaws-c-common.so.1.0.0: Cannot open: File exists
    1156:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/lib/libaws-c-common.so: Cannot create symlink to ‘libaws-c-common.so.1’: File exists
    1157:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/atomics.h: Cannot open: File exists
    1158:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/atomics.inl: Cannot open: File exists
    1159:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/ring_buffer.h: Cannot open: File exists
    1160:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/system_info.h: Cannot open: File exists
    1161:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/linked_hash_table.h: Cannot open: File exists
    1162:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/linked_list.inl: Cannot open: File exists
    1163:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/error.inl: Cannot open: File exists
    ...
    
    1177:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/math.gcc_arm64_asm.inl: Cannot open: File exists
    1178:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/platform.h: Cannot open: File exists
    1179:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/predicates.h: Cannot open: File exists
    1180:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/exports.h: Cannot open: File exists
    1181:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/uri.h: Cannot open: File exists
    1182:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/uuid.h: Cannot open: File exists
    1183:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/math.cbmc.inl: Cannot open: File exists
    1184:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/math.msvc.inl: Cannot open: File exists
    1185:  /usr/bin/tar: ../../../../../nix/store/b6i9pcy6rxyb037jd7p27v86pf806nwl-aws-c-common-0.8.23/include/aws/common/error.h: Cannot open: File exists
    ...
    
    2490:  /usr/bin/tar: ../../../../../nix/store/fmh3s032bcsbfcdp82zsjlmkj1kp72j6-sqlite-3.43.1/lib/libsqlite3.so.0: Cannot create symlink to ‘libsqlite3.so.0.8.6’: File exists
    2491:  /usr/bin/tar: ../../../../../nix/store/fmh3s032bcsbfcdp82zsjlmkj1kp72j6-sqlite-3.43.1/lib/libsqlite3.so: Cannot create symlink to ‘libsqlite3.so.0.8.6’: File exists
    2492:  /usr/bin/tar: ../../../../../nix/store/fmh3s032bcsbfcdp82zsjlmkj1kp72j6-sqlite-3.43.1/lib/libsqlite3.so.0.8.6: Cannot open: File exists
    2493:  /usr/bin/tar: ../../../../../nix/store/fmh3s032bcsbfcdp82zsjlmkj1kp72j6-sqlite-3.43.1/lib/libsqlite3.la: Cannot open: File exists
    2494:  /usr/bin/tar: ../../../../../nix/store/ks4msz5hmdvivf9fm84m1hzqw32swb89-libxml2-2.11.5/lib/libxml2.so.2: Cannot create symlink to ‘libxml2.so.2.11.5’: File exists
    2495:  /usr/bin/tar: ../../../../../nix/store/ks4msz5hmdvivf9fm84m1hzqw32swb89-libxml2-2.11.5/lib/libxml2.so: Cannot create symlink to ‘libxml2.so.2.11.5’: File exists
    2496:  /usr/bin/tar: ../../../../../nix/store/ks4msz5hmdvivf9fm84m1hzqw32swb89-libxml2-2.11.5/lib/libxml2.so.2.11.5: Cannot open: File exists
    2497:  /usr/bin/tar: ../../../../../nix/store/ks4msz5hmdvivf9fm84m1hzqw32swb89-libxml2-2.11.5/lib/libxml2.la: Cannot open: File exists
    2498:  /usr/bin/tar: Exiting with failure status due to previous errors
    2499:  ##[warning]Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
    ...
    
    2746:  ##[group]Run export NHOST_DOMAIN=staging.nhost.run
    2747:  �[36;1mexport NHOST_DOMAIN=staging.nhost.run�[0m
    2748:  �[36;1mexport NHOST_CONFIGSERVER_IMAGE=cli:75f255f816fc6eeac096f917c90213ad3d6853f4�[0m
    2749:  �[36;1m�[0m
    2750:  �[36;1mmkdir new-project�[0m
    2751:  �[36;1mcd new-project�[0m
    2752:  �[36;1m../nhost-cli login --pat ***�[0m
    2753:  �[36;1m../nhost-cli init�[0m
    2754:  �[36;1m../nhost-cli up --down-on-error�[0m
    ...
    
    2782:  minio Pulling 
    2783:  dashboard Pulling 
    2784:  storage Pulling 
    2785:  console Pulling 
    2786:  graphql Pulling 
    2787:  mailhog Pulling 
    2788:  postgres Pulling 
    2789:  traefik Pulling 
    2790:  functions Error manifest for nhost/functions:18-1.3.0 not found: manifest unknown: manifest unknown
    2791:  minio Error context canceled
    2792:  graphql Error context canceled
    2793:  storage Error context canceled
    2794:  dashboard Error context canceled
    2795:  console Error context canceled
    2796:  mailhog Error context canceled
    2797:  auth Error context canceled
    2798:  traefik Error context canceled
    2799:  postgres Error context canceled
    2800:  Error response from daemon: manifest for nhost/functions:18-1.3.0 not found: manifest unknown: manifest unknown
    2801:  failed to start Nhost development environment: failed to start docker compose: exit status 18
    2802:  Stopping Nhost development environment...
    2803:  main.go:65: failed to start Nhost development environment: failed to start docker compose: exit status 18
    2804:  ##[error]Process completed with exit code 1.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @dbarrosop dbarrosop merged commit 90c4e13 into main Jun 28, 2024
    8 checks passed
    @dbarrosop dbarrosop deleted the pnpm branch June 28, 2024 06:40
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants