Skip to content

-dir flag not being respected #5867

Closed
Closed

Description

@berwyn

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 7.7.1
os: win32 x64 (Windows 10 1703 Build 15063.14 "Creators Update" RC)
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/flex-layout: 2.0.0-beta.7
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1

Repro steps.

  1. run ng new -dir foo myapp
  2. Notice how the app is created in cwd, not in ./foo

The log given by the failure.

Correct output for app generation

Desired functionality.

The app should be created in ./foo, as indicated in the help text:

--directory (String) The directory name to create the app in.
  aliases: -dir <value>, --directory <value>

Mention any other details that might be useful.

Activity

  1. changed the title [-]`--dir` flag not being respected[/-] [+]`-dir` flag not being respected[/+] on Apr 6, 2017
  2. delasteve commented on Apr 27, 2017

    @delasteve
    Contributor

    I was unable to reproduce this using

    @angular/cli: 1.0.1
    node: 7.9.0
    os: win32 x64
    

    Using ng new -dir foo someapp, when I lsed the parent directory, I got

    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    d-----        4/27/2017  11:58 AM                foo
    
  3. berwyn commented on Apr 27, 2017

    @berwyn
    Author

    My apologies, I debugged it more and found that the issue required more specific conditions to dupe and forgot to update this bug report. This is specifically if a directory above contains a package.json file. In my case, I was building a group of modules with lerna, where one was an Angular app. Angular CLI 1.0.0 would create the app at the top-level next to package.json rather than in the directory specified by -dir. I have not attempted with 1.0.1 yet, so this may be fixed (I'll report back when I have a chance to test)

    In other words, my expected setup was

    ng new -dir packages/foo-app foo

    resulting in

    ./
    |- package.json # Top level
    |- lerna.json
    `- packages
       `- foo-app
         |- .angular-cli.json
         |- karma.conf.js
         ...
    

    but instead I got

    ./
    |- package.json
    |- lerna.json
    |- .angular-cli.json
    |- karma.conf.js
    ...
    
  4. filipesilva commented on May 4, 2017

    @filipesilva
    Contributor

    I actually thought we fixed this already in #4901. Maybe something is broken.

  5. hansl commented on Jan 14, 2019

    @hansl
    Contributor

    This has been fixed a long time ago, never marked. If this still happens please create a new issue so we can follow up.

  6. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions