cleanup(angular): switch tests to use project name and root as-provided format by default (#18792)
This commit is contained in:
parent
a009523086
commit
b9eba9d72d
@ -13,11 +13,13 @@ describe('angular.json v1 config', () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
newProject();
|
newProject();
|
||||||
runCLI(`generate @nx/angular:app ${app1} --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:app ${app1} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
// reset workspace to use v1 config
|
// reset workspace to use v1 config
|
||||||
updateFile(`angular.json`, angularV1Json(app1));
|
updateFile(`angular.json`, angularV1Json(app1));
|
||||||
removeFile(`apps/${app1}/project.json`);
|
removeFile(`${app1}/project.json`);
|
||||||
removeFile(`apps/${app1}-e2e/project.json`);
|
removeFile(`${app1}-e2e/project.json`);
|
||||||
});
|
});
|
||||||
afterAll(() => cleanupProject());
|
afterAll(() => cleanupProject());
|
||||||
|
|
||||||
@ -31,10 +33,12 @@ describe('angular.json v1 config', () => {
|
|||||||
it('should generate new app with project.json and keep the existing in angular.json', async () => {
|
it('should generate new app with project.json and keep the existing in angular.json', async () => {
|
||||||
// create new app
|
// create new app
|
||||||
const app2 = uniq('app2');
|
const app2 = uniq('app2');
|
||||||
runCLI(`generate @nx/angular:app ${app2} --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:app ${app2} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
|
||||||
// should generate project.json for new projects
|
// should generate project.json for new projects
|
||||||
checkFilesExist(`apps/${app2}/project.json`);
|
checkFilesExist(`${app2}/project.json`);
|
||||||
// check it works correctly
|
// check it works correctly
|
||||||
expect(runCLI(`build ${app2}`)).toContain('Successfully ran target build');
|
expect(runCLI(`build ${app2}`)).toContain('Successfully ran target build');
|
||||||
expect(runCLI(`test ${app2} --no-watch`)).toContain(
|
expect(runCLI(`test ${app2} --no-watch`)).toContain(
|
||||||
@ -53,21 +57,21 @@ const angularV1Json = (appName: string) => `{
|
|||||||
"projects": {
|
"projects": {
|
||||||
"${appName}": {
|
"${appName}": {
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"root": "apps/${appName}",
|
"root": "${appName}",
|
||||||
"sourceRoot": "apps/${appName}/src",
|
"sourceRoot": "${appName}/src",
|
||||||
"prefix": "v1angular",
|
"prefix": "v1angular",
|
||||||
"architect": {
|
"architect": {
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
"outputs": ["{options.outputPath}"],
|
"outputs": ["{options.outputPath}"],
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/apps/${appName}",
|
"outputPath": "dist${appName}",
|
||||||
"index": "apps/${appName}/src/index.html",
|
"index": "${appName}/src/index.html",
|
||||||
"main": "apps/${appName}/src/main.ts",
|
"main": "${appName}/src/main.ts",
|
||||||
"polyfills": ["zone.js"],
|
"polyfills": ["zone.js"],
|
||||||
"tsConfig": "apps/${appName}/tsconfig.app.json",
|
"tsConfig": "${appName}/tsconfig.app.json",
|
||||||
"assets": ["apps/${appName}/src/favicon.ico", "apps/${appName}/src/assets"],
|
"assets": ["${appName}/src/favicon.ico", "${appName}/src/assets"],
|
||||||
"styles": ["apps/${appName}/src/styles.css"],
|
"styles": ["${appName}/src/styles.css"],
|
||||||
"scripts": []
|
"scripts": []
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
@ -119,16 +123,16 @@ const angularV1Json = (appName: string) => `{
|
|||||||
"builder": "@nx/linter:eslint",
|
"builder": "@nx/linter:eslint",
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"apps/${appName}/src/**/*.ts",
|
"${appName}/src/**/*.ts",
|
||||||
"apps/${appName}/src/**/*.html"
|
"${appName}/src/**/*.html"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"builder": "@nx/jest:jest",
|
"builder": "@nx/jest:jest",
|
||||||
"outputs": ["coverage/apps/${appName}"],
|
"outputs": ["coverage${appName}"],
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "apps/${appName}/jest.config.ts",
|
"jestConfig": "${appName}/jest.config.ts",
|
||||||
"passWithNoTests": true
|
"passWithNoTests": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,14 +140,14 @@ const angularV1Json = (appName: string) => `{
|
|||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"${appName}-e2e": {
|
"${appName}-e2e": {
|
||||||
"root": "apps/${appName}-e2e",
|
"root": "${appName}-e2e",
|
||||||
"sourceRoot": "apps/${appName}-e2e/src",
|
"sourceRoot": "${appName}-e2e/src",
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"architect": {
|
"architect": {
|
||||||
"e2e": {
|
"e2e": {
|
||||||
"builder": "@nx/cypress:cypress",
|
"builder": "@nx/cypress:cypress",
|
||||||
"options": {
|
"options": {
|
||||||
"cypressConfig": "apps/${appName}-e2e/cypress.json",
|
"cypressConfig": "${appName}-e2e/cypress.json",
|
||||||
"devServerTarget": "${appName}:serve:development",
|
"devServerTarget": "${appName}:serve:development",
|
||||||
"testingType": "e2e"
|
"testingType": "e2e"
|
||||||
},
|
},
|
||||||
@ -157,7 +161,7 @@ const angularV1Json = (appName: string) => `{
|
|||||||
"builder": "@nx/linter:eslint",
|
"builder": "@nx/linter:eslint",
|
||||||
"outputs": ["{options.outputFile}"],
|
"outputs": ["{options.outputFile}"],
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": ["apps/${appName}-e2e/**/*.{js,ts}"]
|
"lintFilePatterns": ["${appName}-e2e/**/*.{js,ts}"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -34,10 +34,18 @@ describe('Angular Module Federation', () => {
|
|||||||
const remotePort = 4301;
|
const remotePort = 4301;
|
||||||
|
|
||||||
// generate host app
|
// generate host app
|
||||||
runCLI(`generate @nx/angular:host ${hostApp} --style=css --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:host ${hostApp} --style=css --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
// generate remote app
|
// generate remote app
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:remote ${remoteApp1} --host=${hostApp} --port=${remotePort} --style=css --no-interactive`
|
`generate @nx/angular:remote ${remoteApp1} --host=${hostApp} --port=${remotePort} --style=css --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
|
||||||
|
// check files are generated without the layout directory ("apps/")
|
||||||
|
checkFilesExist(
|
||||||
|
`${hostApp}/src/app/app.module.ts`,
|
||||||
|
`${remoteApp1}/src/app/app.module.ts`
|
||||||
);
|
);
|
||||||
|
|
||||||
// check default generated host is built successfully
|
// check default generated host is built successfully
|
||||||
@ -46,14 +54,14 @@ describe('Angular Module Federation', () => {
|
|||||||
|
|
||||||
// generate a shared lib with a seconary entry point
|
// generate a shared lib with a seconary entry point
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:library ${sharedLib} --buildable --no-interactive`
|
`generate @nx/angular:library ${sharedLib} --buildable --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:library-secondary-entry-point --library=${sharedLib} --name=${secondaryEntry} --no-interactive`
|
`generate @nx/angular:library-secondary-entry-point --library=${sharedLib} --name=${secondaryEntry} --no-interactive`
|
||||||
);
|
);
|
||||||
// update host & remote files to use shared library
|
// update host & remote files to use shared library
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${hostApp}/src/app/app.module.ts`,
|
`${hostApp}/src/app/app.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { ${
|
import { ${
|
||||||
@ -91,7 +99,7 @@ describe('Angular Module Federation', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${remoteApp1}/src/app/remote-entry/entry.module.ts`,
|
`${remoteApp1}/src/app/remote-entry/entry.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
@ -138,9 +146,11 @@ describe('Angular Module Federation', () => {
|
|||||||
|
|
||||||
// generate apps
|
// generate apps
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:application ${app1} --routing --no-interactive`
|
`generate @nx/angular:application ${app1} --routing --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/angular:application ${app2} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(`generate @nx/angular:application ${app2} --no-interactive`);
|
|
||||||
|
|
||||||
// convert apps
|
// convert apps
|
||||||
runCLI(
|
runCLI(
|
||||||
@ -168,7 +178,7 @@ describe('Angular Module Federation', () => {
|
|||||||
|
|
||||||
// generate remote apps
|
// generate remote apps
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:host ${host} --ssr --remotes=${remote1},${remote2} --no-interactive`
|
`generate @nx/angular:host ${host} --ssr --remotes=${remote1},${remote2} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
// ports
|
// ports
|
||||||
@ -196,7 +206,7 @@ describe('Angular Module Federation', () => {
|
|||||||
await killProcessAndPorts(process.pid, hostPort, remote1Port, remote2Port);
|
await killProcessAndPorts(process.pid, hostPort, remote1Port, remote2Port);
|
||||||
}, 20_000_000);
|
}, 20_000_000);
|
||||||
|
|
||||||
it('should should support generating host and remote apps with the new name and root format', async () => {
|
it('should should support generating host and remote apps with --project-name-and-root-format=derived', async () => {
|
||||||
const hostApp = uniq('host');
|
const hostApp = uniq('host');
|
||||||
const remoteApp = uniq('remote');
|
const remoteApp = uniq('remote');
|
||||||
const hostPort = 4800;
|
const hostPort = 4800;
|
||||||
@ -204,17 +214,18 @@ describe('Angular Module Federation', () => {
|
|||||||
|
|
||||||
// generate host app
|
// generate host app
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:host ${hostApp} --project-name-and-root-format=as-provided --no-interactive`
|
`generate @nx/angular:host ${hostApp} --project-name-and-root-format=derived --no-interactive`
|
||||||
);
|
);
|
||||||
// generate remote app
|
// generate remote app
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:remote ${remoteApp} --host=${hostApp} --port=${remotePort} --project-name-and-root-format=as-provided --no-interactive`
|
`generate @nx/angular:remote ${remoteApp} --host=${hostApp} --port=${remotePort} --project-name-and-root-format=derived --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
// check files are generated without the layout directory ("apps/") and
|
// check files are generated with the layout directory ("apps/")
|
||||||
// using the project name as the directory when no directory is provided
|
checkFilesExist(
|
||||||
checkFilesExist(`${hostApp}/src/app/app.module.ts`);
|
`apps/${hostApp}/src/app/app.module.ts`,
|
||||||
checkFilesExist(`${remoteApp}/src/app/app.module.ts`);
|
`apps/${remoteApp}/src/app/app.module.ts`
|
||||||
|
);
|
||||||
|
|
||||||
// check default generated host is built successfully
|
// check default generated host is built successfully
|
||||||
const buildOutput = runCLI(`build ${hostApp}`);
|
const buildOutput = runCLI(`build ${hostApp}`);
|
||||||
|
|||||||
@ -27,20 +27,22 @@ describe('Angular Projects', () => {
|
|||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
proj = newProject();
|
proj = newProject();
|
||||||
runCLI(`generate @nx/angular:app ${app1} --no-interactive`);
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${lib1} --add-module-spec --no-interactive`
|
`generate @nx/angular:app ${app1} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
app1DefaultModule = readFile(`apps/${app1}/src/app/app.module.ts`);
|
runCLI(
|
||||||
|
`generate @nx/angular:lib ${lib1} --add-module-spec --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
app1DefaultModule = readFile(`${app1}/src/app/app.module.ts`);
|
||||||
app1DefaultComponentTemplate = readFile(
|
app1DefaultComponentTemplate = readFile(
|
||||||
`apps/${app1}/src/app/app.component.html`
|
`${app1}/src/app/app.component.html`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
updateFile(`apps/${app1}/src/app/app.module.ts`, app1DefaultModule);
|
updateFile(`${app1}/src/app/app.module.ts`, app1DefaultModule);
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app1}/src/app/app.component.html`,
|
`${app1}/src/app/app.component.html`,
|
||||||
app1DefaultComponentTemplate
|
app1DefaultComponentTemplate
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -50,16 +52,16 @@ describe('Angular Projects', () => {
|
|||||||
it('should successfully generate apps and libs and work correctly', async () => {
|
it('should successfully generate apps and libs and work correctly', async () => {
|
||||||
const standaloneApp = uniq('standalone-app');
|
const standaloneApp = uniq('standalone-app');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:app ${standaloneApp} --directory=myDir --standalone=true --no-interactive`
|
`generate @nx/angular:app ${standaloneApp} --directory=myDir/${standaloneApp} --standalone=true --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
const esbuildApp = uniq('esbuild-app');
|
const esbuildApp = uniq('esbuild-app');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --directory=myDir --no-interactive`
|
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --directory=myDir/${esbuildApp} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app1}/src/app/app.module.ts`,
|
`${app1}/src/app/app.module.ts`,
|
||||||
`
|
`
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
@ -78,14 +80,14 @@ describe('Angular Projects', () => {
|
|||||||
|
|
||||||
// check build
|
// check build
|
||||||
runCLI(
|
runCLI(
|
||||||
`run-many --target build --projects=${app1},my-dir-${standaloneApp},my-dir-${esbuildApp} --parallel --prod --output-hashing none`
|
`run-many --target build --projects=${app1},${standaloneApp},${esbuildApp} --parallel --prod --output-hashing none`
|
||||||
);
|
);
|
||||||
checkFilesExist(`dist/apps/${app1}/main.js`);
|
checkFilesExist(`dist/${app1}/main.js`);
|
||||||
checkFilesExist(`dist/apps/my-dir/${standaloneApp}/main.js`);
|
checkFilesExist(`dist/my-dir/${standaloneApp}/main.js`);
|
||||||
checkFilesExist(`dist/apps/my-dir/${esbuildApp}/main.js`);
|
checkFilesExist(`dist/my-dir/${esbuildApp}/main.js`);
|
||||||
// This is a loose requirement because there are a lot of
|
// This is a loose requirement because there are a lot of
|
||||||
// influences external from this project that affect this.
|
// influences external from this project that affect this.
|
||||||
const es2015BundleSize = getSize(tmpProjPath(`dist/apps/${app1}/main.js`));
|
const es2015BundleSize = getSize(tmpProjPath(`dist/${app1}/main.js`));
|
||||||
console.log(
|
console.log(
|
||||||
`The current es2015 bundle size is ${es2015BundleSize / 1000} KB`
|
`The current es2015 bundle size is ${es2015BundleSize / 1000} KB`
|
||||||
);
|
);
|
||||||
@ -93,7 +95,7 @@ describe('Angular Projects', () => {
|
|||||||
|
|
||||||
// check unit tests
|
// check unit tests
|
||||||
runCLI(
|
runCLI(
|
||||||
`run-many --target test --projects=${app1},my-dir-${standaloneApp},my-dir-${esbuildApp},${lib1} --parallel`
|
`run-many --target test --projects=${app1},${standaloneApp},${esbuildApp},${lib1} --parallel`
|
||||||
);
|
);
|
||||||
|
|
||||||
// check e2e tests
|
// check e2e tests
|
||||||
@ -113,7 +115,7 @@ describe('Angular Projects', () => {
|
|||||||
await killProcessAndPorts(process.pid, appPort);
|
await killProcessAndPorts(process.pid, appPort);
|
||||||
|
|
||||||
const esbProcess = await runCommandUntil(
|
const esbProcess = await runCommandUntil(
|
||||||
`serve my-dir-${esbuildApp} -- --port=${appPort}`,
|
`serve ${esbuildApp} -- --port=${appPort}`,
|
||||||
(output) =>
|
(output) =>
|
||||||
output.includes(`Application bundle generation complete`) &&
|
output.includes(`Application bundle generation complete`) &&
|
||||||
output.includes(`localhost:${appPort}`)
|
output.includes(`localhost:${appPort}`)
|
||||||
@ -127,7 +129,7 @@ describe('Angular Projects', () => {
|
|||||||
const app = uniq('app');
|
const app = uniq('app');
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:app ${app} --e2eTestRunner=playwright --no-interactive`
|
`generate @nx/angular:app ${app} --e2eTestRunner=playwright --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (runE2ETests()) {
|
if (runE2ETests()) {
|
||||||
@ -146,7 +148,7 @@ describe('Angular Projects', () => {
|
|||||||
// External HTML template file
|
// External HTML template file
|
||||||
const templateWhichFailsBananaInBoxLintCheck = `<div ([foo])="bar"></div>`;
|
const templateWhichFailsBananaInBoxLintCheck = `<div ([foo])="bar"></div>`;
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app1}/src/app/app.component.html`,
|
`${app1}/src/app/app.component.html`,
|
||||||
templateWhichFailsBananaInBoxLintCheck
|
templateWhichFailsBananaInBoxLintCheck
|
||||||
);
|
);
|
||||||
// Inline template within component.ts file
|
// Inline template within component.ts file
|
||||||
@ -162,7 +164,7 @@ describe('Angular Projects', () => {
|
|||||||
export class InlineTemplateComponent {}
|
export class InlineTemplateComponent {}
|
||||||
`;
|
`;
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app1}/src/app/inline-template.component.ts`,
|
`${app1}/src/app/inline-template.component.ts`,
|
||||||
wrappedAsInlineTemplate
|
wrappedAsInlineTemplate
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -170,12 +172,12 @@ describe('Angular Projects', () => {
|
|||||||
silenceError: true,
|
silenceError: true,
|
||||||
});
|
});
|
||||||
expect(appLintStdOut).toContain(
|
expect(appLintStdOut).toContain(
|
||||||
normalize(`apps/${app1}/src/app/app.component.html`)
|
normalize(`${app1}/src/app/app.component.html`)
|
||||||
);
|
);
|
||||||
expect(appLintStdOut).toContain(`1:6`);
|
expect(appLintStdOut).toContain(`1:6`);
|
||||||
expect(appLintStdOut).toContain(`Invalid binding syntax`);
|
expect(appLintStdOut).toContain(`Invalid binding syntax`);
|
||||||
expect(appLintStdOut).toContain(
|
expect(appLintStdOut).toContain(
|
||||||
normalize(`apps/${app1}/src/app/inline-template.component.ts`)
|
normalize(`${app1}/src/app/inline-template.component.ts`)
|
||||||
);
|
);
|
||||||
expect(appLintStdOut).toContain(`5:19`);
|
expect(appLintStdOut).toContain(`5:19`);
|
||||||
expect(appLintStdOut).toContain(
|
expect(appLintStdOut).toContain(
|
||||||
@ -185,29 +187,29 @@ describe('Angular Projects', () => {
|
|||||||
expect(appLintStdOut).toContain(`Invalid binding syntax`);
|
expect(appLintStdOut).toContain(`Invalid binding syntax`);
|
||||||
|
|
||||||
// cleanup added component
|
// cleanup added component
|
||||||
removeFile(`apps/${app1}/src/app/inline-template.component.ts`);
|
removeFile(`${app1}/src/app/inline-template.component.ts`);
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
|
|
||||||
it('should build the dependent buildable lib and its child lib, as well as the app', async () => {
|
it('should build the dependent buildable lib and its child lib, as well as the app', async () => {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
const esbuildApp = uniq('esbuild-app');
|
const esbuildApp = uniq('esbuild-app');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --no-interactive`
|
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
const buildableLib = uniq('buildlib1');
|
const buildableLib = uniq('buildlib1');
|
||||||
const buildableChildLib = uniq('buildlib2');
|
const buildableChildLib = uniq('buildlib2');
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:library ${buildableLib} --buildable=true --no-interactive`
|
`generate @nx/angular:library ${buildableLib} --buildable=true --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:library ${buildableChildLib} --buildable=true --no-interactive`
|
`generate @nx/angular:library ${buildableChildLib} --buildable=true --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
// update the app module to include a ref to the buildable lib
|
// update the app module to include a ref to the buildable lib
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app1}/src/app/app.module.ts`,
|
`${app1}/src/app/app.module.ts`,
|
||||||
`
|
`
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
@ -228,7 +230,7 @@ describe('Angular Projects', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${esbuildApp}/src/app/app.module.ts`,
|
`${esbuildApp}/src/app/app.module.ts`,
|
||||||
`
|
`
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
@ -251,7 +253,7 @@ describe('Angular Projects', () => {
|
|||||||
|
|
||||||
// update the buildable lib module to include a ref to the buildable child lib
|
// update the buildable lib module to include a ref to the buildable child lib
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${buildableLib}/src/lib/${names(buildableLib).fileName}.module.ts`,
|
`${buildableLib}/src/lib/${names(buildableLib).fileName}.module.ts`,
|
||||||
`
|
`
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -299,11 +301,11 @@ describe('Angular Projects', () => {
|
|||||||
|
|
||||||
// to proof it has been built from source the "main.js" should actually contain
|
// to proof it has been built from source the "main.js" should actually contain
|
||||||
// the path to dist
|
// the path to dist
|
||||||
const mainBundle = readFile(`dist/apps/${app1}/main.js`);
|
const mainBundle = readFile(`dist/${app1}/main.js`);
|
||||||
expect(mainBundle).toContain(`dist/libs/${buildableLib}`);
|
expect(mainBundle).toContain(`dist/${buildableLib}`);
|
||||||
|
|
||||||
const mainEsBuildBundle = readFile(`dist/apps/${esbuildApp}/main.js`);
|
const mainEsBuildBundle = readFile(`dist/${esbuildApp}/main.js`);
|
||||||
expect(mainEsBuildBundle).toContain(`dist/libs/${buildableLib}`);
|
expect(mainEsBuildBundle).toContain(`dist/${buildableLib}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should build publishable libs successfully', () => {
|
it('should build publishable libs successfully', () => {
|
||||||
@ -313,14 +315,14 @@ describe('Angular Projects', () => {
|
|||||||
const entryPoint = uniq('entrypoint');
|
const entryPoint = uniq('entrypoint');
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${lib} --publishable --importPath=@${proj}/${lib} --no-interactive`
|
`generate @nx/angular:lib ${lib} --publishable --importPath=@${proj}/${lib} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:secondary-entry-point --name=${entryPoint} --library=${lib} --no-interactive`
|
`generate @nx/angular:secondary-entry-point --name=${entryPoint} --library=${lib} --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:library ${childLib} --publishable=true --importPath=@${proj}/${childLib} --no-interactive`
|
`generate @nx/angular:library ${childLib} --publishable=true --importPath=@${proj}/${childLib} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:secondary-entry-point --name=sub --library=${childLib} --no-interactive`
|
`generate @nx/angular:secondary-entry-point --name=sub --library=${childLib} --no-interactive`
|
||||||
@ -338,7 +340,7 @@ describe('Angular Projects', () => {
|
|||||||
})
|
})
|
||||||
export class ${names(lib).className}Module {}`;
|
export class ${names(lib).className}Module {}`;
|
||||||
|
|
||||||
updateFile(`libs/${lib}/src/lib/${lib}.module.ts`, moduleContent);
|
updateFile(`${lib}/src/lib/${lib}.module.ts`, moduleContent);
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
const buildOutput = runCLI(`build ${lib}`);
|
const buildOutput = runCLI(`build ${lib}`);
|
||||||
@ -351,17 +353,16 @@ describe('Angular Projects', () => {
|
|||||||
expect(buildOutput).toContain('Successfully ran target build');
|
expect(buildOutput).toContain('Successfully ran target build');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support generating projects with the new name and root format', () => {
|
it('should support generating projects with --project-name-and-root-format=derived', () => {
|
||||||
const appName = uniq('app1');
|
const appName = uniq('app1');
|
||||||
const libName = uniq('@my-org/lib1');
|
const libName = uniq('lib1');
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:app ${appName} --project-name-and-root-format=as-provided --no-interactive`
|
`generate @nx/angular:app ${appName} --project-name-and-root-format=derived --no-interactive`
|
||||||
);
|
);
|
||||||
|
|
||||||
// check files are generated without the layout directory ("apps/") and
|
// check files are generated with the layout directory ("apps/")
|
||||||
// using the project name as the directory when no directory is provided
|
checkFilesExist(`apps/${appName}/src/app/app.module.ts`);
|
||||||
checkFilesExist(`${appName}/src/app/app.module.ts`);
|
|
||||||
// check build works
|
// check build works
|
||||||
expect(runCLI(`build ${appName}`)).toContain(
|
expect(runCLI(`build ${appName}`)).toContain(
|
||||||
`Successfully ran target build for project ${appName}`
|
`Successfully ran target build for project ${appName}`
|
||||||
@ -372,6 +373,29 @@ describe('Angular Projects', () => {
|
|||||||
`Successfully ran target test for project ${appName}`
|
`Successfully ran target test for project ${appName}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/angular:lib ${libName} --buildable --project-name-and-root-format=derived`
|
||||||
|
);
|
||||||
|
|
||||||
|
// check files are generated with the layout directory ("libs/")
|
||||||
|
checkFilesExist(
|
||||||
|
`libs/${libName}/src/index.ts`,
|
||||||
|
`libs/${libName}/src/lib/${libName}.module.ts`
|
||||||
|
);
|
||||||
|
// check build works
|
||||||
|
expect(runCLI(`build ${libName}`)).toContain(
|
||||||
|
`Successfully ran target build for project ${libName}`
|
||||||
|
);
|
||||||
|
// check tests pass
|
||||||
|
const libTestResult = runCLI(`test ${libName}`);
|
||||||
|
expect(libTestResult).toContain(
|
||||||
|
`Successfully ran target test for project ${libName}`
|
||||||
|
);
|
||||||
|
}, 500_000);
|
||||||
|
|
||||||
|
it('should support generating libraries with a scoped name when --project-name-and-root-format=as-provided', () => {
|
||||||
|
const libName = uniq('@my-org/lib1');
|
||||||
|
|
||||||
// assert scoped project names are not supported when --project-name-and-root-format=derived
|
// assert scoped project names are not supported when --project-name-and-root-format=derived
|
||||||
expect(() =>
|
expect(() =>
|
||||||
runCLI(
|
runCLI(
|
||||||
|
|||||||
@ -78,14 +78,14 @@ describe('Angular Cypress Component Tests', () => {
|
|||||||
// add tailwind
|
// add tailwind
|
||||||
runCLI(`generate @nx/angular:setup-tailwind --project=${buildableLibName}`);
|
runCLI(`generate @nx/angular:setup-tailwind --project=${buildableLibName}`);
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${buildableLibName}/src/lib/input/input.component.cy.ts`,
|
`${buildableLibName}/src/lib/input/input.component.cy.ts`,
|
||||||
(content) => {
|
(content) => {
|
||||||
// text-green-500 should now apply
|
// text-green-500 should now apply
|
||||||
return content.replace('rgb(0, 0, 0)', 'rgb(34, 197, 94)');
|
return content.replace('rgb(0, 0, 0)', 'rgb(34, 197, 94)');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${buildableLibName}/src/lib/input-standalone/input-standalone.component.cy.ts`,
|
`${buildableLibName}/src/lib/input-standalone/input-standalone.component.cy.ts`,
|
||||||
(content) => {
|
(content) => {
|
||||||
// text-green-500 should now apply
|
// text-green-500 should now apply
|
||||||
return content.replace('rgb(0, 0, 0)', 'rgb(34, 197, 94)');
|
return content.replace('rgb(0, 0, 0)', 'rgb(34, 197, 94)');
|
||||||
@ -96,7 +96,7 @@ describe('Angular Cypress Component Tests', () => {
|
|||||||
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
|
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
|
||||||
'All specs passed!'
|
'All specs passed!'
|
||||||
);
|
);
|
||||||
checkFilesDoNotExist(`tmp/libs/${buildableLibName}/ct-styles.css`);
|
checkFilesDoNotExist(`tmp${buildableLibName}/ct-styles.css`);
|
||||||
}
|
}
|
||||||
}, 300_000);
|
}, 300_000);
|
||||||
|
|
||||||
@ -116,11 +116,9 @@ describe('Angular Cypress Component Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should use root level tailwinds config', () => {
|
it('should use root level tailwinds config', () => {
|
||||||
useRootLevelTailwindConfig(
|
useRootLevelTailwindConfig(join(buildableLibName, 'tailwind.config.js'));
|
||||||
join('libs', buildableLibName, 'tailwind.config.js')
|
|
||||||
);
|
|
||||||
checkFilesExist('tailwind.config.js');
|
checkFilesExist('tailwind.config.js');
|
||||||
checkFilesDoNotExist(`libs/${buildableLibName}/tailwind.config.js`);
|
checkFilesDoNotExist(`${buildableLibName}/tailwind.config.js`);
|
||||||
|
|
||||||
if (runE2ETests()) {
|
if (runE2ETests()) {
|
||||||
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
|
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
|
||||||
@ -131,14 +129,18 @@ describe('Angular Cypress Component Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function createApp(appName: string) {
|
function createApp(appName: string) {
|
||||||
runCLI(`generate @nx/angular:app ${appName} --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:app ${appName} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:component fancy-component --project=${appName} --no-interactive`
|
`generate @nx/angular:component fancy-component --project=${appName} --no-interactive`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLib(projectName: string, appName: string, libName: string) {
|
function createLib(projectName: string, appName: string, libName: string) {
|
||||||
runCLI(`generate @nx/angular:lib ${libName} --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:lib ${libName} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:component btn --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
|
`generate @nx/angular:component btn --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
|
||||||
);
|
);
|
||||||
@ -146,7 +148,7 @@ function createLib(projectName: string, appName: string, libName: string) {
|
|||||||
`generate @nx/angular:component btn-standalone --project=${libName} --inlineTemplate --inlineStyle --export --standalone --no-interactive`
|
`generate @nx/angular:component btn-standalone --project=${libName} --inlineTemplate --inlineStyle --export --standalone --no-interactive`
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${libName}/src/lib/btn/btn.component.ts`,
|
`${libName}/src/lib/btn/btn.component.ts`,
|
||||||
`
|
`
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
@ -161,7 +163,7 @@ export class BtnComponent {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${libName}/src/lib/btn-standalone/btn-standalone.component.ts`,
|
`${libName}/src/lib/btn-standalone/btn-standalone.component.ts`,
|
||||||
`
|
`
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -181,7 +183,9 @@ export class BtnStandaloneComponent {
|
|||||||
|
|
||||||
function createBuildableLib(projectName: string, libName: string) {
|
function createBuildableLib(projectName: string, libName: string) {
|
||||||
// create lib
|
// create lib
|
||||||
runCLI(`generate @nx/angular:lib ${libName} --buildable --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:lib ${libName} --buildable --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
// create cmp for lib
|
// create cmp for lib
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:component input --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
|
`generate @nx/angular:component input --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
|
||||||
@ -192,7 +196,7 @@ function createBuildableLib(projectName: string, libName: string) {
|
|||||||
);
|
);
|
||||||
// update cmp implmentation to use tailwind clasasserting in tests
|
// update cmp implmentation to use tailwind clasasserting in tests
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${libName}/src/lib/input/input.component.ts`,
|
`${libName}/src/lib/input/input.component.ts`,
|
||||||
`
|
`
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
|
|
||||||
@ -207,7 +211,7 @@ import {Component, Input} from '@angular/core';
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${libName}/src/lib/input-standalone/input-standalone.component.ts`,
|
`${libName}/src/lib/input-standalone/input-standalone.component.ts`,
|
||||||
`
|
`
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
@ -227,7 +231,7 @@ import {CommonModule} from '@angular/common';
|
|||||||
|
|
||||||
function useLibInApp(projectName: string, appName: string, libName: string) {
|
function useLibInApp(projectName: string, appName: string, libName: string) {
|
||||||
createFile(
|
createFile(
|
||||||
`apps/${appName}/src/app/app.component.html`,
|
`${appName}/src/app/app.component.html`,
|
||||||
`
|
`
|
||||||
<${projectName}-btn></${projectName}-btn>
|
<${projectName}-btn></${projectName}-btn>
|
||||||
<${projectName}-btn-standalone></${projectName}-btn-standalone>
|
<${projectName}-btn-standalone></${projectName}-btn-standalone>
|
||||||
@ -236,7 +240,7 @@ function useLibInApp(projectName: string, appName: string, libName: string) {
|
|||||||
);
|
);
|
||||||
const btnModuleName = names(libName).className;
|
const btnModuleName = names(libName).className;
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${appName}/src/app/app.component.scss`,
|
`${appName}/src/app/app.component.scss`,
|
||||||
`
|
`
|
||||||
@use 'styleguide' as *;
|
@use 'styleguide' as *;
|
||||||
|
|
||||||
@ -245,7 +249,7 @@ h1 {
|
|||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${appName}/src/app/app.module.ts`,
|
`${appName}/src/app/app.module.ts`,
|
||||||
`
|
`
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
@ -294,7 +298,7 @@ async function useWorkspaceAssetsInApp(appName: string) {
|
|||||||
|
|
||||||
function updateTestToAssertTailwindIsNotApplied(libName: string) {
|
function updateTestToAssertTailwindIsNotApplied(libName: string) {
|
||||||
createFile(
|
createFile(
|
||||||
`libs/${libName}/src/lib/input/input.component.cy.ts`,
|
`${libName}/src/lib/input/input.component.cy.ts`,
|
||||||
`
|
`
|
||||||
import { MountConfig } from 'cypress/angular';
|
import { MountConfig } from 'cypress/angular';
|
||||||
import { InputComponent } from './input.component';
|
import { InputComponent } from './input.component';
|
||||||
@ -325,7 +329,7 @@ describe(InputComponent.name, () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
createFile(
|
createFile(
|
||||||
`libs/${libName}/src/lib/input-standalone/input-standalone.component.cy.ts`,
|
`${libName}/src/lib/input-standalone/input-standalone.component.cy.ts`,
|
||||||
`
|
`
|
||||||
import { MountConfig } from 'cypress/angular';
|
import { MountConfig } from 'cypress/angular';
|
||||||
import { InputStandaloneComponent } from './input-standalone.component';
|
import { InputStandaloneComponent } from './input-standalone.component';
|
||||||
@ -363,7 +367,7 @@ function useBuildableLibInLib(
|
|||||||
const buildLibNames = names(buildableLibName);
|
const buildLibNames = names(buildableLibName);
|
||||||
// use the buildable lib in lib so now buildableLib has an indirect dep on app
|
// use the buildable lib in lib so now buildableLib has an indirect dep on app
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${libName}/src/lib/btn-standalone/btn-standalone.component.ts`,
|
`${libName}/src/lib/btn-standalone/btn-standalone.component.ts`,
|
||||||
`
|
`
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -386,14 +390,11 @@ function updateBuilableLibTestsToAssertAppStyles(
|
|||||||
appName: string,
|
appName: string,
|
||||||
buildableLibName: string
|
buildableLibName: string
|
||||||
) {
|
) {
|
||||||
updateFile(
|
updateFile(`${appName}/src/styles.css`, `label {color: pink !important;}`);
|
||||||
`apps/${appName}/src/styles.css`,
|
|
||||||
`label {color: pink !important;}`
|
|
||||||
);
|
|
||||||
|
|
||||||
removeFile(`libs/${buildableLibName}/src/lib/input/input.component.cy.ts`);
|
removeFile(`${buildableLibName}/src/lib/input/input.component.cy.ts`);
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${buildableLibName}/src/lib/input-standalone/input-standalone.component.cy.ts`,
|
`${buildableLibName}/src/lib/input-standalone/input-standalone.component.cy.ts`,
|
||||||
(content) => {
|
(content) => {
|
||||||
// app styles should now apply
|
// app styles should now apply
|
||||||
return content.replace('rgb(34, 197, 94)', 'rgb(255, 192, 203)');
|
return content.replace('rgb(34, 197, 94)', 'rgb(255, 192, 203)');
|
||||||
|
|||||||
@ -20,11 +20,13 @@ describe('Angular Package', () => {
|
|||||||
|
|
||||||
it('should work', async () => {
|
it('should work', async () => {
|
||||||
const myapp = uniq('myapp');
|
const myapp = uniq('myapp');
|
||||||
runCLI(`generate @nx/angular:app ${myapp} --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:app ${myapp} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
|
||||||
// Generate root ngrx state management
|
// Generate root ngrx state management
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:ngrx users --parent=apps/${myapp}/src/app/app.module.ts --root --minimal=false`
|
`generate @nx/angular:ngrx users --parent=${myapp}/src/app/app.module.ts --root --minimal=false`
|
||||||
);
|
);
|
||||||
const packageJson = readJson('package.json');
|
const packageJson = readJson('package.json');
|
||||||
expect(packageJson.dependencies['@ngrx/store']).toBeDefined();
|
expect(packageJson.dependencies['@ngrx/store']).toBeDefined();
|
||||||
@ -34,9 +36,11 @@ describe('Angular Package', () => {
|
|||||||
|
|
||||||
const mylib = uniq('mylib');
|
const mylib = uniq('mylib');
|
||||||
// Generate feature library and ngrx state within that library
|
// Generate feature library and ngrx state within that library
|
||||||
runCLI(`g @nx/angular:lib ${mylib} --prefix=fl`);
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:ngrx flights --parent=libs/${mylib}/src/lib/${mylib}.module.ts --facade`
|
`g @nx/angular:lib ${mylib} --prefix=fl --project-name-and-root-format=as-provided`
|
||||||
|
);
|
||||||
|
runCLI(
|
||||||
|
`generate @nx/angular:ngrx flights --parent=${mylib}/src/lib/${mylib}.module.ts --facade`
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
||||||
@ -49,11 +53,13 @@ describe('Angular Package', () => {
|
|||||||
|
|
||||||
it('should work with creators', async () => {
|
it('should work with creators', async () => {
|
||||||
const myapp = uniq('myapp');
|
const myapp = uniq('myapp');
|
||||||
runCLI(`generate @nx/angular:app ${myapp} --routing --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:app ${myapp} --routing --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
|
||||||
// Generate root ngrx state management
|
// Generate root ngrx state management
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:ngrx users --parent=apps/${myapp}/src/app/app.module.ts --root`
|
`generate @nx/angular:ngrx users --parent=${myapp}/src/app/app.module.ts --root`
|
||||||
);
|
);
|
||||||
const packageJson = readJson('package.json');
|
const packageJson = readJson('package.json');
|
||||||
expect(packageJson.dependencies['@ngrx/entity']).toBeDefined();
|
expect(packageJson.dependencies['@ngrx/entity']).toBeDefined();
|
||||||
@ -65,11 +71,13 @@ describe('Angular Package', () => {
|
|||||||
|
|
||||||
const mylib = uniq('mylib');
|
const mylib = uniq('mylib');
|
||||||
// Generate feature library and ngrx state within that library
|
// Generate feature library and ngrx state within that library
|
||||||
runCLI(`g @nx/angular:lib ${mylib} --prefix=fl`);
|
runCLI(
|
||||||
|
`g @nx/angular:lib ${mylib} --prefix=fl --project-name-and-root-format=as-provided`
|
||||||
|
);
|
||||||
|
|
||||||
const flags = `--facade --barrels`;
|
const flags = `--facade --barrels`;
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:ngrx flights --parent=libs/${mylib}/src/lib/${mylib}.module.ts ${flags}`
|
`generate @nx/angular:ngrx flights --parent=${mylib}/src/lib/${mylib}.module.ts ${flags}`
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
||||||
@ -82,11 +90,13 @@ describe('Angular Package', () => {
|
|||||||
|
|
||||||
it('should work with creators using --module', async () => {
|
it('should work with creators using --module', async () => {
|
||||||
const myapp = uniq('myapp');
|
const myapp = uniq('myapp');
|
||||||
runCLI(`generate @nx/angular:app ${myapp} --routing --no-interactive`);
|
runCLI(
|
||||||
|
`generate @nx/angular:app ${myapp} --routing --project-name-and-root-format=as-provided --no-interactive`
|
||||||
|
);
|
||||||
|
|
||||||
// Generate root ngrx state management
|
// Generate root ngrx state management
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:ngrx users --parent=apps/${myapp}/src/app/app.module.ts --root`
|
`generate @nx/angular:ngrx users --parent=${myapp}/src/app/app.module.ts --root`
|
||||||
);
|
);
|
||||||
const packageJson = readJson('package.json');
|
const packageJson = readJson('package.json');
|
||||||
expect(packageJson.dependencies['@ngrx/entity']).toBeDefined();
|
expect(packageJson.dependencies['@ngrx/entity']).toBeDefined();
|
||||||
@ -98,11 +108,13 @@ describe('Angular Package', () => {
|
|||||||
|
|
||||||
const mylib = uniq('mylib');
|
const mylib = uniq('mylib');
|
||||||
// Generate feature library and ngrx state within that library
|
// Generate feature library and ngrx state within that library
|
||||||
runCLI(`g @nx/angular:lib ${mylib} --prefix=fl`);
|
runCLI(
|
||||||
|
`g @nx/angular:lib ${mylib} --prefix=fl --project-name-and-root-format=as-provided`
|
||||||
|
);
|
||||||
|
|
||||||
const flags = `--facade --barrels`;
|
const flags = `--facade --barrels`;
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:ngrx flights --module=libs/${mylib}/src/lib/${mylib}.module.ts ${flags}`
|
`generate @nx/angular:ngrx flights --module=${mylib}/src/lib/${mylib}.module.ts ${flags}`
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
expect(runCLI(`build ${myapp}`)).toMatch(/main\.[a-z0-9]+\.js/);
|
||||||
|
|||||||
@ -10,8 +10,6 @@ import {
|
|||||||
updateProjectConfig,
|
updateProjectConfig,
|
||||||
} from '@nx/e2e/utils';
|
} from '@nx/e2e/utils';
|
||||||
|
|
||||||
// TODO(Colum or Leosvel): Investigate and fix these tests
|
|
||||||
|
|
||||||
describe('Tailwind support', () => {
|
describe('Tailwind support', () => {
|
||||||
let project: string;
|
let project: string;
|
||||||
|
|
||||||
@ -54,8 +52,8 @@ describe('Tailwind support', () => {
|
|||||||
|
|
||||||
const tailwindConfig = `module.exports = {
|
const tailwindConfig = `module.exports = {
|
||||||
content: [
|
content: [
|
||||||
'./apps/**/!(*.stories|*.spec).{ts,html}',
|
'**/!(*.stories|*.spec).{ts,html}',
|
||||||
'./libs/**/!(*.stories|*.spec).{ts,html}',
|
'**/!(*.stories|*.spec).{ts,html}',
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
spacing: {
|
spacing: {
|
||||||
@ -133,7 +131,7 @@ describe('Tailwind support', () => {
|
|||||||
buttonBgColor: string = defaultButtonBgColor
|
buttonBgColor: string = defaultButtonBgColor
|
||||||
) => {
|
) => {
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${lib}/src/lib/foo.component.ts`,
|
`${lib}/src/lib/foo.component.ts`,
|
||||||
`import { Component } from '@angular/core';
|
`import { Component } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -150,7 +148,7 @@ describe('Tailwind support', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${lib}/src/lib/${lib}.module.ts`,
|
`${lib}/src/lib/${lib}.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FooComponent } from './foo.component';
|
import { FooComponent } from './foo.component';
|
||||||
@ -165,7 +163,7 @@ describe('Tailwind support', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
updateFile(
|
updateFile(
|
||||||
`libs/${lib}/src/index.ts`,
|
`${lib}/src/index.ts`,
|
||||||
`export * from './lib/foo.component';
|
`export * from './lib/foo.component';
|
||||||
export * from './lib/${lib}.module';
|
export * from './lib/${lib}.module';
|
||||||
`
|
`
|
||||||
@ -177,7 +175,7 @@ describe('Tailwind support', () => {
|
|||||||
libSpacing: typeof spacing['root']
|
libSpacing: typeof spacing['root']
|
||||||
) => {
|
) => {
|
||||||
const builtComponentContent = readFile(
|
const builtComponentContent = readFile(
|
||||||
`dist/libs/${lib}/esm2022/lib/foo.component.mjs`
|
`dist/${lib}/esm2022/lib/foo.component.mjs`
|
||||||
);
|
);
|
||||||
let expectedStylesRegex = new RegExp(
|
let expectedStylesRegex = new RegExp(
|
||||||
`styles: \\[\\"\\.custom\\-btn(\\[_ngcontent\\-%COMP%\\])?{margin:${libSpacing.md};padding:${libSpacing.sm}}(\\\\n)?\\"\\]`
|
`styles: \\[\\"\\.custom\\-btn(\\[_ngcontent\\-%COMP%\\])?{margin:${libSpacing.md};padding:${libSpacing.sm}}(\\\\n)?\\"\\]`
|
||||||
@ -188,10 +186,10 @@ describe('Tailwind support', () => {
|
|||||||
|
|
||||||
it('should generate a buildable library with tailwind and build correctly', () => {
|
it('should generate a buildable library with tailwind and build correctly', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${buildLibWithTailwind.name} --buildable --add-tailwind --no-interactive`
|
`generate @nx/angular:lib ${buildLibWithTailwind.name} --buildable --add-tailwind --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
updateTailwindConfig(
|
updateTailwindConfig(
|
||||||
`libs/${buildLibWithTailwind.name}/tailwind.config.js`,
|
`${buildLibWithTailwind.name}/tailwind.config.js`,
|
||||||
spacing.projectVariant1
|
spacing.projectVariant1
|
||||||
);
|
);
|
||||||
createLibComponent(
|
createLibComponent(
|
||||||
@ -210,13 +208,13 @@ describe('Tailwind support', () => {
|
|||||||
it('should set up tailwind in a previously generated buildable library and build correctly', () => {
|
it('should set up tailwind in a previously generated buildable library and build correctly', () => {
|
||||||
const buildLibSetupTailwind = uniq('build-lib-setup-tailwind');
|
const buildLibSetupTailwind = uniq('build-lib-setup-tailwind');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${buildLibSetupTailwind} --buildable --no-interactive`
|
`generate @nx/angular:lib ${buildLibSetupTailwind} --buildable --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:setup-tailwind ${buildLibSetupTailwind} --no-interactive`
|
`generate @nx/angular:setup-tailwind ${buildLibSetupTailwind} --no-interactive`
|
||||||
);
|
);
|
||||||
updateTailwindConfig(
|
updateTailwindConfig(
|
||||||
`libs/${buildLibSetupTailwind}/tailwind.config.js`,
|
`${buildLibSetupTailwind}/tailwind.config.js`,
|
||||||
spacing.projectVariant2
|
spacing.projectVariant2
|
||||||
);
|
);
|
||||||
createLibComponent(buildLibSetupTailwind);
|
createLibComponent(buildLibSetupTailwind);
|
||||||
@ -229,10 +227,10 @@ describe('Tailwind support', () => {
|
|||||||
it('should correctly build a buildable library with a tailwind.config.js file in the project root or workspace root', () => {
|
it('should correctly build a buildable library with a tailwind.config.js file in the project root or workspace root', () => {
|
||||||
const buildLibNoProjectConfig = uniq('build-lib-no-project-config');
|
const buildLibNoProjectConfig = uniq('build-lib-no-project-config');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${buildLibNoProjectConfig} --buildable --no-interactive`
|
`generate @nx/angular:lib ${buildLibNoProjectConfig} --buildable --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
createTailwindConfigFile(
|
createTailwindConfigFile(
|
||||||
`libs/${buildLibNoProjectConfig}/tailwind.config.js`,
|
`${buildLibNoProjectConfig}/tailwind.config.js`,
|
||||||
spacing.projectVariant3
|
spacing.projectVariant3
|
||||||
);
|
);
|
||||||
createLibComponent(buildLibNoProjectConfig);
|
createLibComponent(buildLibNoProjectConfig);
|
||||||
@ -245,7 +243,7 @@ describe('Tailwind support', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// remove tailwind.config.js file from the project root to test the one in the workspace root
|
// remove tailwind.config.js file from the project root to test the one in the workspace root
|
||||||
removeFile(`libs/${buildLibNoProjectConfig}/tailwind.config.js`);
|
removeFile(`${buildLibNoProjectConfig}/tailwind.config.js`);
|
||||||
|
|
||||||
runCLI(`build ${buildLibNoProjectConfig}`);
|
runCLI(`build ${buildLibNoProjectConfig}`);
|
||||||
|
|
||||||
@ -254,10 +252,10 @@ describe('Tailwind support', () => {
|
|||||||
|
|
||||||
it('should generate a publishable library with tailwind and build correctly', () => {
|
it('should generate a publishable library with tailwind and build correctly', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${pubLibWithTailwind.name} --publishable --add-tailwind --importPath=@${project}/${pubLibWithTailwind.name} --no-interactive`
|
`generate @nx/angular:lib ${pubLibWithTailwind.name} --publishable --add-tailwind --importPath=@${project}/${pubLibWithTailwind.name} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
updateTailwindConfig(
|
updateTailwindConfig(
|
||||||
`libs/${pubLibWithTailwind.name}/tailwind.config.js`,
|
`${pubLibWithTailwind.name}/tailwind.config.js`,
|
||||||
spacing.projectVariant1
|
spacing.projectVariant1
|
||||||
);
|
);
|
||||||
createLibComponent(
|
createLibComponent(
|
||||||
@ -276,13 +274,13 @@ describe('Tailwind support', () => {
|
|||||||
it('should set up tailwind in a previously generated publishable library and build correctly', () => {
|
it('should set up tailwind in a previously generated publishable library and build correctly', () => {
|
||||||
const pubLibSetupTailwind = uniq('pub-lib-setup-tailwind');
|
const pubLibSetupTailwind = uniq('pub-lib-setup-tailwind');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${pubLibSetupTailwind} --publishable --importPath=@${project}/${pubLibSetupTailwind} --no-interactive`
|
`generate @nx/angular:lib ${pubLibSetupTailwind} --publishable --importPath=@${project}/${pubLibSetupTailwind} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:setup-tailwind ${pubLibSetupTailwind} --no-interactive`
|
`generate @nx/angular:setup-tailwind ${pubLibSetupTailwind} --no-interactive`
|
||||||
);
|
);
|
||||||
updateTailwindConfig(
|
updateTailwindConfig(
|
||||||
`libs/${pubLibSetupTailwind}/tailwind.config.js`,
|
`${pubLibSetupTailwind}/tailwind.config.js`,
|
||||||
spacing.projectVariant2
|
spacing.projectVariant2
|
||||||
);
|
);
|
||||||
createLibComponent(pubLibSetupTailwind);
|
createLibComponent(pubLibSetupTailwind);
|
||||||
@ -295,10 +293,10 @@ describe('Tailwind support', () => {
|
|||||||
it('should correctly build a publishable library with a tailwind.config.js file in the project root or workspace root', () => {
|
it('should correctly build a publishable library with a tailwind.config.js file in the project root or workspace root', () => {
|
||||||
const pubLibNoProjectConfig = uniq('pub-lib-no-project-config');
|
const pubLibNoProjectConfig = uniq('pub-lib-no-project-config');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:lib ${pubLibNoProjectConfig} --publishable --importPath=@${project}/${pubLibNoProjectConfig} --no-interactive`
|
`generate @nx/angular:lib ${pubLibNoProjectConfig} --publishable --importPath=@${project}/${pubLibNoProjectConfig} --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
createTailwindConfigFile(
|
createTailwindConfigFile(
|
||||||
`libs/${pubLibNoProjectConfig}/tailwind.config.js`,
|
`${pubLibNoProjectConfig}/tailwind.config.js`,
|
||||||
spacing.projectVariant3
|
spacing.projectVariant3
|
||||||
);
|
);
|
||||||
createLibComponent(pubLibNoProjectConfig);
|
createLibComponent(pubLibNoProjectConfig);
|
||||||
@ -308,7 +306,7 @@ describe('Tailwind support', () => {
|
|||||||
assertLibComponentStyles(pubLibNoProjectConfig, spacing.projectVariant3);
|
assertLibComponentStyles(pubLibNoProjectConfig, spacing.projectVariant3);
|
||||||
|
|
||||||
// remove tailwind.config.js file from the project root to test the one in the workspace root
|
// remove tailwind.config.js file from the project root to test the one in the workspace root
|
||||||
removeFile(`libs/${pubLibNoProjectConfig}/tailwind.config.js`);
|
removeFile(`${pubLibNoProjectConfig}/tailwind.config.js`);
|
||||||
|
|
||||||
runCLI(`build ${pubLibNoProjectConfig}`);
|
runCLI(`build ${pubLibNoProjectConfig}`);
|
||||||
|
|
||||||
@ -319,12 +317,12 @@ describe('Tailwind support', () => {
|
|||||||
describe('Applications', () => {
|
describe('Applications', () => {
|
||||||
const updateAppComponent = (app: string) => {
|
const updateAppComponent = (app: string) => {
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app}/src/app/app.component.html`,
|
`${app}/src/app/app.component.html`,
|
||||||
`<button class="custom-btn text-white">Click me!</button>`
|
`<button class="custom-btn text-white">Click me!</button>`
|
||||||
);
|
);
|
||||||
|
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${app}/src/app/app.component.css`,
|
`${app}/src/app/app.component.css`,
|
||||||
`.custom-btn {
|
`.custom-btn {
|
||||||
@apply m-md p-sm;
|
@apply m-md p-sm;
|
||||||
}`
|
}`
|
||||||
@ -332,10 +330,10 @@ describe('Tailwind support', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const readAppStylesBundle = (app: string) => {
|
const readAppStylesBundle = (app: string) => {
|
||||||
const stylesBundlePath = listFiles(`dist/apps/${app}`).find((file) =>
|
const stylesBundlePath = listFiles(`dist/${app}`).find((file) =>
|
||||||
file.startsWith('styles.')
|
file.startsWith('styles.')
|
||||||
);
|
);
|
||||||
const stylesBundle = readFile(`dist/apps/${app}/${stylesBundlePath}`);
|
const stylesBundle = readFile(`dist/${app}/${stylesBundlePath}`);
|
||||||
|
|
||||||
return stylesBundle;
|
return stylesBundle;
|
||||||
};
|
};
|
||||||
@ -344,10 +342,10 @@ describe('Tailwind support', () => {
|
|||||||
app: string,
|
app: string,
|
||||||
appSpacing: typeof spacing['root']
|
appSpacing: typeof spacing['root']
|
||||||
) => {
|
) => {
|
||||||
const mainBundlePath = listFiles(`dist/apps/${app}`).find((file) =>
|
const mainBundlePath = listFiles(`dist/${app}`).find((file) =>
|
||||||
file.startsWith('main.')
|
file.startsWith('main.')
|
||||||
);
|
);
|
||||||
const mainBundle = readFile(`dist/apps/${app}/${mainBundlePath}`);
|
const mainBundle = readFile(`dist/${app}/${mainBundlePath}`);
|
||||||
let expectedStylesRegex = new RegExp(
|
let expectedStylesRegex = new RegExp(
|
||||||
`styles:\\[\\"\\.custom\\-btn\\[_ngcontent\\-%COMP%\\]{margin:${appSpacing.md};padding:${appSpacing.sm}}\\"\\]`
|
`styles:\\[\\"\\.custom\\-btn\\[_ngcontent\\-%COMP%\\]{margin:${appSpacing.md};padding:${appSpacing.sm}}\\"\\]`
|
||||||
);
|
);
|
||||||
@ -358,7 +356,7 @@ describe('Tailwind support', () => {
|
|||||||
it('should build correctly and only output the tailwind utilities used', async () => {
|
it('should build correctly and only output the tailwind utilities used', async () => {
|
||||||
const appWithTailwind = uniq('app-with-tailwind');
|
const appWithTailwind = uniq('app-with-tailwind');
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nx/angular:app ${appWithTailwind} --add-tailwind --no-interactive`
|
`generate @nx/angular:app ${appWithTailwind} --add-tailwind --project-name-and-root-format=as-provided --no-interactive`
|
||||||
);
|
);
|
||||||
await updateProjectConfig(appWithTailwind, (config) => {
|
await updateProjectConfig(appWithTailwind, (config) => {
|
||||||
config.targets.build.executor = '@nx/angular:webpack-browser';
|
config.targets.build.executor = '@nx/angular:webpack-browser';
|
||||||
@ -369,11 +367,11 @@ describe('Tailwind support', () => {
|
|||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
updateTailwindConfig(
|
updateTailwindConfig(
|
||||||
`apps/${appWithTailwind}/tailwind.config.js`,
|
`${appWithTailwind}/tailwind.config.js`,
|
||||||
spacing.projectVariant1
|
spacing.projectVariant1
|
||||||
);
|
);
|
||||||
updateFile(
|
updateFile(
|
||||||
`apps/${appWithTailwind}/src/app/app.module.ts`,
|
`${appWithTailwind}/src/app/app.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { LibModule as LibModule1 } from '@${project}/${buildLibWithTailwind.name}';
|
import { LibModule as LibModule1 } from '@${project}/${buildLibWithTailwind.name}';
|
||||||
|
|||||||
@ -206,6 +206,486 @@ exports[`app --minimal should skip "nx-welcome.component.ts" file and references
|
|||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when directory is provided 1`] = `
|
||||||
|
{
|
||||||
|
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "my-dir-my-app",
|
||||||
|
"prefix": "proj",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "apps/my-dir/my-app",
|
||||||
|
"sourceRoot": "apps/my-dir/my-app/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"configurations": {
|
||||||
|
"development": {
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"namedChunks": true,
|
||||||
|
"optimization": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"vendorChunk": true,
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"maximumError": "1mb",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"type": "initial",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximumError": "4kb",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production",
|
||||||
|
"executor": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"assets": [
|
||||||
|
"apps/my-dir/my-app/src/favicon.ico",
|
||||||
|
"apps/my-dir/my-app/src/assets",
|
||||||
|
],
|
||||||
|
"index": "apps/my-dir/my-app/src/index.html",
|
||||||
|
"main": "apps/my-dir/my-app/src/main.ts",
|
||||||
|
"outputPath": "dist/apps/my-dir/my-app",
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js",
|
||||||
|
],
|
||||||
|
"scripts": [],
|
||||||
|
"styles": [
|
||||||
|
"apps/my-dir/my-app/src/styles.css",
|
||||||
|
],
|
||||||
|
"tsConfig": "apps/my-dir/my-app/tsconfig.app.json",
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputPath}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"executor": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "my-dir-my-app:build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/linter:eslint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"apps/my-dir/my-app/**/*.ts",
|
||||||
|
"apps/my-dir/my-app/**/*.html",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputFile}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"configurations": {
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "my-dir-my-app:build:development",
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "my-dir-my-app:build:production",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development",
|
||||||
|
"executor": "@angular-devkit/build-angular:dev-server",
|
||||||
|
},
|
||||||
|
"serve-static": {
|
||||||
|
"executor": "@nx/web:file-server",
|
||||||
|
"options": {
|
||||||
|
"buildTarget": "my-dir-my-app:build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"ci": true,
|
||||||
|
"codeCoverage": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"executor": "@nx/jest:jest",
|
||||||
|
"options": {
|
||||||
|
"jestConfig": "apps/my-dir/my-app/jest.config.ts",
|
||||||
|
"passWithNoTests": true,
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{workspaceRoot}/coverage/{projectRoot}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when directory is provided 2`] = `
|
||||||
|
{
|
||||||
|
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"implicitDependencies": [
|
||||||
|
"my-dir-my-app",
|
||||||
|
],
|
||||||
|
"name": "my-dir-my-app-e2e",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "apps/my-dir/my-app-e2e",
|
||||||
|
"sourceRoot": "apps/my-dir/my-app-e2e/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"e2e": {
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"devServerTarget": "my-dir-my-app:serve-static",
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "my-dir-my-app:serve:production",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"executor": "@nx/cypress:cypress",
|
||||||
|
"options": {
|
||||||
|
"cypressConfig": "apps/my-dir/my-app-e2e/cypress.config.ts",
|
||||||
|
"devServerTarget": "my-dir-my-app:serve:development",
|
||||||
|
"testingType": "e2e",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/linter:eslint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"apps/my-dir/my-app-e2e/**/*.{js,ts}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputFile}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when directory is provided: e2e tsconfig.json 1`] = `
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"outDir": "../../../dist/out-tsc",
|
||||||
|
"sourceMap": false,
|
||||||
|
"strict": true,
|
||||||
|
"types": [
|
||||||
|
"cypress",
|
||||||
|
"node",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.js",
|
||||||
|
"cypress.config.ts",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when directory is provided: tsconfig.app.json 1`] = `
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../../dist/out-tsc",
|
||||||
|
"types": [],
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"jest.config.ts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
],
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"files": [
|
||||||
|
"src/main.ts",
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.d.ts",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when directory is provided: tsconfig.json 1`] = `
|
||||||
|
{
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true,
|
||||||
|
},
|
||||||
|
"compilerOptions": {
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"strict": true,
|
||||||
|
"target": "es2022",
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
},
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.editor.json",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when no directory is provided 1`] = `
|
||||||
|
{
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "my-app",
|
||||||
|
"prefix": "proj",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "apps/my-app",
|
||||||
|
"sourceRoot": "apps/my-app/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"configurations": {
|
||||||
|
"development": {
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"namedChunks": true,
|
||||||
|
"optimization": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"vendorChunk": true,
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"maximumError": "1mb",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"type": "initial",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximumError": "4kb",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production",
|
||||||
|
"executor": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"assets": [
|
||||||
|
"apps/my-app/src/favicon.ico",
|
||||||
|
"apps/my-app/src/assets",
|
||||||
|
],
|
||||||
|
"index": "apps/my-app/src/index.html",
|
||||||
|
"main": "apps/my-app/src/main.ts",
|
||||||
|
"outputPath": "dist/apps/my-app",
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js",
|
||||||
|
],
|
||||||
|
"scripts": [],
|
||||||
|
"styles": [
|
||||||
|
"apps/my-app/src/styles.css",
|
||||||
|
],
|
||||||
|
"tsConfig": "apps/my-app/tsconfig.app.json",
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputPath}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"executor": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "my-app:build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/linter:eslint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"apps/my-app/**/*.ts",
|
||||||
|
"apps/my-app/**/*.html",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputFile}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"configurations": {
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "my-app:build:development",
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "my-app:build:production",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development",
|
||||||
|
"executor": "@angular-devkit/build-angular:dev-server",
|
||||||
|
},
|
||||||
|
"serve-static": {
|
||||||
|
"executor": "@nx/web:file-server",
|
||||||
|
"options": {
|
||||||
|
"buildTarget": "my-app:build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"ci": true,
|
||||||
|
"codeCoverage": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"executor": "@nx/jest:jest",
|
||||||
|
"options": {
|
||||||
|
"jestConfig": "apps/my-app/jest.config.ts",
|
||||||
|
"passWithNoTests": true,
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{workspaceRoot}/coverage/{projectRoot}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when no directory is provided 2`] = `
|
||||||
|
{
|
||||||
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"implicitDependencies": [
|
||||||
|
"my-app",
|
||||||
|
],
|
||||||
|
"name": "my-app-e2e",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "apps/my-app-e2e",
|
||||||
|
"sourceRoot": "apps/my-app-e2e/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"e2e": {
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"devServerTarget": "my-app:serve-static",
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "my-app:serve:production",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"executor": "@nx/cypress:cypress",
|
||||||
|
"options": {
|
||||||
|
"cypressConfig": "apps/my-app-e2e/cypress.config.ts",
|
||||||
|
"devServerTarget": "my-app:serve:development",
|
||||||
|
"testingType": "e2e",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/linter:eslint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"apps/my-app-e2e/**/*.{js,ts}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputFile}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when no directory is provided: e2e tsconfig.json 1`] = `
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"sourceMap": false,
|
||||||
|
"strict": true,
|
||||||
|
"types": [
|
||||||
|
"cypress",
|
||||||
|
"node",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.js",
|
||||||
|
"cypress.config.ts",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when no directory is provided: tsconfig.app.json 1`] = `
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"types": [],
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"jest.config.ts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
],
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"files": [
|
||||||
|
"src/main.ts",
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/**/*.d.ts",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app --project-name-and-root-format=derived should generate correctly when no directory is provided: tsconfig.json 1`] = `
|
||||||
|
{
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"strictTemplates": true,
|
||||||
|
},
|
||||||
|
"compilerOptions": {
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"strict": true,
|
||||||
|
"target": "es2022",
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
},
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.editor.json",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`app --standalone should generate a standalone app correctly with routing 1`] = `
|
exports[`app --standalone should generate a standalone app correctly with routing 1`] = `
|
||||||
"import { bootstrapApplication } from '@angular/platform-browser';
|
"import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
import { appConfig } from './app/app.config';
|
import { appConfig } from './app/app.config';
|
||||||
@ -372,7 +852,7 @@ exports[`app --strict should enable strict type checking: app tsconfig.json 1`]
|
|||||||
"target": "es2022",
|
"target": "es2022",
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
},
|
},
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"files": [],
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
"references": [
|
"references": [
|
||||||
@ -398,7 +878,7 @@ exports[`app --strict should enable strict type checking: e2e tsconfig.json 1`]
|
|||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../dist/out-tsc",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"types": [
|
"types": [
|
||||||
@ -406,7 +886,7 @@ exports[`app --strict should enable strict type checking: e2e tsconfig.json 1`]
|
|||||||
"node",
|
"node",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.js",
|
"src/**/*.js",
|
||||||
@ -418,171 +898,13 @@ exports[`app --strict should enable strict type checking: e2e tsconfig.json 1`]
|
|||||||
exports[`app at the root should accept numbers in the path 1`] = `"src/9-websites/my-app"`;
|
exports[`app at the root should accept numbers in the path 1`] = `"src/9-websites/my-app"`;
|
||||||
|
|
||||||
exports[`app nested should create project configs 1`] = `
|
exports[`app nested should create project configs 1`] = `
|
||||||
{
|
|
||||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
||||||
"name": "my-dir-my-app",
|
|
||||||
"prefix": "proj",
|
|
||||||
"projectType": "application",
|
|
||||||
"root": "apps/my-dir/my-app",
|
|
||||||
"sourceRoot": "apps/my-dir/my-app/src",
|
|
||||||
"tags": [],
|
|
||||||
"targets": {
|
|
||||||
"build": {
|
|
||||||
"configurations": {
|
|
||||||
"development": {
|
|
||||||
"buildOptimizer": false,
|
|
||||||
"extractLicenses": false,
|
|
||||||
"namedChunks": true,
|
|
||||||
"optimization": false,
|
|
||||||
"sourceMap": true,
|
|
||||||
"vendorChunk": true,
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"budgets": [
|
|
||||||
{
|
|
||||||
"maximumError": "1mb",
|
|
||||||
"maximumWarning": "500kb",
|
|
||||||
"type": "initial",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"maximumError": "4kb",
|
|
||||||
"maximumWarning": "2kb",
|
|
||||||
"type": "anyComponentStyle",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"outputHashing": "all",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"defaultConfiguration": "production",
|
|
||||||
"executor": "@angular-devkit/build-angular:browser",
|
|
||||||
"options": {
|
|
||||||
"assets": [
|
|
||||||
"apps/my-dir/my-app/src/favicon.ico",
|
|
||||||
"apps/my-dir/my-app/src/assets",
|
|
||||||
],
|
|
||||||
"index": "apps/my-dir/my-app/src/index.html",
|
|
||||||
"main": "apps/my-dir/my-app/src/main.ts",
|
|
||||||
"outputPath": "dist/apps/my-dir/my-app",
|
|
||||||
"polyfills": [
|
|
||||||
"zone.js",
|
|
||||||
],
|
|
||||||
"scripts": [],
|
|
||||||
"styles": [
|
|
||||||
"apps/my-dir/my-app/src/styles.css",
|
|
||||||
],
|
|
||||||
"tsConfig": "apps/my-dir/my-app/tsconfig.app.json",
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
"{options.outputPath}",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"extract-i18n": {
|
|
||||||
"executor": "@angular-devkit/build-angular:extract-i18n",
|
|
||||||
"options": {
|
|
||||||
"browserTarget": "my-dir-my-app:build",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"lint": {
|
|
||||||
"executor": "@nx/linter:eslint",
|
|
||||||
"options": {
|
|
||||||
"lintFilePatterns": [
|
|
||||||
"apps/my-dir/my-app/**/*.ts",
|
|
||||||
"apps/my-dir/my-app/**/*.html",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
"{options.outputFile}",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"serve": {
|
|
||||||
"configurations": {
|
|
||||||
"development": {
|
|
||||||
"browserTarget": "my-dir-my-app:build:development",
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"browserTarget": "my-dir-my-app:build:production",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"defaultConfiguration": "development",
|
|
||||||
"executor": "@angular-devkit/build-angular:dev-server",
|
|
||||||
},
|
|
||||||
"serve-static": {
|
|
||||||
"executor": "@nx/web:file-server",
|
|
||||||
"options": {
|
|
||||||
"buildTarget": "my-dir-my-app:build",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"configurations": {
|
|
||||||
"ci": {
|
|
||||||
"ci": true,
|
|
||||||
"codeCoverage": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"executor": "@nx/jest:jest",
|
|
||||||
"options": {
|
|
||||||
"jestConfig": "apps/my-dir/my-app/jest.config.ts",
|
|
||||||
"passWithNoTests": true,
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
"{workspaceRoot}/coverage/{projectRoot}",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`app nested should create project configs 2`] = `
|
|
||||||
{
|
|
||||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
||||||
"implicitDependencies": [
|
|
||||||
"my-dir-my-app",
|
|
||||||
],
|
|
||||||
"name": "my-dir-my-app-e2e",
|
|
||||||
"projectType": "application",
|
|
||||||
"root": "apps/my-dir/my-app-e2e",
|
|
||||||
"sourceRoot": "apps/my-dir/my-app-e2e/src",
|
|
||||||
"tags": [],
|
|
||||||
"targets": {
|
|
||||||
"e2e": {
|
|
||||||
"configurations": {
|
|
||||||
"ci": {
|
|
||||||
"devServerTarget": "my-dir-my-app:serve-static",
|
|
||||||
},
|
|
||||||
"production": {
|
|
||||||
"devServerTarget": "my-dir-my-app:serve:production",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"executor": "@nx/cypress:cypress",
|
|
||||||
"options": {
|
|
||||||
"cypressConfig": "apps/my-dir/my-app-e2e/cypress.config.ts",
|
|
||||||
"devServerTarget": "my-dir-my-app:serve:development",
|
|
||||||
"testingType": "e2e",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"lint": {
|
|
||||||
"executor": "@nx/linter:eslint",
|
|
||||||
"options": {
|
|
||||||
"lintFilePatterns": [
|
|
||||||
"apps/my-dir/my-app-e2e/**/*.{js,ts}",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
"{options.outputFile}",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`app not nested should create project configs 1`] = `
|
|
||||||
{
|
{
|
||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"name": "my-app",
|
"name": "my-app",
|
||||||
"prefix": "proj",
|
"prefix": "proj",
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"root": "apps/my-app",
|
"root": "my-dir/my-app",
|
||||||
"sourceRoot": "apps/my-app/src",
|
"sourceRoot": "my-dir/my-app/src",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"targets": {
|
"targets": {
|
||||||
"build": {
|
"build": {
|
||||||
@ -615,20 +937,20 @@ exports[`app not nested should create project configs 1`] = `
|
|||||||
"executor": "@angular-devkit/build-angular:browser",
|
"executor": "@angular-devkit/build-angular:browser",
|
||||||
"options": {
|
"options": {
|
||||||
"assets": [
|
"assets": [
|
||||||
"apps/my-app/src/favicon.ico",
|
"my-dir/my-app/src/favicon.ico",
|
||||||
"apps/my-app/src/assets",
|
"my-dir/my-app/src/assets",
|
||||||
],
|
],
|
||||||
"index": "apps/my-app/src/index.html",
|
"index": "my-dir/my-app/src/index.html",
|
||||||
"main": "apps/my-app/src/main.ts",
|
"main": "my-dir/my-app/src/main.ts",
|
||||||
"outputPath": "dist/apps/my-app",
|
"outputPath": "dist/my-dir/my-app",
|
||||||
"polyfills": [
|
"polyfills": [
|
||||||
"zone.js",
|
"zone.js",
|
||||||
],
|
],
|
||||||
"scripts": [],
|
"scripts": [],
|
||||||
"styles": [
|
"styles": [
|
||||||
"apps/my-app/src/styles.css",
|
"my-dir/my-app/src/styles.css",
|
||||||
],
|
],
|
||||||
"tsConfig": "apps/my-app/tsconfig.app.json",
|
"tsConfig": "my-dir/my-app/tsconfig.app.json",
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
"{options.outputPath}",
|
"{options.outputPath}",
|
||||||
@ -644,8 +966,8 @@ exports[`app not nested should create project configs 1`] = `
|
|||||||
"executor": "@nx/linter:eslint",
|
"executor": "@nx/linter:eslint",
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"apps/my-app/**/*.ts",
|
"my-dir/my-app/**/*.ts",
|
||||||
"apps/my-app/**/*.html",
|
"my-dir/my-app/**/*.html",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -679,7 +1001,7 @@ exports[`app not nested should create project configs 1`] = `
|
|||||||
},
|
},
|
||||||
"executor": "@nx/jest:jest",
|
"executor": "@nx/jest:jest",
|
||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "apps/my-app/jest.config.ts",
|
"jestConfig": "my-dir/my-app/jest.config.ts",
|
||||||
"passWithNoTests": true,
|
"passWithNoTests": true,
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -690,7 +1012,7 @@ exports[`app not nested should create project configs 1`] = `
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`app not nested should create project configs 2`] = `
|
exports[`app nested should create project configs 2`] = `
|
||||||
{
|
{
|
||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"implicitDependencies": [
|
"implicitDependencies": [
|
||||||
@ -698,8 +1020,8 @@ exports[`app not nested should create project configs 2`] = `
|
|||||||
],
|
],
|
||||||
"name": "my-app-e2e",
|
"name": "my-app-e2e",
|
||||||
"projectType": "application",
|
"projectType": "application",
|
||||||
"root": "apps/my-app-e2e",
|
"root": "my-dir/my-app-e2e",
|
||||||
"sourceRoot": "apps/my-app-e2e/src",
|
"sourceRoot": "my-dir/my-app-e2e/src",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"targets": {
|
"targets": {
|
||||||
"e2e": {
|
"e2e": {
|
||||||
@ -713,7 +1035,7 @@ exports[`app not nested should create project configs 2`] = `
|
|||||||
},
|
},
|
||||||
"executor": "@nx/cypress:cypress",
|
"executor": "@nx/cypress:cypress",
|
||||||
"options": {
|
"options": {
|
||||||
"cypressConfig": "apps/my-app-e2e/cypress.config.ts",
|
"cypressConfig": "my-dir/my-app-e2e/cypress.config.ts",
|
||||||
"devServerTarget": "my-app:serve:development",
|
"devServerTarget": "my-app:serve:development",
|
||||||
"testingType": "e2e",
|
"testingType": "e2e",
|
||||||
},
|
},
|
||||||
@ -722,7 +1044,165 @@ exports[`app not nested should create project configs 2`] = `
|
|||||||
"executor": "@nx/linter:eslint",
|
"executor": "@nx/linter:eslint",
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"apps/my-app-e2e/**/*.{js,ts}",
|
"my-dir/my-app-e2e/**/*.{js,ts}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputFile}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app not nested should create project configs 1`] = `
|
||||||
|
{
|
||||||
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"name": "my-app",
|
||||||
|
"prefix": "proj",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "my-app",
|
||||||
|
"sourceRoot": "my-app/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"configurations": {
|
||||||
|
"development": {
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"namedChunks": true,
|
||||||
|
"optimization": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"vendorChunk": true,
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"maximumError": "1mb",
|
||||||
|
"maximumWarning": "500kb",
|
||||||
|
"type": "initial",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"maximumError": "4kb",
|
||||||
|
"maximumWarning": "2kb",
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"outputHashing": "all",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production",
|
||||||
|
"executor": "@angular-devkit/build-angular:browser",
|
||||||
|
"options": {
|
||||||
|
"assets": [
|
||||||
|
"my-app/src/favicon.ico",
|
||||||
|
"my-app/src/assets",
|
||||||
|
],
|
||||||
|
"index": "my-app/src/index.html",
|
||||||
|
"main": "my-app/src/main.ts",
|
||||||
|
"outputPath": "dist/my-app",
|
||||||
|
"polyfills": [
|
||||||
|
"zone.js",
|
||||||
|
],
|
||||||
|
"scripts": [],
|
||||||
|
"styles": [
|
||||||
|
"my-app/src/styles.css",
|
||||||
|
],
|
||||||
|
"tsConfig": "my-app/tsconfig.app.json",
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputPath}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"executor": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "my-app:build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/linter:eslint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"my-app/**/*.ts",
|
||||||
|
"my-app/**/*.html",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{options.outputFile}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"configurations": {
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "my-app:build:development",
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "my-app:build:production",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development",
|
||||||
|
"executor": "@angular-devkit/build-angular:dev-server",
|
||||||
|
},
|
||||||
|
"serve-static": {
|
||||||
|
"executor": "@nx/web:file-server",
|
||||||
|
"options": {
|
||||||
|
"buildTarget": "my-app:build",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"ci": true,
|
||||||
|
"codeCoverage": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"executor": "@nx/jest:jest",
|
||||||
|
"options": {
|
||||||
|
"jestConfig": "my-app/jest.config.ts",
|
||||||
|
"passWithNoTests": true,
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
"{workspaceRoot}/coverage/{projectRoot}",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`app not nested should create project configs 2`] = `
|
||||||
|
{
|
||||||
|
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"implicitDependencies": [
|
||||||
|
"my-app",
|
||||||
|
],
|
||||||
|
"name": "my-app-e2e",
|
||||||
|
"projectType": "application",
|
||||||
|
"root": "my-app-e2e",
|
||||||
|
"sourceRoot": "my-app-e2e/src",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"e2e": {
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"devServerTarget": "my-app:serve-static",
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "my-app:serve:production",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"executor": "@nx/cypress:cypress",
|
||||||
|
"options": {
|
||||||
|
"cypressConfig": "my-app-e2e/cypress.config.ts",
|
||||||
|
"devServerTarget": "my-app:serve:development",
|
||||||
|
"testingType": "e2e",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/linter:eslint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"my-app-e2e/**/*.{js,ts}",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -742,7 +1222,7 @@ exports[`app not nested should generate files: e2e tsconfig.json 1`] = `
|
|||||||
"noImplicitOverride": true,
|
"noImplicitOverride": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../dist/out-tsc",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"types": [
|
"types": [
|
||||||
@ -750,7 +1230,7 @@ exports[`app not nested should generate files: e2e tsconfig.json 1`] = `
|
|||||||
"node",
|
"node",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.js",
|
"src/**/*.js",
|
||||||
@ -762,7 +1242,7 @@ exports[`app not nested should generate files: e2e tsconfig.json 1`] = `
|
|||||||
exports[`app not nested should generate files: tsconfig.app.json 1`] = `
|
exports[`app not nested should generate files: tsconfig.app.json 1`] = `
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../dist/out-tsc",
|
"outDir": "../dist/out-tsc",
|
||||||
"types": [],
|
"types": [],
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
@ -798,7 +1278,7 @@ exports[`app not nested should generate files: tsconfig.json 1`] = `
|
|||||||
"target": "es2022",
|
"target": "es2022",
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
},
|
},
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"files": [],
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
"references": [
|
"references": [
|
||||||
|
|||||||
@ -66,7 +66,7 @@ describe('app', () => {
|
|||||||
const { targets } = readProjectConfiguration(appTree, 'my-app');
|
const { targets } = readProjectConfiguration(appTree, 'my-app');
|
||||||
expect(targets.test).toBeFalsy();
|
expect(targets.test).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/my-app/src/app/app.component.spec.ts')
|
appTree.exists('my-app/src/app/app.component.spec.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -104,33 +104,31 @@ describe('app', () => {
|
|||||||
it('should generate files', async () => {
|
it('should generate files', async () => {
|
||||||
await generateApp(appTree);
|
await generateApp(appTree);
|
||||||
|
|
||||||
expect(appTree.exists(`apps/my-app/jest.config.ts`)).toBeTruthy();
|
expect(appTree.exists('my-app/jest.config.ts')).toBeTruthy();
|
||||||
expect(appTree.exists('apps/my-app/src/main.ts')).toBeTruthy();
|
expect(appTree.exists('my-app/src/main.ts')).toBeTruthy();
|
||||||
expect(appTree.exists('apps/my-app/src/app/app.module.ts')).toBeTruthy();
|
expect(appTree.exists('my-app/src/app/app.module.ts')).toBeTruthy();
|
||||||
expect(
|
expect(appTree.exists('my-app/src/app/app.component.ts')).toBeTruthy();
|
||||||
appTree.exists('apps/my-app/src/app/app.component.ts')
|
expect(appTree.read('my-app/src/app/app.module.ts', 'utf-8')).toContain(
|
||||||
).toBeTruthy();
|
'class AppModule'
|
||||||
expect(
|
);
|
||||||
appTree.read('apps/my-app/src/app/app.module.ts', 'utf-8')
|
|
||||||
).toContain('class AppModule');
|
|
||||||
|
|
||||||
expect(readJson(appTree, 'apps/my-app/tsconfig.json')).toMatchSnapshot(
|
expect(readJson(appTree, 'my-app/tsconfig.json')).toMatchSnapshot(
|
||||||
'tsconfig.json'
|
'tsconfig.json'
|
||||||
);
|
);
|
||||||
|
|
||||||
const tsconfigApp = parseJson(
|
const tsconfigApp = parseJson(
|
||||||
appTree.read('apps/my-app/tsconfig.app.json', 'utf-8')
|
appTree.read('my-app/tsconfig.app.json', 'utf-8')
|
||||||
);
|
);
|
||||||
expect(tsconfigApp).toMatchSnapshot('tsconfig.app.json');
|
expect(tsconfigApp).toMatchSnapshot('tsconfig.app.json');
|
||||||
|
|
||||||
const eslintrcJson = parseJson(
|
const eslintrcJson = parseJson(
|
||||||
appTree.read('apps/my-app/.eslintrc.json', 'utf-8')
|
appTree.read('my-app/.eslintrc.json', 'utf-8')
|
||||||
);
|
);
|
||||||
expect(eslintrcJson.extends).toEqual(['../../.eslintrc.json']);
|
expect(eslintrcJson.extends).toEqual(['../.eslintrc.json']);
|
||||||
|
|
||||||
expect(appTree.exists('apps/my-app-e2e/cypress.config.ts')).toBeTruthy();
|
expect(appTree.exists('my-app-e2e/cypress.config.ts')).toBeTruthy();
|
||||||
const tsconfigE2E = parseJson(
|
const tsconfigE2E = parseJson(
|
||||||
appTree.read('apps/my-app-e2e/tsconfig.json', 'utf-8')
|
appTree.read('my-app-e2e/tsconfig.json', 'utf-8')
|
||||||
);
|
);
|
||||||
expect(tsconfigE2E).toMatchSnapshot('e2e tsconfig.json');
|
expect(tsconfigE2E).toMatchSnapshot('e2e tsconfig.json');
|
||||||
});
|
});
|
||||||
@ -141,10 +139,10 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/playwright-app-e2e/playwright.config.ts')
|
appTree.exists('playwright-app-e2e/playwright.config.ts')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/playwright-app-e2e/src/example.spec.ts')
|
appTree.exists('playwright-app-e2e/src/example.spec.ts')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(appTree, 'playwright-app-e2e')?.targets?.e2e
|
readProjectConfiguration(appTree, 'playwright-app-e2e')?.targets?.e2e
|
||||||
@ -155,13 +153,13 @@ describe('app', () => {
|
|||||||
it('should setup jest with serializers', async () => {
|
it('should setup jest with serializers', async () => {
|
||||||
await generateApp(appTree);
|
await generateApp(appTree);
|
||||||
|
|
||||||
expect(appTree.read('apps/my-app/jest.config.ts', 'utf-8')).toContain(
|
expect(appTree.read('my-app/jest.config.ts', 'utf-8')).toContain(
|
||||||
`'jest-preset-angular/build/serializers/no-ng-attributes'`
|
`'jest-preset-angular/build/serializers/no-ng-attributes'`
|
||||||
);
|
);
|
||||||
expect(appTree.read('apps/my-app/jest.config.ts', 'utf-8')).toContain(
|
expect(appTree.read('my-app/jest.config.ts', 'utf-8')).toContain(
|
||||||
`'jest-preset-angular/build/serializers/ng-snapshot'`
|
`'jest-preset-angular/build/serializers/ng-snapshot'`
|
||||||
);
|
);
|
||||||
expect(appTree.read('apps/my-app/jest.config.ts', 'utf-8')).toContain(
|
expect(appTree.read('my-app/jest.config.ts', 'utf-8')).toContain(
|
||||||
`'jest-preset-angular/build/serializers/html-comment'`
|
`'jest-preset-angular/build/serializers/html-comment'`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -174,8 +172,8 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'app');
|
await generateApp(appTree, 'app');
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const appTsConfig = readJson(appTree, 'apps/app/tsconfig.json');
|
const appTsConfig = readJson(appTree, 'app/tsconfig.json');
|
||||||
expect(appTsConfig.extends).toBe('../../tsconfig.json');
|
expect(appTsConfig.extends).toBe('../tsconfig.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not overwrite default project if already set', async () => {
|
it('should not overwrite default project if already set', async () => {
|
||||||
@ -195,29 +193,25 @@ describe('app', () => {
|
|||||||
|
|
||||||
describe('nested', () => {
|
describe('nested', () => {
|
||||||
it('should create project configs', async () => {
|
it('should create project configs', async () => {
|
||||||
await generateApp(appTree, 'myApp', { directory: 'myDir' });
|
await generateApp(appTree, 'myApp', { directory: 'myDir/myApp' });
|
||||||
expect(
|
expect(readProjectConfiguration(appTree, 'my-app')).toMatchSnapshot();
|
||||||
readProjectConfiguration(appTree, 'my-dir-my-app')
|
expect(readProjectConfiguration(appTree, 'my-app-e2e')).toMatchSnapshot();
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
readProjectConfiguration(appTree, 'my-dir-my-app-e2e')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update tags + implicit dependencies', async () => {
|
it('should update tags + implicit dependencies', async () => {
|
||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
directory: 'myDir',
|
directory: 'myDir/myApp',
|
||||||
tags: 'one,two,my-dir-my-app',
|
tags: 'one,two,my-app',
|
||||||
});
|
});
|
||||||
const projects = devkit.getProjects(appTree);
|
const projects = devkit.getProjects(appTree);
|
||||||
expect(projects).toEqual(
|
expect(projects).toEqual(
|
||||||
new Map(
|
new Map(
|
||||||
Object.entries({
|
Object.entries({
|
||||||
'my-dir-my-app': expect.objectContaining({
|
'my-app': expect.objectContaining({
|
||||||
tags: ['one', 'two', 'my-dir-my-app'],
|
tags: ['one', 'two', 'my-app'],
|
||||||
}),
|
}),
|
||||||
'my-dir-my-app-e2e': expect.objectContaining({
|
'my-app-e2e': expect.objectContaining({
|
||||||
implicitDependencies: ['my-dir-my-app'],
|
implicitDependencies: ['my-app'],
|
||||||
tags: [],
|
tags: [],
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
@ -231,18 +225,18 @@ describe('app', () => {
|
|||||||
|
|
||||||
expect(lookupFn(content)).toEqual(expectedValue);
|
expect(lookupFn(content)).toEqual(expectedValue);
|
||||||
};
|
};
|
||||||
await generateApp(appTree, 'myApp', { directory: 'myDir' });
|
await generateApp(appTree, 'myApp', { directory: 'myDir/myApp' });
|
||||||
|
|
||||||
const appModulePath = 'apps/my-dir/my-app/src/app/app.module.ts';
|
const appModulePath = 'my-dir/my-app/src/app/app.module.ts';
|
||||||
expect(appTree.read(appModulePath, 'utf-8')).toContain('class AppModule');
|
expect(appTree.read(appModulePath, 'utf-8')).toContain('class AppModule');
|
||||||
|
|
||||||
// Make sure these exist
|
// Make sure these exist
|
||||||
[
|
[
|
||||||
`apps/my-dir/my-app/jest.config.ts`,
|
`my-dir/my-app/jest.config.ts`,
|
||||||
'apps/my-dir/my-app/src/main.ts',
|
'my-dir/my-app/src/main.ts',
|
||||||
'apps/my-dir/my-app/src/app/app.module.ts',
|
'my-dir/my-app/src/app/app.module.ts',
|
||||||
'apps/my-dir/my-app/src/app/app.component.ts',
|
'my-dir/my-app/src/app/app.component.ts',
|
||||||
'apps/my-dir/my-app-e2e/cypress.config.ts',
|
'my-dir/my-app-e2e/cypress.config.ts',
|
||||||
].forEach((path) => {
|
].forEach((path) => {
|
||||||
expect(appTree.exists(path)).toBeTruthy();
|
expect(appTree.exists(path)).toBeTruthy();
|
||||||
});
|
});
|
||||||
@ -250,12 +244,12 @@ describe('app', () => {
|
|||||||
// Make sure these have properties
|
// Make sure these have properties
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
path: 'apps/my-dir/my-app/tsconfig.app.json',
|
path: 'my-dir/my-app/tsconfig.app.json',
|
||||||
lookupFn: (json) => json.compilerOptions.outDir,
|
lookupFn: (json) => json.compilerOptions.outDir,
|
||||||
expectedValue: '../../../dist/out-tsc',
|
expectedValue: '../../dist/out-tsc',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'apps/my-dir/my-app/tsconfig.app.json',
|
path: 'my-dir/my-app/tsconfig.app.json',
|
||||||
lookupFn: (json) => json.exclude,
|
lookupFn: (json) => json.exclude,
|
||||||
expectedValue: [
|
expectedValue: [
|
||||||
'jest.config.ts',
|
'jest.config.ts',
|
||||||
@ -264,20 +258,20 @@ describe('app', () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'apps/my-dir/my-app/.eslintrc.json',
|
path: 'my-dir/my-app/.eslintrc.json',
|
||||||
lookupFn: (json) => json.extends,
|
lookupFn: (json) => json.extends,
|
||||||
expectedValue: ['../../../.eslintrc.json'],
|
expectedValue: ['../../.eslintrc.json'],
|
||||||
},
|
},
|
||||||
].forEach(hasJsonValue);
|
].forEach(hasJsonValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extend from tsconfig.base.json', async () => {
|
it('should extend from tsconfig.base.json', async () => {
|
||||||
// ACT
|
// ACT
|
||||||
await generateApp(appTree, 'app', { directory: 'myDir' });
|
await generateApp(appTree, 'app', { directory: 'myDir/app' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const appTsConfig = readJson(appTree, 'apps/my-dir/app/tsconfig.json');
|
const appTsConfig = readJson(appTree, 'my-dir/app/tsconfig.json');
|
||||||
expect(appTsConfig.extends).toBe('../../../tsconfig.base.json');
|
expect(appTsConfig.extends).toBe('../../tsconfig.base.json');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support a root tsconfig.json instead of tsconfig.base.json', async () => {
|
it('should support a root tsconfig.json instead of tsconfig.base.json', async () => {
|
||||||
@ -285,11 +279,11 @@ describe('app', () => {
|
|||||||
appTree.rename('tsconfig.base.json', 'tsconfig.json');
|
appTree.rename('tsconfig.base.json', 'tsconfig.json');
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
await generateApp(appTree, 'app', { directory: 'myDir' });
|
await generateApp(appTree, 'app', { directory: 'myDir/app' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const appTsConfig = readJson(appTree, 'apps/my-dir/app/tsconfig.json');
|
const appTsConfig = readJson(appTree, 'my-dir/app/tsconfig.json');
|
||||||
expect(appTsConfig.extends).toBe('../../../tsconfig.json');
|
expect(appTsConfig.extends).toBe('../../tsconfig.json');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -304,12 +298,14 @@ describe('app', () => {
|
|||||||
|
|
||||||
it('should accept numbers in the path', async () => {
|
it('should accept numbers in the path', async () => {
|
||||||
// ACT
|
// ACT
|
||||||
await generateApp(appTree, 'myApp', { directory: 'src/9-websites' });
|
await generateApp(appTree, 'myApp', {
|
||||||
|
directory: 'src/9-websites/my-app',
|
||||||
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(appTree, 'src-9-websites-my-app').root
|
readProjectConfiguration(appTree, 'my-app').root
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -319,7 +315,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
expect(lookupFn(content)).toEqual(expectedValue);
|
expect(lookupFn(content)).toEqual(expectedValue);
|
||||||
};
|
};
|
||||||
await generateApp(appTree, 'myApp', { directory: 'myDir' });
|
await generateApp(appTree, 'myApp', { directory: 'myDir/myApp' });
|
||||||
|
|
||||||
const appModulePath = 'my-dir/my-app/src/app/app.module.ts';
|
const appModulePath = 'my-dir/my-app/src/app/app.module.ts';
|
||||||
expect(appTree.read(appModulePath, 'utf-8')).toContain('class AppModule');
|
expect(appTree.read(appModulePath, 'utf-8')).toContain('class AppModule');
|
||||||
@ -363,99 +359,87 @@ describe('app', () => {
|
|||||||
describe('routing', () => {
|
describe('routing', () => {
|
||||||
it('should include RouterTestingModule', async () => {
|
it('should include RouterTestingModule', async () => {
|
||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
directory: 'myDir',
|
directory: 'myDir/myApp',
|
||||||
routing: true,
|
routing: true,
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/my-dir/my-app/src/app/app.module.ts', 'utf-8')
|
appTree.read('my-dir/my-app/src/app/app.module.ts', 'utf-8')
|
||||||
).toContain('RouterModule.forRoot');
|
).toContain('RouterModule.forRoot');
|
||||||
expect(
|
expect(
|
||||||
appTree.read(
|
appTree.read('my-dir/my-app/src/app/app.component.spec.ts', 'utf-8')
|
||||||
'apps/my-dir/my-app/src/app/app.component.spec.ts',
|
|
||||||
'utf-8'
|
|
||||||
)
|
|
||||||
).toContain('imports: [RouterTestingModule]');
|
).toContain('imports: [RouterTestingModule]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not modify tests when --skip-tests is set', async () => {
|
it('should not modify tests when --skip-tests is set', async () => {
|
||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
directory: 'myDir',
|
directory: 'myDir/myApp',
|
||||||
routing: true,
|
routing: true,
|
||||||
skipTests: true,
|
skipTests: true,
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/my-dir/my-app/src/app/app.component.spec.ts')
|
appTree.exists('my-dir/my-app/src/app/app.component.spec.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('template generation mode', () => {
|
describe('template generation mode', () => {
|
||||||
it('should create Nx specific `app.component.html` template', async () => {
|
it('should create Nx specific `app.component.html` template', async () => {
|
||||||
await generateApp(appTree, 'myApp', { directory: 'myDir' });
|
await generateApp(appTree, 'myApp', { directory: 'myDir/myApp' });
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/my-dir/my-app/src/app/app.component.html', 'utf-8')
|
appTree.read('my-dir/my-app/src/app/app.component.html', 'utf-8')
|
||||||
).toContain('<proj-nx-welcome></proj-nx-welcome>');
|
).toContain('<proj-nx-welcome></proj-nx-welcome>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should update `template`'s property of AppComponent with Nx content", async () => {
|
it("should update `template`'s property of AppComponent with Nx content", async () => {
|
||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
directory: 'myDir',
|
directory: 'myDir/myApp',
|
||||||
inlineTemplate: true,
|
inlineTemplate: true,
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/my-dir/my-app/src/app/app.component.ts', 'utf-8')
|
appTree.read('my-dir/my-app/src/app/app.component.ts', 'utf-8')
|
||||||
).toContain('<proj-nx-welcome></proj-nx-welcome>');
|
).toContain('<proj-nx-welcome></proj-nx-welcome>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create Nx specific `nx-welcome.component.ts` file', async () => {
|
it('should create Nx specific `nx-welcome.component.ts` file', async () => {
|
||||||
await generateApp(appTree, 'myApp', { directory: 'myDir' });
|
await generateApp(appTree, 'myApp', { directory: 'myDir/myApp' });
|
||||||
expect(
|
expect(
|
||||||
appTree.read(
|
appTree.read('my-dir/my-app/src/app/nx-welcome.component.ts', 'utf-8')
|
||||||
'apps/my-dir/my-app/src/app/nx-welcome.component.ts',
|
|
||||||
'utf-8'
|
|
||||||
)
|
|
||||||
).toContain('Hello there');
|
).toContain('Hello there');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update the AppComponent spec to target Nx content', async () => {
|
it('should update the AppComponent spec to target Nx content', async () => {
|
||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
directory: 'myDir',
|
directory: 'myDir/myApp',
|
||||||
inlineTemplate: true,
|
inlineTemplate: true,
|
||||||
});
|
});
|
||||||
const testFileContent = appTree.read(
|
const testFileContent = appTree.read(
|
||||||
'apps/my-dir/my-app/src/app/app.component.spec.ts',
|
'my-dir/my-app/src/app/app.component.spec.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(testFileContent).toContain(`querySelector('h1')`);
|
expect(testFileContent).toContain(`querySelector('h1')`);
|
||||||
expect(testFileContent).toContain('Welcome my-dir-my-app');
|
expect(testFileContent).toContain('Welcome my-app');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('--style scss', () => {
|
describe('--style scss', () => {
|
||||||
it('should generate scss styles', async () => {
|
it('should generate scss styles', async () => {
|
||||||
await generateApp(appTree, 'myApp', { style: 'scss' });
|
await generateApp(appTree, 'myApp', { style: 'scss' });
|
||||||
expect(appTree.exists('apps/my-app/src/app/app.component.scss')).toEqual(
|
expect(appTree.exists('my-app/src/app/app.component.scss')).toEqual(true);
|
||||||
true
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('--style sass', () => {
|
describe('--style sass', () => {
|
||||||
it('should generate sass styles', async () => {
|
it('should generate sass styles', async () => {
|
||||||
await generateApp(appTree, 'myApp', { style: 'sass' });
|
await generateApp(appTree, 'myApp', { style: 'sass' });
|
||||||
expect(appTree.exists('apps/my-app/src/app/app.component.sass')).toEqual(
|
expect(appTree.exists('my-app/src/app/app.component.sass')).toEqual(true);
|
||||||
true
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('--style less', () => {
|
describe('--style less', () => {
|
||||||
it('should generate less styles', async () => {
|
it('should generate less styles', async () => {
|
||||||
await generateApp(appTree, 'myApp', { style: 'less' });
|
await generateApp(appTree, 'myApp', { style: 'less' });
|
||||||
expect(appTree.exists('apps/my-app/src/app/app.component.less')).toEqual(
|
expect(appTree.exists('my-app/src/app/app.component.less')).toEqual(true);
|
||||||
true
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -482,7 +466,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
describe('--linter', () => {
|
describe('--linter', () => {
|
||||||
describe('eslint', () => {
|
describe('eslint', () => {
|
||||||
it('should add lint taret', async () => {
|
it('should add lint target', async () => {
|
||||||
await generateApp(appTree, 'myApp', { linter: Linter.EsLint });
|
await generateApp(appTree, 'myApp', { linter: Linter.EsLint });
|
||||||
expect(readProjectConfiguration(appTree, 'my-app').targets.lint)
|
expect(readProjectConfiguration(appTree, 'my-app').targets.lint)
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
@ -490,8 +474,8 @@ describe('app', () => {
|
|||||||
"executor": "@nx/linter:eslint",
|
"executor": "@nx/linter:eslint",
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"apps/my-app/**/*.ts",
|
"my-app/**/*.ts",
|
||||||
"apps/my-app/**/*.html",
|
"my-app/**/*.html",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -505,7 +489,7 @@ describe('app', () => {
|
|||||||
"executor": "@nx/linter:eslint",
|
"executor": "@nx/linter:eslint",
|
||||||
"options": {
|
"options": {
|
||||||
"lintFilePatterns": [
|
"lintFilePatterns": [
|
||||||
"apps/my-app-e2e/**/*.{js,ts}",
|
"my-app-e2e/**/*.{js,ts}",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@ -518,11 +502,11 @@ describe('app', () => {
|
|||||||
it('should add valid eslint JSON configuration which extends from Nx presets', async () => {
|
it('should add valid eslint JSON configuration which extends from Nx presets', async () => {
|
||||||
await generateApp(appTree, 'myApp', { linter: Linter.EsLint });
|
await generateApp(appTree, 'myApp', { linter: Linter.EsLint });
|
||||||
|
|
||||||
const eslintConfig = readJson(appTree, 'apps/my-app/.eslintrc.json');
|
const eslintConfig = readJson(appTree, 'my-app/.eslintrc.json');
|
||||||
expect(eslintConfig).toMatchInlineSnapshot(`
|
expect(eslintConfig).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"../../.eslintrc.json",
|
"../.eslintrc.json",
|
||||||
],
|
],
|
||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
"!**/*",
|
"!**/*",
|
||||||
@ -585,7 +569,7 @@ describe('app', () => {
|
|||||||
it('should generate jest.config.ts with serializers', async () => {
|
it('should generate jest.config.ts with serializers', async () => {
|
||||||
await generateApp(appTree);
|
await generateApp(appTree);
|
||||||
|
|
||||||
const jestConfig = appTree.read('apps/my-app/jest.config.ts', 'utf-8');
|
const jestConfig = appTree.read('my-app/jest.config.ts', 'utf-8');
|
||||||
|
|
||||||
expect(jestConfig).toContain(
|
expect(jestConfig).toContain(
|
||||||
`'jest-preset-angular/build/serializers/no-ng-attributes'`
|
`'jest-preset-angular/build/serializers/no-ng-attributes'`
|
||||||
@ -601,7 +585,7 @@ describe('app', () => {
|
|||||||
it('should add reference to tsconfig.spec.json to tsconfig.json', async () => {
|
it('should add reference to tsconfig.spec.json to tsconfig.json', async () => {
|
||||||
await generateApp(appTree);
|
await generateApp(appTree);
|
||||||
|
|
||||||
const { references } = readJson(appTree, 'apps/my-app/tsconfig.json');
|
const { references } = readJson(appTree, 'my-app/tsconfig.json');
|
||||||
expect(
|
expect(
|
||||||
references.find((r) => r.path.includes('tsconfig.spec.json'))
|
references.find((r) => r.path.includes('tsconfig.spec.json'))
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
@ -613,19 +597,19 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
});
|
});
|
||||||
expect(appTree.exists('apps/my-app/src/test-setup.ts')).toBeFalsy();
|
expect(appTree.exists('my-app/src/test-setup.ts')).toBeFalsy();
|
||||||
expect(appTree.exists('apps/my-app/src/test.ts')).toBeFalsy();
|
expect(appTree.exists('my-app/src/test.ts')).toBeFalsy();
|
||||||
expect(appTree.exists('apps/my-app/tsconfig.spec.json')).toBeFalsy();
|
expect(appTree.exists('my-app/tsconfig.spec.json')).toBeFalsy();
|
||||||
expect(appTree.exists('apps/my-app/jest.config.ts')).toBeFalsy();
|
expect(appTree.exists('my-app/jest.config.ts')).toBeFalsy();
|
||||||
expect(appTree.exists('apps/my-app/karma.config.js')).toBeFalsy();
|
expect(appTree.exists('my-app/karma.config.js')).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/my-app/src/app/app.component.spec.ts')
|
appTree.exists('my-app/src/app/app.component.spec.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(appTree, 'my-app').targets.test
|
readProjectConfiguration(appTree, 'my-app').targets.test
|
||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
// check tsconfig.spec.json is not referenced
|
// check tsconfig.spec.json is not referenced
|
||||||
const { references } = readJson(appTree, 'apps/my-app/tsconfig.json');
|
const { references } = readJson(appTree, 'my-app/tsconfig.json');
|
||||||
expect(
|
expect(
|
||||||
references.every((r) => !r.path.includes('tsconfig.spec.json'))
|
references.every((r) => !r.path.includes('tsconfig.spec.json'))
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
@ -639,7 +623,7 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'myApp', {
|
await generateApp(appTree, 'myApp', {
|
||||||
e2eTestRunner: E2eTestRunner.None,
|
e2eTestRunner: E2eTestRunner.None,
|
||||||
});
|
});
|
||||||
expect(appTree.exists('apps/my-app-e2e')).toBeFalsy();
|
expect(appTree.exists('my-app-e2e')).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -662,10 +646,10 @@ describe('app', () => {
|
|||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(appTree.exists('apps/customer-ui/proxy.conf.json')).toBeTruthy();
|
expect(appTree.exists('customer-ui/proxy.conf.json')).toBeTruthy();
|
||||||
expect(
|
expect(appTree.read('customer-ui/proxy.conf.json', 'utf-8')).toContain(
|
||||||
appTree.read('apps/customer-ui/proxy.conf.json', 'utf-8')
|
proxyConfContent
|
||||||
).toContain(proxyConfContent);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -673,7 +657,7 @@ describe('app', () => {
|
|||||||
it('should not generate a proxy.conf.json', async () => {
|
it('should not generate a proxy.conf.json', async () => {
|
||||||
await generateApp(appTree, 'customer-ui');
|
await generateApp(appTree, 'customer-ui');
|
||||||
|
|
||||||
expect(appTree.exists('apps/customer-ui/proxy.conf.json')).toBeFalsy();
|
expect(appTree.exists('customer-ui/proxy.conf.json')).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -682,9 +666,9 @@ describe('app', () => {
|
|||||||
it('should enable strict type checking', async () => {
|
it('should enable strict type checking', async () => {
|
||||||
await generateApp(appTree, 'my-app', { strict: true });
|
await generateApp(appTree, 'my-app', { strict: true });
|
||||||
|
|
||||||
const appTsConfig = readJson(appTree, 'apps/my-app/tsconfig.json');
|
const appTsConfig = readJson(appTree, 'my-app/tsconfig.json');
|
||||||
expect(appTsConfig).toMatchSnapshot('app tsconfig.json');
|
expect(appTsConfig).toMatchSnapshot('app tsconfig.json');
|
||||||
const e2eTsConfig = readJson(appTree, 'apps/my-app-e2e/tsconfig.json');
|
const e2eTsConfig = readJson(appTree, 'my-app-e2e/tsconfig.json');
|
||||||
expect(e2eTsConfig).toMatchSnapshot('e2e tsconfig.json');
|
expect(e2eTsConfig).toMatchSnapshot('e2e tsconfig.json');
|
||||||
|
|
||||||
// should not update workspace configuration since --strict=true is the default
|
// should not update workspace configuration since --strict=true is the default
|
||||||
@ -710,7 +694,7 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'app1');
|
await generateApp(appTree, 'app1');
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(appTree.exists('apps/app1/tailwind.config.js')).toBeFalsy();
|
expect(appTree.exists('app1/tailwind.config.js')).toBeFalsy();
|
||||||
const { devDependencies } = readJson(appTree, 'package.json');
|
const { devDependencies } = readJson(appTree, 'package.json');
|
||||||
expect(devDependencies['tailwindcss']).toBeUndefined();
|
expect(devDependencies['tailwindcss']).toBeUndefined();
|
||||||
expect(devDependencies['postcss']).toBeUndefined();
|
expect(devDependencies['postcss']).toBeUndefined();
|
||||||
@ -722,7 +706,7 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'app1', { addTailwind: false });
|
await generateApp(appTree, 'app1', { addTailwind: false });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(appTree.exists('apps/app1/tailwind.config.js')).toBeFalsy();
|
expect(appTree.exists('app1/tailwind.config.js')).toBeFalsy();
|
||||||
const { devDependencies } = readJson(appTree, 'package.json');
|
const { devDependencies } = readJson(appTree, 'package.json');
|
||||||
expect(devDependencies['tailwindcss']).toBeUndefined();
|
expect(devDependencies['tailwindcss']).toBeUndefined();
|
||||||
expect(devDependencies['postcss']).toBeUndefined();
|
expect(devDependencies['postcss']).toBeUndefined();
|
||||||
@ -734,7 +718,7 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'app1', { addTailwind: true });
|
await generateApp(appTree, 'app1', { addTailwind: true });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(appTree.read('apps/app1/tailwind.config.js', 'utf-8'))
|
expect(appTree.read('app1/tailwind.config.js', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
|
"const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
|
||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
@ -768,26 +752,22 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
expect(appTree.read('standalone/src/main.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/main.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.config.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.config.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.routes.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.routes.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.component.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.component.spec.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
|
expect(appTree.exists('standalone/src/app/app.module.ts')).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.component.spec.ts', 'utf-8')
|
appTree.read('standalone/src/app/nx-welcome.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
appTree.exists('apps/standalone/src/app/app.module.ts')
|
|
||||||
).toBeFalsy();
|
|
||||||
expect(
|
|
||||||
appTree.read('apps/standalone/src/app/nx-welcome.component.ts', 'utf-8')
|
|
||||||
).toContain('standalone: true');
|
).toContain('standalone: true');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -799,23 +779,19 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
expect(appTree.read('standalone/src/main.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/main.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.config.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.config.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.component.ts', 'utf-8')
|
appTree.read('standalone/src/app/app.component.spec.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
|
expect(appTree.exists('standalone/src/app/app.module.ts')).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/standalone/src/app/app.component.spec.ts', 'utf-8')
|
appTree.read('standalone/src/app/nx-welcome.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
appTree.exists('apps/standalone/src/app/app.module.ts')
|
|
||||||
).toBeFalsy();
|
|
||||||
expect(
|
|
||||||
appTree.read('apps/standalone/src/app/nx-welcome.component.ts', 'utf-8')
|
|
||||||
).toContain('standalone: true');
|
).toContain('standalone: true');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -831,9 +807,7 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'nostandalone');
|
await generateApp(appTree, 'nostandalone');
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(appTree.exists('nostandalone/src/app/app.module.ts')).toBeTruthy();
|
||||||
appTree.exists('apps/nostandalone/src/app/app.module.ts')
|
|
||||||
).toBeTruthy();
|
|
||||||
expect(enquirer.prompt).toHaveBeenCalled();
|
expect(enquirer.prompt).toHaveBeenCalled();
|
||||||
|
|
||||||
// CLEANUP
|
// CLEANUP
|
||||||
@ -853,7 +827,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/nostandalone/src/app/app.module.ts')
|
appTree.exists('nostandalone/src/app/app.module.ts')
|
||||||
).not.toBeTruthy();
|
).not.toBeTruthy();
|
||||||
expect(enquirer.prompt).toHaveBeenCalled();
|
expect(enquirer.prompt).toHaveBeenCalled();
|
||||||
|
|
||||||
@ -867,8 +841,7 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'myapp');
|
await generateApp(appTree, 'myapp');
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(appTree.read('apps/myapp/src/main.ts', 'utf-8'))
|
expect(appTree.read('myapp/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
|
|
||||||
@ -932,19 +905,19 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'plain', { minimal: true });
|
await generateApp(appTree, 'plain', { minimal: true });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/plain/src/app/nx-welcome.component.ts')
|
appTree.exists('plain/src/app/nx-welcome.component.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.module.ts', 'utf-8')
|
appTree.read('plain/src/app/app.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.spec.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.spec.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.html', 'utf-8')
|
appTree.read('plain/src/app/app.component.html', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -952,19 +925,19 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'plain', { minimal: true, routing: true });
|
await generateApp(appTree, 'plain', { minimal: true, routing: true });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/plain/src/app/nx-welcome.component.ts')
|
appTree.exists('plain/src/app/nx-welcome.component.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.module.ts', 'utf-8')
|
appTree.read('plain/src/app/app.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.spec.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.spec.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.html', 'utf-8')
|
appTree.read('plain/src/app/app.component.html', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -972,16 +945,16 @@ describe('app', () => {
|
|||||||
await generateApp(appTree, 'plain', { minimal: true, standalone: true });
|
await generateApp(appTree, 'plain', { minimal: true, standalone: true });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/plain/src/app/nx-welcome.component.ts')
|
appTree.exists('plain/src/app/nx-welcome.component.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.spec.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.spec.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.html', 'utf-8')
|
appTree.read('plain/src/app/app.component.html', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -993,16 +966,16 @@ describe('app', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
appTree.exists('apps/plain/src/app/nx-welcome.component.ts')
|
appTree.exists('plain/src/app/nx-welcome.component.ts')
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.spec.ts', 'utf-8')
|
appTree.read('plain/src/app/app.component.spec.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
appTree.read('apps/plain/src/app/app.component.html', 'utf-8')
|
appTree.read('plain/src/app/app.component.html', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1027,6 +1000,85 @@ describe('app', () => {
|
|||||||
).toBeUndefined();
|
).toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('--project-name-and-root-format=derived', () => {
|
||||||
|
it('should generate correctly when no directory is provided', async () => {
|
||||||
|
await generateApp(appTree, 'myApp', {
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(readProjectConfiguration(appTree, 'my-app')).toMatchSnapshot();
|
||||||
|
expect(readProjectConfiguration(appTree, 'my-app-e2e')).toMatchSnapshot();
|
||||||
|
expect(appTree.exists('apps/my-app/jest.config.ts')).toBeTruthy();
|
||||||
|
expect(appTree.exists('apps/my-app/src/main.ts')).toBeTruthy();
|
||||||
|
expect(appTree.exists('apps/my-app/src/app/app.module.ts')).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
appTree.exists('apps/my-app/src/app/app.component.ts')
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
appTree.read('apps/my-app/src/app/app.module.ts', 'utf-8')
|
||||||
|
).toContain('class AppModule');
|
||||||
|
expect(readJson(appTree, 'apps/my-app/tsconfig.json')).toMatchSnapshot(
|
||||||
|
'tsconfig.json'
|
||||||
|
);
|
||||||
|
const tsconfigApp = parseJson(
|
||||||
|
appTree.read('apps/my-app/tsconfig.app.json', 'utf-8')
|
||||||
|
);
|
||||||
|
expect(tsconfigApp).toMatchSnapshot('tsconfig.app.json');
|
||||||
|
const eslintrcJson = parseJson(
|
||||||
|
appTree.read('apps/my-app/.eslintrc.json', 'utf-8')
|
||||||
|
);
|
||||||
|
expect(eslintrcJson.extends).toEqual(['../../.eslintrc.json']);
|
||||||
|
expect(appTree.exists('apps/my-app-e2e/cypress.config.ts')).toBeTruthy();
|
||||||
|
const tsconfigE2E = parseJson(
|
||||||
|
appTree.read('apps/my-app-e2e/tsconfig.json', 'utf-8')
|
||||||
|
);
|
||||||
|
expect(tsconfigE2E).toMatchSnapshot('e2e tsconfig.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should generate correctly when directory is provided', async () => {
|
||||||
|
await generateApp(appTree, 'myApp', {
|
||||||
|
directory: 'myDir',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
readProjectConfiguration(appTree, 'my-dir-my-app')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
readProjectConfiguration(appTree, 'my-dir-my-app-e2e')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(appTree.exists('apps/my-dir/my-app/jest.config.ts')).toBeTruthy();
|
||||||
|
expect(appTree.exists('apps/my-dir/my-app/src/main.ts')).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
appTree.exists('apps/my-dir/my-app/src/app/app.module.ts')
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
appTree.exists('apps/my-dir/my-app/src/app/app.component.ts')
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
appTree.read('apps/my-dir/my-app/src/app/app.module.ts', 'utf-8')
|
||||||
|
).toContain('class AppModule');
|
||||||
|
expect(
|
||||||
|
readJson(appTree, 'apps/my-dir/my-app/tsconfig.json')
|
||||||
|
).toMatchSnapshot('tsconfig.json');
|
||||||
|
const tsconfigApp = parseJson(
|
||||||
|
appTree.read('apps/my-dir/my-app/tsconfig.app.json', 'utf-8')
|
||||||
|
);
|
||||||
|
expect(tsconfigApp).toMatchSnapshot('tsconfig.app.json');
|
||||||
|
const eslintrcJson = parseJson(
|
||||||
|
appTree.read('apps/my-dir/my-app/.eslintrc.json', 'utf-8')
|
||||||
|
);
|
||||||
|
expect(eslintrcJson.extends).toEqual(['../../../.eslintrc.json']);
|
||||||
|
expect(
|
||||||
|
appTree.exists('apps/my-dir/my-app-e2e/cypress.config.ts')
|
||||||
|
).toBeTruthy();
|
||||||
|
const tsconfigE2E = parseJson(
|
||||||
|
appTree.read('apps/my-dir/my-app-e2e/tsconfig.json', 'utf-8')
|
||||||
|
);
|
||||||
|
expect(tsconfigE2E).toMatchSnapshot('e2e tsconfig.json');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function generateApp(
|
async function generateApp(
|
||||||
|
|||||||
@ -14,7 +14,7 @@ jest.mock('@nx/cypress/src/utils/cypress-version');
|
|||||||
describe('componentCypressSpec generator', () => {
|
describe('componentCypressSpec generator', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
const appName = 'ng-app1';
|
const appName = 'ng-app1';
|
||||||
const specFile = `apps/${appName}-e2e/src/e2e/test-button/test-button.component.cy.ts`;
|
const specFile = `${appName}-e2e/src/e2e/test-button/test-button.component.cy.ts`;
|
||||||
let mockedInstalledCypressVersion: jest.Mock<
|
let mockedInstalledCypressVersion: jest.Mock<
|
||||||
ReturnType<typeof installedCypressVersion>
|
ReturnType<typeof installedCypressVersion>
|
||||||
> = installedCypressVersion as never;
|
> = installedCypressVersion as never;
|
||||||
@ -28,7 +28,7 @@ describe('componentCypressSpec generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`apps/${appName}/src/app/test-button/test-button.component.ts`,
|
`${appName}/src/app/test-button/test-button.component.ts`,
|
||||||
`import { Component, Input } from '@angular/core';
|
`import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
||||||
@ -57,7 +57,7 @@ export class TestButtonComponent {
|
|||||||
componentFileName: 'test-button.component',
|
componentFileName: 'test-button.component',
|
||||||
componentName: 'TestButtonComponent',
|
componentName: 'TestButtonComponent',
|
||||||
componentPath: `test-button`,
|
componentPath: `test-button`,
|
||||||
projectPath: `apps/${appName}/src/app`,
|
projectPath: `${appName}/src/app`,
|
||||||
projectName: appName,
|
projectName: appName,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ export class TestButtonComponent {
|
|||||||
componentFileName: 'test-button.component',
|
componentFileName: 'test-button.component',
|
||||||
componentName: 'TestButtonComponent',
|
componentName: 'TestButtonComponent',
|
||||||
componentPath: `test-button`,
|
componentPath: `test-button`,
|
||||||
projectPath: `apps/${appName}/src/app`,
|
projectPath: `${appName}/src/app`,
|
||||||
projectName: appName,
|
projectName: appName,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -83,15 +83,15 @@ export class TestButtonComponent {
|
|||||||
|
|
||||||
it('should generate .spec.ts when using cypress.json', async () => {
|
it('should generate .spec.ts when using cypress.json', async () => {
|
||||||
mockedInstalledCypressVersion.mockReturnValue(9);
|
mockedInstalledCypressVersion.mockReturnValue(9);
|
||||||
const v9SpecFile = `apps/${appName}-e2e/src/integration/test-button/test-button.component.spec.ts`;
|
const v9SpecFile = `${appName}-e2e/src/integration/test-button/test-button.component.spec.ts`;
|
||||||
tree.delete(`apps/${appName}-e2e/cypress.config.ts`);
|
tree.delete(`${appName}-e2e/cypress.config.ts`);
|
||||||
tree.write(`apps/${appName}-e2e/cypress.json`, `{}`);
|
tree.write(`${appName}-e2e/cypress.json`, `{}`);
|
||||||
|
|
||||||
await componentCypressSpecGenerator(tree, {
|
await componentCypressSpecGenerator(tree, {
|
||||||
componentFileName: 'test-button.component',
|
componentFileName: 'test-button.component',
|
||||||
componentName: 'TestButtonComponent',
|
componentName: 'TestButtonComponent',
|
||||||
componentPath: `test-button`,
|
componentPath: `test-button`,
|
||||||
projectPath: `apps/${appName}/src/app`,
|
projectPath: `${appName}/src/app`,
|
||||||
projectName: appName,
|
projectName: appName,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { componentStoryGenerator } from './component-story';
|
|||||||
describe('componentStory generator', () => {
|
describe('componentStory generator', () => {
|
||||||
let tree: Tree;
|
let tree: Tree;
|
||||||
const libName = 'ng-lib1';
|
const libName = 'ng-lib1';
|
||||||
const storyFile = `libs/${libName}/src/lib/test-button/test-button.component.stories.ts`;
|
const storyFile = `${libName}/src/lib/test-button/test-button.component.stories.ts`;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
@ -21,7 +21,7 @@ describe('componentStory generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.ts`,
|
`${libName}/src/lib/test-button/test-button.component.ts`,
|
||||||
`import { Component, Input } from '@angular/core';
|
`import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
||||||
@ -52,7 +52,7 @@ describe('componentStory generator', () => {
|
|||||||
componentFileName: 'test-button.component',
|
componentFileName: 'test-button.component',
|
||||||
componentName: 'TestButtonComponent',
|
componentName: 'TestButtonComponent',
|
||||||
componentPath: `src/lib/test-button`,
|
componentPath: `src/lib/test-button`,
|
||||||
projectPath: `libs/${libName}`,
|
projectPath: `${libName}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(storybookUtils.getComponentProps).not.toHaveBeenCalled();
|
expect(storybookUtils.getComponentProps).not.toHaveBeenCalled();
|
||||||
@ -65,7 +65,7 @@ describe('componentStory generator', () => {
|
|||||||
componentFileName: 'test-button.component',
|
componentFileName: 'test-button.component',
|
||||||
componentName: 'TestButtonComponent',
|
componentName: 'TestButtonComponent',
|
||||||
componentPath: `src/lib/test-button`,
|
componentPath: `src/lib/test-button`,
|
||||||
projectPath: `libs/${libName}`,
|
projectPath: `${libName}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.exists(storyFile)).toBe(true);
|
expect(tree.exists(storyFile)).toBe(true);
|
||||||
@ -76,7 +76,7 @@ describe('componentStory generator', () => {
|
|||||||
componentFileName: 'test-button.component',
|
componentFileName: 'test-button.component',
|
||||||
componentName: 'TestButtonComponent',
|
componentName: 'TestButtonComponent',
|
||||||
componentPath: `src/lib/test-button`,
|
componentPath: `src/lib/test-button`,
|
||||||
projectPath: `libs/${libName}`,
|
projectPath: `${libName}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read(storyFile).toString()).toMatchSnapshot();
|
expect(tree.read(storyFile).toString()).toMatchSnapshot();
|
||||||
|
|||||||
@ -38,7 +38,7 @@ describe('Angular Cypress Component Test Generator', () => {
|
|||||||
componentDir: 'src/lib/my-lib',
|
componentDir: 'src/lib/my-lib',
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
tree.read('my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ describe('Angular Cypress Component Test Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
'libs/my-lib/src/lib/my-lib/my-lib.component.ts',
|
'my-lib/src/lib/my-lib/my-lib.component.ts',
|
||||||
`
|
`
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
tree.read('my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
});
|
});
|
||||||
tree.write(
|
tree.write(
|
||||||
'libs/my-lib/src/lib/my-lib/my-lib.component.ts',
|
'my-lib/src/lib/my-lib/my-lib.component.ts',
|
||||||
`
|
`
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -141,7 +141,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
componentDir: 'src/lib/my-lib',
|
componentDir: 'src/lib/my-lib',
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
tree.read('my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
|
|
||||||
await componentGenerator(tree, { name: 'my-lib', project: 'my-lib' });
|
await componentGenerator(tree, { name: 'my-lib', project: 'my-lib' });
|
||||||
tree.write(
|
tree.write(
|
||||||
'libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts',
|
'my-lib/src/lib/my-lib/my-lib.component.cy.ts',
|
||||||
`should not overwrite`
|
`should not overwrite`
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ export class MyLibComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
tree.read('my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
||||||
).toEqual('should not overwrite');
|
).toEqual('should not overwrite');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ describe(MyLibComponent.name, () => {
|
|||||||
componentDir: 'src/lib/my-lib',
|
componentDir: 'src/lib/my-lib',
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
tree.read('my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
||||||
).toEqual(expected);
|
).toEqual(expected);
|
||||||
|
|
||||||
componentTestGenerator(tree, {
|
componentTestGenerator(tree, {
|
||||||
@ -217,7 +217,7 @@ describe(MyLibComponent.name, () => {
|
|||||||
componentDir: 'src/lib/my-lib',
|
componentDir: 'src/lib/my-lib',
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
tree.read('my-lib/src/lib/my-lib/my-lib.component.cy.ts', 'utf-8')
|
||||||
).toEqual(expected);
|
).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -89,16 +89,14 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
generateTests: false,
|
generateTests: false,
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists('fancy-lib/src/lib/fancy-cmp/fancy-cmp.component.cy.ts')
|
||||||
'libs/fancy-lib/src/lib/fancy-cmp/fancy-cmp.component.cy.ts'
|
|
||||||
)
|
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
|
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
|
||||||
).toEqual({
|
).toEqual({
|
||||||
executor: '@nx/cypress:cypress',
|
executor: '@nx/cypress:cypress',
|
||||||
options: {
|
options: {
|
||||||
cypressConfig: 'libs/fancy-lib/cypress.config.ts',
|
cypressConfig: 'fancy-lib/cypress.config.ts',
|
||||||
devServerTarget: 'fancy-app:build',
|
devServerTarget: 'fancy-app:build',
|
||||||
skipServe: true,
|
skipServe: true,
|
||||||
testingType: 'component',
|
testingType: 'component',
|
||||||
@ -151,16 +149,14 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
generateTests: false,
|
generateTests: false,
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists('fancy-lib/src/lib/fancy-cmp/fancy-cmp.component.cy.ts')
|
||||||
'libs/fancy-lib/src/lib/fancy-cmp/fancy-cmp.component.cy.ts'
|
|
||||||
)
|
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
|
readProjectConfiguration(tree, 'fancy-lib').targets['component-test']
|
||||||
).toEqual({
|
).toEqual({
|
||||||
executor: '@nx/cypress:cypress',
|
executor: '@nx/cypress:cypress',
|
||||||
options: {
|
options: {
|
||||||
cypressConfig: 'libs/fancy-lib/cypress.config.ts',
|
cypressConfig: 'fancy-lib/cypress.config.ts',
|
||||||
devServerTarget: 'fancy-app:build:development',
|
devServerTarget: 'fancy-app:build:development',
|
||||||
skipServe: true,
|
skipServe: true,
|
||||||
testingType: 'component',
|
testingType: 'component',
|
||||||
@ -252,7 +248,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
).toEqual({
|
).toEqual({
|
||||||
executor: '@nx/cypress:cypress',
|
executor: '@nx/cypress:cypress',
|
||||||
options: {
|
options: {
|
||||||
cypressConfig: 'apps/fancy-app/cypress.config.ts',
|
cypressConfig: 'fancy-app/cypress.config.ts',
|
||||||
devServerTarget: 'fancy-app:build',
|
devServerTarget: 'fancy-app:build',
|
||||||
skipServe: true,
|
skipServe: true,
|
||||||
testingType: 'component',
|
testingType: 'component',
|
||||||
@ -273,7 +269,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
export: true,
|
export: true,
|
||||||
});
|
});
|
||||||
tree.write(
|
tree.write(
|
||||||
'apps/fancy-app/src/app/blah.component.ts',
|
'fancy-app/src/app/blah.component.ts',
|
||||||
`import {FancyCmpComponent} from '@something/fancy-lib'`
|
`import {FancyCmpComponent} from '@something/fancy-lib'`
|
||||||
);
|
);
|
||||||
projectGraph = {
|
projectGraph = {
|
||||||
@ -312,7 +308,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
).toEqual({
|
).toEqual({
|
||||||
executor: '@nx/cypress:cypress',
|
executor: '@nx/cypress:cypress',
|
||||||
options: {
|
options: {
|
||||||
cypressConfig: 'libs/fancy-lib/cypress.config.ts',
|
cypressConfig: 'fancy-lib/cypress.config.ts',
|
||||||
devServerTarget: 'fancy-app:build',
|
devServerTarget: 'fancy-app:build',
|
||||||
skipServe: true,
|
skipServe: true,
|
||||||
testingType: 'component',
|
testingType: 'component',
|
||||||
@ -363,7 +359,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
generateTests: true,
|
generateTests: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read('libs/my-lib/cypress.config.ts', 'utf-8'))
|
expect(tree.read('my-lib/cypress.config.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';
|
"import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';
|
||||||
import { defineConfig } from 'cypress';
|
import { defineConfig } from 'cypress';
|
||||||
@ -374,7 +370,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/my-lib/cypress/support/component.ts', 'utf-8')
|
tree.read('my-lib/cypress/support/component.ts', 'utf-8')
|
||||||
).toMatchSnapshot('component.ts');
|
).toMatchSnapshot('component.ts');
|
||||||
});
|
});
|
||||||
it('should work with simple components', async () => {
|
it('should work with simple components', async () => {
|
||||||
@ -421,7 +417,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [one, two, three] = getCmpsFromTree(tree, {
|
const [one, two, three] = getCmpsFromTree(tree, {
|
||||||
basePath: 'libs/my-lib/src/lib',
|
basePath: 'my-lib/src/lib',
|
||||||
name: 'something',
|
name: 'something',
|
||||||
});
|
});
|
||||||
expect(one.cy).toMatchSnapshot();
|
expect(one.cy).toMatchSnapshot();
|
||||||
@ -473,7 +469,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [one, two, three] = getCmpsFromTree(tree, {
|
const [one, two, three] = getCmpsFromTree(tree, {
|
||||||
basePath: 'libs/my-lib-standalone/src/lib',
|
basePath: 'my-lib-standalone/src/lib',
|
||||||
name: 'something',
|
name: 'something',
|
||||||
});
|
});
|
||||||
expect(one.cy).toMatchSnapshot();
|
expect(one.cy).toMatchSnapshot();
|
||||||
@ -491,7 +487,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
name: 'something',
|
name: 'something',
|
||||||
standalone: false,
|
standalone: false,
|
||||||
withInputs: true,
|
withInputs: true,
|
||||||
basePath: 'libs/with-inputs-cmp/src/lib',
|
basePath: 'with-inputs-cmp/src/lib',
|
||||||
});
|
});
|
||||||
projectGraph = {
|
projectGraph = {
|
||||||
nodes: {
|
nodes: {
|
||||||
@ -527,7 +523,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [one, two, three] = getCmpsFromTree(tree, {
|
const [one, two, three] = getCmpsFromTree(tree, {
|
||||||
basePath: 'libs/with-inputs-cmp/src/lib',
|
basePath: 'with-inputs-cmp/src/lib',
|
||||||
name: 'something',
|
name: 'something',
|
||||||
});
|
});
|
||||||
expect(one.cy).toMatchSnapshot();
|
expect(one.cy).toMatchSnapshot();
|
||||||
@ -545,7 +541,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
name: 'something',
|
name: 'something',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
withInputs: true,
|
withInputs: true,
|
||||||
basePath: 'libs/with-inputs-standalone-cmp/src/lib',
|
basePath: 'with-inputs-standalone-cmp/src/lib',
|
||||||
});
|
});
|
||||||
projectGraph = {
|
projectGraph = {
|
||||||
nodes: {
|
nodes: {
|
||||||
@ -581,7 +577,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const [one, two, three] = getCmpsFromTree(tree, {
|
const [one, two, three] = getCmpsFromTree(tree, {
|
||||||
basePath: 'libs/with-inputs-standalone-cmp/src/lib',
|
basePath: 'with-inputs-standalone-cmp/src/lib',
|
||||||
name: 'something',
|
name: 'something',
|
||||||
});
|
});
|
||||||
expect(one.cy).toMatchSnapshot();
|
expect(one.cy).toMatchSnapshot();
|
||||||
@ -603,13 +599,13 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'fancy-button',
|
name: 'fancy-button',
|
||||||
path: 'libs/secondary/src/lib/button',
|
path: 'secondary/src/lib/button',
|
||||||
project: 'secondary',
|
project: 'secondary',
|
||||||
flat: true,
|
flat: true,
|
||||||
});
|
});
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'standalone-fancy-button',
|
name: 'standalone-fancy-button',
|
||||||
path: 'libs/secondary/src/lib/button',
|
path: 'secondary/src/lib/button',
|
||||||
project: 'secondary',
|
project: 'secondary',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
flat: true,
|
flat: true,
|
||||||
@ -641,13 +637,13 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
'libs/secondary/src/lib/button/fancy-button.component.cy.ts',
|
'secondary/src/lib/button/fancy-button.component.cy.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
'libs/secondary/src/lib/button/standalone-fancy-button.component.cy.ts',
|
'secondary/src/lib/button/standalone-fancy-button.component.cy.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
@ -660,15 +656,15 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
});
|
});
|
||||||
await setup(tree, { project: 'cool-lib', name: 'abc', standalone: false });
|
await setup(tree, { project: 'cool-lib', name: 'abc', standalone: false });
|
||||||
tree.write(
|
tree.write(
|
||||||
'libs/cool-lib/src/lib/abc-one/abc-one.component.cy.ts',
|
'cool-lib/src/lib/abc-one/abc-one.component.cy.ts',
|
||||||
`const msg = 'should not overwrite abc-one';`
|
`const msg = 'should not overwrite abc-one';`
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
'libs/cool-lib/src/lib/abc-two/abc-two.component.cy.ts',
|
'cool-lib/src/lib/abc-two/abc-two.component.cy.ts',
|
||||||
`const msg = 'should not overwrite abc-two';`
|
`const msg = 'should not overwrite abc-two';`
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
'libs/cool-lib/src/lib/abc-three/abc-three.component.cy.ts',
|
'cool-lib/src/lib/abc-three/abc-three.component.cy.ts',
|
||||||
`const msg = 'should not overwrite abc-three';`
|
`const msg = 'should not overwrite abc-three';`
|
||||||
);
|
);
|
||||||
projectGraph = {
|
projectGraph = {
|
||||||
@ -698,7 +694,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
|
|
||||||
const [one, two, three] = getCmpsFromTree(tree, {
|
const [one, two, three] = getCmpsFromTree(tree, {
|
||||||
name: 'abc',
|
name: 'abc',
|
||||||
basePath: 'libs/cool-lib/src/lib',
|
basePath: 'cool-lib/src/lib',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(one.cy).toMatchInlineSnapshot(`
|
expect(one.cy).toMatchInlineSnapshot(`
|
||||||
@ -733,7 +729,7 @@ describe('Cypress Component Testing Configuration', () => {
|
|||||||
flat: true,
|
flat: true,
|
||||||
});
|
});
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/multiple-components/src/lib/cmp-one.component.ts`,
|
`multiple-components/src/lib/cmp-one.component.ts`,
|
||||||
`
|
`
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
@ -790,10 +786,7 @@ export class MultipleComponentsModule { }
|
|||||||
generateTests: true,
|
generateTests: true,
|
||||||
});
|
});
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read('multiple-components/src/lib/cmp-one.component.cy.ts', 'utf-8')
|
||||||
'libs/multiple-components/src/lib/cmp-one.component.cy.ts',
|
|
||||||
'utf-8'
|
|
||||||
)
|
|
||||||
).toEqual('');
|
).toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -160,11 +160,11 @@ exports[`Host App Generator --ssr should generate the correct files 9`] = `
|
|||||||
"executor": "@nx/angular:webpack-server",
|
"executor": "@nx/angular:webpack-server",
|
||||||
"options": {
|
"options": {
|
||||||
"customWebpackConfig": {
|
"customWebpackConfig": {
|
||||||
"path": "apps/test/webpack.server.config.js",
|
"path": "test/webpack.server.config.js",
|
||||||
},
|
},
|
||||||
"main": "apps/test/server.ts",
|
"main": "test/server.ts",
|
||||||
"outputPath": "dist/apps/test/server",
|
"outputPath": "dist/test/server",
|
||||||
"tsConfig": "apps/test/tsconfig.server.json",
|
"tsConfig": "test/tsconfig.server.json",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -359,11 +359,11 @@ exports[`Host App Generator --ssr should generate the correct files for standalo
|
|||||||
"executor": "@nx/angular:webpack-server",
|
"executor": "@nx/angular:webpack-server",
|
||||||
"options": {
|
"options": {
|
||||||
"customWebpackConfig": {
|
"customWebpackConfig": {
|
||||||
"path": "apps/test/webpack.server.config.js",
|
"path": "test/webpack.server.config.js",
|
||||||
},
|
},
|
||||||
"main": "apps/test/server.ts",
|
"main": "test/server.ts",
|
||||||
"outputPath": "dist/apps/test/server",
|
"outputPath": "dist/test/server",
|
||||||
"tsConfig": "apps/test/tsconfig.server.json",
|
"tsConfig": "test/tsconfig.server.json",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -509,10 +509,10 @@ describe('AppComponent', () => {
|
|||||||
expect(app).toBeTruthy();
|
expect(app).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(\`should have as title 'test-dashboard'\`, () => {
|
it(\`should have as title 'dashboard'\`, () => {
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
const fixture = TestBed.createComponent(AppComponent);
|
||||||
const app = fixture.componentInstance;
|
const app = fixture.componentInstance;
|
||||||
expect(app.title).toEqual('test-dashboard');
|
expect(app.title).toEqual('dashboard');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render title', fakeAsync(() => {
|
it('should render title', fakeAsync(() => {
|
||||||
@ -523,7 +523,7 @@ describe('AppComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const compiled = fixture.nativeElement as HTMLElement;
|
const compiled = fixture.nativeElement as HTMLElement;
|
||||||
expect(compiled.querySelector('h1')?.textContent).toContain(
|
expect(compiled.querySelector('h1')?.textContent).toContain(
|
||||||
'Welcome test-dashboard'
|
'Welcome dashboard'
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -21,7 +21,7 @@ describe('Host App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a host app with a remote', async () => {
|
it('should generate a host app with a remote', async () => {
|
||||||
@ -39,10 +39,8 @@ describe('Host App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(tree.read('remote/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
||||||
tree.read('apps/remote/webpack.config.js', 'utf-8')
|
expect(tree.read('test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(tree.read('apps/test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a host and any remotes that dont exist with correct routing setup', async () => {
|
it('should generate a host and any remotes that dont exist with correct routing setup', async () => {
|
||||||
@ -57,12 +55,12 @@ describe('Host App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.exists('apps/remote1/project.json')).toBeTruthy();
|
expect(tree.exists('remote1/project.json')).toBeTruthy();
|
||||||
expect(tree.exists('apps/remote2/project.json')).toBeTruthy();
|
expect(tree.exists('remote2/project.json')).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/host-app/module-federation.config.js', 'utf-8')
|
tree.read('host-app/module-federation.config.js', 'utf-8')
|
||||||
).toContain(`'remote1', 'remote2'`);
|
).toContain(`'remote1', 'remote2'`);
|
||||||
expect(tree.read('apps/host-app/src/app/app.component.html', 'utf-8'))
|
expect(tree.read('host-app/src/app/app.component.html', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"<ul class="remote-menu">
|
"<ul class="remote-menu">
|
||||||
<li><a routerLink="/">Home</a></li>
|
<li><a routerLink="/">Home</a></li>
|
||||||
@ -88,11 +86,11 @@ describe('Host App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.exists('apps/remote1/project.json')).toBeTruthy();
|
expect(tree.exists('remote1/project.json')).toBeTruthy();
|
||||||
expect(tree.exists('apps/remote2/project.json')).toBeTruthy();
|
expect(tree.exists('remote2/project.json')).toBeTruthy();
|
||||||
expect(tree.exists('apps/remote3/project.json')).toBeTruthy();
|
expect(tree.exists('remote3/project.json')).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/host-app/module-federation.config.js', 'utf-8')
|
tree.read('host-app/module-federation.config.js', 'utf-8')
|
||||||
).toContain(`'remote1', 'remote2', 'remote3'`);
|
).toContain(`'remote1', 'remote2', 'remote3'`);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -106,17 +104,17 @@ describe('Host App Generator', () => {
|
|||||||
// ACT
|
// ACT
|
||||||
await generateTestHostApplication(tree, {
|
await generateTestHostApplication(tree, {
|
||||||
name: 'hostApp',
|
name: 'hostApp',
|
||||||
directory: 'foo',
|
directory: 'foo/hostApp',
|
||||||
remotes: ['remote1', 'remote2', 'remote3'],
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.exists('apps/remote1/project.json')).toBeTruthy();
|
expect(tree.exists('remote1/project.json')).toBeTruthy();
|
||||||
expect(tree.exists('apps/foo/remote2/project.json')).toBeTruthy();
|
expect(tree.exists('foo/remote2/project.json')).toBeTruthy();
|
||||||
expect(tree.exists('apps/foo/remote3/project.json')).toBeTruthy();
|
expect(tree.exists('foo/remote3/project.json')).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/foo/host-app/module-federation.config.js', 'utf-8')
|
tree.read('foo/host-app/module-federation.config.js', 'utf-8')
|
||||||
).toContain(`'remote1', 'foo-remote2', 'foo-remote3'`);
|
).toContain(`'remote1', 'remote2', 'remote3'`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a host with remotes using standalone components', async () => {
|
it('should generate a host with remotes using standalone components', async () => {
|
||||||
@ -131,11 +129,11 @@ describe('Host App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.exists(`apps/host/src/app/app.module.ts`)).toBeFalsy();
|
expect(tree.exists(`host/src/app/app.module.ts`)).toBeFalsy();
|
||||||
expect(tree.read(`apps/host/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
expect(tree.read(`host/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
expect(tree.read(`apps/host/src/remotes.d.ts`, 'utf-8')).toMatchSnapshot();
|
expect(tree.read(`host/src/remotes.d.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/host/src/app/app.component.ts`, 'utf-8')
|
tree.read(`host/src/app/app.component.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -152,7 +150,7 @@ describe('Host App Generator', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/host/src/app/app.component.spec.ts`, 'utf-8')
|
tree.read(`host/src/app/app.component.spec.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -164,13 +162,13 @@ describe('Host App Generator', () => {
|
|||||||
await generateTestHostApplication(tree, {
|
await generateTestHostApplication(tree, {
|
||||||
name: 'dashboard',
|
name: 'dashboard',
|
||||||
remotes: ['remote1'],
|
remotes: ['remote1'],
|
||||||
directory: 'test',
|
directory: 'test/dashboard',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/dashboard/src/app/app.component.spec.ts`, 'utf-8')
|
tree.read(`test/dashboard/src/app/app.component.spec.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -205,26 +203,22 @@ describe('Host App Generator', () => {
|
|||||||
// ASSERT
|
// ASSERT
|
||||||
const project = readProjectConfiguration(tree, 'test');
|
const project = readProjectConfiguration(tree, 'test');
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/app/app.module.ts`, 'utf-8')
|
tree.read(`test/src/app/app.module.ts`, 'utf-8')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
tree.read(`test/src/bootstrap.server.ts`, 'utf-8')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/src/main.server.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/server.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
tree.read(`test/module-federation.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/bootstrap.ts`, 'utf-8')
|
tree.read(`test/webpack.server.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/bootstrap.server.ts`, 'utf-8')
|
tree.read(`test/src/app/app.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/main.server.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(tree.read(`apps/test/server.ts`, 'utf-8')).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/module-federation.config.js`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/webpack.server.config.js`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/app.routes.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(project.targets.server).toMatchSnapshot();
|
expect(project.targets.server).toMatchSnapshot();
|
||||||
expect(project.targets['serve-ssr']).toMatchSnapshot();
|
expect(project.targets['serve-ssr']).toMatchSnapshot();
|
||||||
@ -243,31 +237,27 @@ describe('Host App Generator', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const project = readProjectConfiguration(tree, 'test');
|
const project = readProjectConfiguration(tree, 'test');
|
||||||
expect(tree.exists(`apps/test/src/app/app.module.ts`)).toBeFalsy();
|
expect(tree.exists(`test/src/app/app.module.ts`)).toBeFalsy();
|
||||||
|
expect(tree.read(`test/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/bootstrap.ts`, 'utf-8')
|
tree.read(`test/src/bootstrap.server.ts`, 'utf-8')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/src/main.server.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/server.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
tree.read(`test/module-federation.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/bootstrap.server.ts`, 'utf-8')
|
tree.read(`test/webpack.server.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/main.server.ts`, 'utf-8')
|
tree.read(`test/src/app/app.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(tree.read(`apps/test/server.ts`, 'utf-8')).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/module-federation.config.js`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/webpack.server.config.js`, 'utf-8')
|
tree.read(`test/src/app/app.config.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/app/app.routes.ts`, 'utf-8')
|
tree.read(`test/src/app/app.config.server.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/app.config.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/app.config.server.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(project.targets.server).toMatchSnapshot();
|
expect(project.targets.server).toMatchSnapshot();
|
||||||
expect(project.targets['serve-ssr']).toMatchSnapshot();
|
expect(project.targets['serve-ssr']).toMatchSnapshot();
|
||||||
@ -294,4 +284,55 @@ describe('Host App Generator', () => {
|
|||||||
.toThrow(stripIndents`The "standalone" option is only supported in Angular >= 14.1.0. You are currently using 14.0.0.
|
.toThrow(stripIndents`The "standalone" option is only supported in Angular >= 14.1.0. You are currently using 14.0.0.
|
||||||
You can resolve this error by removing the "standalone" option or by migrating to Angular 14.1.0.`);
|
You can resolve this error by removing the "standalone" option or by migrating to Angular 14.1.0.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('--project-name-and-root-format=derived', () => {
|
||||||
|
it('should generate a host, integrate existing remotes and generate any remotes that dont exist', async () => {
|
||||||
|
// ARRANGE
|
||||||
|
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
|
await generateTestRemoteApplication(tree, {
|
||||||
|
name: 'remote1',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
// ACT
|
||||||
|
await generateTestHostApplication(tree, {
|
||||||
|
name: 'hostApp',
|
||||||
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
// ASSERT
|
||||||
|
expect(tree.exists('apps/remote1/project.json')).toBeTruthy();
|
||||||
|
expect(tree.exists('apps/remote2/project.json')).toBeTruthy();
|
||||||
|
expect(tree.exists('apps/remote3/project.json')).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
tree.read('apps/host-app/module-federation.config.js', 'utf-8')
|
||||||
|
).toContain(`'remote1', 'remote2', 'remote3'`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should generate a host, integrate existing remotes and generate any remotes that dont exist, in a directory', async () => {
|
||||||
|
// ARRANGE
|
||||||
|
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
|
await generateTestRemoteApplication(tree, {
|
||||||
|
name: 'remote1',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
// ACT
|
||||||
|
await generateTestHostApplication(tree, {
|
||||||
|
name: 'hostApp',
|
||||||
|
directory: 'foo',
|
||||||
|
remotes: ['remote1', 'remote2', 'remote3'],
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
// ASSERT
|
||||||
|
expect(tree.exists('apps/remote1/project.json')).toBeTruthy();
|
||||||
|
expect(tree.exists('apps/foo/remote2/project.json')).toBeTruthy();
|
||||||
|
expect(tree.exists('apps/foo/remote3/project.json')).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
tree.read('apps/foo/host-app/module-federation.config.js', 'utf-8')
|
||||||
|
).toContain(`'remote1', 'foo-remote2', 'foo-remote3'`);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -413,7 +413,7 @@ export const myLibRoutes: Route[] = [
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lib --standalone should generate a library with a standalone component in a directory 1`] = `
|
exports[`lib --standalone should generate a library with a standalone component in a directory 1`] = `
|
||||||
"export * from './lib/my-dir-my-lib/my-dir-my-lib.component';
|
"export * from './lib/my-lib/my-lib.component';
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -422,30 +422,30 @@ exports[`lib --standalone should generate a library with a standalone component
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'proj-my-dir-my-lib',
|
selector: 'proj-my-lib',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule],
|
imports: [CommonModule],
|
||||||
templateUrl: './my-dir-my-lib.component.html',
|
templateUrl: './my-lib.component.html',
|
||||||
styleUrls: ['./my-dir-my-lib.component.css'],
|
styleUrls: ['./my-lib.component.css'],
|
||||||
})
|
})
|
||||||
export class MyDirMyLibComponent {}
|
export class MyLibComponent {}
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`lib --standalone should generate a library with a standalone component in a directory 3`] = `
|
exports[`lib --standalone should generate a library with a standalone component in a directory 3`] = `
|
||||||
"import { ComponentFixture, TestBed } from '@angular/core/testing';
|
"import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { MyDirMyLibComponent } from './my-dir-my-lib.component';
|
import { MyLibComponent } from './my-lib.component';
|
||||||
|
|
||||||
describe('MyDirMyLibComponent', () => {
|
describe('MyLibComponent', () => {
|
||||||
let component: MyDirMyLibComponent;
|
let component: MyLibComponent;
|
||||||
let fixture: ComponentFixture<MyDirMyLibComponent>;
|
let fixture: ComponentFixture<MyLibComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [MyDirMyLibComponent],
|
imports: [MyLibComponent],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(MyDirMyLibComponent);
|
fixture = TestBed.createComponent(MyLibComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
@ -506,12 +506,12 @@ exports[`lib router lazy should add RouterModule.forChild 1`] = `
|
|||||||
"import { NgModule } from '@angular/core';
|
"import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { myDirMyLibRoutes } from './lib.routes';
|
import { myLibRoutes } from './lib.routes';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [CommonModule, RouterModule.forChild(myDirMyLibRoutes)],
|
imports: [CommonModule, RouterModule.forChild(myLibRoutes)],
|
||||||
})
|
})
|
||||||
export class MyDirMyLibModule {}
|
export class MyLibModule {}
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -538,9 +538,8 @@ import { AppComponent } from './app.component';
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
RouterModule.forRoot([
|
RouterModule.forRoot([
|
||||||
{
|
{
|
||||||
path: 'my-dir-my-lib',
|
path: 'my-lib',
|
||||||
loadChildren: () =>
|
loadChildren: () => import('@proj/my-lib').then((m) => m.MyLibModule),
|
||||||
import('@proj/my-dir/my-lib').then((m) => m.MyDirMyLibModule),
|
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
@ -561,19 +560,16 @@ import { AppComponent } from './app.component';
|
|||||||
BrowserModule,
|
BrowserModule,
|
||||||
RouterModule.forRoot([
|
RouterModule.forRoot([
|
||||||
{
|
{
|
||||||
path: 'my-dir-my-lib',
|
path: 'my-lib',
|
||||||
loadChildren: () =>
|
loadChildren: () => import('@proj/my-lib').then((m) => m.MyLibModule),
|
||||||
import('@proj/my-dir/my-lib').then((m) => m.MyDirMyLibModule),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'my-lib2',
|
path: 'my-lib2',
|
||||||
loadChildren: () =>
|
loadChildren: () => import('@proj/my-lib2').then((m) => m.MyLib2Module),
|
||||||
import('@proj/my-dir/my-lib2').then((m) => m.MyLib2Module),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'my-lib3',
|
path: 'my-lib3',
|
||||||
loadChildren: () =>
|
loadChildren: () => import('@proj/my-lib3').then((m) => m.MyLib3Module),
|
||||||
import('@proj/my-dir/my-lib3').then((m) => m.MyLib3Module),
|
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
@ -592,9 +588,8 @@ import { AppComponent } from './app.component';
|
|||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: 'my-dir-my-lib',
|
path: 'my-lib',
|
||||||
loadChildren: () =>
|
loadChildren: () => import('@proj/my-lib').then((m) => m.MyLibModule),
|
||||||
import('@proj/my-dir/my-lib').then((m) => m.MyDirMyLibModule),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,7 @@ describe('updateModuleName Rule', () => {
|
|||||||
destination: 'my/first',
|
destination: 'my/first',
|
||||||
updateImportPath: true,
|
updateImportPath: true,
|
||||||
newProjectName: 'my-first',
|
newProjectName: 'my-first',
|
||||||
oldProjectRoot: 'libs/my-first',
|
oldProjectRoot: 'my-first',
|
||||||
};
|
};
|
||||||
await moveGenerator(tree, schema);
|
await moveGenerator(tree, schema);
|
||||||
|
|
||||||
@ -42,14 +42,14 @@ describe('updateModuleName Rule', () => {
|
|||||||
const updatedModuleSpecPath =
|
const updatedModuleSpecPath =
|
||||||
'/libs/shared/my-first/src/lib/shared-my-first.module.spec.ts';
|
'/libs/shared/my-first/src/lib/shared-my-first.module.spec.ts';
|
||||||
const indexPath = '/libs/shared/my-first/src/index.ts';
|
const indexPath = '/libs/shared/my-first/src/index.ts';
|
||||||
const secondModulePath = '/libs/my-second/src/lib/my-second.module.ts';
|
const secondModulePath = 'my-second/src/lib/my-second.module.ts';
|
||||||
|
|
||||||
const schema: NormalizedSchema = {
|
const schema: NormalizedSchema = {
|
||||||
projectName: 'my-first',
|
projectName: 'my-first',
|
||||||
destination: 'shared/my-first',
|
destination: 'shared/my-first',
|
||||||
updateImportPath: true,
|
updateImportPath: true,
|
||||||
newProjectName: 'shared-my-first',
|
newProjectName: 'shared-my-first',
|
||||||
oldProjectRoot: 'libs/my-first',
|
oldProjectRoot: 'my-first',
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@ -72,7 +72,7 @@ describe('updateModuleName Rule', () => {
|
|||||||
unitTestRunner: UnitTestRunner.Jest,
|
unitTestRunner: UnitTestRunner.Jest,
|
||||||
});
|
});
|
||||||
tree.write(
|
tree.write(
|
||||||
'/libs/my-first/src/lib/my-first.module.ts',
|
'my-first/src/lib/my-first.module.ts',
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ describe('updateModuleName Rule', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
'/libs/my-first/src/lib/my-first.module.spec.ts',
|
'my-first/src/lib/my-first.module.spec.ts',
|
||||||
`import { async, TestBed } from '@angular/core/testing';
|
`import { async, TestBed } from '@angular/core/testing';
|
||||||
import { MyFirstModule } from './my-first.module';
|
import { MyFirstModule } from './my-first.module';
|
||||||
|
|
||||||
@ -159,14 +159,14 @@ describe('updateModuleName Rule', () => {
|
|||||||
destination: 'my-destination',
|
destination: 'my-destination',
|
||||||
updateImportPath: true,
|
updateImportPath: true,
|
||||||
newProjectName: 'my-destination',
|
newProjectName: 'my-destination',
|
||||||
oldProjectRoot: 'libs/my-source',
|
oldProjectRoot: 'my-source',
|
||||||
};
|
};
|
||||||
|
|
||||||
const modulePath = '/libs/my-destination/src/lib/my-destination.module.ts';
|
const modulePath = 'my-destination/src/lib/my-destination.module.ts';
|
||||||
const moduleSpecPath =
|
const moduleSpecPath =
|
||||||
'/libs/my-destination/src/lib/my-destination.module.spec.ts';
|
'my-destination/src/lib/my-destination.module.spec.ts';
|
||||||
const indexPath = '/libs/my-destination/src/index.ts';
|
const indexPath = 'my-destination/src/index.ts';
|
||||||
const importerPath = '/libs/my-importer/src/lib/my-importing-file.ts';
|
const importerPath = 'my-importer/src/lib/my-importing-file.ts';
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
// fake a mid-move tree:
|
// fake a mid-move tree:
|
||||||
@ -181,7 +181,7 @@ describe('updateModuleName Rule', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
'/libs/my-destination/src/lib/my-source.module.ts',
|
'my-destination/src/lib/my-source.module.ts',
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -191,7 +191,7 @@ describe('updateModuleName Rule', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
'/libs/my-destination/src/lib/my-source.module.spec.ts',
|
'my-destination/src/lib/my-source.module.spec.ts',
|
||||||
`import { async, TestBed } from '@angular/core/testing';
|
`import { async, TestBed } from '@angular/core/testing';
|
||||||
import { MySourceModule } from './my-source.module';
|
import { MySourceModule } from './my-source.module';
|
||||||
describe('MySourceModule', () => {
|
describe('MySourceModule', () => {
|
||||||
@ -292,7 +292,7 @@ describe('updateModuleName Rule', () => {
|
|||||||
updateModuleName(tree, schema);
|
updateModuleName(tree, schema);
|
||||||
|
|
||||||
const moduleFile = tree.read(
|
const moduleFile = tree.read(
|
||||||
'/libs/my-source-demo/src/lib/my-source-demo.module.ts',
|
'my-source-demo/src/lib/my-source-demo.module.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
expect(moduleFile).toContain(`export class MySourceDemoModule {}`);
|
expect(moduleFile).toContain(`export class MySourceDemoModule {}`);
|
||||||
|
|||||||
@ -23,21 +23,21 @@ describe('ngrx', () => {
|
|||||||
const defaultOptions: NgRxGeneratorOptions = {
|
const defaultOptions: NgRxGeneratorOptions = {
|
||||||
directory: '+state',
|
directory: '+state',
|
||||||
minimal: true,
|
minimal: true,
|
||||||
parent: 'apps/myapp/src/app/app.module.ts',
|
parent: 'myapp/src/app/app.module.ts',
|
||||||
name: 'users',
|
name: 'users',
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultStandaloneOptions: NgRxGeneratorOptions = {
|
const defaultStandaloneOptions: NgRxGeneratorOptions = {
|
||||||
directory: '+state',
|
directory: '+state',
|
||||||
minimal: true,
|
minimal: true,
|
||||||
parent: 'apps/my-app/src/app/app.config.ts',
|
parent: 'my-app/src/app/app.config.ts',
|
||||||
name: 'users',
|
name: 'users',
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultModuleOptions: NgRxGeneratorOptions = {
|
const defaultModuleOptions: NgRxGeneratorOptions = {
|
||||||
directory: '+state',
|
directory: '+state',
|
||||||
minimal: true,
|
minimal: true,
|
||||||
module: 'apps/myapp/src/app/app.module.ts',
|
module: 'myapp/src/app/app.module.ts',
|
||||||
name: 'users',
|
name: 'users',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ describe('ngrx', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')
|
tree.read('myapp/src/app/app.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -96,24 +96,18 @@ describe('ngrx', () => {
|
|||||||
minimal: true,
|
minimal: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.exists('/apps/myapp/src/app/+state/users.actions.ts')).toBe(
|
expect(tree.exists('myapp/src/app/+state/users.actions.ts')).toBe(false);
|
||||||
|
expect(tree.exists('myapp/src/app/+state/users.effects.ts')).toBe(false);
|
||||||
|
expect(tree.exists('myapp/src/app/+state/users.effects.spec.ts')).toBe(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(tree.exists('/apps/myapp/src/app/+state/users.effects.ts')).toBe(
|
expect(tree.exists('myapp/src/app/+state/users.reducer.ts')).toBe(false);
|
||||||
|
expect(tree.exists('myapp/src/app/+state/users.selectors.ts')).toBe(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(
|
expect(tree.exists('myapp/src/app/+state/users.selectors.spec.ts')).toBe(
|
||||||
tree.exists('/apps/myapp/src/app/+state/users.effects.spec.ts')
|
|
||||||
).toBe(false);
|
|
||||||
expect(tree.exists('/apps/myapp/src/app/+state/users.reducer.ts')).toBe(
|
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(tree.exists('/apps/myapp/src/app/+state/users.selectors.ts')).toBe(
|
|
||||||
false
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
tree.exists('/apps/myapp/src/app/+state/users.selectors.spec.ts')
|
|
||||||
).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a root module with feature module when minimal is set to false', async () => {
|
it('should add a root module with feature module when minimal is set to false', async () => {
|
||||||
@ -124,7 +118,7 @@ describe('ngrx', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')
|
tree.read('myapp/src/app/app.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -136,7 +130,7 @@ describe('ngrx', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')
|
tree.read('myapp/src/app/app.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -145,12 +139,12 @@ describe('ngrx', () => {
|
|||||||
|
|
||||||
await ngrxGenerator(tree, {
|
await ngrxGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
module: 'apps/no-router-app/src/app/app.module.ts',
|
module: 'no-router-app/src/app/app.module.ts',
|
||||||
root: true,
|
root: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const appModule = tree.read(
|
const appModule = tree.read(
|
||||||
'/apps/no-router-app/src/app/app.module.ts',
|
'no-router-app/src/app/app.module.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
expect(appModule).not.toContain('StoreRouterConnectingModule.forRoot()');
|
expect(appModule).not.toContain('StoreRouterConnectingModule.forRoot()');
|
||||||
@ -164,7 +158,7 @@ describe('ngrx', () => {
|
|||||||
facade: true,
|
facade: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')).toContain(
|
expect(tree.read('myapp/src/app/app.module.ts', 'utf-8')).toContain(
|
||||||
'providers: [UsersFacade]'
|
'providers: [UsersFacade]'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -177,9 +171,9 @@ describe('ngrx', () => {
|
|||||||
facade: false,
|
facade: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(tree.read('myapp/src/app/app.module.ts', 'utf-8')).not.toContain(
|
||||||
tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')
|
'providers: [UsersFacade]'
|
||||||
).not.toContain('providers: [UsersFacade]');
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not add facade provider when minimal is true', async () => {
|
it('should not add facade provider when minimal is true', async () => {
|
||||||
@ -190,9 +184,9 @@ describe('ngrx', () => {
|
|||||||
facade: true,
|
facade: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(tree.read('myapp/src/app/app.module.ts', 'utf-8')).not.toContain(
|
||||||
tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')
|
'providers: [UsersFacade]'
|
||||||
).not.toContain('providers: [UsersFacade]');
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not generate imports when skipImport is true', async () => {
|
it('should not generate imports when skipImport is true', async () => {
|
||||||
@ -202,14 +196,14 @@ describe('ngrx', () => {
|
|||||||
skipImport: true,
|
skipImport: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expectFileToExist('/apps/myapp/src/app/+state/users.actions.ts');
|
expectFileToExist('myapp/src/app/+state/users.actions.ts');
|
||||||
expectFileToExist('/apps/myapp/src/app/+state/users.effects.ts');
|
expectFileToExist('myapp/src/app/+state/users.effects.ts');
|
||||||
expectFileToExist('/apps/myapp/src/app/+state/users.effects.spec.ts');
|
expectFileToExist('myapp/src/app/+state/users.effects.spec.ts');
|
||||||
expectFileToExist('/apps/myapp/src/app/+state/users.reducer.ts');
|
expectFileToExist('myapp/src/app/+state/users.reducer.ts');
|
||||||
expectFileToExist('/apps/myapp/src/app/+state/users.selectors.ts');
|
expectFileToExist('myapp/src/app/+state/users.selectors.ts');
|
||||||
expectFileToExist('/apps/myapp/src/app/+state/users.selectors.spec.ts');
|
expectFileToExist('myapp/src/app/+state/users.selectors.spec.ts');
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/myapp/src/app/app.module.ts', 'utf-8')
|
tree.read('myapp/src/app/app.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -356,7 +350,7 @@ describe('ngrx', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should generate with custom directory', async () => {
|
it('should generate with custom directory', async () => {
|
||||||
statePath = '/apps/myapp/src/app/my-custom-directory';
|
statePath = 'myapp/src/app/my-custom-directory';
|
||||||
|
|
||||||
await ngrxGenerator(tree, {
|
await ngrxGenerator(tree, {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
@ -502,11 +496,11 @@ describe('ngrx', () => {
|
|||||||
routing: true,
|
routing: true,
|
||||||
});
|
});
|
||||||
tree.write(
|
tree.write(
|
||||||
'apps/my-app/src/app/app.component.html',
|
'my-app/src/app/app.component.html',
|
||||||
'<router-outlet></router-outlet>'
|
'<router-outlet></router-outlet>'
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
'apps/my-app/src/app/app.routes.ts',
|
'my-app/src/app/app.routes.ts',
|
||||||
`import { Routes } from '@angular/router';
|
`import { Routes } from '@angular/router';
|
||||||
import { NxWelcomeComponent } from './nx-welcome.component';
|
import { NxWelcomeComponent } from './nx-welcome.component';
|
||||||
export const appRoutes: Routes = [{ path: '', component: NxWelcomeComponent }];`
|
export const appRoutes: Routes = [{ path: '', component: NxWelcomeComponent }];`
|
||||||
@ -515,7 +509,7 @@ describe('ngrx', () => {
|
|||||||
|
|
||||||
it('should throw when the parent cannot be found', async () => {
|
it('should throw when the parent cannot be found', async () => {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
const parentPath = 'apps/my-app/src/app/non-existent.routes.ts';
|
const parentPath = 'my-app/src/app/non-existent.routes.ts';
|
||||||
|
|
||||||
// ACT & ASSERT
|
// ACT & ASSERT
|
||||||
await expect(
|
await expect(
|
||||||
@ -533,28 +527,22 @@ describe('ngrx', () => {
|
|||||||
minimal: true,
|
minimal: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read('/apps/my-app/src/main.ts', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('my-app/src/main.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.config.ts', 'utf-8')
|
tree.read('my-app/src/app/app.config.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(tree.exists('/apps/my-app/src/app/+state/users.actions.ts')).toBe(
|
expect(tree.exists('my-app/src/app/+state/users.actions.ts')).toBe(false);
|
||||||
|
expect(tree.exists('my-app/src/app/+state/users.effects.ts')).toBe(false);
|
||||||
|
expect(tree.exists('my-app/src/app/+state/users.effects.spec.ts')).toBe(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(tree.exists('/apps/my-app/src/app/+state/users.effects.ts')).toBe(
|
expect(tree.exists('my-app/src/app/+state/users.reducer.ts')).toBe(false);
|
||||||
|
expect(tree.exists('my-app/src/app/+state/users.selectors.ts')).toBe(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(
|
expect(tree.exists('my-app/src/app/+state/users.selectors.spec.ts')).toBe(
|
||||||
tree.exists('/apps/my-app/src/app/+state/users.effects.spec.ts')
|
|
||||||
).toBe(false);
|
|
||||||
expect(tree.exists('/apps/my-app/src/app/+state/users.reducer.ts')).toBe(
|
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
expect(
|
|
||||||
tree.exists('/apps/my-app/src/app/+state/users.selectors.ts')
|
|
||||||
).toBe(false);
|
|
||||||
expect(
|
|
||||||
tree.exists('/apps/my-app/src/app/+state/users.selectors.spec.ts')
|
|
||||||
).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a root module with feature module when minimal is set to false', async () => {
|
it('should add a root module with feature module when minimal is set to false', async () => {
|
||||||
@ -564,9 +552,9 @@ describe('ngrx', () => {
|
|||||||
minimal: false,
|
minimal: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read('/apps/my-app/src/main.ts', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('my-app/src/main.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.config.ts', 'utf-8')
|
tree.read('my-app/src/app/app.config.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -575,17 +563,17 @@ describe('ngrx', () => {
|
|||||||
...defaultStandaloneOptions,
|
...defaultStandaloneOptions,
|
||||||
root: false,
|
root: false,
|
||||||
route: undefined,
|
route: undefined,
|
||||||
parent: 'apps/my-app/src/app/app.routes.ts',
|
parent: 'my-app/src/app/app.routes.ts',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.routes.ts', 'utf-8')
|
tree.read('my-app/src/app/app.routes.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a feature module when route is non-empty', async () => {
|
it('should add a feature module when route is non-empty', async () => {
|
||||||
tree.write(
|
tree.write(
|
||||||
'apps/my-app/src/app/app.routes.ts',
|
'my-app/src/app/app.routes.ts',
|
||||||
`import { Routes } from '@angular/router';
|
`import { Routes } from '@angular/router';
|
||||||
import { NxWelcomeComponent } from './nx-welcome.component';
|
import { NxWelcomeComponent } from './nx-welcome.component';
|
||||||
export const appRoutes: Routes = [{ path: 'home', component: NxWelcomeComponent }];`
|
export const appRoutes: Routes = [{ path: 'home', component: NxWelcomeComponent }];`
|
||||||
@ -595,11 +583,11 @@ describe('ngrx', () => {
|
|||||||
...defaultStandaloneOptions,
|
...defaultStandaloneOptions,
|
||||||
root: false,
|
root: false,
|
||||||
route: 'home',
|
route: 'home',
|
||||||
parent: 'apps/my-app/src/app/app.routes.ts',
|
parent: 'my-app/src/app/app.routes.ts',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.routes.ts', 'utf-8')
|
tree.read('my-app/src/app/app.routes.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -608,11 +596,11 @@ describe('ngrx', () => {
|
|||||||
...defaultStandaloneOptions,
|
...defaultStandaloneOptions,
|
||||||
root: false,
|
root: false,
|
||||||
route: '',
|
route: '',
|
||||||
parent: 'apps/my-app/src/app/app.routes.ts',
|
parent: 'my-app/src/app/app.routes.ts',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.routes.ts', 'utf-8')
|
tree.read('my-app/src/app/app.routes.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -624,9 +612,9 @@ describe('ngrx', () => {
|
|||||||
facade: true,
|
facade: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read('/apps/my-app/src/main.ts', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('my-app/src/main.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.config.ts', 'utf-8')
|
tree.read('my-app/src/app/app.config.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -636,11 +624,11 @@ describe('ngrx', () => {
|
|||||||
root: false,
|
root: false,
|
||||||
minimal: false,
|
minimal: false,
|
||||||
facade: true,
|
facade: true,
|
||||||
parent: 'apps/my-app/src/app/app.routes.ts',
|
parent: 'my-app/src/app/app.routes.ts',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/my-app/src/app/app.routes.ts', 'utf-8')
|
tree.read('my-app/src/app/app.routes.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -691,7 +679,7 @@ describe('ngrx', () => {
|
|||||||
await ngrxGenerator(tree, defaultOptions);
|
await ngrxGenerator(tree, defaultOptions);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/myapp/src/app/+state/users.effects.ts', 'utf-8')
|
tree.read('myapp/src/app/+state/users.effects.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -707,7 +695,7 @@ describe('ngrx', () => {
|
|||||||
await ngrxGenerator(tree, defaultOptions);
|
await ngrxGenerator(tree, defaultOptions);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/myapp/src/app/+state/users.effects.ts', 'utf-8')
|
tree.read('myapp/src/app/+state/users.effects.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -715,7 +703,7 @@ describe('ngrx', () => {
|
|||||||
await ngrxGenerator(tree, { ...defaultOptions, facade: true });
|
await ngrxGenerator(tree, { ...defaultOptions, facade: true });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/myapp/src/app/+state/users.facade.ts', 'utf-8')
|
tree.read('myapp/src/app/+state/users.facade.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -731,12 +719,12 @@ describe('ngrx', () => {
|
|||||||
await ngrxGenerator(tree, { ...defaultOptions, facade: true });
|
await ngrxGenerator(tree, { ...defaultOptions, facade: true });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/myapp/src/app/+state/users.facade.ts', 'utf-8')
|
tree.read('myapp/src/app/+state/users.facade.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when Angular version < 14.1 and NgRx < 15 but path to routes file is provided', async () => {
|
it('should throw when Angular version < 14.1 and NgRx < 15 but path to routes file is provided', async () => {
|
||||||
const parentPath = 'apps/myapp/src/app/app.routes.ts';
|
const parentPath = 'myapp/src/app/app.routes.ts';
|
||||||
tree.write(
|
tree.write(
|
||||||
parentPath,
|
parentPath,
|
||||||
`import { Routes } from '@angular/router';
|
`import { Routes } from '@angular/router';
|
||||||
@ -765,7 +753,7 @@ describe('ngrx', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when Angular version < 15 and NgRx is not currently installed but path to routes file is provided', async () => {
|
it('should throw when Angular version < 15 and NgRx is not currently installed but path to routes file is provided', async () => {
|
||||||
const parentPath = 'apps/myapp/src/app/app.routes.ts';
|
const parentPath = 'myapp/src/app/app.routes.ts';
|
||||||
tree.write(
|
tree.write(
|
||||||
parentPath,
|
parentPath,
|
||||||
`import { Routes } from '@angular/router';
|
`import { Routes } from '@angular/router';
|
||||||
@ -793,7 +781,7 @@ describe('ngrx', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when the provided parent does not have an NgModule', async () => {
|
it('should throw when the provided parent does not have an NgModule', async () => {
|
||||||
const parentPath = 'apps/myapp/src/app/app.routes.ts';
|
const parentPath = 'myapp/src/app/app.routes.ts';
|
||||||
tree.write(
|
tree.write(
|
||||||
parentPath,
|
parentPath,
|
||||||
`import { Routes } from '@angular/router';
|
`import { Routes } from '@angular/router';
|
||||||
@ -830,7 +818,7 @@ describe('ngrx', () => {
|
|||||||
await ngrxGenerator(tree, defaultOptions);
|
await ngrxGenerator(tree, defaultOptions);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('/apps/myapp/src/app/+state/users.effects.ts', 'utf-8')
|
tree.read('myapp/src/app/+state/users.effects.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -130,7 +130,7 @@ exports[`MF Remote App Generator --ssr should generate the correct files 6`] = `
|
|||||||
"module.exports = {
|
"module.exports = {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
exposes: {
|
exposes: {
|
||||||
'./Module': 'apps/test/src/app/remote-entry/entry.module.ts',
|
'./Module': 'test/src/app/remote-entry/entry.module.ts',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
@ -198,11 +198,11 @@ exports[`MF Remote App Generator --ssr should generate the correct files 11`] =
|
|||||||
"executor": "@nx/angular:webpack-server",
|
"executor": "@nx/angular:webpack-server",
|
||||||
"options": {
|
"options": {
|
||||||
"customWebpackConfig": {
|
"customWebpackConfig": {
|
||||||
"path": "apps/test/webpack.server.config.js",
|
"path": "test/webpack.server.config.js",
|
||||||
},
|
},
|
||||||
"main": "apps/test/server.ts",
|
"main": "test/server.ts",
|
||||||
"outputPath": "dist/apps/test/server",
|
"outputPath": "dist/test/server",
|
||||||
"tsConfig": "apps/test/tsconfig.server.json",
|
"tsConfig": "test/tsconfig.server.json",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -225,7 +225,7 @@ exports[`MF Remote App Generator --ssr should generate the correct files 13`] =
|
|||||||
],
|
],
|
||||||
"executor": "nx:run-commands",
|
"executor": "nx:run-commands",
|
||||||
"options": {
|
"options": {
|
||||||
"command": "PORT=4201 node dist/apps/test/server/main.js",
|
"command": "PORT=4201 node dist/test/server/main.js",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -266,7 +266,7 @@ exports[`MF Remote App Generator should generate the a remote setup for standalo
|
|||||||
"module.exports = {
|
"module.exports = {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
exposes: {
|
exposes: {
|
||||||
'./Routes': 'apps/test/src/app/remote-entry/entry.routes.ts',
|
'./Routes': 'test/src/app/remote-entry/entry.routes.ts',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
|||||||
@ -24,7 +24,7 @@ describe('MF Remote App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a remote mf app with a host', async () => {
|
it('should generate a remote mf app with a host', async () => {
|
||||||
@ -42,8 +42,8 @@ describe('MF Remote App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/host/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('host/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
||||||
expect(tree.read('apps/test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('test/webpack.config.js', 'utf-8')).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should error when a remote app is attempted to be generated with an incorrect host', async () => {
|
it('should error when a remote app is attempted to be generated with an incorrect host', async () => {
|
||||||
@ -122,23 +122,21 @@ describe('MF Remote App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.exists(`apps/test/src/app/app.module.ts`)).toBeFalsy();
|
expect(tree.exists(`test/src/app/app.module.ts`)).toBeFalsy();
|
||||||
expect(tree.exists(`apps/test/src/app/app.component.ts`)).toBeFalsy();
|
expect(tree.exists(`test/src/app/app.component.ts`)).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(`apps/test/src/app/remote-entry/entry.module.ts`)
|
tree.exists(`test/src/app/remote-entry/entry.module.ts`)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(tree.read(`apps/test/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
expect(tree.read(`test/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/module-federation.config.js`, 'utf-8')
|
tree.read(`test/module-federation.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/app/remote-entry/entry.component.ts`, 'utf-8')
|
tree.read(`test/src/app/remote-entry/entry.component.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/src/app/app.routes.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/app/app.routes.ts`, 'utf-8')
|
tree.read(`test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -168,7 +166,7 @@ describe('MF Remote App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/test/src/app/app.component.ts', 'utf-8'))
|
expect(tree.read('test/src/app/app.component.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { Component } from '@angular/core';
|
"import { Component } from '@angular/core';
|
||||||
|
|
||||||
@ -192,10 +190,10 @@ describe('MF Remote App Generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/test/src/index.html', 'utf-8')).not.toContain(
|
expect(tree.read('test/src/index.html', 'utf-8')).not.toContain(
|
||||||
'proj-root'
|
'proj-root'
|
||||||
);
|
);
|
||||||
expect(tree.read('apps/test/src/index.html', 'utf-8')).toContain(
|
expect(tree.read('test/src/index.html', 'utf-8')).toContain(
|
||||||
'proj-test-entry'
|
'proj-test-entry'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -214,39 +212,35 @@ describe('MF Remote App Generator', () => {
|
|||||||
// ASSERT
|
// ASSERT
|
||||||
const project = readProjectConfiguration(tree, 'test');
|
const project = readProjectConfiguration(tree, 'test');
|
||||||
expect(
|
expect(
|
||||||
tree.exists(`apps/test/src/app/remote-entry/entry.module.ts`)
|
tree.exists(`test/src/app/remote-entry/entry.module.ts`)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/app/app.module.ts`, 'utf-8')
|
tree.read(`test/src/app/app.module.ts`, 'utf-8')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/src/bootstrap.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
tree.read(`test/src/bootstrap.server.ts`, 'utf-8')
|
||||||
|
).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/src/main.server.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(tree.read(`test/server.ts`, 'utf-8')).toMatchSnapshot();
|
||||||
|
expect(
|
||||||
|
tree.read(`test/module-federation.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/bootstrap.ts`, 'utf-8')
|
tree.read(`test/webpack.server.config.js`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/bootstrap.server.ts`, 'utf-8')
|
tree.read(`test/src/app/remote-entry/entry.component.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/main.server.ts`, 'utf-8')
|
tree.read(`test/src/app/app.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(tree.read(`apps/test/server.ts`, 'utf-8')).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/module-federation.config.js`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/webpack.server.config.js`, 'utf-8')
|
tree.read(`test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/remote-entry/entry.component.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/app.routes.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
expect(
|
|
||||||
tree.read(`apps/test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(project.targets.server).toMatchSnapshot();
|
expect(project.targets.server).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
tree.read(`test/src/app/remote-entry/entry.routes.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(project.targets['static-server']).toMatchSnapshot();
|
expect(project.targets['static-server']).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
@ -272,4 +266,35 @@ describe('MF Remote App Generator', () => {
|
|||||||
.toThrow(stripIndents`The "standalone" option is only supported in Angular >= 14.1.0. You are currently using 14.0.0.
|
.toThrow(stripIndents`The "standalone" option is only supported in Angular >= 14.1.0. You are currently using 14.0.0.
|
||||||
You can resolve this error by removing the "standalone" option or by migrating to Angular 14.1.0.`);
|
You can resolve this error by removing the "standalone" option or by migrating to Angular 14.1.0.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('--project-name-and-root-format=derived', () => {
|
||||||
|
it('should generate remote', async () => {
|
||||||
|
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
|
|
||||||
|
await generateTestRemoteApplication(tree, {
|
||||||
|
name: 'test',
|
||||||
|
port: 4201,
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(tree.exists('apps/test/webpack.config.js')).toBe(true);
|
||||||
|
expect(readProjectConfiguration(tree, 'test').root).toBe('apps/test');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should generate remote in a directory', async () => {
|
||||||
|
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
|
|
||||||
|
await generateTestRemoteApplication(tree, {
|
||||||
|
name: 'test',
|
||||||
|
port: 4201,
|
||||||
|
directory: 'shared',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(tree.exists('apps/shared/test/webpack.config.js')).toBe(true);
|
||||||
|
expect(readProjectConfiguration(tree, 'shared-test').root).toBe(
|
||||||
|
'apps/shared/test'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,7 +11,7 @@ describe('scam-to-standalone', () => {
|
|||||||
await scamGenerator(tree, { name: 'bar', project: 'foo' });
|
await scamGenerator(tree, { name: 'bar', project: 'foo' });
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
'apps/foo/src/app/mymodule.module.ts',
|
'foo/src/app/mymodule.module.ts',
|
||||||
`import { BarComponentModule } from './bar/bar.component';
|
`import { BarComponentModule } from './bar/bar.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -25,7 +25,7 @@ describe('scam-to-standalone', () => {
|
|||||||
project: 'foo',
|
project: 'foo',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.read('apps/foo/src/app/bar/bar.component.ts', 'utf-8'))
|
expect(tree.read('foo/src/app/bar/bar.component.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { Component, NgModule } from '@angular/core';
|
"import { Component, NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
@ -41,7 +41,7 @@ describe('scam-to-standalone', () => {
|
|||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
|
|
||||||
expect(tree.read('apps/foo/src/app/mymodule.module.ts', 'utf-8'))
|
expect(tree.read('foo/src/app/mymodule.module.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { BarComponent } from './bar/bar.component';
|
"import { BarComponent } from './bar/bar.component';
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ describe('scam-to-standalone', () => {
|
|||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
|
|
||||||
expect(tree.read('apps/foo/src/app/bar/bar.component.spec.ts', 'utf-8'))
|
expect(tree.read('foo/src/app/bar/bar.component.spec.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { ComponentFixture, TestBed } from '@angular/core/testing';
|
"import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { BarComponent } from './bar.component';
|
import { BarComponent } from './bar.component';
|
||||||
|
|||||||
@ -94,7 +94,7 @@ exports[`Init MF should create webpack and mf configs correctly 4`] = `
|
|||||||
"module.exports = {
|
"module.exports = {
|
||||||
name: 'remote1',
|
name: 'remote1',
|
||||||
exposes: {
|
exposes: {
|
||||||
'./Module': 'apps/remote1/src/app/remote-entry/entry.module.ts',
|
'./Module': 'remote1/src/app/remote-entry/entry.module.ts',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
"
|
"
|
||||||
|
|||||||
@ -36,20 +36,15 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(tree.exists(`${app}/module-federation.config.js`)).toBeTruthy();
|
||||||
tree.exists(`apps/${app}/module-federation.config.js`)
|
expect(tree.exists(`${app}/webpack.config.js`)).toBeTruthy();
|
||||||
).toBeTruthy();
|
expect(tree.exists(`${app}/webpack.prod.config.js`)).toBeTruthy();
|
||||||
expect(tree.exists(`apps/${app}/webpack.config.js`)).toBeTruthy();
|
|
||||||
expect(tree.exists(`apps/${app}/webpack.prod.config.js`)).toBeTruthy();
|
|
||||||
|
|
||||||
const webpackContents = tree.read(
|
const webpackContents = tree.read(`${app}/webpack.config.js`, 'utf-8');
|
||||||
`apps/${app}/webpack.config.js`,
|
|
||||||
'utf-8'
|
|
||||||
);
|
|
||||||
expect(webpackContents).toMatchSnapshot();
|
expect(webpackContents).toMatchSnapshot();
|
||||||
|
|
||||||
const mfConfigContents = tree.read(
|
const mfConfigContents = tree.read(
|
||||||
`apps/${app}/module-federation.config.js`,
|
`${app}/module-federation.config.js`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
expect(mfConfigContents).toMatchSnapshot();
|
expect(mfConfigContents).toMatchSnapshot();
|
||||||
@ -63,7 +58,7 @@ describe('Init MF', () => {
|
|||||||
'create bootstrap file with the contents of main.ts',
|
'create bootstrap file with the contents of main.ts',
|
||||||
async (app, type: 'host' | 'remote') => {
|
async (app, type: 'host' | 'remote') => {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
const mainContents = tree.read(`apps/${app}/src/main.ts`, 'utf-8');
|
const mainContents = tree.read(`${app}/src/main.ts`, 'utf-8');
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
await setupMf(tree, {
|
await setupMf(tree, {
|
||||||
@ -72,11 +67,8 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const bootstrapContents = tree.read(
|
const bootstrapContents = tree.read(`${app}/src/bootstrap.ts`, 'utf-8');
|
||||||
`apps/${app}/src/bootstrap.ts`,
|
const updatedMainContents = tree.read(`${app}/src/main.ts`, 'utf-8');
|
||||||
'utf-8'
|
|
||||||
);
|
|
||||||
const updatedMainContents = tree.read(`apps/${app}/src/main.ts`, 'utf-8');
|
|
||||||
|
|
||||||
expect(bootstrapContents).toEqual(mainContents);
|
expect(bootstrapContents).toEqual(mainContents);
|
||||||
expect(updatedMainContents).not.toEqual(mainContents);
|
expect(updatedMainContents).not.toEqual(mainContents);
|
||||||
@ -90,7 +82,7 @@ describe('Init MF', () => {
|
|||||||
'should alter main.ts to import the bootstrap file dynamically',
|
'should alter main.ts to import the bootstrap file dynamically',
|
||||||
async (app, type: 'host' | 'remote') => {
|
async (app, type: 'host' | 'remote') => {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
const mainContents = tree.read(`apps/${app}/src/main.ts`, 'utf-8');
|
const mainContents = tree.read(`${app}/src/main.ts`, 'utf-8');
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
await setupMf(tree, {
|
await setupMf(tree, {
|
||||||
@ -99,7 +91,7 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const updatedMainContents = tree.read(`apps/${app}/src/main.ts`, 'utf-8');
|
const updatedMainContents = tree.read(`${app}/src/main.ts`, 'utf-8');
|
||||||
|
|
||||||
expect(updatedMainContents).toEqual(
|
expect(updatedMainContents).toEqual(
|
||||||
`import('./bootstrap').catch((err) => console.error(err));\n`
|
`import('./bootstrap').catch((err) => console.error(err));\n`
|
||||||
@ -130,7 +122,7 @@ describe('Init MF', () => {
|
|||||||
);
|
);
|
||||||
expect(build.executor).toEqual('@nx/angular:webpack-browser');
|
expect(build.executor).toEqual('@nx/angular:webpack-browser');
|
||||||
expect(build.options.customWebpackConfig.path).toEqual(
|
expect(build.options.customWebpackConfig.path).toEqual(
|
||||||
`apps/${app}/webpack.config.js`
|
`${app}/webpack.config.js`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -145,7 +137,7 @@ describe('Init MF', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const { build } = readProjectConfiguration(tree, 'app1').targets;
|
const { build } = readProjectConfiguration(tree, 'app1').targets;
|
||||||
expect(tree.exists('apps/app1/webpack.prod.config.js')).toBeFalsy();
|
expect(tree.exists('app1/webpack.prod.config.js')).toBeFalsy();
|
||||||
expect(build.configurations.production.customWebpackConfig).toBeUndefined();
|
expect(build.configurations.production.customWebpackConfig).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -159,10 +151,10 @@ describe('Init MF', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/remote1/src/app/remote-entry/entry.component.ts', 'utf-8')
|
tree.read('remote1/src/app/remote-entry/entry.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/remote1/src/app/remote-entry/entry.module.ts', 'utf-8')
|
tree.read('remote1/src/app/remote-entry/entry.module.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -172,7 +164,7 @@ describe('Init MF', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/remote1/src/app/remote-entry/entry.component.ts', 'utf-8')
|
tree.read('remote1/src/app/remote-entry/entry.component.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -186,7 +178,7 @@ describe('Init MF', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const mfConfigContents = tree.read(
|
const mfConfigContents = tree.read(
|
||||||
`apps/app1/module-federation.config.js`,
|
`app1/module-federation.config.js`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -208,10 +200,7 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const hostMfConfig = tree.read(
|
const hostMfConfig = tree.read('app1/module-federation.config.js', 'utf-8');
|
||||||
'apps/app1/module-federation.config.js',
|
|
||||||
'utf-8'
|
|
||||||
);
|
|
||||||
expect(hostMfConfig).toMatchSnapshot();
|
expect(hostMfConfig).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -242,10 +231,7 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const hostMfConfig = tree.read(
|
const hostMfConfig = tree.read('app1/module-federation.config.js', 'utf-8');
|
||||||
'apps/app1/module-federation.config.js',
|
|
||||||
'utf-8'
|
|
||||||
);
|
|
||||||
expect(hostMfConfig).toMatchSnapshot();
|
expect(hostMfConfig).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -280,7 +266,7 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const hostAppRoutes = tree.read('apps/app1/src/app/app.routes.ts', 'utf-8');
|
const hostAppRoutes = tree.read('app1/src/app/app.routes.ts', 'utf-8');
|
||||||
expect(hostAppRoutes).toMatchSnapshot();
|
expect(hostAppRoutes).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -301,7 +287,7 @@ describe('Init MF', () => {
|
|||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
const cypressCommands = tree.read(
|
const cypressCommands = tree.read(
|
||||||
'apps/test-app-e2e/src/support/e2e.ts',
|
'test-app-e2e/src/support/e2e.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
);
|
);
|
||||||
expect(cypressCommands).toContain(
|
expect(cypressCommands).toContain(
|
||||||
@ -320,13 +306,13 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
expect(tree.read('app1/module-federation.config.js', 'utf-8')).toContain(
|
||||||
|
'remotes: []'
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/app1/module-federation.config.js', 'utf-8')
|
tree.exists('app1/src/assets/module-federation.manifest.json')
|
||||||
).toContain('remotes: []');
|
|
||||||
expect(
|
|
||||||
tree.exists('apps/app1/src/assets/module-federation.manifest.json')
|
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(tree.read('apps/app1/src/main.ts', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('app1/src/main.ts', 'utf-8')).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -355,8 +341,7 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/ng14/src/bootstrap.ts', 'utf-8'))
|
expect(tree.read('ng14/src/bootstrap.ts', 'utf-8')).toMatchInlineSnapshot(`
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
"import { bootstrapApplication } from '@angular/platform-browser';
|
"import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
import { appConfig } from './app/app.config';
|
import { appConfig } from './app/app.config';
|
||||||
import { RemoteEntryComponent } from './app/remote-entry/entry.component';
|
import { RemoteEntryComponent } from './app/remote-entry/entry.component';
|
||||||
@ -392,17 +377,15 @@ describe('Init MF', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
|
expect(tree.read('app1/module-federation.config.js', 'utf-8')).toContain(
|
||||||
|
'remotes: []'
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
tree.read('apps/app1/module-federation.config.js', 'utf-8')
|
readJson(tree, 'app1/src/assets/module-federation.manifest.json')
|
||||||
).toContain('remotes: []');
|
|
||||||
expect(
|
|
||||||
readJson(tree, 'apps/app1/src/assets/module-federation.manifest.json')
|
|
||||||
).toEqual({
|
).toEqual({
|
||||||
remote1: 'http://localhost:4201',
|
remote1: 'http://localhost:4201',
|
||||||
});
|
});
|
||||||
expect(
|
expect(tree.read('app1/src/app/app.routes.ts', 'utf-8')).toMatchSnapshot();
|
||||||
tree.read('apps/app1/src/app/app.routes.ts', 'utf-8')
|
|
||||||
).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when installed version of angular < 14.1.0 and --standalone is used', async () => {
|
it('should throw an error when installed version of angular < 14.1.0 and --standalone is used', async () => {
|
||||||
|
|||||||
@ -20,9 +20,9 @@ exports[`setupSSR should create the files correctly for ssr 1`] = `
|
|||||||
],
|
],
|
||||||
"executor": "@angular-devkit/build-angular:server",
|
"executor": "@angular-devkit/build-angular:server",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "apps/app1/server.ts",
|
"main": "app1/server.ts",
|
||||||
"outputPath": "dist/apps/app1/server",
|
"outputPath": "dist/app1/server",
|
||||||
"tsConfig": "apps/app1/tsconfig.server.json",
|
"tsConfig": "app1/tsconfig.server.json",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -41,7 +41,7 @@ import { AppServerModule } from './src/main.server';
|
|||||||
// The Express app is exported so that it can be used by serverless Functions.
|
// The Express app is exported so that it can be used by serverless Functions.
|
||||||
export function app(): express.Express {
|
export function app(): express.Express {
|
||||||
const server = express();
|
const server = express();
|
||||||
const distFolder = join(process.cwd(), 'dist/apps/app1/browser');
|
const distFolder = join(process.cwd(), 'dist/app1/browser');
|
||||||
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
|
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
|
||||||
? 'index.original.html'
|
? 'index.original.html'
|
||||||
: 'index';
|
: 'index';
|
||||||
@ -122,9 +122,9 @@ exports[`setupSSR should create the files correctly for ssr when app is standalo
|
|||||||
],
|
],
|
||||||
"executor": "@angular-devkit/build-angular:server",
|
"executor": "@angular-devkit/build-angular:server",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "apps/app1/server.ts",
|
"main": "app1/server.ts",
|
||||||
"outputPath": "dist/apps/app1/server",
|
"outputPath": "dist/app1/server",
|
||||||
"tsConfig": "apps/app1/tsconfig.server.json",
|
"tsConfig": "app1/tsconfig.server.json",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@ -143,7 +143,7 @@ import bootstrap from './src/main.server';
|
|||||||
// The Express app is exported so that it can be used by serverless Functions.
|
// The Express app is exported so that it can be used by serverless Functions.
|
||||||
export function app(): express.Express {
|
export function app(): express.Express {
|
||||||
const server = express();
|
const server = express();
|
||||||
const distFolder = join(process.cwd(), 'dist/apps/app1/browser');
|
const distFolder = join(process.cwd(), 'dist/app1/browser');
|
||||||
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
|
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
|
||||||
? 'index.original.html'
|
? 'index.original.html'
|
||||||
: 'index';
|
: 'index';
|
||||||
@ -217,8 +217,8 @@ exports[`setupSSR should use fileReplacements if they already exist 1`] = `
|
|||||||
"production": {
|
"production": {
|
||||||
"fileReplacements": [
|
"fileReplacements": [
|
||||||
{
|
{
|
||||||
"replace": "apps/app1/src/environments/environment.ts",
|
"replace": "app1/src/environments/environment.ts",
|
||||||
"with": "apps/app1/src/environments/environment.prod.ts",
|
"with": "app1/src/environments/environment.prod.ts",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"outputHashing": "media",
|
"outputHashing": "media",
|
||||||
@ -230,9 +230,9 @@ exports[`setupSSR should use fileReplacements if they already exist 1`] = `
|
|||||||
],
|
],
|
||||||
"executor": "@angular-devkit/build-angular:server",
|
"executor": "@angular-devkit/build-angular:server",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "apps/app1/server.ts",
|
"main": "app1/server.ts",
|
||||||
"outputPath": "dist/apps/app1/server",
|
"outputPath": "dist/app1/server",
|
||||||
"tsConfig": "apps/app1/tsconfig.server.json",
|
"tsConfig": "app1/tsconfig.server.json",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -27,13 +27,13 @@ describe('setupSSR', () => {
|
|||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(tree, 'app1').targets.server
|
readProjectConfiguration(tree, 'app1').targets.server
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(tree.read('apps/app1/server.ts', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('app1/server.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(tree.read('apps/app1/src/main.server.ts', 'utf-8'))
|
expect(tree.read('app1/src/main.server.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"export { AppServerModule } from './app/app.server.module';
|
"export { AppServerModule } from './app/app.server.module';
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read('apps/app1/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
|
expect(tree.read('app1/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
|
||||||
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ describe('setupSSR', () => {
|
|||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read('apps/app1/tsconfig.server.json', 'utf-8'))
|
expect(tree.read('app1/tsconfig.server.json', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
"/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ describe('setupSSR', () => {
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read('apps/app1/src/app/app.server.module.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.server.module.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { NgModule } from '@angular/core';
|
"import { NgModule } from '@angular/core';
|
||||||
import { ServerModule } from '@angular/platform-server';
|
import { ServerModule } from '@angular/platform-server';
|
||||||
@ -71,7 +71,7 @@ describe('setupSSR', () => {
|
|||||||
export class AppServerModule {}
|
export class AppServerModule {}
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read('apps/app1/src/app/app.module.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.module.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { NgModule } from '@angular/core';
|
"import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
@ -128,13 +128,13 @@ describe('setupSSR', () => {
|
|||||||
name: 'app1',
|
name: 'app1',
|
||||||
});
|
});
|
||||||
|
|
||||||
tree.write('apps/app1/src/environments/environment.ts', '');
|
tree.write('app1/src/environments/environment.ts', '');
|
||||||
tree.write('apps/app1/src/environments/environment.prod.ts', '');
|
tree.write('app1/src/environments/environment.prod.ts', '');
|
||||||
const project = readProjectConfiguration(tree, 'app1');
|
const project = readProjectConfiguration(tree, 'app1');
|
||||||
project.targets.build.configurations.production.fileReplacements = [
|
project.targets.build.configurations.production.fileReplacements = [
|
||||||
{
|
{
|
||||||
replace: 'apps/app1/src/environments/environment.ts',
|
replace: 'app1/src/environments/environment.ts',
|
||||||
with: 'apps/app1/src/environments/environment.prod.ts',
|
with: 'app1/src/environments/environment.prod.ts',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
updateProjectConfiguration(tree, 'app1', project);
|
updateProjectConfiguration(tree, 'app1', project);
|
||||||
@ -164,8 +164,8 @@ describe('setupSSR', () => {
|
|||||||
expect(
|
expect(
|
||||||
readProjectConfiguration(tree, 'app1').targets.server
|
readProjectConfiguration(tree, 'app1').targets.server
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(tree.read('apps/app1/server.ts', 'utf-8')).toMatchSnapshot();
|
expect(tree.read('app1/server.ts', 'utf-8')).toMatchSnapshot();
|
||||||
expect(tree.read('apps/app1/src/main.server.ts', 'utf-8'))
|
expect(tree.read('app1/src/main.server.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { bootstrapApplication } from '@angular/platform-browser';
|
"import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
import { AppComponent } from './app/app.component';
|
import { AppComponent } from './app/app.component';
|
||||||
@ -176,7 +176,7 @@ describe('setupSSR', () => {
|
|||||||
export default bootstrap;
|
export default bootstrap;
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read('apps/app1/tsconfig.server.json', 'utf-8'))
|
expect(tree.read('app1/tsconfig.server.json', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
"/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||||
{
|
{
|
||||||
@ -190,7 +190,7 @@ describe('setupSSR', () => {
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read('apps/app1/src/app/app.config.server.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.config.server.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
"import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
||||||
import { provideServerRendering } from '@angular/platform-server';
|
import { provideServerRendering } from '@angular/platform-server';
|
||||||
@ -249,7 +249,7 @@ describe('setupSSR', () => {
|
|||||||
await setupSsr(tree, { project: 'app1', hydration: true });
|
await setupSsr(tree, { project: 'app1', hydration: true });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/app1/src/app/app.module.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.module.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { NgModule } from '@angular/core';
|
"import { NgModule } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
@ -283,7 +283,7 @@ describe('setupSSR', () => {
|
|||||||
await setupSsr(tree, { project: 'app1', hydration: true });
|
await setupSsr(tree, { project: 'app1', hydration: true });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/app1/src/app/app.config.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.config.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { ApplicationConfig } from '@angular/core';
|
"import { ApplicationConfig } from '@angular/core';
|
||||||
import { provideClientHydration } from '@angular/platform-browser';
|
import { provideClientHydration } from '@angular/platform-browser';
|
||||||
@ -294,7 +294,7 @@ describe('setupSSR', () => {
|
|||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
|
|
||||||
expect(tree.read('apps/app1/src/app/app.config.server.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.config.server.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
"import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
||||||
import { provideServerRendering } from '@angular/platform-server';
|
import { provideServerRendering } from '@angular/platform-server';
|
||||||
@ -356,7 +356,7 @@ describe('setupSSR', () => {
|
|||||||
await setupSsr(tree, { project: 'app1' });
|
await setupSsr(tree, { project: 'app1' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/app1/src/main.server.ts', 'utf-8'))
|
expect(tree.read('app1/src/main.server.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"/***************************************************************************************************
|
"/***************************************************************************************************
|
||||||
* Initialize the server environment - for example, adding DOM built-in types to the global scope.
|
* Initialize the server environment - for example, adding DOM built-in types to the global scope.
|
||||||
@ -389,7 +389,7 @@ describe('setupSSR', () => {
|
|||||||
await setupSsr(tree, { project: 'app1' });
|
await setupSsr(tree, { project: 'app1' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/app1/src/app/app.module.ts', 'utf-8'))
|
expect(tree.read('app1/src/app/app.module.ts', 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"import { NgModule } from '@angular/core';
|
"import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
@ -422,8 +422,7 @@ describe('setupSSR', () => {
|
|||||||
await setupSsr(tree, { project: 'app1' });
|
await setupSsr(tree, { project: 'app1' });
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read('apps/app1/src/main.ts', 'utf-8'))
|
expect(tree.read('app1/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
|
||||||
.toMatchInlineSnapshot(`
|
|
||||||
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
import { AppModule } from './app/app.module';
|
import { AppModule } from './app/app.module';
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ describe('angularStories generator: applications', () => {
|
|||||||
await angularStoriesGenerator(tree, { name: appName });
|
await angularStoriesGenerator(tree, { name: appName });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read(`apps/${appName}/src/app/app.component.stories.ts`, 'utf-8')
|
tree.read(`${appName}/src/app/app.component.stories.ts`, 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -42,9 +42,7 @@ describe('angularStories generator: applications', () => {
|
|||||||
await angularStoriesGenerator(tree, { name: appName });
|
await angularStoriesGenerator(tree, { name: appName });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(`${appName}/src/app/my-scam/my-scam.component.stories.ts`)
|
||||||
`apps/${appName}/src/app/my-scam/my-scam.component.stories.ts`
|
|
||||||
)
|
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -53,13 +51,11 @@ describe('angularStories generator: applications', () => {
|
|||||||
|
|
||||||
await angularStoriesGenerator(tree, {
|
await angularStoriesGenerator(tree, {
|
||||||
name: appName,
|
name: appName,
|
||||||
ignorePaths: [`apps/${appName}/src/app/my-scam/**`],
|
ignorePaths: [`${appName}/src/app/my-scam/**`],
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(`${appName}/src/app/my-scam/my-scam.component.stories.ts`)
|
||||||
`apps/${appName}/src/app/my-scam/my-scam.component.stories.ts`
|
|
||||||
)
|
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -68,13 +64,11 @@ describe('angularStories generator: applications', () => {
|
|||||||
|
|
||||||
await angularStoriesGenerator(tree, {
|
await angularStoriesGenerator(tree, {
|
||||||
name: appName,
|
name: appName,
|
||||||
ignorePaths: [`apps/${appName}/src/app/my-scam/my-scam.component.ts`],
|
ignorePaths: [`${appName}/src/app/my-scam/my-scam.component.ts`],
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(`${appName}/src/app/my-scam/my-scam.component.stories.ts`)
|
||||||
`apps/${appName}/src/app/my-scam/my-scam.component.stories.ts`
|
|
||||||
)
|
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,27 +81,25 @@ describe('angularStories generator: applications', () => {
|
|||||||
|
|
||||||
await angularStoriesGenerator(tree, {
|
await angularStoriesGenerator(tree, {
|
||||||
name: appName,
|
name: appName,
|
||||||
ignorePaths: [
|
ignorePaths: [`${appName}/src/app/component-a/component-a.component.ts`],
|
||||||
`apps/${appName}/src/app/component-a/component-a.component.ts`,
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`apps/${appName}/src/app/component-a/component-b/component-b.component.stories.ts`,
|
`${appName}/src/app/component-a/component-b/component-b.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`apps/${appName}/src/app/component-a/component-a.component.stories.ts`
|
`${appName}/src/app/component-a/component-a.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should ignore a path when using a routing module', async () => {
|
it('should ignore a path when using a routing module', async () => {
|
||||||
tree.write(
|
tree.write(
|
||||||
`apps/${appName}/src/app/component/component.module.ts`,
|
`${appName}/src/app/component/component.module.ts`,
|
||||||
stripIndents`
|
stripIndents`
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
@ -116,7 +108,7 @@ describe('angularStories generator: applications', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
`apps/${appName}/src/app/component/component-routing.module.ts`,
|
`${appName}/src/app/component/component-routing.module.ts`,
|
||||||
stripIndents`
|
stripIndents`
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
@ -138,17 +130,17 @@ describe('angularStories generator: applications', () => {
|
|||||||
|
|
||||||
await angularStoriesGenerator(tree, {
|
await angularStoriesGenerator(tree, {
|
||||||
name: appName,
|
name: appName,
|
||||||
ignorePaths: [`apps/${appName}/src/app/app.component.ts`],
|
ignorePaths: [`${appName}/src/app/app.component.ts`],
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`apps/${appName}/src/app/component/component.component.stories.ts`,
|
`${appName}/src/app/component/component.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(`apps/${appName}/src/app/app.component.stories.ts`)
|
tree.exists(`${appName}/src/app/app.component.stories.ts`)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -163,7 +155,7 @@ describe('angularStories generator: applications', () => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`apps/${appName}/src/app/my-scam/my-scam.component.stories.ts`,
|
`${appName}/src/app/my-scam/my-scam.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
|
|||||||
@ -53,7 +53,7 @@ describe('angularStories generator: libraries', () => {
|
|||||||
|
|
||||||
it('should generate stories.ts files', async () => {
|
it('should generate stories.ts files', async () => {
|
||||||
// add secondary entrypoint
|
// add secondary entrypoint
|
||||||
writeJson(tree, `libs/${libName}/package.json`, { name: libName });
|
writeJson(tree, `${libName}/package.json`, { name: libName });
|
||||||
await librarySecondaryEntryPointGenerator(tree, {
|
await librarySecondaryEntryPointGenerator(tree, {
|
||||||
library: libName,
|
library: libName,
|
||||||
name: 'secondary-entry-point',
|
name: 'secondary-entry-point',
|
||||||
@ -62,40 +62,40 @@ describe('angularStories generator: libraries', () => {
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-button',
|
name: 'secondary-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await angularStoriesGenerator(tree, { name: libName });
|
await angularStoriesGenerator(tree, { name: libName });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/barrel/barrel-button/barrel-button.component.stories.ts`
|
`${libName}/src/lib/barrel/barrel-button/barrel-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/nested/nested-button/nested-button.component.stories.ts`
|
`${libName}/src/lib/nested/nested-button/nested-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.stories.ts`
|
`${libName}/src/lib/test-button/test-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/test-other/test-other.component.stories.ts`
|
`${libName}/src/lib/test-other/test-other.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.stories.ts`,
|
`${libName}/src/lib/test-button/test-button.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts`
|
`${libName}/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
@ -118,12 +118,12 @@ describe('angularStories generator: libraries', () => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.stories.ts`
|
`${libName}/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.stories.ts`
|
`${libName}/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
@ -135,17 +135,17 @@ describe('angularStories generator: libraries', () => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.stories.ts`
|
`${libName}/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.stories.ts`
|
`${libName}/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.stories.ts`
|
`${libName}/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
@ -157,12 +157,12 @@ describe('angularStories generator: libraries', () => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/static-member-declarations/cmp1/cmp1.component.stories.ts`
|
`${libName}/src/lib/static-member-declarations/cmp1/cmp1.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/static-member-declarations/cmp2/cmp2.component.stories.ts`
|
`${libName}/src/lib/static-member-declarations/cmp2/cmp2.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
@ -173,9 +173,7 @@ describe('angularStories generator: libraries', () => {
|
|||||||
await angularStoriesGenerator(tree, { name: libName });
|
await angularStoriesGenerator(tree, { name: libName });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(`${libName}/src/lib/my-scam/my-scam.component.stories.ts`)
|
||||||
`libs/${libName}/src/lib/my-scam/my-scam.component.stories.ts`
|
|
||||||
)
|
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -189,9 +187,7 @@ describe('angularStories generator: libraries', () => {
|
|||||||
await angularStoriesGenerator(tree, { name: libName });
|
await angularStoriesGenerator(tree, { name: libName });
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(`${libName}/src/lib/my-scam/my-scam.component.stories.ts`)
|
||||||
`libs/${libName}/src/lib/my-scam/my-scam.component.stories.ts`
|
|
||||||
)
|
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -203,7 +199,7 @@ describe('angularStories generator: libraries', () => {
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
});
|
});
|
||||||
// add secondary entrypoint
|
// add secondary entrypoint
|
||||||
writeJson(tree, `libs/${libName}/package.json`, { name: libName });
|
writeJson(tree, `${libName}/package.json`, { name: libName });
|
||||||
await librarySecondaryEntryPointGenerator(tree, {
|
await librarySecondaryEntryPointGenerator(tree, {
|
||||||
library: libName,
|
library: libName,
|
||||||
name: 'secondary-entry-point',
|
name: 'secondary-entry-point',
|
||||||
@ -212,7 +208,7 @@ describe('angularStories generator: libraries', () => {
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-standalone',
|
name: 'secondary-standalone',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
standalone: true,
|
standalone: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -220,23 +216,23 @@ describe('angularStories generator: libraries', () => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/standalone/standalone.component.stories.ts`
|
`${libName}/src/lib/standalone/standalone.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`libs/${libName}/src/lib/standalone/standalone.component.stories.ts`,
|
`${libName}/src/lib/standalone/standalone.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts`
|
`${libName}/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`libs/${libName}/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts`,
|
`${libName}/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
@ -244,7 +240,7 @@ describe('angularStories generator: libraries', () => {
|
|||||||
|
|
||||||
it('should ignore paths', async () => {
|
it('should ignore paths', async () => {
|
||||||
// add secondary entrypoint
|
// add secondary entrypoint
|
||||||
writeJson(tree, `libs/${libName}/package.json`, { name: libName });
|
writeJson(tree, `${libName}/package.json`, { name: libName });
|
||||||
await librarySecondaryEntryPointGenerator(tree, {
|
await librarySecondaryEntryPointGenerator(tree, {
|
||||||
library: libName,
|
library: libName,
|
||||||
name: 'secondary-entry-point',
|
name: 'secondary-entry-point',
|
||||||
@ -253,46 +249,46 @@ describe('angularStories generator: libraries', () => {
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-button',
|
name: 'secondary-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await angularStoriesGenerator(tree, {
|
await angularStoriesGenerator(tree, {
|
||||||
name: libName,
|
name: libName,
|
||||||
ignorePaths: [
|
ignorePaths: [
|
||||||
`libs/${libName}/src/lib/barrel/**`,
|
`${libName}/src/lib/barrel/**`,
|
||||||
`libs/${libName}/secondary-entry-point/**`,
|
`${libName}/secondary-entry-point/**`,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/barrel/barrel-button/barrel-button.component.stories.ts`
|
`${libName}/src/lib/barrel/barrel-button/barrel-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/nested/nested-button/nested-button.component.stories.ts`
|
`${libName}/src/lib/nested/nested-button/nested-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.stories.ts`
|
`${libName}/src/lib/test-button/test-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/src/lib/test-other/test-other.component.stories.ts`
|
`${libName}/src/lib/test-other/test-other.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.stories.ts`,
|
`${libName}/src/lib/test-button/test-button.component.stories.ts`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
`libs/${libName}/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts`
|
`${libName}/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts`
|
||||||
)
|
)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -97,102 +97,102 @@ exports[`StorybookConfiguration generator should generate in the correct folder
|
|||||||
"jest.config.ts",
|
"jest.config.ts",
|
||||||
"jest.preset.js",
|
"jest.preset.js",
|
||||||
"libs/.gitignore",
|
"libs/.gitignore",
|
||||||
"libs/test-ui-lib/.eslintrc.json",
|
|
||||||
"libs/test-ui-lib/.storybook/main.ts",
|
|
||||||
"libs/test-ui-lib/.storybook/preview.ts",
|
|
||||||
"libs/test-ui-lib/.storybook/tsconfig.json",
|
|
||||||
"libs/test-ui-lib/jest.config.ts",
|
|
||||||
"libs/test-ui-lib/package.json",
|
|
||||||
"libs/test-ui-lib/project.json",
|
|
||||||
"libs/test-ui-lib/README.md",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/ng-package.json",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/README.md",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/index.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.css",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.html",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-entry-point.module.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.css",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.html",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.ts",
|
|
||||||
"libs/test-ui-lib/src/index.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/index.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/static-member-declarations.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-ui-lib.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare.module.ts",
|
|
||||||
"libs/test-ui-lib/src/test-setup.ts",
|
|
||||||
"libs/test-ui-lib/tsconfig.json",
|
|
||||||
"libs/test-ui-lib/tsconfig.lib.json",
|
|
||||||
"libs/test-ui-lib/tsconfig.spec.json",
|
|
||||||
"nx.json",
|
"nx.json",
|
||||||
"package.json",
|
"package.json",
|
||||||
|
"test-ui-lib/.eslintrc.json",
|
||||||
|
"test-ui-lib/.storybook/main.ts",
|
||||||
|
"test-ui-lib/.storybook/preview.ts",
|
||||||
|
"test-ui-lib/.storybook/tsconfig.json",
|
||||||
|
"test-ui-lib/jest.config.ts",
|
||||||
|
"test-ui-lib/package.json",
|
||||||
|
"test-ui-lib/project.json",
|
||||||
|
"test-ui-lib/README.md",
|
||||||
|
"test-ui-lib/secondary-entry-point/ng-package.json",
|
||||||
|
"test-ui-lib/secondary-entry-point/README.md",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/index.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.css",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.html",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.spec.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-entry-point.module.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.css",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.html",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.spec.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.ts",
|
||||||
|
"test-ui-lib/src/index.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/index.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel.module.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested.module.ts",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.css",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.html",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.css",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.html",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.css",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.html",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/static-member-declarations.module.ts",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.css",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.html",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.ts",
|
||||||
|
"test-ui-lib/src/lib/test-ui-lib.module.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare.module.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare.module.ts",
|
||||||
|
"test-ui-lib/src/test-setup.ts",
|
||||||
|
"test-ui-lib/tsconfig.json",
|
||||||
|
"test-ui-lib/tsconfig.lib.json",
|
||||||
|
"test-ui-lib/tsconfig.spec.json",
|
||||||
"tsconfig.base.json",
|
"tsconfig.base.json",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
@ -208,102 +208,102 @@ exports[`StorybookConfiguration generator should generate the right files 1`] =
|
|||||||
"jest.config.ts",
|
"jest.config.ts",
|
||||||
"jest.preset.js",
|
"jest.preset.js",
|
||||||
"libs/.gitignore",
|
"libs/.gitignore",
|
||||||
"libs/test-ui-lib/.eslintrc.json",
|
|
||||||
"libs/test-ui-lib/.storybook/main.ts",
|
|
||||||
"libs/test-ui-lib/.storybook/preview.ts",
|
|
||||||
"libs/test-ui-lib/.storybook/tsconfig.json",
|
|
||||||
"libs/test-ui-lib/jest.config.ts",
|
|
||||||
"libs/test-ui-lib/package.json",
|
|
||||||
"libs/test-ui-lib/project.json",
|
|
||||||
"libs/test-ui-lib/README.md",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/ng-package.json",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/README.md",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/index.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.css",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.html",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-entry-point.module.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.css",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.html",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.ts",
|
|
||||||
"libs/test-ui-lib/src/index.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel-button/index.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/barrel/barrel.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested-button/nested-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/nested/nested.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/standalone/standalone.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/static-member-declarations/static-member-declarations.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-button/test-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-other/test-other.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/test-ui-lib.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-declare/variable-declare.module.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.css",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.html",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.spec.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.stories.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.ts",
|
|
||||||
"libs/test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare.module.ts",
|
|
||||||
"libs/test-ui-lib/src/test-setup.ts",
|
|
||||||
"libs/test-ui-lib/tsconfig.json",
|
|
||||||
"libs/test-ui-lib/tsconfig.lib.json",
|
|
||||||
"libs/test-ui-lib/tsconfig.spec.json",
|
|
||||||
"nx.json",
|
"nx.json",
|
||||||
"package.json",
|
"package.json",
|
||||||
|
"test-ui-lib/.eslintrc.json",
|
||||||
|
"test-ui-lib/.storybook/main.ts",
|
||||||
|
"test-ui-lib/.storybook/preview.ts",
|
||||||
|
"test-ui-lib/.storybook/tsconfig.json",
|
||||||
|
"test-ui-lib/jest.config.ts",
|
||||||
|
"test-ui-lib/package.json",
|
||||||
|
"test-ui-lib/project.json",
|
||||||
|
"test-ui-lib/README.md",
|
||||||
|
"test-ui-lib/secondary-entry-point/ng-package.json",
|
||||||
|
"test-ui-lib/secondary-entry-point/README.md",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/index.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.css",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.html",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.spec.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.stories.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-button/secondary-button.component.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-entry-point.module.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.css",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.html",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.spec.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.stories.ts",
|
||||||
|
"test-ui-lib/secondary-entry-point/src/lib/secondary-standalone/secondary-standalone.component.ts",
|
||||||
|
"test-ui-lib/src/index.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/barrel-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel-button/index.ts",
|
||||||
|
"test-ui-lib/src/lib/barrel/barrel.module.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested-button/nested-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/nested/nested.module.ts",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.css",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.html",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/standalone/standalone.component.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.css",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.html",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp1/cmp1.component.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.css",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.html",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/cmp2/cmp2.component.ts",
|
||||||
|
"test-ui-lib/src/lib/static-member-declarations/static-member-declarations.module.ts",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/test-button/test-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.css",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.html",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/test-other/test-other.component.ts",
|
||||||
|
"test-ui-lib/src/lib/test-ui-lib.module.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-button/variable-declare-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare-view/variable-declare-view.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-declare/variable-declare.module.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-anotherview/variable-spread-declare-anotherview.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-button/variable-spread-declare-button.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.css",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.html",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.spec.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.stories.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare-view/variable-spread-declare-view.component.ts",
|
||||||
|
"test-ui-lib/src/lib/variable-spread-declare/variable-spread-declare.module.ts",
|
||||||
|
"test-ui-lib/src/test-setup.ts",
|
||||||
|
"test-ui-lib/tsconfig.json",
|
||||||
|
"test-ui-lib/tsconfig.lib.json",
|
||||||
|
"test-ui-lib/tsconfig.spec.json",
|
||||||
"tsconfig.base.json",
|
"tsconfig.base.json",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -50,18 +50,16 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
generateStories: false,
|
generateStories: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.exists('libs/test-ui-lib/.storybook/main.ts')).toBeTruthy();
|
expect(tree.exists('test-ui-lib/.storybook/main.ts')).toBeTruthy();
|
||||||
expect(
|
expect(tree.exists('test-ui-lib/.storybook/tsconfig.json')).toBeTruthy();
|
||||||
tree.exists('libs/test-ui-lib/.storybook/tsconfig.json')
|
|
||||||
).toBeTruthy();
|
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
'libs/test-ui-lib/src/lib/test-button/test-button.component.stories.ts'
|
'test-ui-lib/src/lib/test-button/test-button.component.stories.ts'
|
||||||
)
|
)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
expect(
|
expect(
|
||||||
tree.exists(
|
tree.exists(
|
||||||
'libs/test-ui-lib/src/lib/test-other/test-other.component.stories.ts'
|
'test-ui-lib/src/lib/test-other/test-other.component.stories.ts'
|
||||||
)
|
)
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
@ -74,7 +72,7 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
tree.read('libs/test-ui-lib/.storybook/main.ts', 'utf-8')
|
tree.read('test-ui-lib/.storybook/main.ts', 'utf-8')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -84,19 +82,17 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
generateStories: true,
|
generateStories: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(tree.exists('libs/test-ui-lib/.storybook/main.ts')).toBeTruthy();
|
expect(tree.exists('test-ui-lib/.storybook/main.ts')).toBeTruthy();
|
||||||
expect(
|
expect(tree.exists('test-ui-lib/.storybook/tsconfig.json')).toBeTruthy();
|
||||||
tree.exists('libs/test-ui-lib/.storybook/tsconfig.json')
|
|
||||||
).toBeTruthy();
|
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
'libs/test-ui-lib/src/lib/test-button/test-button.component.stories.ts',
|
'test-ui-lib/src/lib/test-button/test-button.component.stories.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
expect(
|
expect(
|
||||||
tree.read(
|
tree.read(
|
||||||
'libs/test-ui-lib/src/lib/test-other/test-other.component.stories.ts',
|
'test-ui-lib/src/lib/test-other/test-other.component.stories.ts',
|
||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
@ -120,7 +116,7 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
});
|
});
|
||||||
// add secondary entrypoint
|
// add secondary entrypoint
|
||||||
writeJson(tree, `libs/${libName}/package.json`, { name: libName });
|
writeJson(tree, `${libName}/package.json`, { name: libName });
|
||||||
await librarySecondaryEntryPointGenerator(tree, {
|
await librarySecondaryEntryPointGenerator(tree, {
|
||||||
library: libName,
|
library: libName,
|
||||||
name: 'secondary-entry-point',
|
name: 'secondary-entry-point',
|
||||||
@ -129,14 +125,14 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-button',
|
name: 'secondary-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
export: true,
|
export: true,
|
||||||
});
|
});
|
||||||
// add a standalone component to the secondary entrypoint
|
// add a standalone component to the secondary entrypoint
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-standalone',
|
name: 'secondary-standalone',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
standalone: true,
|
standalone: true,
|
||||||
export: true,
|
export: true,
|
||||||
});
|
});
|
||||||
@ -157,7 +153,7 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
standalone: true,
|
standalone: true,
|
||||||
});
|
});
|
||||||
// add secondary entrypoint
|
// add secondary entrypoint
|
||||||
writeJson(tree, `libs/${libName}/package.json`, { name: libName });
|
writeJson(tree, `${libName}/package.json`, { name: libName });
|
||||||
await librarySecondaryEntryPointGenerator(tree, {
|
await librarySecondaryEntryPointGenerator(tree, {
|
||||||
library: libName,
|
library: libName,
|
||||||
name: 'secondary-entry-point',
|
name: 'secondary-entry-point',
|
||||||
@ -166,14 +162,14 @@ describe('StorybookConfiguration generator', () => {
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-button',
|
name: 'secondary-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
export: true,
|
export: true,
|
||||||
});
|
});
|
||||||
// add a standalone component to the secondary entrypoint
|
// add a standalone component to the secondary entrypoint
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'secondary-standalone',
|
name: 'secondary-standalone',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/secondary-entry-point/src/lib`,
|
path: `${libName}/secondary-entry-point/src/lib`,
|
||||||
standalone: true,
|
standalone: true,
|
||||||
export: true,
|
export: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -20,7 +20,10 @@ export async function generateTestApplication(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
addAngularPluginPeerDeps(tree);
|
addAngularPluginPeerDeps(tree);
|
||||||
tree.write('.gitignore', '');
|
tree.write('.gitignore', '');
|
||||||
await applicationGenerator(tree, options);
|
await applicationGenerator(tree, {
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
|
...options,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateTestHostApplication(
|
export async function generateTestHostApplication(
|
||||||
@ -29,7 +32,7 @@ export async function generateTestHostApplication(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
addAngularPluginPeerDeps(tree);
|
addAngularPluginPeerDeps(tree);
|
||||||
tree.write('.gitignore', '');
|
tree.write('.gitignore', '');
|
||||||
await host(tree, options);
|
await host(tree, { projectNameAndRootFormat: 'as-provided', ...options });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateTestRemoteApplication(
|
export async function generateTestRemoteApplication(
|
||||||
@ -38,7 +41,7 @@ export async function generateTestRemoteApplication(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
addAngularPluginPeerDeps(tree);
|
addAngularPluginPeerDeps(tree);
|
||||||
tree.write('.gitignore', '');
|
tree.write('.gitignore', '');
|
||||||
await remote(tree, options);
|
await remote(tree, { projectNameAndRootFormat: 'as-provided', ...options });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateTestLibrary(
|
export async function generateTestLibrary(
|
||||||
@ -47,7 +50,10 @@ export async function generateTestLibrary(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
addAngularPluginPeerDeps(tree);
|
addAngularPluginPeerDeps(tree);
|
||||||
tree.write('.gitignore', '');
|
tree.write('.gitignore', '');
|
||||||
await libraryGenerator(tree, options);
|
await libraryGenerator(tree, {
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
|
...options,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createStorybookTestWorkspaceForLib(
|
export async function createStorybookTestWorkspaceForLib(
|
||||||
@ -65,6 +71,7 @@ export async function createStorybookTestWorkspaceForLib(
|
|||||||
simpleName: false,
|
simpleName: false,
|
||||||
skipFormat: false,
|
skipFormat: false,
|
||||||
unitTestRunner: UnitTestRunner.Jest,
|
unitTestRunner: UnitTestRunner.Jest,
|
||||||
|
projectNameAndRootFormat: 'as-provided',
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
@ -73,7 +80,7 @@ export async function createStorybookTestWorkspaceForLib(
|
|||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.ts`,
|
`${libName}/src/lib/test-button/test-button.component.ts`,
|
||||||
`import { Component, Input } from '@angular/core';
|
`import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
export type ButtonStyle = 'default' | 'primary' | 'accent';
|
||||||
@ -92,11 +99,11 @@ export class TestButtonComponent {
|
|||||||
);
|
);
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/test-button/test-button.component.html`,
|
`${libName}/src/lib/test-button/test-button.component.html`,
|
||||||
`<button [attr.type]="type" [ngClass]="style"></button>`
|
`<button [attr.type]="type" [ngClass]="style"></button>`
|
||||||
);
|
);
|
||||||
|
|
||||||
const modulePath = `libs/${libName}/src/lib/${libName}.module.ts`;
|
const modulePath = `${libName}/src/lib/${libName}.module.ts`;
|
||||||
tree.write(
|
tree.write(
|
||||||
modulePath,
|
modulePath,
|
||||||
`import * as ButtonExports from './test-button/test-button.component';
|
`import * as ButtonExports from './test-button/test-button.component';
|
||||||
@ -112,17 +119,17 @@ export class TestButtonComponent {
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'barrel-button',
|
name: 'barrel-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/barrel`,
|
path: `${libName}/src/lib/barrel`,
|
||||||
module: 'barrel',
|
module: 'barrel',
|
||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/barrel/barrel-button/index.ts`,
|
`${libName}/src/lib/barrel/barrel-button/index.ts`,
|
||||||
`export * from './barrel-button.component';`
|
`export * from './barrel-button.component';`
|
||||||
);
|
);
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/barrel/barrel.module.ts`,
|
`${libName}/src/lib/barrel/barrel.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { BarrelButtonComponent } from './barrel-button';
|
import { BarrelButtonComponent } from './barrel-button';
|
||||||
@ -143,19 +150,19 @@ export class BarrelModule {}`
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'variable-declare-button',
|
name: 'variable-declare-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/variable-declare`,
|
path: `${libName}/src/lib/variable-declare`,
|
||||||
module: 'variable-declare',
|
module: 'variable-declare',
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'variable-declare-view',
|
name: 'variable-declare-view',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/variable-declare`,
|
path: `${libName}/src/lib/variable-declare`,
|
||||||
module: 'variable-declare',
|
module: 'variable-declare',
|
||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/variable-declare/variable-declare.module.ts`,
|
`${libName}/src/lib/variable-declare/variable-declare.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { VariableDeclareButtonComponent } from './variable-declare-button/variable-declare-button.component';
|
import { VariableDeclareButtonComponent } from './variable-declare-button/variable-declare-button.component';
|
||||||
@ -183,26 +190,26 @@ export class VariableDeclareModule {}`
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'variable-spread-declare-button',
|
name: 'variable-spread-declare-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/variable-spread-declare`,
|
path: `${libName}/src/lib/variable-spread-declare`,
|
||||||
module: 'variable-spread-declare',
|
module: 'variable-spread-declare',
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'variable-spread-declare-view',
|
name: 'variable-spread-declare-view',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/variable-spread-declare`,
|
path: `${libName}/src/lib/variable-spread-declare`,
|
||||||
module: 'variable-spread-declare',
|
module: 'variable-spread-declare',
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'variable-spread-declare-anotherview',
|
name: 'variable-spread-declare-anotherview',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/variable-spread-declare`,
|
path: `${libName}/src/lib/variable-spread-declare`,
|
||||||
module: 'variable-spread-declare',
|
module: 'variable-spread-declare',
|
||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/variable-spread-declare/variable-spread-declare.module.ts`,
|
`${libName}/src/lib/variable-spread-declare/variable-spread-declare.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { VariableSpreadDeclareButtonComponent } from './variable-spread-declare-button/variable-spread-declare-button.component';
|
import { VariableSpreadDeclareButtonComponent } from './variable-spread-declare-button/variable-spread-declare-button.component';
|
||||||
@ -230,19 +237,19 @@ export class VariableSpreadDeclareModule {}`
|
|||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'cmp1',
|
name: 'cmp1',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/static-member-declarations`,
|
path: `${libName}/src/lib/static-member-declarations`,
|
||||||
module: 'static-member-declarations',
|
module: 'static-member-declarations',
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'cmp2',
|
name: 'cmp2',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib/static-member-declarations`,
|
path: `${libName}/src/lib/static-member-declarations`,
|
||||||
module: 'static-member-declarations',
|
module: 'static-member-declarations',
|
||||||
});
|
});
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
`libs/${libName}/src/lib/static-member-declarations/static-member-declarations.module.ts`,
|
`${libName}/src/lib/static-member-declarations/static-member-declarations.module.ts`,
|
||||||
`import { NgModule } from '@angular/core';
|
`import { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { Cmp1Component } from './cmp1/cmp1.component';
|
import { Cmp1Component } from './cmp1/cmp1.component';
|
||||||
@ -262,14 +269,14 @@ export class StaticMemberDeclarationsModule {
|
|||||||
generateModule(tree, {
|
generateModule(tree, {
|
||||||
name: 'nested',
|
name: 'nested',
|
||||||
project: libName,
|
project: libName,
|
||||||
path: `libs/${libName}/src/lib`,
|
path: `${libName}/src/lib`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
name: 'nested-button',
|
name: 'nested-button',
|
||||||
project: libName,
|
project: libName,
|
||||||
module: 'nested',
|
module: 'nested',
|
||||||
path: `libs/${libName}/src/lib/nested`,
|
path: `${libName}/src/lib/nested`,
|
||||||
});
|
});
|
||||||
|
|
||||||
await componentGenerator(tree, {
|
await componentGenerator(tree, {
|
||||||
|
|||||||
@ -17,16 +17,16 @@ describe('webWorker generator', () => {
|
|||||||
it('should generate files', async () => {
|
it('should generate files', async () => {
|
||||||
await webWorkerGenerator(tree, { name: 'test-worker', project: appName });
|
await webWorkerGenerator(tree, { name: 'test-worker', project: appName });
|
||||||
|
|
||||||
expect(tree.exists(`apps/${appName}/tsconfig.worker.json`));
|
expect(tree.exists(`${appName}/tsconfig.worker.json`));
|
||||||
expect(tree.exists(`apps/${appName}/src/app/test-worker.worker.ts`));
|
expect(tree.exists(`${appName}/src/app/test-worker.worker.ts`));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extend from tsconfig.base.json', async () => {
|
it('should extend from tsconfig.base.json', async () => {
|
||||||
await webWorkerGenerator(tree, { name: 'test-worker', project: appName });
|
await webWorkerGenerator(tree, { name: 'test-worker', project: appName });
|
||||||
|
|
||||||
expect(
|
expect(tree.read(`${appName}/tsconfig.worker.json`, 'utf-8')).toContain(
|
||||||
tree.read(`apps/${appName}/tsconfig.worker.json`, 'utf-8')
|
'"extends": "../tsconfig.base.json"'
|
||||||
).toContain('"extends": "../../tsconfig.base.json"');
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should extend from tsconfig.json when used instead of tsconfig.base.json', async () => {
|
it('should extend from tsconfig.json when used instead of tsconfig.base.json', async () => {
|
||||||
@ -34,9 +34,9 @@ describe('webWorker generator', () => {
|
|||||||
|
|
||||||
await webWorkerGenerator(tree, { name: 'test-worker', project: appName });
|
await webWorkerGenerator(tree, { name: 'test-worker', project: appName });
|
||||||
|
|
||||||
expect(
|
expect(tree.read(`${appName}/tsconfig.worker.json`, 'utf-8')).toContain(
|
||||||
tree.read(`apps/${appName}/tsconfig.worker.json`, 'utf-8')
|
'"extends": "../tsconfig.json"'
|
||||||
).toContain('"extends": "../../tsconfig.json"');
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should format files', async () => {
|
it('should format files', async () => {
|
||||||
@ -61,7 +61,7 @@ describe('webWorker generator', () => {
|
|||||||
|
|
||||||
it('should add the snippet correctly', async () => {
|
it('should add the snippet correctly', async () => {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
tree.write(`apps/${appName}/src/app/test-worker.ts`, ``);
|
tree.write(`${appName}/src/app/test-worker.ts`, ``);
|
||||||
|
|
||||||
// ACT
|
// ACT
|
||||||
await webWorkerGenerator(tree, {
|
await webWorkerGenerator(tree, {
|
||||||
@ -71,7 +71,7 @@ describe('webWorker generator', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ASSERT
|
// ASSERT
|
||||||
expect(tree.read(`apps/${appName}/src/app/test-worker.ts`, 'utf-8'))
|
expect(tree.read(`${appName}/src/app/test-worker.ts`, 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"if (typeof Worker !== 'undefined') {
|
"if (typeof Worker !== 'undefined') {
|
||||||
// Create a new
|
// Create a new
|
||||||
@ -86,7 +86,7 @@ describe('webWorker generator', () => {
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
`);
|
`);
|
||||||
expect(tree.read(`apps/${appName}/src/app/test-worker.worker.ts`, 'utf-8'))
|
expect(tree.read(`${appName}/src/app/test-worker.worker.ts`, 'utf-8'))
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
"/// <reference lib="webworker" />
|
"/// <reference lib="webworker" />
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,10 @@ describe('renameWebpackServer', () => {
|
|||||||
it('should rename webpack-server to webpack-dev-server correctly', async () => {
|
it('should rename webpack-server to webpack-dev-server correctly', async () => {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
await generateTestRemoteApplication(tree, { name: 'remote' });
|
await generateTestRemoteApplication(tree, {
|
||||||
|
name: 'remote',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
|
});
|
||||||
|
|
||||||
updateJson(tree, 'apps/remote/project.json', (json) => {
|
updateJson(tree, 'apps/remote/project.json', (json) => {
|
||||||
json.targets.serve.executor = '@nrwl/angular:webpack-server';
|
json.targets.serve.executor = '@nrwl/angular:webpack-server';
|
||||||
|
|||||||
@ -12,6 +12,7 @@ describe('Migration to delete Browserslist configurations', () => {
|
|||||||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
await generateTestApplication(tree, {
|
await generateTestApplication(tree, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -16,10 +16,12 @@ describe('Migration to update target and add useDefineForClassFields', () => {
|
|||||||
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
await generateTestApplication(tree, {
|
await generateTestApplication(tree, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
});
|
});
|
||||||
await generateTestApplication(tree, {
|
await generateTestApplication(tree, {
|
||||||
name: 'karma',
|
name: 'karma',
|
||||||
unitTestRunner: UnitTestRunner.None,
|
unitTestRunner: UnitTestRunner.None,
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
});
|
});
|
||||||
|
|
||||||
const karmaProject = readProjectConfiguration(tree, 'karma');
|
const karmaProject = readProjectConfiguration(tree, 'karma');
|
||||||
|
|||||||
@ -12,6 +12,7 @@ describe(`Migration to remove bundleDependencies`, () => {
|
|||||||
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
const tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
||||||
await generateTestApplication(tree, {
|
await generateTestApplication(tree, {
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
});
|
});
|
||||||
|
|
||||||
const project = readProjectConfiguration(tree, 'test');
|
const project = readProjectConfiguration(tree, 'test');
|
||||||
|
|||||||
@ -74,6 +74,7 @@ async function setup(tree: Tree, name: string) {
|
|||||||
await generateTestApplication(tree, {
|
await generateTestApplication(tree, {
|
||||||
name,
|
name,
|
||||||
skipPackageJson: true,
|
skipPackageJson: true,
|
||||||
|
projectNameAndRootFormat: 'derived',
|
||||||
});
|
});
|
||||||
|
|
||||||
const projectConfig = readProjectConfiguration(tree, name);
|
const projectConfig = readProjectConfiguration(tree, name);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export function createApp(
|
|||||||
// save for getAppDir() lookup by external *.spec.ts tests
|
// save for getAppDir() lookup by external *.spec.ts tests
|
||||||
appConfig = {
|
appConfig = {
|
||||||
appName,
|
appName,
|
||||||
appModule: `/apps/${appName}/src/app/app.module.ts`,
|
appModule: `${appName}/src/app/app.module.ts`,
|
||||||
};
|
};
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
@ -51,7 +51,7 @@ export function createApp(
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
`/apps/${appName}/src/main.ts`,
|
`${appName}/src/main.ts`,
|
||||||
`
|
`
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
@ -63,24 +63,24 @@ export function createApp(
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
`/apps/${appName}/tsconfig.app.json`,
|
`${appName}/tsconfig.app.json`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
include: ['**/*.ts'],
|
include: ['**/*.ts'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
tree.write(
|
tree.write(
|
||||||
`/apps/${appName}-e2e/tsconfig.e2e.json`,
|
`${appName}-e2e/tsconfig.e2e.json`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
include: ['../**/*.ts'],
|
include: ['../**/*.ts'],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
addProjectConfiguration(tree, appName, {
|
addProjectConfiguration(tree, appName, {
|
||||||
root: `apps/${appName}`,
|
root: `${appName}`,
|
||||||
sourceRoot: `apps/${appName}/src`,
|
sourceRoot: `${appName}/src`,
|
||||||
targets: {
|
targets: {
|
||||||
build: {
|
build: {
|
||||||
options: {
|
options: {
|
||||||
main: `apps/${appName}/src/main.ts`,
|
main: `${appName}/src/main.ts`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
serve: {
|
serve: {
|
||||||
@ -96,8 +96,8 @@ export function createLib(tree: Tree, libName: string) {
|
|||||||
|
|
||||||
libConfig = {
|
libConfig = {
|
||||||
name,
|
name,
|
||||||
module: `/libs/${propertyName}/src/lib/${fileName}.module.ts`,
|
module: `${propertyName}/src/lib/${fileName}.module.ts`,
|
||||||
barrel: `/libs/${propertyName}/src/index.ts`,
|
barrel: `${propertyName}/src/index.ts`,
|
||||||
};
|
};
|
||||||
|
|
||||||
tree.write(
|
tree.write(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user