Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(angular): incremental build generators #5

Draft
wants to merge 117 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
8acdcb6
feat(angular: generate convert-to-buildable generator
LayZeeDK Jan 6, 2021
9c541fe
feat(angular): add convert-to-buildable generator
LayZeeDK Jan 6, 2021
3425916
feat(angular): [WIP] convert-to-buildable
LayZeeDK Jan 6, 2021
760f3ea
docs: change "folder" to "directory"
LayZeeDK Jan 6, 2021
eed4058
test: add missing file declarations
LayZeeDK Jan 6, 2021
633985d
feat(angular): fix file generation
LayZeeDK Jan 6, 2021
0e4bf43
refactor(angular): restructure convert-to-buildable files
LayZeeDK Jan 6, 2021
66775f3
refactor(angular): rename addNgPackagr
LayZeeDK Jan 6, 2021
f71f246
test(angular): rename variables
LayZeeDK Jan 6, 2021
f7ee046
feat(angular): accept source root folder in readImportPathOrThrow
LayZeeDK Jan 7, 2021
88286d8
test(angular): use sourceRoot property
LayZeeDK Jan 7, 2021
f6ee20b
feat(angular): normalize import source path based on OS
LayZeeDK Jan 7, 2021
3277bef
test(angular): add integration tests for convert-to-buildable generator
LayZeeDK Jan 7, 2021
723b37f
chore: sort test project paths
LayZeeDK Jan 8, 2021
5a1efa2
chore: correct coverage directory
LayZeeDK Jan 8, 2021
78a9ea3
feat(angular): remove auto-generated executor and generator
LayZeeDK Jan 8, 2021
13ef6f7
test(angular): add e2e test for convert-to-buildable generator
LayZeeDK Jan 8, 2021
08b129f
test(angular): cover adding ng-packagr
LayZeeDK Jan 8, 2021
9466eff
feat: remove auto-generated build executor
LayZeeDK Jan 9, 2021
2833ad3
feat(angular): add build target to specified library project
LayZeeDK Jan 10, 2021
659f5fb
test(angular): cover addLibraryBuildTarget with unit test
LayZeeDK Jan 10, 2021
804da84
test(angular): cover adding build target in integration test
LayZeeDK Jan 10, 2021
9bca070
docs(angular): add missing parenthesis in log message
LayZeeDK Jan 10, 2021
e335502
feat(angular): add guard checks to addLibraryBuildTarget
LayZeeDK Jan 10, 2021
45d2ad8
feat(angular): add updateApplicationBuildTarget, refactor normalized …
LayZeeDK Jan 10, 2021
06a5c06
feat(angular): remove unused types
LayZeeDK Jan 10, 2021
2e50afd
docs(angular): improve internal documentation
LayZeeDK Jan 10, 2021
63a0e9e
feat(angular): support application project in convert-to-buildable ge…
LayZeeDK Jan 10, 2021
2890e41
test(angular): try to fix pnpm install in e2e tests
LayZeeDK Jan 10, 2021
e5fa525
chore(angular): delete unused file
LayZeeDK Jan 11, 2021
ab871c2
test(angular): use Yarn for end-to-end tests
LayZeeDK Jan 11, 2021
b8ddee7
style: format
LayZeeDK Jan 11, 2021
a89d9c4
test(angular): fix default collection
LayZeeDK Jan 11, 2021
1c96f34
test(angular): fix e2e workspace
LayZeeDK Jan 11, 2021
6d9d678
chore: skip Nx cache for e2e tests on CI
LayZeeDK Jan 11, 2021
999e57b
test(angular): remove unused e2e test
LayZeeDK Jan 11, 2021
4c20b60
feat: specify ng-packagr version
LayZeeDK Jan 12, 2021
b187009
chore: increase e2e test timeout
LayZeeDK Jan 12, 2021
5e001de
test(angular): use unique library name prefix
LayZeeDK Jan 12, 2021
135e9ad
test(angular): adjust unit test
LayZeeDK Jan 12, 2021
9cc9d95
chore: remove reference to missing configuration
LayZeeDK Jan 12, 2021
ef28a7e
feat(internal): generate e2e-util library
LayZeeDK Jan 12, 2021
cf3ec0a
refactor: convert .d.ts files to .ts
LayZeeDK Jan 12, 2021
a75e8bf
test: extract e2e-util library
LayZeeDK Jan 12, 2021
c7d7684
test(angular): cover library build target
LayZeeDK Jan 12, 2021
16adb02
test(angular): simplify e2e tests
LayZeeDK Jan 12, 2021
f768700
feat(angular): make importPath optional
LayZeeDK Jan 12, 2021
aadf608
test(angular): increase test timeout... again
LayZeeDK Jan 12, 2021
e4d5ddd
feat(angular): make it run
LayZeeDK Jan 12, 2021
0e90a51
test(angular): cover application project e2e
LayZeeDK Jan 12, 2021
431a884
test(angular): extract e2e utility, simplify setup
LayZeeDK Jan 13, 2021
2e09f9c
test(angular): rename usePackageManager
LayZeeDK Jan 13, 2021
51c5254
test(angular): lift setup
LayZeeDK Jan 13, 2021
9584d6e
test(angular): remove usePackageManager usage
LayZeeDK Jan 13, 2021
1beaaf9
chore: remove explicit package manager setting
LayZeeDK Jan 13, 2021
57d4bec
Merge branch 'main' into angular/feat/incremental-build-generators
LayZeeDK Jan 13, 2021
7d90026
test: remove incorrect types
LayZeeDK Jan 13, 2021
dae6e7d
test(angular): remove reference to deleted file
LayZeeDK Jan 13, 2021
4f7c94b
test(angular): fix e2e tests in CI pipeline
LayZeeDK Jan 13, 2021
83df8bf
chore: expose Node API in e2e-util
LayZeeDK Jan 14, 2021
dcdf183
test(angular): fix pnpm install issue in CI
LayZeeDK Jan 14, 2021
3ee5221
test(angular): another e2e fix attempt
LayZeeDK Jan 14, 2021
c21a7da
test(angular): fix PNPM in e2e
LayZeeDK Jan 14, 2021
86e6259
test(angular): fix PNPM in e2e
LayZeeDK Jan 14, 2021
ace54cc
Revert "test(angular): fix PNPM in e2e"
LayZeeDK Jan 14, 2021
7de77de
test(angular): extract PNPM install fix
LayZeeDK Jan 14, 2021
c09e147
test(angular): lift e2e setup
LayZeeDK Jan 14, 2021
5bca412
chore: remove unnecessary NPM configuration
LayZeeDK Jan 14, 2021
7c9e299
test: configure lib types
LayZeeDK Jan 14, 2021
e18e476
test(angular): group library test cases
LayZeeDK Jan 14, 2021
fa5d726
feat: generate internal test util library
LayZeeDK Jan 14, 2021
650fa96
feat(internal): add Angular library generator
LayZeeDK Jan 14, 2021
fa87662
feat: generate @nxworker/shared package
LayZeeDK Jan 14, 2021
504d364
style: format
LayZeeDK Jan 14, 2021
bccba86
chore: ignore PNPM lockfile when formatting
LayZeeDK Jan 14, 2021
0c815c7
chore: lock dependencies
LayZeeDK Jan 14, 2021
a35a633
refactor: correct imports
LayZeeDK Jan 14, 2021
f3d9248
chore: trigger pipeline run
LayZeeDK Jan 14, 2021
ff6bb77
chore: delete debug comment
LayZeeDK Jan 14, 2021
2398f6e
Merge branch 'main' into angular/feat/incremental-build-generators
LayZeeDK Jan 14, 2021
8537d23
refactor: remove moved file reference
LayZeeDK Jan 14, 2021
1b9ac0e
test(angular): fix e2e tests
LayZeeDK Jan 14, 2021
2e62a49
test(angular): fix e2e test in CI
LayZeeDK Jan 14, 2021
0e7b650
refactor: remove shared package usage from angular package
LayZeeDK Jan 15, 2021
317af10
refactor: copy file type test-util library
LayZeeDK Jan 15, 2021
3abdac4
refactor: remove shared package usage from test-util
LayZeeDK Jan 15, 2021
4a5edf4
refactor: remove shared package
LayZeeDK Jan 15, 2021
c8e4e2f
Merge branch 'main' into angular/feat/incremental-build-generators
LayZeeDK Jan 15, 2021
29c8a17
refactor(angular): extract use-incremental-build generator
LayZeeDK Jan 15, 2021
070f1ee
test(angular): integration test use-incremental-build generator
LayZeeDK Jan 15, 2021
da2ecb9
test(angular): split e2e tests
LayZeeDK Jan 16, 2021
4f4fda8
chore: run e2e tests in serial
LayZeeDK Jan 16, 2021
8ca49c2
test(angular): enable e2e test
LayZeeDK Jan 16, 2021
9104e76
style: format
LayZeeDK Jan 16, 2021
defbcef
test(angular): fix imports
LayZeeDK Jan 16, 2021
f743886
feat(angular): update build scripts
LayZeeDK Jan 16, 2021
df28559
test(angular): fix test
LayZeeDK Jan 16, 2021
869b667
test(angular): fix e2e in CI pipeline
LayZeeDK Jan 16, 2021
982ffc7
test(angular): extract useDefaultBaseBranch e2e utility
LayZeeDK Jan 17, 2021
ecf29df
style: lint
LayZeeDK Jan 17, 2021
ae2b6e4
test(angular): refactor convert-to-buildable integration test
LayZeeDK Jan 17, 2021
d1fac46
test(angular): organize properties
LayZeeDK Jan 17, 2021
2ac5739
test(angular): refactor unit test for addLibraryBuildTarget
LayZeeDK Jan 17, 2021
dc55a79
test(angular): refactor addNgPackagr unit test
LayZeeDK Jan 17, 2021
f94e006
test(angular): refactor unit test for generateBuildableLibraryConfigu…
LayZeeDK Jan 17, 2021
3f9af47
test(angular): refactor convert-to-buildable integration test, extrac…
LayZeeDK Jan 17, 2021
e2e8be3
style: format
LayZeeDK Jan 17, 2021
96dff41
test(angular): allow test util import in spec file
LayZeeDK Jan 17, 2021
3cab7c2
fix(angular): use Nx beta to fix build target for buildable Angular l…
LayZeeDK Jan 25, 2021
1cc8fd2
refactor: remove PNPM e2e CI fix
LayZeeDK Jan 25, 2021
ca34232
chore: update Nx
LayZeeDK Jan 28, 2021
237916e
test(angular): update Nx requirements in e2e tests
LayZeeDK Jan 28, 2021
2ed1f7a
style: refer disabled code to PR
LayZeeDK Jan 29, 2021
48346f3
fix(angular): fix writeJson
LayZeeDK Jan 30, 2021
9bcd4ca
test(angular): cover updateApplicationBuildTarget
LayZeeDK Jan 30, 2021
a53b9bf
test(angular): cover happy paths of updateBuildScripts
LayZeeDK Jan 30, 2021
edf9963
Merge branch 'main' into angular/feat/incremental-build-generators
LayZeeDK Feb 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@
"platform:node"
]
},
{
"sourceTag": "scope:internal",
"onlyDependOnLibsWithTags": ["scope:internal", "scope:shared"]
},
{
"sourceTag": "type:e2e",
"onlyDependOnLibsWithTags": ["type:package"]
"onlyDependOnLibsWithTags": ["type:package", "type:e2e-util"]
},
{
"sourceTag": "type:e2e-util",
"onlyDependOnLibsWithTags": ["type:e2e-util"]
},
{
"sourceTag": "type:tool",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ jobs:
--verify-store-integrity false
- run: pnpm store prune

- run: pnpm e2e
- run: pnpm e2e -- --skip-nx-cache
5 changes: 3 additions & 2 deletions e2e/angular-e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ module.exports = {
tsConfig: '<rootDir>/tsconfig.spec.json',
},
},
testTimeout: 30000,
runner: 'jest-serial-runner',
testTimeout: 120_000,
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2eangular-e2e',
coverageDirectory: '../../coverage/e2e/angular-e2e',
};
62 changes: 0 additions & 62 deletions e2e/angular-e2e/tests/angular.spec.ts

This file was deleted.

61 changes: 61 additions & 0 deletions e2e/angular-e2e/tests/convert-to-buildable.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { addPackages } from '@internal/e2e-util';
import {
checkFilesExist,
copyNodeModules,
ensureNxProject,
readJson,
runNxCommandAsync,
uniq,
} from '@nrwl/nx-plugin/testing';
import * as path from 'path';

describe('@nxworker/angular:convert-to-buildable generator e2e', () => {
beforeAll(() => {
copyNodeModules(['@nrwl/angular', 'ng-packagr']);
ensureNxProject('@nxworker/angular', 'dist/packages/angular');
addPackages({
devDependencies: {
['@nrwl/angular']: '^11.2.0 || >=11.2.0-rc.2',
},
});
});

beforeEach(async () => {
projectName = uniq('convert-to-buildable');
await runNxCommandAsync(`generate @nrwl/angular:library ${projectName}`);
});

let projectName: string;

it('generates buildable library configurations', async () => {
const configurationFileNames = [
'ng-package.json',
'package.json',
'tsconfig.lib.prod.json',
].map(fileName => path.join('libs', projectName, fileName));

await runNxCommandAsync(
`generate @nxworker/angular:convert-to-buildable ${projectName}`
);

expect(() => checkFilesExist(...configurationFileNames)).not.toThrow();
});

it('adds ng-packagr', async () => {
await runNxCommandAsync(
`generate @nxworker/angular:convert-to-buildable ${projectName}`
);

const { devDependencies = {} } = readJson('package.json');
expect(devDependencies['ng-packagr']).toBeDefined();
});

it('adds a "build" execution target', async () => {
await runNxCommandAsync(
`generate @nxworker/angular:convert-to-buildable ${projectName}`
);

const result = await runNxCommandAsync(`build ${projectName}`);
expect(result.stdout).toContain('Built Angular Package');
});
});
61 changes: 61 additions & 0 deletions e2e/angular-e2e/tests/use-incremental-build.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { addPackages, useDefaultBaseBranch } from '@internal/e2e-util';
import {
copyNodeModules,
ensureNxProject,
runCommandAsync,
runNxCommandAsync,
uniq,
} from '@nrwl/nx-plugin/testing';

