| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eceb5cd commit fe280b2
28 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,128 @@ | |||
| 1 | + # Copyright Google Inc. All Rights Reserved. | ||
| 2 | + # | ||
| 3 | + # Use of this source code is governed by an MIT-style license that can be | ||
| 4 | + # found in the LICENSE file at https://angular.io/license | ||
| 5 | + | ||
| 6 | + licenses(["notice"]) # MIT | ||
| 7 | + | ||
| 8 | + load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") | ||
| 9 | + load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test") | ||
| 10 | + load("@npm_bazel_typescript//:index.bzl", "ts_library") | ||
| 11 | + load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm") | ||
| 12 | + load("//tools:ts_json_schema.bzl", "ts_json_schema") | ||
| 13 | + | ||
| 14 | + package(default_visibility = ["//visibility:public"]) | ||
| 15 | + | ||
| 16 | + ts_json_schema( | ||
| 17 | + name = "webpack_schema", | ||
| 18 | + src = "src/webpack/schema.json", | ||
| 19 | + ) | ||
| 20 | + | ||
| 21 | + ts_json_schema( | ||
| 22 | + name = "webpack_dev_server_schema", | ||
| 23 | + src = "src/webpack-dev-server/schema.json", | ||
| 24 | + ) | ||
| 25 | + | ||
| 26 | + ts_library( | ||
| 27 | + name = "build_webpack", | ||
| 28 | + srcs = glob( | ||
| 29 | + include = ["src/**/*.ts"], | ||
| 30 | + exclude = [ | ||
| 31 | + "src/test-utils.ts", | ||
| 32 | + "src/**/*_spec.ts", | ||
| 33 | + ], | ||
| 34 | + ) + [ | ||
| 35 | + "//packages/angular_devkit/build_webpack:src/webpack/schema.ts", | ||
| 36 | + "//packages/angular_devkit/build_webpack:src/webpack-dev-server/schema.ts", | ||
| 37 | + ], | ||
| 38 | + data = glob( | ||
| 39 | + include = [ | ||
| 40 | + "package.json", | ||
| 41 | + "builders.json", | ||
| 42 | + "src/webpack/schema.json", | ||
| 43 | + "src/webpack-dev-server/schema.json", | ||
| 44 | + ], | ||
| 45 | + ), | ||
| 46 | + devmode_module = "commonjs", | ||
| 47 | + devmode_target = "es2018", | ||
| 48 | + module_name = "@angular-devkit/build-webpack", | ||
| 49 | + module_root = "src/index.d.ts", | ||
| 50 | + deps = [ | ||
| 51 | + "//packages/angular_devkit/architect", | ||
| 52 | + "//packages/angular_devkit/core", | ||
| 53 | + "@npm//@types/node", | ||
| 54 | + "@npm//@types/webpack", | ||
| 55 | + "@npm//@types/webpack-dev-server", | ||
| 56 | + "@npm//rxjs", | ||
| 57 | + "@npm//webpack", | ||
| 58 | + "@npm//webpack-dev-server", | ||
| 59 | + ], | ||
| 60 | + ) | ||
| 61 | + | ||
| 62 | + ts_library( | ||
| 63 | + name = "build_webpack_test_lib", | ||
| 64 | + testonly = True, | ||
| 65 | + srcs = glob( | ||
| 66 | + include = [ | ||
| 67 | + "src/test-utils.ts", | ||
| 68 | + "src/**/*_spec.ts", | ||
| 69 | + ], | ||
| 70 | + ), | ||
| 71 | + data = glob( | ||
| 72 | + include = [ | ||
| 73 | + "test/**/*", | ||
| 74 | + ], | ||
| 75 | + ), | ||
| 76 | + devmode_module = "commonjs", | ||
| 77 | + devmode_target = "es2018", | ||
| 78 | + tsconfig = "//:tsconfig-test.json", | ||
| 79 | + deps = [ | ||
| 80 | + ":build_webpack", | ||
| 81 | + "//packages/angular_devkit/architect", | ||
| 82 | + "//packages/angular_devkit/architect/node", | ||
| 83 | + "//packages/angular_devkit/architect/testing", | ||
| 84 | + "//packages/angular_devkit/core", | ||
| 85 | + "//packages/angular_devkit/core/node", | ||
| 86 | + "//packages/ngtools/webpack", | ||
| 87 | + "@npm//@angular/common", | ||
| 88 | + "@npm//@angular/compiler", | ||
| 89 | + "@npm//@angular/compiler-cli", | ||
| 90 | + "@npm//@angular/core", | ||
| 91 | + "@npm//@angular/platform-browser", | ||
| 92 | + "@npm//@angular/platform-browser-dynamic", | ||
| 93 | + "@npm//@types/jasmine", | ||
| 94 | + "@npm//@types/node", | ||
| 95 | + "@npm//@types/node-fetch", | ||
| 96 | + "@npm//node-fetch", | ||
| 97 | + "@npm//raw-loader", | ||
| 98 | + "@npm//tslib", | ||
| 99 | + "@npm//zone.js", | ||
| 100 | + ], | ||
| 101 | + ) | ||
| 102 | + | ||
| 103 | + jasmine_node_test( | ||
| 104 | + name = "build_webpack_test", | ||
| 105 | + srcs = [":build_webpack_test_lib"], | ||
| 106 | + # Turns off nodejs require patches and turns on the linker, which sets up up node_modules | ||
| 107 | + # so that standard node module resolution work. | ||
| 108 | + templated_args = ["--nobazel_patch_module_resolver"], | ||
| 109 | + deps = [ | ||
| 110 | + "@npm//jasmine", | ||
| 111 | + "@npm//source-map", | ||
| 112 | + ], | ||
| 113 | + ) | ||
| 114 | + | ||
| 115 | + pkg_npm( | ||
| 116 | + name = "npm_package", | ||
| 117 | + deps = [ | ||
| 118 | + ":build_webpack", | ||
| 119 | + ], | ||
| 120 | + ) | ||
| 121 | + | ||
| 122 | + pkg_tar( | ||
| 123 | + name = "npm_package_archive", | ||
| 124 | + srcs = [":npm_package"], | ||
| 125 | + extension = "tar.gz", | ||
| 126 | + strip_prefix = "./npm_package", | ||
| 127 | + tags = ["manual"], | ||
| 128 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,9 +14,5 @@ | |||
| 14 | 14 | "peerDependencies": { | |
| 15 | 15 | "webpack": "^4.6.0", | |
| 16 | 16 | "webpack-dev-server": "^3.1.4" | |
| 17 | - }, | ||
| 18 | - "devDependencies": { | ||
| 19 | - "webpack": "4.42.1", | ||
| 20 | - "webpack-dev-server": "^3.1.4" | ||
| 21 | 17 | } | |
| 22 | 18 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,8 +14,6 @@ import fetch from 'node-fetch'; // tslint:disable-line:no-implicit-dependencies | |||
| 14 | 14 | import * as path from 'path'; | |
| 15 | 15 | import { DevServerBuildOutput } from './index'; | |
| 16 | 16 | ||
| 17 | - const devkitRoot = (global as any)._DevKitRoot; // tslint:disable-line:no-any | ||
| 18 | - | ||
| 19 | 17 | ||
| 20 | 18 | describe('Dev Server Builder', () => { | |
| 21 | 19 | let testArchitectHost: TestingArchitectHost; | |
@@ -41,7 +39,9 @@ describe('Dev Server Builder', () => { | |||
| 41 | 39 | } | |
| 42 | 40 | ||
| 43 | 41 | beforeEach(async () => { | |
| 44 | - await createArchitect(path.join(devkitRoot, 'tests/angular_devkit/build_webpack/basic-app/')); | ||
| 42 | + const ngJsonPath = path.join(__dirname, '../../test/basic-app/angular.json'); | ||
| 43 | + const workspaceRoot = path.dirname(require.resolve(ngJsonPath)); | ||
| 44 | + await createArchitect(workspaceRoot); | ||
| 45 | 45 | }); | |
| 46 | 46 | ||
| 47 | 47 | it('works', async () => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,10 @@ import { Architect } from '@angular-devkit/architect'; | |||
| 9 | 9 | import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node'; | |
| 10 | 10 | import { TestingArchitectHost } from '@angular-devkit/architect/testing'; | |
| 11 | 11 | import { join, normalize, schema, workspaces } from '@angular-devkit/core'; | |
| 12 | - import { NodeJsSyncHost } from '@angular-devkit/core/node'; | ||
| 12 | + import { NodeJsSyncHost, createConsoleLogger } from '@angular-devkit/core/node'; | ||
| 13 | 13 | import * as path from 'path'; | |
| 14 | 14 | import { BuildResult } from './index'; | |
| 15 | 15 | ||
| 16 | - const devkitRoot = (global as any)._DevKitRoot; // tslint:disable-line:no-any | ||
| 17 | - | ||
| 18 | 16 | ||
| 19 | 17 | describe('Webpack Builder basic test', () => { | |
| 20 | 18 | let testArchitectHost: TestingArchitectHost; | |
@@ -38,7 +36,8 @@ describe('Webpack Builder basic test', () => { | |||
| 38 | 36 | } | |
| 39 | 37 | ||
| 40 | 38 | describe('basic app', () => { | |
| 41 | - const workspaceRoot = path.join(devkitRoot, 'tests/angular_devkit/build_webpack/basic-app/'); | ||
| 39 | + const ngJsonPath = path.join(__dirname, '../../test/basic-app/angular.json'); | ||
| 40 | + const workspaceRoot = path.dirname(require.resolve(ngJsonPath)); | ||
| 42 | 41 | const outputPath = join(normalize(workspaceRoot), 'dist'); | |
| 43 | 42 | ||
| 44 | 43 | beforeEach(async () => { | |
@@ -72,15 +71,17 @@ describe('Webpack Builder basic test', () => { | |||
| 72 | 71 | }); | |
| 73 | 72 | ||
| 74 | 73 | describe('Angular app', () => { | |
| 75 | - const workspaceRoot = path.join(devkitRoot, 'tests/angular_devkit/build_webpack/angular-app/'); | ||
| 76 | - const outputPath = join(normalize(workspaceRoot), 'dist/'); | ||
| 74 | + jasmine.DEFAULT_TIMEOUT_INTERVAL = 150000; | ||
| 75 | + const ngJsonPath = path.join(__dirname, '../../test/angular-app/angular.json'); | ||
| 76 | + const workspaceRoot = path.dirname(require.resolve(ngJsonPath)); | ||
| 77 | + const outputPath = join(normalize(workspaceRoot), 'dist'); | ||
| 77 | 78 | ||
| 78 | 79 | beforeEach(async () => { | |
| 79 | 80 | await createArchitect(workspaceRoot); | |
| 80 | 81 | }); | |
| 81 | 82 | ||
| 82 | 83 | it('works', async () => { | |
| 83 | - const run = await architect.scheduleTarget({ project: 'app', target: 'build-webpack' }); | ||
| 84 | + const run = await architect.scheduleTarget({ project: 'app', target: 'build-webpack' }, {}, {logger: createConsoleLogger()}); | ||
| 84 | 85 | const output = await run.result; | |
| 85 | 86 | ||
| 86 | 87 | expect(output.success).toBe(true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,13 +13,13 @@ | |||
| 13 | 13 | "schematics": {}, | |
| 14 | 14 | "targets": { | |
| 15 | 15 | "build-webpack": { | |
| 16 | - "builder": "../../../../packages/angular_devkit/build_webpack:webpack", | ||
| 16 | + "builder": "../../:webpack", | ||
| 17 | 17 | "options": { | |
| 18 | 18 | "webpackConfig": "webpack.config.js" | |
| 19 | 19 | } | |
| 20 | 20 | }, | |
| 21 | 21 | "serve-webpack": { | |
| 22 | - "builder": "../../../../packages/angular_devkit/build_webpack:webpack-dev-server", | ||
| 22 | + "builder": "../../:webpack-dev-server", | ||
| 23 | 23 | "options": { | |
| 24 | 24 | "webpackConfig": "webpack.config.js" | |
| 25 | 25 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments