Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Creating a new ng project in a tmp folder, clashes with existing files at the root (different location) #493

@sebawita

Description

@sebawita

Bug Report or Feature Request (mark with an x)

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

Area

- [ ] devkit
- [x] schematics

Versions

"@angular-devkit/core": "^0.4.5",
"@angular-devkit/schematics": "^0.4.5",
"@schematics/angular": "^0.4.5",

Repro steps

Run the below rule, in a folder that already contains any of the files (i.e. /src/app/environments/environment.prod.ts), which the application schematic generates.

This will throw an Error, even though the schematic should create the files in a tmp folder.

const createNgProject = () => {
  const options: ApplicationSchema = {
      name: 'tmp-name',
      directory: 'tmp',
      sourceDir: 'src',
      skipInstall: true
  }
  return externalSchematic('@schematics/angular', 'application', options);
}

The log given by the failure

Error: Path "/app/environments/environment.prod.ts" already exist.
Path "/app/environments/environment.prod.ts" already exist.

Desired functionality

Ideally the application schematic run for a different directory (i.e. tmp), shouldn't clash with the existing files, which are at a different location.

Mention any other details that might be useful

When I provide different value for sourceDir, then the application files get generated without any problems.
However, in my use case I need to use the same sourceDir, as the current project, as I need to extract .angular-cli.json settings, where some of the settings point to sourceDir.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions