fix(nx-plugin): allow create-package without e2eProject (#27572)
Current behavior: `nx g create-package create-my-plugin --project my-plugin` fails because `e2eProject` defaults to the root project. Expected behavior: `nx g create-package create-my-plugin --project my-plugin` succeeds.
This commit is contained in:
parent
ca89950920
commit
ecbd2cba04
@ -66,9 +66,7 @@
|
|||||||
"e2eProject": {
|
"e2eProject": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the e2e project.",
|
"description": "The name of the e2e project.",
|
||||||
"alias": "p",
|
"x-prompt": "What is the name of the e2e project? Leave blank to skip e2e tests"
|
||||||
"$default": { "$source": "projectName" },
|
|
||||||
"x-prompt": "What is the name of the e2e project?"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["name", "project"],
|
"required": ["name", "project"],
|
||||||
|
|||||||
@ -423,6 +423,26 @@ describe('Nx Plugin', () => {
|
|||||||
}, 90000);
|
}, 90000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to generate a create-package plugin without e2e tests', async () => {
|
||||||
|
const plugin = uniq('plugin');
|
||||||
|
const createAppName = `create-${plugin}-app`;
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/plugin:plugin ${plugin} --e2eTestRunner jest --publishable`
|
||||||
|
);
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/plugin:create-package ${createAppName} --project=${plugin}`
|
||||||
|
);
|
||||||
|
|
||||||
|
const buildResults = runCLI(`build ${createAppName}`);
|
||||||
|
expect(buildResults).toContain('Done compiling TypeScript files');
|
||||||
|
|
||||||
|
checkFilesExist(
|
||||||
|
`libs/${plugin}/src/generators/preset`,
|
||||||
|
`libs/${createAppName}`,
|
||||||
|
`dist/libs/${createAppName}/bin/index.js`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should be able to generate a create-package plugin ', async () => {
|
it('should be able to generate a create-package plugin ', async () => {
|
||||||
const plugin = uniq('plugin');
|
const plugin = uniq('plugin');
|
||||||
const createAppName = `create-${plugin}-app`;
|
const createAppName = `create-${plugin}-app`;
|
||||||
@ -449,7 +469,7 @@ describe('Nx Plugin', () => {
|
|||||||
const plugin = uniq('plugin');
|
const plugin = uniq('plugin');
|
||||||
expect(() =>
|
expect(() =>
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/plugin:create-package ${plugin} --project=invalid-plugin`
|
`generate @nx/plugin:create-package create-${plugin} --project=invalid-plugin`
|
||||||
)
|
)
|
||||||
).toThrow();
|
).toThrow();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -68,11 +68,7 @@
|
|||||||
"e2eProject": {
|
"e2eProject": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the e2e project.",
|
"description": "The name of the e2e project.",
|
||||||
"alias": "p",
|
"x-prompt": "What is the name of the e2e project? Leave blank to skip e2e tests"
|
||||||
"$default": {
|
|
||||||
"$source": "projectName"
|
|
||||||
},
|
|
||||||
"x-prompt": "What is the name of the e2e project?"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["name", "project"]
|
"required": ["name", "project"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user