Skip to content

Commit

Permalink
fixup! fixup! feat(core): compile only schematics realted source when…
Browse files Browse the repository at this point in the history
… using workspace-schematics
  • Loading branch information
Hotell authored and vsavkin committed Sep 1, 2020
1 parent 2068d8d commit 488c373
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions e2e/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function runNgNew(): string {
* Sets up a new project in the temporary project path
* for the currently selected CLI.
*/
export function newProject(): void {
export function newProject() {
projName = uniq('proj');
try {
if (!directoryExists(tmpBackupProjPath())) {
Expand Down Expand Up @@ -165,6 +165,8 @@ export function newProject(): void {
console.log(e.message);
throw e;
}

return { tmpProjPath: tmpProjPath() };
}

/**
Expand All @@ -174,9 +176,9 @@ export function newProject(): void {
*
* If one is not found, it creates a new project.
*/
export function ensureProject(): void {
export function ensureProject() {
// if (!directoryExists(tmpProjPath())) {
newProject();
return newProject();
// }
}

Expand Down
16 changes: 10 additions & 6 deletions e2e/workspace/src/workspace-aux-commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ forEachCli((cli) => {

describe('workspace-schematic', () => {
function setup() {
ensureProject();
const { tmpProjPath } = ensureProject();

const custom = uniq('custom');
const failing = uniq('custom-failing');
Expand All @@ -216,11 +216,11 @@ forEachCli((cli) => {
`tools/schematics/${failing}/schema.json`
);

return { custom, failing };
return { custom, failing, tmpProjPath };
}

it('should compile only schematic files', () => {
const { custom } = setup();
const { custom, tmpProjPath } = setup();
const workspace = uniq('workspace');

updateFile(
Expand All @@ -231,13 +231,17 @@ forEachCli((cli) => {
);

const dryRunOutput = runCommand(
`npm run workspace-schematic ${custom} ${workspace} -- --no-interactive --directory=dir --skipTsConfig=true -d`
`npm run workspace-schematic ${custom} ${workspace} -- --no-interactive -d`
);

expect(
exists(`dist/out-tsc/tools/schematics/${custom}/index.js`)
exists(
`${tmpProjPath}/dist/out-tsc/tools/schematics/${custom}/index.js`
)
).toEqual(true);
expect(exists(`dist/out-tsc/tools/utils/utils.js`)).toEqual(false);
expect(
exists(`${tmpProjPath}/dist/out-tsc/tools/utils/utils.js`)
).toEqual(false);
});

it('should support workspace-specific schematics', async () => {
Expand Down

0 comments on commit 488c373

Please sign in to comment.