describe('@nxworker/angular:use-incremental-build generator e2e', () => {
beforeAll(() => {
copyNodeModules(['@nrwl/angular']);
ensureNxProject('@nxworker/angular', 'dist/packages/angular');
addPackages({
devDependencies: {
['@nrwl/angular']: '^11.2.0 || >=11.2.0-rc.2',
},
});
useDefaultBaseBranch('main');
});

beforeEach(async () => {
projectName = uniq('use-incremental-build');
await runNxCommandAsync(
`generate @nrwl/angular:application ${projectName}`
);
});

let projectName: string;

it('updates the "build" execution target', async () => {
await runNxCommandAsync(
`generate @nxworker/angular:use-incremental-build ${projectName}`
);

const result = await runNxCommandAsync(
`build ${projectName} --parallel --with-deps`
);
expect(result.stdout).toContain('Running target "build" succeeded');
});

it('updates the "build" script', async () => {
await runNxCommandAsync(
`generate @nxworker/angular:use-incremental-build ${projectName}`
);

const result = await runCommandAsync(`npm run build -- ${projectName}`);
expect(result.stdout).toContain('Running target "build" succeeded');
});

it('updates the "affected:build" script', async () => {
await runNxCommandAsync(
`generate @nxworker/angular:use-incremental-build ${projectName}`
);

const result = await runCommandAsync(
`npm run affected:build -- --base=remotes/origin/main`
);
expect(result.stdout).toContain('Running target "build" succeeded');
});
});
3 changes: 0 additions & 3 deletions e2e/angular-e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
},
{
"path": "./tsconfig.spec.json"
}
Expand Down
20 changes: 11 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
module.exports = {
projects: [
'<rootDir>/e2e/angular-e2e',
'<rootDir>/packages/angular',
'<rootDir>/tools',
'<rootDir>/e2e/examples/angular/nrwl-airlines/booking/desktop-app',
'<rootDir>/e2e/examples/angular/nrwl-airlines/booking/mobile-app',
'<rootDir>/e2e/examples/angular/nrwl-airlines/check-in/desktop-app',
'<rootDir>/e2e/examples/angular/nrwl-airlines/check-in/mobile-app',
'<rootDir>/packages/examples/angular/nrwl-airlines/shared/root/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/check-in/root/feature-shell',
'<rootDir>/packages/examples/angular/nrwl-airlines/check-in/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/shared/ui-buttons',
'<rootDir>/packages/examples/angular/nrwl-airlines/shared/util-formatting',
'<rootDir>/packages/examples/angular/nrwl-airlines/seatmap/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/seatmap/feature-seat-listing',
'<rootDir>/packages/angular',
'<rootDir>/packages/examples/angular/nrwl-airlines/booking/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/booking/feature-flight-search',
'<rootDir>/packages/examples/angular/nrwl-airlines/booking/feature-passenger-info',
'<rootDir>/packages/examples/angular/nrwl-airlines/booking/root/feature-shell',
'<rootDir>/packages/examples/angular/nrwl-airlines/check-in/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/check-in/root/feature-shell',
'<rootDir>/packages/examples/angular/nrwl-airlines/seatmap/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/seatmap/feature-seat-listing',
'<rootDir>/packages/examples/angular/nrwl-airlines/shared/root/data-access',
'<rootDir>/packages/examples/angular/nrwl-airlines/shared/ui-buttons',
'<rootDir>/packages/examples/angular/nrwl-airlines/shared/util-formatting',
'<rootDir>/packages/internal/e2e-util',
'<rootDir>/packages/internal/test-util',
'<rootDir>/tools',
],
};
6 changes: 6 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@
"examples-angular-nrwl-airlines-shared-util-formatting": {
"tags": ["domain:shared", "platform:web", "scope:shared", "type:util"]
},
"internal-e2e-util": {
"tags": ["platform:node", "scope:internal", "type:e2e-util"]
},
"internal-test-util": {
"tags": ["platform:node", "scope:internal", "type:test-util"]
},
"workspace-tools": {
"tags": ["platform:node", "type:tool"]
}
Expand Down
Loading