Skip to content

Commit

Permalink
version for webpack rc.6
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Oct 10, 2020
1 parent 47eda1e commit 291d35f
Show file tree
Hide file tree
Showing 15 changed files with 13,297 additions and 156 deletions.
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#bfc3d8",
"activityBar.activeBorder": "#ab747d",
"activityBar.background": "#bfc3d8",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#ab747d",
"activityBarBadge.foreground": "#15202b",
"statusBar.background": "#9fa6c5",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#7f89b2",
"titleBar.activeBackground": "#9fa6c5",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#9fa6c599",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#9fa6c5"
}
2 changes: 2 additions & 0 deletions e2e/mf-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
displayName: 'mf-e2e',
preset: '../../jest.preset.js',
verbose: true,
silent: false,
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
Expand Down
50 changes: 15 additions & 35 deletions e2e/mf-e2e/tests/mf.test.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
import {
checkFilesExist,
ensureNxProject,
readJson,
runNxCommandAsync,
uniq,
} from '@nrwl/nx-plugin/testing';

import * as fs from 'fs';
import { angularJson } from './test-files';

describe('mf e2e', () => {
it('should create mf', async (done) => {
const plugin = uniq('mf');
ensureNxProject('@angular-architects/mf', 'dist/packages/mf');
await runNxCommandAsync(`generate @angular-architects/mf:mf ${plugin}`);
ensureNxProject('@angular-architects/module-federation', 'dist/packages/mf');

fs.unlinkSync('tmp/nx-e2e/proj/workspace.json');
fs.writeFileSync('tmp/nx-e2e/proj/angular.json', angularJson);
fs.mkdirSync('tmp/nx-e2e/proj/apps/shell');

const result = await runNxCommandAsync(`build ${plugin}`);
expect(result.stdout).toContain('Builder ran');
await runNxCommandAsync(`generate @angular-architects/module-federation:init shell 5000`);

done();
});
expect(fs.existsSync('tmp/nx-e2e/proj/apps/shell/webpack.config.js')).toBeTruthy();
expect(fs.existsSync('tmp/nx-e2e/proj/apps/shell/webpack.prod.config.js')).toBeTruthy();

describe('--directory', () => {
it('should create src in the specified directory', async (done) => {
const plugin = uniq('mf');
ensureNxProject('@angular-architects/mf', 'dist/packages/mf');
await runNxCommandAsync(
`generate @angular-architects/mf:mf ${plugin} --directory subdir`
);
expect(() =>
checkFilesExist(`libs/subdir/${plugin}/src/index.ts`)
).not.toThrow();
done();
});
});
done();
}, 90000);

describe('--tags', () => {
it('should add tags to nx.json', async (done) => {
const plugin = uniq('mf');
ensureNxProject('@angular-architects/mf', 'dist/packages/mf');
await runNxCommandAsync(
`generate @angular-architects/mf:mf ${plugin} --tags e2etag,e2ePackage`
);
const nxJson = readJson('nx.json');
expect(nxJson.projects[plugin].tags).toEqual(['e2etag', 'e2ePackage']);
done();
});
});

});
241 changes: 241 additions & 0 deletions e2e/mf-e2e/tests/test-files.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
export const angularJson = `
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"mfe1": {
"projectType": "application",
"schematics": {},
"root": "apps/mfe1",
"sourceRoot": "apps/mfe1/src",
"prefix": "app",
"architect": {
"build": {
"builder": "",
"options": {
"outputPath": "dist/mfe1",
"index": "apps/mfe1/src/index.html",
"main": "apps/mfe1/src/main.ts",
"polyfills": "apps/mfe1/src/polyfills.ts",
"tsConfig": "apps/mfe1/tsconfig.app.json",
"aot": true,
"assets": [
"apps/mfe1/src/favicon.ico",
"apps/mfe1/src/assets"
],
"styles": [],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/mfe1/src/environments/environment.ts",
"with": "apps/mfe1/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "",
"options": {
"browserTarget": "mfe1:build"
},
"configurations": {
"production": {
"browserTarget": "mfe1:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "mfe1:build"
}
},
"test": {
"builder": "",
"options": {
"main": "apps/mfe1/src/test.ts",
"polyfills": "apps/mfe1/src/polyfills.ts",
"tsConfig": "apps/mfe1/tsconfig.spec.json",
"karmaConfig": "apps/mfe1/karma.conf.js",
"assets": [
"apps/mfe1/src/favicon.ico",
"apps/mfe1/src/assets"
],
"styles": [
"apps/mfe1/src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/mfe1/tsconfig.app.json",
"apps/mfe1/tsconfig.spec.json",
"apps/mfe1/e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "apps/mfe1/e2e/protractor.conf.js",
"devServerTarget": "mfe1:serve"
},
"configurations": {
"production": {
"devServerTarget": "mfe1:serve:production"
}
}
}
}
},
"shell": {
"projectType": "application",
"schematics": {},
"root": "apps/shell",
"sourceRoot": "apps/shell/src",
"prefix": "app",
"architect": {
"build": {
"builder": "",
"options": {
"outputPath": "dist/shell",
"index": "apps/shell/src/index.html",
"main": "apps/shell/src/main.ts",
"polyfills": "apps/shell/src/polyfills.ts",
"tsConfig": "apps/shell/tsconfig.app.json",
"aot": true,
"assets": [
"apps/shell/src/favicon.ico",
"apps/shell/src/assets"
],
"styles": [],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/shell/src/environments/environment.ts",
"with": "apps/shell/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "",
"options": {
"browserTarget": "shell:build"
},
"configurations": {
"production": {
"browserTarget": "shell:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "shell:build"
}
},
"test": {
"builder": "",
"options": {
"main": "apps/shell/src/test.ts",
"polyfills": "apps/shell/src/polyfills.ts",
"tsConfig": "apps/shell/tsconfig.spec.json",
"karmaConfig": "apps/shell/karma.conf.js",
"assets": [
"apps/shell/src/favicon.ico",
"apps/shell/src/assets"
],
"styles": [],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/shell/tsconfig.app.json",
"apps/shell/tsconfig.spec.json",
"apps/shell/e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "apps/shell/e2e/protractor.conf.js",
"devServerTarget": "shell:serve"
},
"configurations": {
"production": {
"devServerTarget": "shell:serve:production"
}
}
}
}
}
},
"defaultProject": "mfe1",
"cli": {
"packageManager": "yarn"
}
}
`


2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
"cacheableOperations": []
}
}
},
Expand Down
Loading

0 comments on commit 291d35f

Please sign in to comment.