Skip to content

No option to create workspace only with ng-new #11402

@martzmakes

Description

@martzmakes

Bug Report or Feature Request (mark with an x)

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

Area

- [ ] devkit
- [x] schematics

Repro steps

This is more of a conceptual / documentation request... I'm in the process of creating my own collection of schematics to scaffold out a project structure using a mono-repo approach.

The only way to do this at the moment is to run:

ng new asdf
cd asdf
ng g app whatever

but then all of the src/ files remain (and the original angular.json info for a project that is now inconsistently stored). There's no way to create a new repo without the src folder... and when I do this using a custom schematic by essentially duplicating ng-new and removing

schematic('application', applicationOptions),
schematic('application', applicationOptions),

Whenever I run...

$ ng new asdf -c=my-schematic
$ cd asdf
$ ng g app whatever
    {"inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","style":"css","skipTests":false,"skipPackageJson":false,"name":"whatever"}
CREATE projects/whatever-e2e/protractor.conf.js (752 bytes)
CREATE projects/whatever-e2e/src/app.e2e-spec.ts (304 bytes)
CREATE projects/whatever-e2e/src/app.po.ts (208 bytes)
CREATE projects/whatever-e2e/tsconfig.e2e.json (219 bytes)

Only the e2e files get put into projects/ and the angular.json file remains largely empty:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {},
  "cli": {
    "defaultCollection": "my-schematic"
  }
}

I suspect this has to do with something silently failing in the application schematic or a path being off... but I wanted to check first if there was an easier way.

Desired functionality

Seems like as mono-repo / project-based apps may become more common... there should be an easy way to create a workspace-only repo (no /src application). Or if there is a preferred way to do it, it should be documented. I'd rather not do ng new, remove src and remove "clean" the angular.json file.

Mention any other details that might be useful

I'd be happy to submit a PR for documentation and/or enabling a way to create a project-structure-based app (i.e. no /src folder)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions