Skip to content

Commit

Permalink
Merge pull request #1188 from IgniteUI/bpenkov/ng-proj-resolve
Browse files Browse the repository at this point in the history
Resolve proj lib by  type
  • Loading branch information
Lipata authored Jan 2, 2024
2 parents 22f31e1 + 7247f4d commit 2867a29
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# [13.1.2](https://github.com/IgniteUI/igniteui-cli/compare/v13.1.1...v13.1.2) (2024-01-02)

## What's Changed

* Resolve proj lib by type by @jackofdiamond5 in https://github.com/IgniteUI/igniteui-cli/pull/1188

**Full Changelog**: https://github.com/IgniteUI/igniteui-cli/compare/v13.1.1...v13.1.2

# [13.1.1](https://github.com/IgniteUI/igniteui-cli/compare/v13.1.0...v13.1.1) (2023-12-14)

## What's Changed
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "igniteui-cli",
"version": "13.1.1",
"version": "13.1.2",
"description": "CLI tool for creating Ignite UI projects",
"keywords": [
"CLI",
Expand Down Expand Up @@ -78,8 +78,8 @@
"all": true
},
"dependencies": {
"@igniteui/angular-templates": "~17.1.1311",
"@igniteui/cli-core": "~13.1.1",
"@igniteui/angular-templates": "~17.1.1312",
"@igniteui/cli-core": "~13.1.2",
"chalk": "^2.3.2",
"fs-extra": "^3.0.1",
"glob": "^7.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@igniteui/cli-core",
"version": "13.1.1",
"version": "13.1.2",
"description": "Base types and functionality for Ignite UI CLI",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.2.2"
}
}
4 changes: 2 additions & 2 deletions packages/igx-templates/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@igniteui/angular-templates",
"version": "17.1.1311",
"version": "17.1.1312",
"description": "Templates for Ignite UI for Angular projects and components",
"repository": {
"type": "git",
Expand All @@ -12,7 +12,7 @@
"author": "Infragistics",
"license": "MIT",
"dependencies": {
"@igniteui/cli-core": "~13.1.1",
"@igniteui/cli-core": "~13.1.2",
"typescript": "~4.7.2"
}
}
6 changes: 3 additions & 3 deletions packages/ng-schematics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@igniteui/angular-schematics",
"version": "17.1.1311",
"version": "17.1.1312",
"description": "Ignite UI for Angular Schematics for ng new and ng generate",
"repository": {
"type": "git",
Expand All @@ -20,8 +20,8 @@
"dependencies": {
"@angular-devkit/core": "~14.0.0",
"@angular-devkit/schematics": "~14.0.0",
"@igniteui/angular-templates": "~17.1.1311",
"@igniteui/cli-core": "~13.1.1",
"@igniteui/angular-templates": "~17.1.1312",
"@igniteui/cli-core": "~13.1.2",
"@schematics/angular": "~14.0.0",
"rxjs": "^6.6.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ng-schematics/src/ng-new/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function newProject(options: OptionsSchema): Rule {
throw new SchematicsException(`Folder "${options.name}" already exists!`);
}
const framework = templateManager.getFrameworkByName("angular");
projLibrary = await prompt.getProjectLibrary(framework);
projLibrary = await prompt.getProjectLibraryByType(framework, options.type);

if (!options.name || !prompt.nameIsValid(options.name)) {
options.name = await prompt.getUserInput({
Expand Down
4 changes: 2 additions & 2 deletions packages/ng-schematics/src/ng-new/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Schematics ng-new", () => {
const mockSession = {
chooseActionLoop: spyOn(SchematicsPromptSession.prototype, "chooseActionLoop")
.and.returnValue(Promise.resolve(true)),
getProjectLibrary: spyOn(SchematicsPromptSession.prototype, "getProjectLibrary")
getProjectLibraryByType: spyOn(SchematicsPromptSession.prototype, "getProjectLibraryByType")
.and.returnValue((Promise.resolve(mockLibrary))),
getProjectTemplate: spyOn(SchematicsPromptSession.prototype, "getProjectTemplate")
.and.returnValue(Promise.resolve(mockProject)),
Expand Down Expand Up @@ -112,7 +112,7 @@ describe("Schematics ng-new", () => {
};

const mockSession = {
getProjectLibrary: spyOn(SchematicsPromptSession.prototype, "getProjectLibrary")
getProjectLibraryByType: spyOn(SchematicsPromptSession.prototype, "getProjectLibraryByType")
.and.returnValue((Promise.resolve(mockLibrary)))
};

Expand Down
6 changes: 6 additions & 0 deletions packages/ng-schematics/src/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"template": {
"description": "Project template.",
"type": "string"
},
"type": {
"description": "Project type.",
"type": "string",
"alias": "t",
"default": "igx-ts"
}
},
"required": [
Expand Down
2 changes: 2 additions & 0 deletions packages/ng-schematics/src/ng-new/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ export abstract class OptionsSchema {
public theme: string;

public template: string;

public type: string;
}
6 changes: 6 additions & 0 deletions packages/ng-schematics/src/prompt/SchematicsPromptSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export class SchematicsPromptSession extends BasePromptSession {
return super.getProjectLibrary(framework);
}

public async getProjectLibraryByType(framework: Framework, type: string): Promise<ProjectLibrary> {
type = type === "igx-ts" || type === "igx-ts-legacy" ? type : "igx-ts";
framework.projectLibraries = [framework.projectLibraries.find(lib => lib.projectType === type)!];
return super.getProjectLibrary(framework);
}

public async getProjectTemplate(projectLibrary: ProjectLibrary): Promise<ProjectTemplate> {
return super.getProjectTemplate(projectLibrary);
}
Expand Down

0 comments on commit 2867a29

Please sign in to comment.