Angular-cli: Can't specify output path when building a library project

Created on 16 Nov 2018  路  7Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

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

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions


node: 10
npm: 6
cli: 7.0.6
os: linux

Repro steps

issue a command to build a library with output-path flag

ng build my-lib --output-path=dist

The log given by the failure

Unknown option: '--output-path'

Desired functionality

build command should accept custom output path for libs

library more info

Most helpful comment

All 7 comments

Hi, the output path for library needs to be specified in the ng-package.json One of the reasons why this is not an option is because when changing the output path you鈥檇 need to change the path mappings in root tsconfig as otherwise you won鈥檛 be able to consume the library within the workspace.

Can you explain why you need to provide the output from the command line ?

Hi, Ill try to explain my use case.

Mostly I need to have the same CI files for all library projects (ie: always outputting the artifacts to the same folder name, dist instead of dist/lib-1-name, so the CI runners always know where to look without me telling them what the name of the project to handle is).

I understand that the library is a separate workspace, so needs to be outputted in a separate folder, but I don't use the monorepo way of managing projects. Most of us don't, actually. In my use case, one lib is one NG CLI project, and the app section of the angular cli project is used as a playground/demo/e2e-test section for the lib (it's not a potential output of the project).

But you're right, I could change the ng-package.json for each project, and it would work. So you can close the issue if you feel like the flag would be useless/impossible to implement.

Thanks

@avatsaev The build-ng-packagr schema just doesn't support other properties than project, tsConfig and watch.

{
  "title": "ng-packagr Target",
  "description": "ng-packagr target options for Build Architect.",
  "type": "object",
  "properties": {
    "project": {
      "type": "string",
      "description": "The file path of the package.json for distribution via npm."
    },
    "tsConfig": {
      "type": "string",
      "description": "The file path of the TypeScript configuration file."
    },
    "watch": {
      "type": "boolean",
      "description": "Run build when files change.",
      "default": false
    }
  },
  "additionalProperties": false,
  "required": [
    "project"
  ]
}

I understand, thank you for the explanation

But separating app build and lib build options in docs and --help screen would've made it clear without me having to open an issue.

Closing

Hi,

This is driving my nuts. Since I have updated my project to angular 8, the dist folder gets deleted before a production build. The library is symlink from this dist folder. My project fails to build because it keeps deleting the folder because it is missing the library. Possibly my setup is wrong, can anybody point me the right direction?

Cheers
Olaf

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gotschmarcel picture gotschmarcel  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments

hareeshav picture hareeshav  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments