Angular-cli: ng new <project-name> -- Using "." or "_" in"project-name" produces errors.

Created on 29 May 2018  ·  10Comments  ·  Source: angular/angular-cli

Versions

Angular CLI: 6.0.5
Node: 10.2.1
OS: win32 x64
Angular:
...

Package Version

@angular-devkit/architect 0.6.5
@angular-devkit/core 0.6.5
@angular-devkit/schematics 0.6.5
@schematics/angular 0.6.5
@schematics/update 0.6.5
rxjs 6.2.0
typescript 2.7.2


Windows 10

Repro steps

  • ng new project.1
  • ng new project_1

Observed behavior

```

$ ng new project.1

Project name "project.1" is invalid.

$ ng new project_1
Schematic input does not validate against the Schema: {"name":"project_1","version":"6.0.5","newProjectRoot":"projects","skipInstall":false,"linkCli":false,"skipGit":false,"commit":null}
Errors:

Data path ".name" should match format "html-selector".

Desired behavior

  • Expect "." or "_" to be valid characters in a project name as was in the case in older versions of CLI.

Mention any other details that might be useful (optional)

schematicangular low inconvenient triage #1 feature

Most helpful comment

So far I'm managing to work around this by renaming the created folder after it has been scaffolded.

ng new FooBar --directory Foo.Bar

works for me in the sense that I don't need to rename the directory afterwards. The project is still referred to as FooBar rather than Foo.Bar in all the template files of course.

All 10 comments

It seems that it produces error for any special char. I've tested it with - and / also.

We use App.projectname for everything. Now dead in water.

So far I'm managing to work around this by renaming the created folder after it has been scaffolded.
So hope it helps those that land here while this is still open. :)

So far I'm managing to work around this by renaming the created folder after it has been scaffolded.

ng new FooBar --directory Foo.Bar

works for me in the sense that I don't need to rename the directory afterwards. The project is still referred to as FooBar rather than Foo.Bar in all the template files of course.

Maybe add a feature where if you want to include . or _ in the project name, you can enclose it in quotes. Ex:

ng new "20avva.github.io"

Can we install Angular 2.0.0 Version . How to install Angular 2 using CLI and which command we will write in CLI specific command.

Can we install Angular 2.0.0 Version .

I guess you could. Long-term support for 2.x.x ended several years ago though, so I'm not sure why you would.

@sachin hedaoo If you are reading online “Angular 2” this really refers to the remake of AngularJS in typescript. Even the latest version of angular (which is 7.x iirc) can be referred to as Angular 2.

Essentially, Angular 2 can refer to Angular 2.0.0 but this doesn't really happen anymore (in my limited experience).

On Mar 29, 2019, at 05:49, Kristian Thy notifications@github.com wrote:

Can we install Angular 2.0.0 Version .

I guess you could. Long-term support for 2.x.x ended several years ago though, so I'm not sure why you would.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Some infrastructure seems to have changed, so we may be able to loosen these restrictions. We probably can't allow everything, but we can likely be a little more flexible. Need some additional investigation to determine how flexible we can be.

I have a similar problem when I try to generate a new library with ng generate library @companyname/my-lib. This removes the @ from the foldername resulting in a projects/companyname/my-lib folder-structure. Any ideas for workarounds? Currently I rename the folder and adjust the angular.json, package.json etc. manually

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brtnshrdr picture brtnshrdr  ·  3Comments

5amfung picture 5amfung  ·  3Comments

rwillmer picture rwillmer  ·  3Comments

MateenKadwaikar picture MateenKadwaikar  ·  3Comments

jmurphzyo picture jmurphzyo  ·  3Comments