Skip to content

app.cwd points to original cwd when passing --cwd #947

@mootari

Description

@mootari

Prerequisites

  • Have you searched for existing issues (open and close) to see if the bug or feature request has already been reported?
  • If this is a bug report, are you running the latest version of Assemble? If not, please update to the latest version and verify that the issue still occurs before proceding.
  • Have you read the Contributing Guide? <-- Broken link
  • Have you reviewed the project readme (you might find advice about creating new issues)?
  • Are you creating an issue in the correct repository? (For example, if your issue is related to [grunt-assemble][] or [handlebars-helpers][], you will want to create the issue in that project).

Ready? Great! Please provide the following details:

version

0.24.3

description

When invoking assemble from the shell and passing the --cwd option, assemble correctly changes process.cwd to the specified directory, but app.cwd still returns the original cwd.

/dir/src/assemblefile.js

const app = require('assemble')();
// ...
module.exports = app;
# Note: /dir contains package.json
$ cd /dir
$ npx assemble --cwd=src

The problem appears to be that the original cwd gets cached. I had plastered breakpoints all over base-cwd/index.js but was unable to capture the first assignment. Whenever I got to break in either get or set, cached had already assigned the initial cwd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions