Skip to content

request: get default config store-dir #2575

@andykais

Description

@andykais

Hi, is it possible to see the store-dir location before it is set in the config? Currently, this is the default output:

$ pnpm config get store-dir
undefined

but of course there is a location for the store-dir without the config being set (~/.pnpm-store on unix, I am not sure what on windows).

This is an issue that deals with CI specifically. I want to know the store-dir in order to cache it for future builds. This is currently what it looks like for github workflows:

- uses: pnpm/action-setup@v1.2.0
  with:
    version: 4.14.2
- run: pnpm config set store-dir ~/.pnpm-store
- uses: actions/cache@v1
  with:
    path: ~/.pnpm-store
    key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

If I want to have windows builds as well, it gets more complicated. I will need to include a conditional to set a folder for windows. This is really unnecessary since I dont care where the folder is set, I just want to know ahead of time where it is to tell the cache. Ideally I could just do this:

- uses: pnpm/action-setup@v1.2.0
  with:
    version: 4.14.2
- name: Get pnpm cache directory
  id: pnpm-cache
  run: echo "::set-output name=dir::$(pnpm config get cache)"
  - uses: actions/cache@v1 
    with:
      path: ${{ steps.npm-cache.outputs.dir }}
      key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions