Library schematic does not support path property
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- angular, typescript
- Domaine
- cli
Piste de recherche
Commencez par le dépôt de reproduction minimale lié dans l’issue et suivez le point d’entrée du schematic de library dans @schematics/angular/library/index.js, ainsi que utility/workspace.js de la stack d’erreur. Vérifiez comment le chemin est traité lorsque l’application est générée dans un sous-dossier. Le travail est terminé lorsque le schematic de library accepte le chemin et localise le angular.json de l’application générée sans l’erreur du workspace.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
🐞 Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [X] schematics
Is this a regression?
Not as far as I know
Description
I tried to create a schematic that generates an application and adds a library to it. However, the library schematic does not accept a path as parameter and it then attempts to create the library in the folder that contains the application. Specifically, it tries to read the angular.json file from the folder containing the application folder (e.g. the folder where the schematic is run).
Note that I expected the path property to work, as it's included with most of the other Angular schematics, for example component, module and service.
🔬 Minimal Reproduction
A minimal reproduction may be found in this repo.
It also addresses a problem I had when trying to work around this with applyToSubtree.
Here is the simplest description I could come up with.
Given this factory:
export function createProject(_options: any): Rule {
return (_tree: Tree, _context: SchematicContext) => {
return chain([
externalSchematic('@schematics/angular', 'ng-new', optionsNew),
externalSchematic('@schematics/angular', 'library', optionsLib)
]);
};
}
If you execute the schematic in a folder named /parent/folder and the app generates in a new folder named app (/parent/folder/app), the library schematic searches for the angular.json in /parent/folder instead of /parent/folder/app.
🔥 Exception or Error
An error occured:
Error: Unable to locate a workspace file for workspace path.
at Object.readWorkspace (C:\dev\scratchpad\scaffolding-tests\node_modules\@angular-devkit\core\src\workspace\core.js:74:19)
at async Object.getWorkspace (C:\dev\scratchpad\scaffolding-tests\node_modules\@schematics\angular\utility\workspace.js:51:27)
at async C:\dev\scratchpad\scaffolding-tests\node_modules\@schematics\angular\library\index.js:153:27
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.1
Node: 12.12.0
OS: win32 x64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.803.1 (cli-only)
@angular-devkit/core 8.3.17
@angular-devkit/schematics 8.3.17
@schematics/angular 8.3.1 (cli-only)
@schematics/update 0.803.1 (cli-only)
rxjs 6.4.0
typescript 3.5.3
Similar issues
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 17 h 25 min
- PR mergées (30 j)
- 183
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Ouvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 personne assignée ·
Toutes les issues de angular/angular-cli
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
fil-donadoni/tolaria#4409 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
corsairdev/corsair#1764 ·