1

I am trying to create the new angular-cli project with --source-dir option but its creating directory as true.

Full command ng new foobar --prefix foo --style scss --routing true --skip-git true --source-dir web --dry-run

Angular version

enter image description here

Output

enter image description here

1
  • What happens when you put quotes around web and run the same command? Commented Jan 12, 2018 at 18:30

2 Answers 2

1

Use this command instead:

ng new foobar --prefix foo --style scss --routing true --skip-git true --source-dir=web --dry-run

You just need to put an equal (=) between the --source-dir and web.

Output:

The option '--source-dir' is not registered with the new command. Run `ng new --help` for a list of supported options.
create foobar/e2e/app.e2e-spec.ts (288 bytes)
create foobar/e2e/app.po.ts (208 bytes)
create foobar/e2e/tsconfig.e2e.json (235 bytes)
create foobar/karma.conf.js (923 bytes)
create foobar/package.json (1317 bytes)
create foobar/protractor.conf.js (722 bytes)
create foobar/README.md (1022 bytes)
create foobar/tsconfig.json (363 bytes)
create foobar/tslint.json (3040 bytes)
create foobar/.angular-cli.json (1243 bytes)
create foobar/.editorconfig (245 bytes)
create foobar/web/assets/.gitkeep (0 bytes)
create foobar/web/environments/environment.prod.ts (51 bytes)
create foobar/web/environments/environment.ts (387 bytes)
create foobar/web/favicon.ico (5430 bytes)
create foobar/web/index.html (293 bytes)
create foobar/web/main.ts (370 bytes)
create foobar/web/polyfills.ts (2405 bytes)
create foobar/web/styles.scss (80 bytes)
create foobar/web/test.ts (642 bytes)
create foobar/web/tsconfig.app.json (211 bytes)
create foobar/web/tsconfig.spec.json (304 bytes)
create foobar/web/typings.d.ts (104 bytes)
create foobar/web/app/app-routing.module.ts (245 bytes)
create foobar/web/app/app.module.ts (395 bytes)
create foobar/web/app/app.component.html (1173 bytes)
create foobar/web/app/app.component.spec.ts (1103 bytes)
create foobar/web/app/app.component.ts (208 bytes)
create foobar/web/app/app.component.scss (0 bytes)

Based on the output of the command, the --source-dir option looks like it is deprecated. It will likely go away in the future. I am not seeing a replacement for it in the --help.

Sign up to request clarification or add additional context in comments.

2 Comments

I did not found any reference about --source-dir in --help. Why only --source-dir required = for argument ?
You find more about the option here. I do not know why this one only works with =. I have always used = with all the options, so I am a bit surprised it works without them. :)
0

Try this command:

ng new SportsStore --skip-git --skip-tests --directory ClientApp

It would appear that the switch --source-dir was deprecated.

The previous command creates the following output:

CREATE ClientApp/angular.json (4195 bytes)
CREATE ClientApp/package.json (1286 bytes)
CREATE ClientApp/README.md (1028 bytes)
CREATE ClientApp/tsconfig.json (543 bytes)
CREATE ClientApp/tslint.json (1988 bytes)
CREATE ClientApp/.editorconfig (246 bytes)
CREATE ClientApp/.gitignore (631 bytes)
CREATE ClientApp/browserslist (429 bytes)
CREATE ClientApp/karma.conf.js (1023 bytes)
CREATE ClientApp/tsconfig.app.json (270 bytes)
CREATE ClientApp/tsconfig.spec.json (270 bytes)
CREATE ClientApp/src/favicon.ico (948 bytes)
CREATE ClientApp/src/index.html (297 bytes)
CREATE ClientApp/src/main.ts (372 bytes)
CREATE ClientApp/src/polyfills.ts (2838 bytes)
CREATE ClientApp/src/styles.css (80 bytes)
CREATE ClientApp/src/test.ts (642 bytes)
CREATE ClientApp/src/assets/.gitkeep (0 bytes)
CREATE ClientApp/src/environments/environment.prod.ts (51 bytes)
CREATE ClientApp/src/environments/environment.ts (662 bytes)
CREATE ClientApp/src/app/app.module.ts (314 bytes)
CREATE ClientApp/src/app/app.component.html (25467 bytes)
CREATE ClientApp/src/app/app.component.ts (215 bytes)
CREATE ClientApp/src/app/app.component.css (0 bytes)
CREATE ClientApp/e2e/protractor.conf.js (810 bytes)
CREATE ClientApp/e2e/tsconfig.json (214 bytes)
CREATE ClientApp/e2e/src/app.e2e-spec.ts (644 bytes)
CREATE ClientApp/e2e/src/app.po.ts (262 bytes)
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

These are the versions installed on my box:

$ node --version
v10.16.0

$ npm --version
6.9.0

Angular CLI: 8.3.0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.