Asset copy Enhancement
See original GitHub issueType of Issue
[ ] Bug Report
[x] Feature Request
Description
Recent PR https://github.com/ng-packagr/ng-packagr/pull/1465/ Introduced the feature to copy assets. But the current format will limit us to :
- Having all assets under project src … ( from looking at the code)
- and we cannot customize the destination folder structure.
we are expecting assets to be under ::
projects/<lib-name>/**/assets
and destination will always be mapped to<dist-path>/<lib-name>/**/assets
in my project , we have multiple projects (libraries & apps)in same repo and we have a common folder for assets … and this is out side of the project root (as expected)
with this i would not be able to use this ng-packagr feature as is …
Expected Behaviour
I was looking at the AsstePattern syntax of anuglar-builder ( browser) … https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/browser/schema.json#L393
export type AssetPattern =
| {
/**
* The pattern to match.
*/
glob: string;
/**
* The input directory path in which to apply 'glob'. Defaults to the project root.
*/
input: string;
/**
* An array of globs to ignore.
*/
ignore?: string[];
/**
* Absolute path within the output.
*/
output: string;
}
| string;
this will allow to be more granular and as a user of the ng-packagr i can get alot of flexibility …
I wanted this feature badly for my projects so did a poc for the same ,in the forked repo https://github.com/arvindnama/ng-packagr/commit/957c8f057636d86bf7e1637fa567540bed7a81f3
NOTE: I will create a PR on the master branch with the above changes soon.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 9.0.0-rc3
@angular/*: 8.2.3
typescript: 3.5.3
rxjs: 6.5.3
node:12.13.1
npm 6.12.1
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 4 years ago
- Reactions:51
- Comments:23 (3 by maintainers)
Top GitHub Comments
create a PR for the above https://github.com/ng-packagr/ng-packagr/pull/1500
This same issue is happening in our projects, the new feature in ng-package to copy assets is ok but I think it is not compliant with default structure of an Angular library created with Angular CLI, where assets are into src folder not at the same level and they are supposed to be imported from /assets not /src/assets when using them in other applications in angular.json.
The propert solution would be to allow defining the output path so that you can keep the assets folder where it is and copy them to dist/library/assets instead of dist/library/src/assets.