From 62525e9d126d2fa496c73c9ae895cb7cea38428b Mon Sep 17 00:00:00 2001 From: Manfred Steyer Date: Wed, 23 Dec 2020 14:18:31 +0100 Subject: [PATCH] Angular 11 update --- lib/.npmignore | 1 + lib/package.json | 2 +- lib/src/browser/schema.ext.json | 41 + lib/src/browser/schema.json | 1028 +++++++++++++---------- lib/src/karma/index.ts | 2 +- lib/src/karma/schema.ext.json | 26 + lib/src/karma/schema.json | 521 ++++++------ lib/src/plus-dev-server/index.ts | 2 +- lib/src/plus-dev-server/schema.ext.json | 39 + lib/src/plus-dev-server/schema.json | 141 +++- lib/src/utils/index.ts | 2 +- 11 files changed, 1060 insertions(+), 745 deletions(-) create mode 100644 lib/src/browser/schema.ext.json create mode 100644 lib/src/karma/schema.ext.json create mode 100644 lib/src/plus-dev-server/schema.ext.json diff --git a/lib/.npmignore b/lib/.npmignore index 6461dee..bd6c7fe 100644 --- a/lib/.npmignore +++ b/lib/.npmignore @@ -1 +1,2 @@ *.ts +!*.d.ts \ No newline at end of file diff --git a/lib/package.json b/lib/package.json index 457674c..b95982a 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "ngx-build-plus", - "version": "10.1.1", + "version": "11.0.0-beta.02", "description": "Extends the Angular CLI's build process!", "license": "MIT", "repository": { diff --git a/lib/src/browser/schema.ext.json b/lib/src/browser/schema.ext.json new file mode 100644 index 0000000..8371147 --- /dev/null +++ b/lib/src/browser/schema.ext.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/schema", + + "extraWebpackConfig": { + "type": "string", + "description": "Additional Webpack Config that gets merged with the default config." + }, + "singleBundle": { + "type": "boolean", + "description": "Puts everything reachable from main.ts (entries vendor, main, and runtime) into one bundle. All other entry points are removed. To also get polyfills and/or styles, use --keepPolyfills or --keepStyles", + "default": false + }, + "keepPolyfills": { + "type": "boolean", + "description": "Generate polyfills bundle when using single-bundle", + "default": true + }, + "configHook": { + "type": "string", + "description": "es module exporting a configHook function (default export).", + "default": "" + }, + + "plugin": { + "type": "string", + "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", + "default": "" + }, + "bundleStyles": { + "type": "boolean", + "description": "DEPRECATED: Use keepStyles instead", + "default": true + }, + "keepStyles": { + "type": "boolean", + "description": "Used conjunction with 'singleBundle' to explizitly bundle styles", + "default": true + } + + +} \ No newline at end of file diff --git a/lib/src/browser/schema.json b/lib/src/browser/schema.json index 30d2147..17d8096 100644 --- a/lib/src/browser/schema.json +++ b/lib/src/browser/schema.json @@ -1,472 +1,616 @@ { - "title": "Webpack browser schema for Build Facade.", - "description": "Browser target options", - "properties": { - "assets": { - "type": "array", - "description": "List of static application assets.", - "default": [], - "items": { - "$ref": "#/definitions/assetPattern" - } - }, - "es5BrowserSupport": { - "description": "Enables conditionally loaded ES2015 polyfills.", - "type": "boolean", - "x-deprecated": "This will be determined from the list of supported browsers specified in the 'browserslist' file." - }, - "extraWebpackConfig": { - "type": "string", - "description": "Additional Webpack Config that gets merged with the default config." - }, - "singleBundle": { - "type": "boolean", - "description": "Puts everything reachable from main.ts (entries vendor, main, and runtime) into one bundle. All other entry points are removed. To also get polyfills and/or styles, use --keepPolyfills or --keepStyles", - "default": false - }, - "keepPolyfills": { - "type": "boolean", - "description": "Generate polyfills bundle when using single-bundle", - "default": true - }, - "configHook": { - "type": "string", - "description": "es module exporting a configHook function (default export).", - "default": "" - }, + "$schema": "http://json-schema.org/schema", + "title": "Webpack browser schema for Build Facade.", + "description": "Browser target options", + "type": "object", + "properties": { - "plugin": { - "type": "string", - "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", - "default": "" - }, + "extraWebpackConfig": { + "type": "string", + "description": "Additional Webpack Config that gets merged with the default config." + }, + "singleBundle": { + "type": "boolean", + "description": "Puts everything reachable from main.ts (entries vendor, main, and runtime) into one bundle. All other entry points are removed. To also get polyfills and/or styles, use --keepPolyfills or --keepStyles", + "default": false + }, + "keepPolyfills": { + "type": "boolean", + "description": "Generate polyfills bundle when using single-bundle", + "default": true + }, + "configHook": { + "type": "string", + "description": "es module exporting a configHook function (default export).", + "default": "" + }, + "plugin": { + "type": "string", + "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", + "default": "" + }, + "bundleStyles": { + "type": "boolean", + "description": "DEPRECATED: Use keepStyles instead", + "default": true + }, + "keepStyles": { + "type": "boolean", + "description": "Used conjunction with 'singleBundle' to explizitly bundle styles", + "default": true + }, - "bundleStyles": { - "type": "boolean", - "description": "DEPRECATED: Use keepStyles instead", - "default": true - }, - "keepStyles": { - "type": "boolean", - "description": "Used conjunction with 'singleBundle' to explizitly bundle styles", - "default": true - }, - "budgets": { - "description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.", - "type": "array", - "items": { - "$ref": "#/definitions/budget" - }, - "default": [] - }, - "main": { - "type": "string", - "description": "The name of the main entry-point file." - }, - "polyfills": { - "type": "string", - "description": "The name of the polyfills file." - }, - "tsConfig": { - "type": "string", - "description": "The name of the TypeScript configuration file." - }, - "scripts": { - "description": "Global scripts to be included in the build.", - "type": "array", - "default": [], - "items": { - "$ref": "#/definitions/extraEntryPoint" - } - }, - "styles": { - "description": "Global styles to be included in the build.", - "type": "array", - "default": [], - "items": { - "$ref": "#/definitions/extraEntryPoint" - } - }, - "stylePreprocessorOptions": { - "description": "Options to pass to style preprocessors.", - "type": "object", - "properties": { - "includePaths": { - "description": "Paths to include. Paths will be resolved to project root.", - "type": "array", - "items": { - "type": "string" - }, - "default": [] + "assets": { + "type": "array", + "description": "List of static application assets.", + "default": [], + "items": { + "$ref": "#/definitions/assetPattern" } }, - "additionalProperties": false - }, - "optimization": { - "type": "boolean", - "description": "Defines the optimization level of the build.", - "default": false - }, - "fileReplacements": { - "description": "Replace files with other files in the build.", - "type": "array", - "items": { - "$ref": "#/definitions/fileReplacement" + "main": { + "type": "string", + "description": "The full path for the main entry point to the app, relative to the current workspace.", + "$valueDescription": "fileName" }, - "default": [] - }, - "outputPath": { - "type": "string", - "description": "Path where output will be placed." - }, - "aot": { - "type": "boolean", - "description": "Build using Ahead of Time compilation.", - "default": false - }, - "sourceMap": { - "type": "boolean", - "description": "Output sourcemaps.", - "default": true - }, - "vendorSourceMap": { - "type": "boolean", - "description": "Resolve vendor packages sourcemaps.", - "default": false - }, - "evalSourceMap": { - "type": "boolean", - "description": "Output in-file eval sourcemaps.", - "default": false - }, - "vendorChunk": { - "type": "boolean", - "description": "Use a separate bundle containing only vendor libraries.", - "default": true - }, - "commonChunk": { - "type": "boolean", - "description": "Use a separate bundle containing code used across multiple bundles.", - "default": true - }, - "baseHref": { - "type": "string", - "description": "Base url for the application being built." - }, - "deployUrl": { - "type": "string", - "description": "URL where files will be deployed." - }, - "verbose": { - "type": "boolean", - "description": "Adds more details to output logging.", - "default": false - }, - "progress": { - "type": "boolean", - "description": "Log progress to the console while building.", - "default": true - }, - "i18nFile": { - "type": "string", - "description": "Localization file to use for i18n." - }, - "i18nFormat": { - "type": "string", - "description": "Format of the localization file specified with --i18n-file." - }, - "i18nLocale": { - "type": "string", - "description": "Locale to use for i18n." - }, - "i18nMissingTranslation": { - "type": "string", - "description": "How to handle missing translations for i18n." - }, - - "localize": { - "oneOf": [ - { - "type": "boolean", - "description": "Translate all locales." - }, - { - "type": "array", - "description": "List of locales ID's to translate.", - "minItems": 1, - "items": { - "type": "string", - "pattern": "^[a-z]{2}(-[a-zA-Z]{2,})?$" - } + "polyfills": { + "type": "string", + "description": "The full path for the polyfills file, relative to the current workspace." + }, + "tsConfig": { + "type": "string", + "description": "The full path for the TypeScript configuration file, relative to the current workspace." + }, + "scripts": { + "description": "Global scripts to be included in the build.", + "type": "array", + "default": [], + "items": { + "$ref": "#/definitions/extraEntryPoint" } - ] - }, - "extractCss": { - "type": "boolean", - "description": "Extract css from global styles onto css files instead of js ones.", - "default": false - }, - "watch": { - "type": "boolean", - "description": "Run build when files change.", - "default": false - }, - "outputHashing": { - "type": "string", - "description": "Define the output filename cache-busting hashing mode.", - "default": "none", - "enum": [ - "none", - "all", - "media", - "bundles" - ] - }, - "poll": { - "type": "number", - "description": "Enable and define the file watching poll time period in milliseconds." - }, - "deleteOutputPath": { - "type": "boolean", - "description": "Delete the output path before building.", - "default": true - }, - "preserveSymlinks": { - "type": "boolean", - "description": "Do not use the real path when resolving modules.", - "default": false - }, - "extractLicenses": { - "type": "boolean", - "description": "Extract all licenses in a separate file, in the case of production builds only.", - "default": true - }, - "showCircularDependencies": { - "type": "boolean", - "description": "Show circular dependency warnings on builds.", - "default": true - }, - "buildOptimizer": { - "type": "boolean", - "description": "Enables @angular-devkit/build-optimizer optimizations when using the 'aot' option.", - "default": false - }, - "namedChunks": { - "type": "boolean", - "description": "Use file name for lazy loaded chunks.", - "default": true - }, - "subresourceIntegrity": { - "type": "boolean", - "description": "Enables the use of subresource integrity validation.", - "default": false - }, - "serviceWorker": { - "type": "boolean", - "description": "Generates a service worker config for production builds.", - "default": false - }, - "ngswConfigPath": { - "type": "string", - "description": "Path to ngsw-config.json." - }, - "skipAppShell": { - "type": "boolean", - "description": "Flag to prevent building an app shell.", - "default": false - }, - "index": { - "type": "string", - "description": "The name of the index HTML file." - }, - "statsJson": { - "type": "boolean", - "description": "Generates a 'stats.json' file which can be analyzed using tools such as: #webpack-bundle-analyzer' or https: //webpack.github.io/analyse.", - "default": false - }, - "forkTypeChecker": { - "type": "boolean", - "description": "Run the TypeScript type checker in a forked process.", - "default": true - }, - "lazyModules": { - "description": "List of additional NgModule files that will be lazy loaded. Lazy router modules with be discovered automatically.", - "type": "array", - "items": { - "type": "string" }, - "default": [] - }, - "budgets": { - "description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.", - "type": "array", - "items": { - "$ref": "#/definitions/budget" + "styles": { + "description": "Global styles to be included in the build.", + "type": "array", + "default": [], + "items": { + "$ref": "#/definitions/extraEntryPoint" + } }, - "default": [] - } - }, - "additionalProperties": true, - "required": [ - "outputPath", - "index", - "main", - "tsConfig" - ], - "definitions": { - "assetPattern": { - "oneOf": [ - { - "type": "object", - "properties": { - "glob": { - "type": "string", - "description": "The pattern to match." + "stylePreprocessorOptions": { + "description": "Options to pass to style preprocessors.", + "type": "object", + "properties": { + "includePaths": { + "description": "Paths to include. Paths will be resolved to project root.", + "type": "array", + "items": { + "type": "string" }, - "input": { - "type": "string", - "description": "The input path dir in which to apply 'glob'. Defaults to the project root." + "default": [] + } + }, + "additionalProperties": false + }, + "optimization": { + "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.", + "x-user-analytics": 16, + "default": false, + "oneOf": [ + { + "type": "object", + "properties": { + "scripts": { + "type": "boolean", + "description": "Enables optimization of the scripts output.", + "default": true + }, + "styles": { + "description": "Enables optimization of the styles output.", + "default": true, + "oneOf": [ + { + "type": "object", + "properties": { + "minify": { + "type": "boolean", + "description": "Minify CSS definitions by removing extraneous whitespace and comments, merging identifiers and minimizing values.", + "default": true + }, + "inlineCritical": { + "type": "boolean", + "description": "Extract and inline critical CSS definitions to improve first paint time.", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": "boolean" + } + ] + }, + "fonts": { + "description": "Enables optimization for fonts. This requires internet access.", + "default": true, + "oneOf": [ + { + "type": "object", + "properties": { + "inline": { + "type": "boolean", + "description": "Reduce render blocking requests by inlining external Google fonts and icons CSS definitions in the application's HTML index file. This requires internet access.", + "default": true + } + }, + "additionalProperties": false + }, + { + "type": "boolean" + } + ] + } }, - "output": { + "additionalProperties": false + }, + { + "type": "boolean" + } + ] + }, + "fileReplacements": { + "description": "Replace compilation source files with other compilation source files in the build.", + "type": "array", + "items": { + "$ref": "#/definitions/fileReplacement" + }, + "default": [] + }, + "outputPath": { + "type": "string", + "description": "The full path for the new output directory, relative to the current workspace.\n\nBy default, writes output to a folder named dist/ in the current project." + }, + "resourcesOutputPath": { + "type": "string", + "description": "The path where style resources will be placed, relative to outputPath.", + "default": "" + }, + "aot": { + "type": "boolean", + "description": "Build using Ahead of Time compilation.", + "x-user-analytics": 13, + "default": false + }, + "sourceMap": { + "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.", + "default": true, + "oneOf": [ + { + "type": "object", + "properties": { + "scripts": { + "type": "boolean", + "description": "Output source maps for all scripts.", + "default": true + }, + "styles": { + "type": "boolean", + "description": "Output source maps for all styles.", + "default": true + }, + "hidden": { + "type": "boolean", + "description": "Output source maps used for error reporting tools.", + "default": false + }, + "vendor": { + "type": "boolean", + "description": "Resolve vendor packages source maps.", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": "boolean" + } + ] + }, + "vendorChunk": { + "type": "boolean", + "description": "Use a separate bundle containing only vendor libraries.", + "default": true + }, + "commonChunk": { + "type": "boolean", + "description": "Use a separate bundle containing code used across multiple bundles.", + "default": true + }, + "baseHref": { + "type": "string", + "description": "Base url for the application being built." + }, + "deployUrl": { + "type": "string", + "description": "URL where files will be deployed." + }, + "verbose": { + "type": "boolean", + "description": "Adds more details to output logging.", + "default": false + }, + "progress": { + "type": "boolean", + "description": "Log progress to the console while building.", + "default": true + }, + "i18nFile": { + "type": "string", + "description": "Localization file to use for i18n.", + "x-deprecated": "Use 'locales' object in the project metadata instead." + }, + "i18nFormat": { + "type": "string", + "description": "Format of the localization file specified with --i18n-file.", + "x-deprecated": "No longer needed as the format will be determined automatically." + }, + "i18nLocale": { + "type": "string", + "description": "Locale to use for i18n.", + "x-deprecated": "Use 'localize' instead." + }, + "i18nMissingTranslation": { + "type": "string", + "description": "How to handle missing translations for i18n.", + "enum": ["warning", "error", "ignore"], + "default": "warning" + }, + "localize": { + "description": "Translate the bundles in one or more locales.", + "oneOf": [ + { + "type": "boolean", + "description": "Translate all locales." + }, + { + "type": "array", + "description": "List of locales ID's to translate.", + "minItems": 1, + "items": { "type": "string", - "description": "Absolute path within the output." + "pattern": "^[a-zA-Z]{2,3}(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-[a-zA-Z]{5,8})?(-x(-[a-zA-Z0-9]{1,8})+)?$" } + } + ] + }, + "extractCss": { + "type": "boolean", + "description": "Extract CSS from global styles into '.css' files instead of '.js'.", + "default": true, + "x-deprecated": "Deprecated since version 11.0. No longer required to disable CSS extraction for HMR." + }, + "watch": { + "type": "boolean", + "description": "Run build when files change.", + "default": false + }, + "outputHashing": { + "type": "string", + "description": "Define the output filename cache-busting hashing mode.", + "default": "none", + "enum": [ + "none", + "all", + "media", + "bundles" + ] + }, + "poll": { + "type": "number", + "description": "Enable and define the file watching poll time period in milliseconds." + }, + "deleteOutputPath": { + "type": "boolean", + "description": "Delete the output path before building.", + "default": true + }, + "preserveSymlinks": { + "type": "boolean", + "description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set." + }, + "extractLicenses": { + "type": "boolean", + "description": "Extract all licenses in a separate file.", + "default": false + }, + "showCircularDependencies": { + "type": "boolean", + "description": "Show circular dependency warnings on builds.", + "default": true + }, + "buildOptimizer": { + "type": "boolean", + "description": "Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.", + "default": false + }, + "namedChunks": { + "type": "boolean", + "description": "Use file name for lazy loaded chunks.", + "default": true + }, + "subresourceIntegrity": { + "type": "boolean", + "description": "Enables the use of subresource integrity validation.", + "default": false + }, + "serviceWorker": { + "type": "boolean", + "description": "Generates a service worker config for production builds.", + "default": false + }, + "ngswConfigPath": { + "type": "string", + "description": "Path to ngsw-config.json." + }, + "index": { + "description": "Configures the generation of the application's HTML index.", + "oneOf": [ + { + "type": "string", + "description": "The path of a file to use for the application's HTML index. The filename of the specified path will be used for the generated file and will be created in the root of the application's configured output path." }, - "additionalProperties": false, - "required": [ - "glob", - "input", - "output" - ] + { + "type": "object", + "description": "", + "properties": { + "input": { + "type": "string", + "minLength": 1, + "description": "The path of a file to use for the application's generated HTML index." + }, + "output": { + "type": "string", + "minLength": 1, + "default": "index.html", + "description": "The output path of the application's generated HTML index file. The full provided path will be used and will be considered relative to the application's configured output path." + } + }, + "required": ["input"] + } + ] + }, + "statsJson": { + "type": "boolean", + "description": "Generates a 'stats.json' file which can be analyzed using tools such as 'webpack-bundle-analyzer'.", + "default": false + }, + "forkTypeChecker": { + "type": "boolean", + "description": "Run the TypeScript type checker in a forked process.", + "default": true + }, + "lazyModules": { + "description": "List of additional NgModule files that will be lazy loaded. Lazy router modules will be discovered automatically.", + "type": "array", + "items": { + "type": "string" + }, + "x-deprecated": "'SystemJsNgModuleLoader' is deprecated, and this is part of its usage. Use 'import()' syntax instead.", + "default": [] + }, + "budgets": { + "description": "Budget thresholds to ensure parts of your application stay within boundaries which you set.", + "type": "array", + "items": { + "$ref": "#/definitions/budget" }, - { + "default": [] + }, + "webWorkerTsConfig": { + "type": "string", + "description": "TypeScript configuration for Web Worker modules." + }, + "crossOrigin": { + "type": "string", + "description": "Define the crossorigin attribute setting of elements that provide CORS support.", + "default": "none", + "enum": [ + "none", + "anonymous", + "use-credentials" + ] + }, + "experimentalRollupPass": { + "type": "boolean", + "description": "Concatenate modules with Rollup before bundling them with Webpack.", + "default": false + }, + "allowedCommonJsDependencies": { + "description": "A list of CommonJS packages that are allowed to be used without a build time warning.", + "type": "array", + "items": { "type": "string" - } - ] + }, + "default": [] + } }, - "fileReplacement": { - "oneOf": [ - { - "type": "object", - "properties": { - "src": { - "type": "string" + "additionalProperties": false, + "required": [ + "outputPath", + "index", + "main", + "tsConfig" + ], + "definitions": { + "assetPattern": { + "oneOf": [ + { + "type": "object", + "properties": { + "followSymlinks": { + "type": "boolean", + "default": false, + "description": "Allow glob patterns to follow symlink directories. This allows subdirectories of the symlink to be searched." + }, + "glob": { + "type": "string", + "description": "The pattern to match." + }, + "input": { + "type": "string", + "description": "The input directory path in which to apply 'glob'. Defaults to the project root." + }, + "ignore": { + "description": "An array of globs to ignore.", + "type": "array", + "items": { + "type": "string" + } + }, + "output": { + "type": "string", + "description": "Absolute path within the output." + } }, - "replaceWith": { - "type": "string" - } + "additionalProperties": false, + "required": [ + "glob", + "input", + "output" + ] }, - "additionalProperties": false, - "required": [ - "src", - "replaceWith" - ] - }, - { - "type": "object", - "properties": { - "replace": { - "type": "string" + { + "type": "string" + } + ] + }, + "fileReplacement": { + "oneOf": [ + { + "type": "object", + "properties": { + "src": { + "type": "string", + "pattern": "\\.(([cm]?j|t)sx?|json)$" + }, + "replaceWith": { + "type": "string", + "pattern": "\\.(([cm]?j|t)sx?|json)$" + } }, - "with": { - "type": "string" - } + "additionalProperties": false, + "required": [ + "src", + "replaceWith" + ] }, - "additionalProperties": false, - "required": [ - "replace", - "with" - ] - } - ] - }, - "extraEntryPoint": { - "oneOf": [ - { - "type": "object", - "properties": { - "input": { - "type": "string", - "description": "The file to include." + { + "type": "object", + "properties": { + "replace": { + "type": "string", + "pattern": "\\.(([cm]?j|t)sx?|json)$" + }, + "with": { + "type": "string", + "pattern": "\\.(([cm]?j|t)sx?|json)$" + } }, - "bundleName": { - "type": "string", - "description": "The bundle name for this extra entry point." + "additionalProperties": false, + "required": [ + "replace", + "with" + ] + } + ] + }, + "extraEntryPoint": { + "oneOf": [ + { + "type": "object", + "properties": { + "input": { + "type": "string", + "description": "The file to include." + }, + "bundleName": { + "type": "string", + "description": "The bundle name for this extra entry point." + }, + "inject": { + "type": "boolean", + "description": "If the bundle will be referenced in the HTML file.", + "default": true + } }, - "lazy": { - "type": "boolean", - "description": "If the bundle will be lazy loaded.", - "default": false - } + "additionalProperties": false, + "required": [ + "input" + ] }, - "additionalProperties": false, - "required": [ - "input" - ] - }, - { - "type": "string", - "description": "The file to include." - } - ] - }, - "budget": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The type of budget.", - "enum": [ - "all", - "allScript", - "any", - "anyScript", - "anyComponentStyle", - "bundle", - "initial" - ] - }, - "name": { - "type": "string", - "description": "The name of the bundle." - }, - "baseline": { - "type": "string", - "description": "The baseline size for comparison." - }, - "maximumWarning": { - "type": "string", - "description": "The maximum threshold for warning relative to the baseline." - }, - "maximumError": { - "type": "string", - "description": "The maximum threshold for error relative to the baseline." - }, - "minimumWarning": { - "type": "string", - "description": "The minimum threshold for warning relative to the baseline." - }, - "minimumError": { - "type": "string", - "description": "The minimum threshold for error relative to the baseline." - }, - "warning": { - "type": "string", - "description": "The threshold for warning relative to the baseline (min & max)." - }, - "error": { - "type": "string", - "description": "The threshold for error relative to the baseline (min & max)." - } + { + "type": "string", + "description": "The file to include." + } + ] }, - "additionalProperties": false, - "required": [ - "type" - ] + "budget": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of budget.", + "enum": [ + "all", + "allScript", + "any", + "anyScript", + "anyComponentStyle", + "bundle", + "initial" + ] + }, + "name": { + "type": "string", + "description": "The name of the bundle." + }, + "baseline": { + "type": "string", + "description": "The baseline size for comparison." + }, + "maximumWarning": { + "type": "string", + "description": "The maximum threshold for warning relative to the baseline." + }, + "maximumError": { + "type": "string", + "description": "The maximum threshold for error relative to the baseline." + }, + "minimumWarning": { + "type": "string", + "description": "The minimum threshold for warning relative to the baseline." + }, + "minimumError": { + "type": "string", + "description": "The minimum threshold for error relative to the baseline." + }, + "warning": { + "type": "string", + "description": "The threshold for warning relative to the baseline (min & max)." + }, + "error": { + "type": "string", + "description": "The threshold for error relative to the baseline (min & max)." + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + } } - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/lib/src/karma/index.ts b/lib/src/karma/index.ts index 3137375..9d14978 100644 --- a/lib/src/karma/index.ts +++ b/lib/src/karma/index.ts @@ -5,7 +5,7 @@ import { Transforms, runBuilderHandler } from "../utils"; import { JsonObject } from "@angular-devkit/core"; -function serveWebpackBrowserPlus( +export function serveWebpackBrowserPlus( options: any, context: BuilderContext, transforms: Transforms = {} diff --git a/lib/src/karma/schema.ext.json b/lib/src/karma/schema.ext.json new file mode 100644 index 0000000..18a293d --- /dev/null +++ b/lib/src/karma/schema.ext.json @@ -0,0 +1,26 @@ +{ + "extraWebpackConfig": { + "type": "string", + "description": "Additional Webpack Config that gets merged with the default config." + }, + "singleBundle": { + "type": "boolean", + "description": "Generate just one bundle", + "default": false + }, + "keepPolyfills": { + "type": "boolean", + "description": "Generate polyfills bundle when using single-bundle", + "default": true + }, + "configHook": { + "type": "string", + "description": "es module exporting a configHook function (default export).", + "default": "" + }, + "plugin": { + "type": "string", + "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", + "default": "" + } +} \ No newline at end of file diff --git a/lib/src/karma/schema.json b/lib/src/karma/schema.json index 795a1fd..48d95e8 100644 --- a/lib/src/karma/schema.json +++ b/lib/src/karma/schema.json @@ -1,298 +1,293 @@ { - "title": "Karma Target", - "description": "Karma target options for Build Facade.", - "type": "object", - "properties": { - "main": { - "type": "string", - "description": "The name of the main entry-point file." - }, - "tsConfig": { - "type": "string", - "description": "The name of the TypeScript configuration file." - }, - "karmaConfig": { - "type": "string", - "description": "The name of the Karma configuration file." - }, - "polyfills": { - "type": "string", - "description": "The name of the polyfills file." - }, - "assets": { - "type": "array", - "description": "List of static application assets.", - "default": [], - "items": { - "$ref": "#/definitions/assetPattern" - } - }, - "scripts": { - "description": "Global scripts to be included in the build.", - "type": "array", - "default": [], - "items": { - "$ref": "#/definitions/extraEntryPoint" - } - }, - "styles": { - "description": "Global styles to be included in the build.", - "type": "array", - "default": [], - "items": { - "$ref": "#/definitions/extraEntryPoint" - } - }, - "stylePreprocessorOptions": { - "description": "Options to pass to style preprocessors", - "type": "object", - "properties": { - "includePaths": { - "description": "Paths to include. Paths will be resolved to project root.", - "type": "array", - "items": { - "type": "string" - }, - "default": [] - } + "$schema": "http://json-schema.org/draft-07/schema", + "title": "Karma Target", + "description": "Karma target options for Build Facade.", + "type": "object", + "properties": { - }, - "additionalProperties": false - }, - "environment": { - "type": "string", - "description": "Defines the build environment." - }, - "sourceMap": { - "description": "Output sourcemaps.", - "default": true, - "oneOf": [ - { - "type": "object", - "properties": { - "scripts": { - "type": "boolean", - "description": "Output sourcemaps for all scripts.", - "default": true - }, - "styles": { - "type": "boolean", - "description": "Output sourcemaps for all styles.", - "default": true - }, - "vendor": { - "type": "boolean", - "description": "Resolve vendor packages sourcemaps.", - "default": false - } - }, - "additionalProperties": false + + "extraWebpackConfig": { + "type": "string", + "description": "Additional Webpack Config that gets merged with the default config." + }, + "singleBundle": { + "type": "boolean", + "description": "Generate just one bundle", + "default": false + }, + "keepPolyfills": { + "type": "boolean", + "description": "Generate polyfills bundle when using single-bundle", + "default": true + }, + "configHook": { + "type": "string", + "description": "es module exporting a configHook function (default export).", + "default": "" + }, + "plugin": { + "type": "string", + "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", + "default": "" + }, + + + + + "main": { + "type": "string", + "description": "The name of the main entry-point file." + }, + "tsConfig": { + "type": "string", + "description": "The name of the TypeScript configuration file." + }, + "karmaConfig": { + "type": "string", + "description": "The name of the Karma configuration file." + }, + "polyfills": { + "type": "string", + "description": "The name of the polyfills file." + }, + "assets": { + "type": "array", + "description": "List of static application assets.", + "default": [], + "items": { + "$ref": "#/definitions/assetPattern" + } + }, + "scripts": { + "description": "Global scripts to be included in the build.", + "type": "array", + "default": [], + "items": { + "$ref": "#/definitions/extraEntryPoint" + } + }, + "styles": { + "description": "Global styles to be included in the build.", + "type": "array", + "default": [], + "items": { + "$ref": "#/definitions/extraEntryPoint" + } + }, + "stylePreprocessorOptions": { + "description": "Options to pass to style preprocessors", + "type": "object", + "properties": { + "includePaths": { + "description": "Paths to include. Paths will be resolved to project root.", + "type": "array", + "items": { + "type": "string" }, - { - "type": "boolean" - } - ] - }, - "vendorSourceMap": { - "type": "boolean", - "description": "Resolve vendor packages sourcemaps.", - "x-deprecated": true, - "default": false - }, - "evalSourceMap": { - "type": "boolean", - "description": "Output in-file eval sourcemaps.", - "x-deprecated": true - }, - "progress": { - "type": "boolean", - "description": "Log progress to the console while building." - }, - "watch": { - "type": "boolean", - "description": "Run build when files change." - }, - "poll": { - "type": "number", - "description": "Enable and define the file watching poll time period in milliseconds." - }, - "preserveSymlinks": { - "type": "boolean", - "description": "Do not use the real path when resolving modules.", - "default": false - }, - "browsers": { - "type": "string", - "description": "Override which browsers tests are run against." - }, - "codeCoverage": { - "type": "boolean", - "description": "Output a code coverage report.", - "default": false + "default": [] + } }, - "codeCoverageExclude": { - "type": "array", - "description": "Globs to exclude from code coverage.", - "items": { - "type": "string" - }, - "default": [] + "additionalProperties": false + }, + "include": { + "type": "array", + "items": { + "type": "string" }, - "fileReplacements": { - "description": "Replace files with other files in the build.", - "type": "array", - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "src": { - "type": "string" - }, - "replaceWith": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "src", - "replaceWith" - ] + "description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead" + }, + "sourceMap": { + "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.", + "default": true, + "oneOf": [ + { + "type": "object", + "properties": { + "scripts": { + "type": "boolean", + "description": "Output source maps for all scripts.", + "default": true }, - { - "type": "object", - "properties": { - "replace": { - "type": "string" - }, - "with": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "replace", - "with" - ] + "styles": { + "type": "boolean", + "description": "Output source maps for all styles.", + "default": true + }, + "vendor": { + "type": "boolean", + "description": "Resolve vendor packages source maps.", + "default": false } - ] + }, + "additionalProperties": false }, - "default": [] - }, - "reporters": { - "type": "array", - "description": "Karma reporters to use. Directly passed to the karma runner.", - "items": { - "type": "string" + { + "type": "boolean" } + ] + }, + "progress": { + "type": "boolean", + "description": "Log progress to the console while building.", + "default": true + }, + "watch": { + "type": "boolean", + "description": "Run build when files change.", + "default": true + }, + "poll": { + "type": "number", + "description": "Enable and define the file watching poll time period in milliseconds." + }, + "preserveSymlinks": { + "type": "boolean", + "description": "Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set." + }, + "browsers": { + "type": "string", + "description": "Override which browsers tests are run against." + }, + "codeCoverage": { + "type": "boolean", + "description": "Output a code coverage report.", + "default": false + }, + "codeCoverageExclude": { + "type": "array", + "description": "Globs to exclude from code coverage.", + "items": { + "type": "string" }, - - - - - - "extraWebpackConfig": { - "type": "string", - "description": "Additional Webpack Config that gets merged with the default config." - }, - "singleBundle": { - "type": "boolean", - "description": "Generate just one bundle", - "default": false - }, - "keepPolyfills": { - "type": "boolean", - "description": "Generate polyfills bundle when using single-bundle", - "default": true - }, - "configHook": { - "type": "string", - "description": "es module exporting a configHook function (default export).", - "default": "" - }, - - "plugin": { - "type": "string", - "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", - "default": "" - } - - + "default": [] }, - "additionalProperties": false, - "required": [ - "main", - "tsConfig", - "karmaConfig" - ], - "definitions": { - "assetPattern": { + "fileReplacements": { + "description": "Replace compilation source files with other compilation source files in the build.", + "type": "array", + "items": { "oneOf": [ { "type": "object", "properties": { - "glob": { - "type": "string", - "description": "The pattern to match." - }, - "input": { - "type": "string", - "description": "The input directory path in which to apply 'glob'. Defaults to the project root." - }, - "output": { - "type": "string", - "description": "Absolute path within the output." + "src": { + "type": "string" }, - "ignore": { - "description": "An array of globs to ignore.", - "type": "array", - "items": { - "type": "string" - } + "replaceWith": { + "type": "string" } }, "additionalProperties": false, "required": [ - "glob", - "input", - "output" + "src", + "replaceWith" ] }, - { - "type": "string" - } - ] - }, - "extraEntryPoint": { - "oneOf": [ { "type": "object", "properties": { - "input": { - "type": "string", - "description": "The file to include." - }, - "bundleName": { - "type": "string", - "description": "The bundle name for this extra entry point." + "replace": { + "type": "string" }, - "lazy": { - "type": "boolean", - "description": "If the bundle will be lazy loaded.", - "default": false + "with": { + "type": "string" } }, - "additionalProperties": true, + "additionalProperties": false, "required": [ - "input" + "replace", + "with" ] - }, - { - "type": "string", - "description": "The file to include." } ] + }, + "default": [] + }, + "reporters": { + "type": "array", + "description": "Karma reporters to use. Directly passed to the karma runner.", + "items": { + "type": "string" } + }, + "webWorkerTsConfig": { + "type": "string", + "description": "TypeScript configuration for Web Worker modules." + } + }, + "additionalProperties": false, + "required": [ + "main", + "tsConfig", + "karmaConfig" + ], + "definitions": { + "assetPattern": { + "oneOf": [ + { + "type": "object", + "properties": { + "glob": { + "type": "string", + "description": "The pattern to match." + }, + "input": { + "type": "string", + "description": "The input directory path in which to apply 'glob'. Defaults to the project root." + }, + "output": { + "type": "string", + "description": "Absolute path within the output." + }, + "ignore": { + "description": "An array of globs to ignore.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "required": [ + "glob", + "input", + "output" + ] + }, + { + "type": "string" + } + ] + }, + "extraEntryPoint": { + "oneOf": [ + { + "type": "object", + "properties": { + "input": { + "type": "string", + "description": "The file to include." + }, + "bundleName": { + "type": "string", + "description": "The bundle name for this extra entry point." + }, + "inject": { + "type": "boolean", + "description": "If the bundle will be referenced in the HTML file.", + "default": true + } + }, + "additionalProperties": false, + "required": [ + "input" + ] + }, + { + "type": "string", + "description": "The file to include." + } + ] } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/lib/src/plus-dev-server/index.ts b/lib/src/plus-dev-server/index.ts index 7021e93..35e0e7e 100644 --- a/lib/src/plus-dev-server/index.ts +++ b/lib/src/plus-dev-server/index.ts @@ -5,7 +5,7 @@ import { Transforms, runBuilderHandler } from "../utils"; import { JsonObject } from "@angular-devkit/core"; -function serveWebpackBrowserPlus( +export function serveWebpackBrowserPlus( options: any, context: BuilderContext, transforms: Transforms = {} diff --git a/lib/src/plus-dev-server/schema.ext.json b/lib/src/plus-dev-server/schema.ext.json new file mode 100644 index 0000000..ab91780 --- /dev/null +++ b/lib/src/plus-dev-server/schema.ext.json @@ -0,0 +1,39 @@ +{ + "extraWebpackConfig": { + "type": "string", + "description": "Additional Webpack Config that gets merged with the default config." + }, + "singleBundle": { + "type": "boolean", + "description": "Puts everything reachable from main.ts (entries vendor, main, and runtime) into one bundle. All other entry points are removed. To also get polyfills and/or styles, use --keepPolyfills or --keepStyles", + "default": false + }, + "keepPolyfills": { + "type": "boolean", + "description": "Generate polyfills bundle when using single-bundle", + "default": true + }, + "configHook": { + "type": "string", + "description": "es module exporting a configHook function (default export).", + "default": "" + }, + + "plugin": { + "type": "string", + "description": "es module exporting a Plugin object (default export). Just used for ng build; not for ng serve", + "default": "" + }, + + "bundleStyles": { + "type": "boolean", + "description": "DEPRECATED: Use keepStyles instead", + "default": true + }, + + "keepStyles": { + "type": "boolean", + "description": "Used conjunction with 'singleBundle' to explizitly bundle styles", + "default": true + } +} \ No newline at end of file diff --git a/lib/src/plus-dev-server/schema.json b/lib/src/plus-dev-server/schema.json index c33b40b..f85db94 100644 --- a/lib/src/plus-dev-server/schema.json +++ b/lib/src/plus-dev-server/schema.json @@ -1,9 +1,11 @@ { - "title": "Karma Target", - "description": "Karma target options for Build Facade.", + "$schema": "http://json-schema.org/schema", + "title": "Dev Server Target", + "description": "Dev Server target options for Build Facade.", "type": "object", "properties": { + "extraWebpackConfig": { "type": "string", "description": "Additional Webpack Config that gets merged with the default config." @@ -42,17 +44,10 @@ "default": true }, - - - "verbose": { - "type": "boolean", - "description": "Adds more details to output logging.", - "default": false - }, - "browserTarget": { "type": "string", - "description": "Target to serve." + "description": "A browser builder target to serve in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.", + "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$" }, "port": { "type": "number", @@ -81,12 +76,26 @@ "type": "string", "description": "SSL certificate to use for serving HTTPS." }, + "headers": { + "type": "object", + "description": "Custom HTTP headers to be added to all responses.", + "propertyNames": { + "pattern": "^[-_A-Za-z0-9]+$" + }, + "additionalProperties": { + "type": "string" + } + }, "open": { "type": "boolean", "description": "Opens the url in default browser.", "default": false, "alias": "o" }, + "verbose": { + "type": "boolean", + "description": "Adds more details to output logging." + }, "liveReload": { "type": "boolean", "description": "Whether to reload the page on change, using live-reload.", @@ -94,13 +103,20 @@ }, "publicHost": { "type": "string", - "description": "Specify the URL that the browser client will use." + "description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies." + }, + "allowedHosts": { + "type": "array", + "description": "List of hosts that are allowed to access the dev server.", + "default": [], + "items": { + "type": "string" + } }, "servePath": { "type": "string", "description": "The pathname where the app will be served." }, - "disableHostCheck": { "type": "boolean", "description": "Don't verify connected clients are part of allowed hosts.", @@ -119,61 +135,114 @@ "hmrWarning": { "type": "boolean", "description": "Show a warning when the --hmr option is enabled.", - "default": true + "default": true, + "x-deprecated": "No longer has an effect." }, "servePathDefaultWarning": { "type": "boolean", "description": "Show a warning when deploy-url/base-href use unsupported serve path values.", - "default": true + "default": true, + "x-deprecated": "No longer has an effect." }, "optimization": { - "type": "boolean", - "description": "Defines the optimization level of the build." + "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.", + "x-user-analytics": 16, + "oneOf": [ + { + "type": "object", + "properties": { + "scripts": { + "type": "boolean", + "description": "Enables optimization of the scripts output.", + "default": true + }, + "styles": { + "type": "boolean", + "description": "Enables optimization of the styles output.", + "default": true + } + }, + "additionalProperties": false + }, + { + "type": "boolean" + } + ], + "x-deprecated": "Use the \"optimization\" option in the browser builder instead." }, "aot": { "type": "boolean", - "description": "Build using Ahead of Time compilation." + "description": "Build using Ahead of Time compilation.", + "x-user-analytics": 13, + "x-deprecated": "Use the \"aot\" option in the browser builder instead." }, "sourceMap": { - "type": "boolean", - "description": "Output sourcemaps." - }, - "vendorSourceMap": { - "type": "boolean", - "description": "Resolve vendor packages sourcemaps.", - "default": false - }, - "evalSourceMap": { - "type": "boolean", - "description": "Output in-file eval sourcemaps." + "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.", + "oneOf": [ + { + "type": "object", + "properties": { + "scripts": { + "type": "boolean", + "description": "Output source maps for all scripts.", + "default": true + }, + "styles": { + "type": "boolean", + "description": "Output source maps for all styles.", + "default": true + }, + "hidden": { + "type": "boolean", + "description": "Output source maps used for error reporting tools.", + "default": false + }, + "vendor": { + "type": "boolean", + "description": "Resolve vendor packages source maps.", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": "boolean" + } + ], + "x-deprecated": "Use the \"sourceMap\" option in the browser builder instead." }, "vendorChunk": { "type": "boolean", - "description": "Use a separate bundle containing only vendor libraries." + "description": "Use a separate bundle containing only vendor libraries.", + "x-deprecated": "Use the \"vendorChunk\" option in the browser builder instead." }, "commonChunk": { "type": "boolean", - "description": "Use a separate bundle containing code used across multiple bundles." + "description": "Use a separate bundle containing code used across multiple bundles.", + "x-deprecated": "Use the \"commonChunk\" option in the browser builder instead." }, "baseHref": { "type": "string", - "description": "Base url for the application being built." + "description": "Base url for the application being built.", + "x-deprecated": "Use the \"baseHref\" option in the browser builder instead." }, "deployUrl": { "type": "string", - "description": "URL where files will be deployed." + "description": "URL where files will be deployed.", + "x-deprecated": "Use the \"deployUrl\" option in the browser builder instead." }, "progress": { "type": "boolean", - "description": "Log progress to the console while building." + "description": "Log progress to the console while building.", + "x-deprecated": "Use the \"progress\" option in the browser builder instead." }, "poll": { "type": "number", "description": "Enable and define the file watching poll time period in milliseconds." } }, - "additionalProperties": true, + "additionalProperties": false, "required": [ "browserTarget" ] -} +} \ No newline at end of file diff --git a/lib/src/utils/index.ts b/lib/src/utils/index.ts index 7bb97c0..de297d7 100644 --- a/lib/src/utils/index.ts +++ b/lib/src/utils/index.ts @@ -69,7 +69,7 @@ function setupConfigHook(transforms: Transforms, options: any, context: BuilderC } } - const keepStyles = options.bundleStyles || options.keepStyles; + const keepStyles = !options.bundleStyles || options.keepStyles; if (options.singleBundle && !keepStyles && config.entry && config.entry['styles']) { delete config.entry['styles'];