-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ng set apps[0].main does not work #1763
Comments
Thanks, we'll take a look. |
Support changing properties of array items in `CliConfig.set` method. This makes the following commands to work: - `$ ng set apps[0].main my-main.ts` - `$ ng set apps.0.test my-test.ts` Closes angular#1763
This also will load angular-cli.json in the HOME directory as a fallback, supports more stuff from the JSON Schema (like default values) than the old one, and actually verify that what you inputs is the right thing. This will be its own NPM package at some point, as other people will probably be interested in having a JSON Schema loader that gives type safety and provides fallbacks and metadata. Closes #1763
Looks like this issue occurs again. This one works:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Overview
Setting an app config option with a set command does not work.
$ ng set apps.0.main src/my-main.ts
gives error:Invalid config path
.$ ng set apps[0].main src/my-main.ts
also fails in the same way.Motivation
As a part of the Vaadin Elements R&D project, we have a @vaadin/angular2-polymer package that allows developers to use Polymer elements in Angular applications. It is possible, but due to some technical limitations there is a requirement to load and bootstrap the Angular app after the Polymer elements are loaded and registered.
For the regular SystemJS Angular workflow, we recommend our users to wrap the
System.import('app')
call inside a listener for theWebComponentsReady
event, and thus postpone the Angular app load after the Polymer elements are registered. I am writing the alternative instructions for those who use webpack, especially for theangular-cli@webpack
generated projects.For the above requirement, we are probably going to instruct our users to switch the main app entry point to a separate proxy loader script, where we wait for the
WebComponentsReady
event and require the originalmain.ts
:Switching the app config properties from the command line would be easier then editing the json manually. I would prefer the
ng set
command in our instructions. But, as it turns out, the command does not work for changing the properties of theapps[0]
.Versions
OS: Mac OS X El Capitan.
Steps to Reproduce
Results
The config is not changed, and the following error is given in the output:
Other information
For the get command, both
ng get apps[0].main
andng get apps.0.main
work. But for the set, neither of the paths work. Not sure what is the correct syntax to address array items.The issue seems to be in
CliConfig.set
. The array items are not considered by a path check in there.The type check there also looks incorrect for me (
typeof
statements seem excessive, as long ascheckPath.type
are always set with strings):The
schema.json
itself seems to have a different syntax for the apps, also not considered byCliConfig.set
: the app property types are declared in a short format: ("main": "string"
), while the rest of the properties are in a long format ("version": { "type": "string" }
).I’m preparing a PR to support this, please let me know if it is welcome.
The text was updated successfully, but these errors were encountered: