Skip to content

Commit

Permalink
feat: change generator name on nx.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfdez committed Feb 29, 2024
1 parent 3c1832a commit 9333ded
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
2 changes: 1 addition & 1 deletion plugin/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nx-prueba",
"name": "nx-sass",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "plugin/src",
"projectType": "library",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function normalizeOptions(host: Tree, options: Partial<Sche
name: options.name,
projectType: 'library',
directory: options.directory,
callingGenerator: 'nx-sass:library',
callingGenerator: '@gitopslovers/nx-sass:library',
});

// Set defaults and then overwrite with user options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default function setGeneratorDefaults(tree: Tree): void {

nxJson.generators = nxJson.generators ?? {};

nxJson.generators['nx-sass:library'] = {
...(nxJson.generators['nx-sass:library'] || {}),
nxJson.generators['@gitopslovers/nx-sass:library'] = {
...(nxJson.generators['@gitopslovers/nx-sass:library'] || {}),
};

updateNxJson(tree, nxJson);
Expand Down
20 changes: 0 additions & 20 deletions plugin/src/generators/library/generator.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('normalizeOptions', () => {
name: 'test',
projectType: 'library',
directory: 'my-library',
callingGenerator: 'nx-sass:library',
callingGenerator: '@gitopslovers/nx-sass:library',
});

expect(normalizedOptions).toEqual({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('setGeneratorDefaults', () => {
it('should set generator defaults', () => {
const mockNxJson = {
generators: {
'nx-sass:library': {},
'@gitopslovers/nx-sass:library': {},
},
};

Expand All @@ -27,7 +27,7 @@ describe('setGeneratorDefaults', () => {
...mockNxJson,
generators: {
...(mockNxJson.generators || {}),
'nx-sass:library': {},
'@gitopslovers/nx-sass:library': {},
},
});
});
Expand All @@ -42,7 +42,7 @@ describe('setGeneratorDefaults', () => {
expect(readNxJson).toHaveBeenCalledWith(appTree);
expect(updateNxJson).toHaveBeenCalledWith(appTree, {
generators: {
'nx-sass:library': {},
'@gitopslovers/nx-sass:library': {},
},
});
});
Expand Down

0 comments on commit 9333ded

Please sign in to comment.