From 52d1c5957295ee6eaef6e21983f0ebc6ca91e33d Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 11:57:03 +1000 Subject: [PATCH 01/11] Change Github Actions workflow syntax to JSON, add spell check task --- .github/workflows/ci.yml | 94 +++++++++++++++++++++++++++++----------- package.json | 1 - 2 files changed, 69 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 637a0459..1ee8dd54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,25 +1,69 @@ -name: Continuous Integration -on: - # Every push - push: - schedule: - # Every Monday and Thursday at 12PM UTC - - cron: '0 12 * * 1,4' - -jobs: - test: - strategy: - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - node-version: [ 10.x, 12.x, 13.x ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: ./node_modules/.bin/nyc --reporter=lcovonly npm test - - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_UPLOAD_TOKEN }} +{ + "name": "Continuous Integration", + "on": { + # Every push + "push": {}, + "schedule": [ + { + # Every Monday and Thursday at 12PM UTC + "cron": "0 12 * * 1,4" + } + ] + }, + "jobs": { + "test": { + "strategy": { + "matrix": { + "os": [ + "ubuntu-latest", + "macos-latest", + "windows-latest" + ], + "node-version": [ + "10.x", + "12.x", + "13.x" + ] + } + }, + "runs-on": "${{ matrix.os }}", + "steps": [ + { + "name": "Checkout", + "uses": "actions/checkout@v1" + }, + { + "name": "Setup node", + "uses": "actions/setup-node@v1", + "with": { + "node-version": "${{ matrix.node-version }}" + } + }, + { + "name": "Install dependencies", + "run": "npm ci" + }, + { + "name": "Run tests", + "run": "./node_modules/.bin/nyc --reporter=lcovonly npm test" + }, + { + "name": "Push coverage to Codecov", + "uses": "codecov/codecov-action@v1", + "with": { + "token": "${{ secrets.CODECOV_UPLOAD_TOKEN }}" + } + } + ] + }, + "release-readiness": { + "runs-on": "ubuntu-latest", + "steps": [ + { + "name": "Check spelling", + "uses": "rojopolis/spellcheck-github-actions@0.2.0" + } + ] + } + } +} diff --git a/package.json b/package.json index a1eb58b3..4c7bf386 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,6 @@ "engines": { "node": ">=10.0.0" }, - "engineStrict": true, "ava": { "files": [ "dist/**/*.test.js" From 0b2c8b2c3d063e05c895459002f314e178257b27 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 12:00:50 +1000 Subject: [PATCH 02/11] Switch spell check action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ee8dd54..31b6fdec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ "steps": [ { "name": "Check spelling", - "uses": "rojopolis/spellcheck-github-actions@0.2.0" + "uses": "sbates130272/spellcheck-github-actions@v0.6.0" } ] } From 576005e51428b1bdfaa53998ef70203d86615946 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 12:04:07 +1000 Subject: [PATCH 03/11] Added wordlist file for spell check action --- .wordlist.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .wordlist.txt diff --git a/.wordlist.txt b/.wordlist.txt new file mode 100644 index 00000000..e69de29b From eabc62aaa580d3f40568d656f4c50e678f3cebbf Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 12:13:23 +1000 Subject: [PATCH 04/11] Use cspell --- .github/workflows/ci.yml | 17 ++++++++++++++++- .wordlist.txt | 0 2 files changed, 16 insertions(+), 1 deletion(-) delete mode 100644 .wordlist.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31b6fdec..92336390 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,9 +59,24 @@ "release-readiness": { "runs-on": "ubuntu-latest", "steps": [ + { + "name": "Checkout", + "uses": "actions/checkout@v1" + }, + { + "name": "Setup node", + "uses": "actions/setup-node@v1", + "with": { + "node-version": "13.x" + } + }, + { + "name": "Install cspell", + "run": "npm i -g cspell" + }, { "name": "Check spelling", - "uses": "sbates130272/spellcheck-github-actions@v0.6.0" + "run": "cspell 'src/**/*.ts'" } ] } diff --git a/.wordlist.txt b/.wordlist.txt deleted file mode 100644 index e69de29b..00000000 From cb0eb1ebb7b69450ff35351da5c25db1882d7025 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 12:36:38 +1000 Subject: [PATCH 05/11] Spelling corrections --- cspell.json | 7 +++++++ ...dle-assets.bundleorchestrator._constructor_.md} | 6 +++--- ...ulp-bundle-assets.bundleorchestrator._flush.md} | 4 ++-- ...bundle-assets.bundleorchestrator._transform.md} | 4 ++-- ...md => gulp-bundle-assets.bundleorchestrator.md} | 14 +++++++------- docs/api/gulp-bundle-assets.md | 2 +- package.json | 2 +- ...strator.test.ts => bundle-orchestrator.test.ts} | 4 ++-- ...ndle-orchastrator.ts => bundle-orchestrator.ts} | 4 ++-- src/bundle.ts | 2 +- src/config/merge-configs.ts | 5 +++-- src/config/validate-bundle.test.ts | 2 +- src/main.ts | 12 ++++++++---- src/missing-types.d.ts | 2 +- 14 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 cspell.json rename docs/api/{gulp-bundle-assets.bundleorchastrator._constructor_.md => gulp-bundle-assets.bundleorchestrator._constructor_.md} (71%) rename docs/api/{gulp-bundle-assets.bundleorchastrator._flush.md => gulp-bundle-assets.bundleorchestrator._flush.md} (66%) rename docs/api/{gulp-bundle-assets.bundleorchastrator._transform.md => gulp-bundle-assets.bundleorchestrator._transform.md} (76%) rename docs/api/{gulp-bundle-assets.bundleorchastrator.md => gulp-bundle-assets.bundleorchestrator.md} (53%) rename src/{bundle-orchastrator.test.ts => bundle-orchestrator.test.ts} (98%) rename src/{bundle-orchastrator.ts => bundle-orchestrator.ts} (98%) diff --git a/cspell.json b/cspell.json new file mode 100644 index 00000000..b716670d --- /dev/null +++ b/cspell.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json", + "ignoreWords": [ + "userfrosting", + "errlop" + ] +} diff --git a/docs/api/gulp-bundle-assets.bundleorchastrator._constructor_.md b/docs/api/gulp-bundle-assets.bundleorchestrator._constructor_.md similarity index 71% rename from docs/api/gulp-bundle-assets.bundleorchastrator._constructor_.md rename to docs/api/gulp-bundle-assets.bundleorchestrator._constructor_.md index 081819d1..e67366d0 100644 --- a/docs/api/gulp-bundle-assets.bundleorchastrator._constructor_.md +++ b/docs/api/gulp-bundle-assets.bundleorchestrator._constructor_.md @@ -1,10 +1,10 @@ -[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchastrator](./gulp-bundle-assets.bundleorchastrator.md) > [(constructor)](./gulp-bundle-assets.bundleorchastrator._constructor_.md) +[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchestrator](./gulp-bundle-assets.bundleorchestrator.md) > [(constructor)](./gulp-bundle-assets.bundleorchestrator._constructor_.md) -## BundleOrchastrator.(constructor) +## BundleOrchestrator.(constructor) -Constructs a new instance of the `BundleOrchastrator` class +Constructs a new instance of the `BundleOrchestrator` class Signature: diff --git a/docs/api/gulp-bundle-assets.bundleorchastrator._flush.md b/docs/api/gulp-bundle-assets.bundleorchestrator._flush.md similarity index 66% rename from docs/api/gulp-bundle-assets.bundleorchastrator._flush.md rename to docs/api/gulp-bundle-assets.bundleorchestrator._flush.md index 89ef7124..604c9f8a 100644 --- a/docs/api/gulp-bundle-assets.bundleorchastrator._flush.md +++ b/docs/api/gulp-bundle-assets.bundleorchestrator._flush.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchastrator](./gulp-bundle-assets.bundleorchastrator.md) > [\_flush](./gulp-bundle-assets.bundleorchastrator._flush.md) +[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchestrator](./gulp-bundle-assets.bundleorchestrator.md) > [\_flush](./gulp-bundle-assets.bundleorchestrator._flush.md) -## BundleOrchastrator.\_flush() method +## BundleOrchestrator.\_flush() method Signature: diff --git a/docs/api/gulp-bundle-assets.bundleorchastrator._transform.md b/docs/api/gulp-bundle-assets.bundleorchestrator._transform.md similarity index 76% rename from docs/api/gulp-bundle-assets.bundleorchastrator._transform.md rename to docs/api/gulp-bundle-assets.bundleorchestrator._transform.md index 501d23f2..80b33e3e 100644 --- a/docs/api/gulp-bundle-assets.bundleorchastrator._transform.md +++ b/docs/api/gulp-bundle-assets.bundleorchestrator._transform.md @@ -1,8 +1,8 @@ -[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchastrator](./gulp-bundle-assets.bundleorchastrator.md) > [\_transform](./gulp-bundle-assets.bundleorchastrator._transform.md) +[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchestrator](./gulp-bundle-assets.bundleorchestrator.md) > [\_transform](./gulp-bundle-assets.bundleorchestrator._transform.md) -## BundleOrchastrator.\_transform() method +## BundleOrchestrator.\_transform() method Collects copies of applicable files to later bundle. diff --git a/docs/api/gulp-bundle-assets.bundleorchastrator.md b/docs/api/gulp-bundle-assets.bundleorchestrator.md similarity index 53% rename from docs/api/gulp-bundle-assets.bundleorchastrator.md rename to docs/api/gulp-bundle-assets.bundleorchestrator.md index 80b57209..054dc98f 100644 --- a/docs/api/gulp-bundle-assets.bundleorchastrator.md +++ b/docs/api/gulp-bundle-assets.bundleorchestrator.md @@ -1,27 +1,27 @@ -[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchastrator](./gulp-bundle-assets.bundleorchastrator.md) +[Home](./index.md) > [@userfrosting/gulp-bundle-assets](./gulp-bundle-assets.md) > [BundleOrchestrator](./gulp-bundle-assets.bundleorchestrator.md) -## BundleOrchastrator class +## BundleOrchestrator class -Orchastrates bundling. +Orchestrates bundling. Signature: ```typescript -export declare class BundleOrchastrator extends Transform +export declare class BundleOrchestrator extends Transform ``` ## Constructors | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(config, joiner, resultsCallback)](./gulp-bundle-assets.bundleorchastrator._constructor_.md) | | Constructs a new instance of the BundleOrchastrator class | +| [(constructor)(config, joiner, resultsCallback)](./gulp-bundle-assets.bundleorchestrator._constructor_.md) | | Constructs a new instance of the BundleOrchestrator class | ## Methods | Method | Modifiers | Description | | --- | --- | --- | -| [\_flush(callback)](./gulp-bundle-assets.bundleorchastrator._flush.md) | | | -| [\_transform(chunk, encoding, callback)](./gulp-bundle-assets.bundleorchastrator._transform.md) | | Collects copies of applicable files to later bundle. | +| [\_flush(callback)](./gulp-bundle-assets.bundleorchestrator._flush.md) | | | +| [\_transform(chunk, encoding, callback)](./gulp-bundle-assets.bundleorchestrator._transform.md) | | Collects copies of applicable files to later bundle. | diff --git a/docs/api/gulp-bundle-assets.md b/docs/api/gulp-bundle-assets.md index 317a15ff..67656ae0 100644 --- a/docs/api/gulp-bundle-assets.md +++ b/docs/api/gulp-bundle-assets.md @@ -8,7 +8,7 @@ | Class | Description | | --- | --- | -| [BundleOrchastrator](./gulp-bundle-assets.bundleorchastrator.md) | Orchastrates bundling. | +| [BundleOrchestrator](./gulp-bundle-assets.bundleorchestrator.md) | Orchestrates bundling. | ## Enumerations diff --git a/package.json b/package.json index 4c7bf386..abd61e6f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@userfrosting/gulp-bundle-assets", "version": "4.0.0-rc.1", - "description": "Orchastrates JS and CSS bundle creation in an efficient and configurable manner.", + "description": "Orchestrates JS and CSS bundle creation in an efficient and configurable manner.", "funding": "https://opencollective.com/userfrosting", "type": "commonjs", "main": "./dist/index.js", diff --git a/src/bundle-orchastrator.test.ts b/src/bundle-orchestrator.test.ts similarity index 98% rename from src/bundle-orchastrator.test.ts rename to src/bundle-orchestrator.test.ts index 317de758..fe315ba4 100644 --- a/src/bundle-orchastrator.test.ts +++ b/src/bundle-orchestrator.test.ts @@ -1,5 +1,5 @@ import test, { ExecutionContext } from "ava"; -import { BundleOrchastrator, ResultsCallback } from "./bundle-orchastrator.js"; +import { BundleOrchestrator, ResultsCallback } from "./bundle-orchestrator.js"; import intoStream from "into-stream"; import getStream from "get-stream"; import { Readable, Stream } from "stream"; @@ -84,7 +84,7 @@ interface IBundleBuilderFlags { * @param flags Flags used to modify returned bundler. */ function buildBundler(t: ExecutionContext, flags: IBundleBuilderFlags = {}) { - return new BundleOrchastrator( + return new BundleOrchestrator( { cwd: flags.explicitCwd ? process.cwd() diff --git a/src/bundle-orchastrator.ts b/src/bundle-orchestrator.ts similarity index 98% rename from src/bundle-orchastrator.ts rename to src/bundle-orchestrator.ts index 0e53d480..324d3a90 100644 --- a/src/bundle-orchastrator.ts +++ b/src/bundle-orchestrator.ts @@ -98,10 +98,10 @@ async function handleVinylChunk( } /** - * Orchastrates bundling. + * Orchestrates bundling. * @public */ -export class BundleOrchastrator extends Transform { +export class BundleOrchestrator extends Transform { private scriptBundles: Set = new Set(); diff --git a/src/bundle.ts b/src/bundle.ts index 93e5381b..9a58b41a 100644 --- a/src/bundle.ts +++ b/src/bundle.ts @@ -95,7 +95,7 @@ export class Bundle { const orderedFiles: Vinyl[] = []; for (const path of this.initialPaths) { const file = this.files.get(path); - /* istanbul ignore else map.get can testnically be undefined */ + /* istanbul ignore else map.get can technically be undefined */ if (file) orderedFiles.push(file); else throw new Error("Unexpected condition, previously tracked file is undefined"); } diff --git a/src/config/merge-configs.ts b/src/config/merge-configs.ts index 30f2e86a..c2f0c448 100644 --- a/src/config/merge-configs.ts +++ b/src/config/merge-configs.ts @@ -1,7 +1,8 @@ import { Config } from "./config.js"; import MergeBundle from "./merge-bundle.js"; import extend from "just-extend"; -import Errlop from "errlop"; +import ExtendedError from "errlop"; + /** * Merges a collection of configurations. * No validation is conducted, it is expected that provided inputs are all valid. @@ -34,7 +35,7 @@ export default function MergeConfigs(rawConfigs: Config[]): Config { nextConfig.bundle[bundleName] = MergeBundle(outConfig.bundle[bundleName], nextConfig.bundle[bundleName]); } catch (exception) { - throw new Errlop(`Exception raised while merging bundle '${bundleName}' in the raw configuration at index '${rawConfigs.indexOf(config)}'.`, exception); + throw new ExtendedError(`Exception raised while merging bundle '${bundleName}' in the raw configuration at index '${rawConfigs.indexOf(config)}'.`, exception); } } // Otherwise just set it diff --git a/src/config/validate-bundle.test.ts b/src/config/validate-bundle.test.ts index 49d3e91d..b714d981 100644 --- a/src/config/validate-bundle.test.ts +++ b/src/config/validate-bundle.test.ts @@ -10,7 +10,7 @@ test("Empty object", t => { }); /** - * Should thow if the bundle is not an object. + * Should throw if the bundle is not an object. */ test("Non-object bundle", t => { const bundle: any = "a string"; diff --git a/src/main.ts b/src/main.ts index a27cd430..612d78b4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,13 +1,17 @@ export { default as MergeRawConfigs } from "./config/merge-configs.js"; export { default as ValidateRawConfig } from "./config/validate-config.js"; export { - BundleOrchastrator, + /** + * @deprecated + */ + BundleOrchestrator as BundleOrchastrator,// spell-checker:disable-line + BundleOrchestrator, Bundlers, Results, ResultsCallback, -} from "./bundle-orchastrator.js"; -import { BundleOrchastrator } from "./bundle-orchastrator.js"; -export default BundleOrchastrator; +} from "./bundle-orchestrator.js"; +import { BundleOrchestrator } from "./bundle-orchestrator.js"; +export default BundleOrchestrator; export { BundleStreamFactory } from "./bundle"; export { Bundle, diff --git a/src/missing-types.d.ts b/src/missing-types.d.ts index d2583800..5c311a3e 100644 --- a/src/missing-types.d.ts +++ b/src/missing-types.d.ts @@ -1,4 +1,4 @@ -// TODO Typings here cannot be made 100% accurate in all cases untill https://github.com/microsoft/TypeScript/issues/5453 or another alternative is implemented +// TODO Typings here cannot be made 100% accurate in all cases until https://github.com/microsoft/TypeScript/issues/5453 or another alternative is implemented declare module "just-extend" { function extend(target: T, source: U): T & U; function extend(target: T, source1: U, source2: V): T & U & V; From fb841ecffb6e4a62575435c0735e9782f5f0ee45 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 12:44:49 +1000 Subject: [PATCH 06/11] Updated changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c6123d6..f92b8de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed +- Name of bundle class, existing symbol name preserved to maintain compatibility. +- Deprecated export `BundleOrchastrator` in favour of `BundleOrchestrator` + ## [4.0.0] - 2020-03-14 ## [4.0.0-rc.1] - 2020-02-22 From 14c5c30f1451e5d8de38cd9922ff00288a5b8f2e Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 13:29:29 +1000 Subject: [PATCH 07/11] Spelling fixes --- src/bundle-orchestrator.test.ts | 4 ++-- src/bundle-orchestrator.ts | 6 +++--- src/config/config.ts | 2 +- src/config/merge-configs.test.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bundle-orchestrator.test.ts b/src/bundle-orchestrator.test.ts index fe315ba4..c92b2fb2 100644 --- a/src/bundle-orchestrator.test.ts +++ b/src/bundle-orchestrator.test.ts @@ -309,7 +309,7 @@ test("Bundles with unmet dependencies", async t => { }, { instanceOf: Error, - message: "Stream completed before all bundles recieved their dependencies", + message: "Stream completed before all bundles received their dependencies", } ); }); @@ -324,7 +324,7 @@ test("Bundles with all dependencies unmet", async t => { }, { instanceOf: Error, - message: "Stream completed before all bundles recieved their dependencies", + message: "Stream completed before all bundles received their dependencies", } ); }); diff --git a/src/bundle-orchestrator.ts b/src/bundle-orchestrator.ts index 324d3a90..1befe381 100644 --- a/src/bundle-orchestrator.ts +++ b/src/bundle-orchestrator.ts @@ -172,13 +172,13 @@ export class BundleOrchestrator extends Transform { try { // Only handle Vinyl chunks if (!Vinyl.isVinyl(chunk)) { - this.logger.warn("Ignoring recieved non-Vinyl chunk"); + this.logger.warn("Ignoring received non-Vinyl chunk"); this.push(chunk, encoding); callback(); return; } - this.logger.trace("Recieved Vinyl chunk", { pathHistory: chunk.history }); + this.logger.trace("Received Vinyl chunk", { pathHistory: chunk.history }); // Offer chunks to bundles, return any results await handleVinylChunk(chunk, this.scriptBundles, this.results.scripts, this.push.bind(this)); @@ -201,7 +201,7 @@ export class BundleOrchestrator extends Transform { try { // Produce error if there are bundles without all requirements if (this.scriptBundles.size > 0 || this.styleBundles.size > 0) { - throw new Error("Stream completed before all bundles recieved their dependencies"); + throw new Error("Stream completed before all bundles received their dependencies"); } // Invoke results callback diff --git a/src/config/config.ts b/src/config/config.ts index 27925470..d4235d73 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -25,7 +25,7 @@ export enum CollisionReactions { } /** - * Options relevent to UserFrosting's Sprinkle system. + * Options relevant to UserFrosting's Sprinkle system. * @public */ export interface SprinkleOptions { diff --git a/src/config/merge-configs.test.ts b/src/config/merge-configs.test.ts index 407fea28..8904e33d 100644 --- a/src/config/merge-configs.test.ts +++ b/src/config/merge-configs.test.ts @@ -24,7 +24,7 @@ test("First object with bundle property and second object empty", t => { }); /** - * Should return object equviliant to input. + * Should return object equivalent to input. */ test("Single object", t => { const config: Config = { From 09c11263e8f76ef4a39ef2cab7bba92c93cadaf5 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 14:19:17 +1000 Subject: [PATCH 08/11] More spelling fixes, refinement of cspell configuration --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 12 ++++++++---- README.md | 8 ++++---- cspell.json | 31 +++++++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92336390..80f61ea2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ }, { "name": "Check spelling", - "run": "cspell 'src/**/*.ts'" + "run": "cspell '**'" } ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index f92b8de8..280f91d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +[//]: # (spell-checker:disable) + ### Changed - Name of bundle class, existing symbol name preserved to maintain compatibility. - Deprecated export `BundleOrchastrator` in favour of `BundleOrchestrator` +[//]: # (spell-checker:enable) + ## [4.0.0] - 2020-03-14 ## [4.0.0-rc.1] - 2020-02-22 @@ -40,7 +44,7 @@ This release focuses on improving performance and maintainability. These have be - Logging interface, now uses [`ts-log`](https://www.npmjs.com/package/ts-log). ### Removed -- Virtual path logic in favour of [`@userfrosting/vinly-fs-vpath`](https://github.com/userfrosting/vinyl-fs-vpath). +- Virtual path logic in favour of [`@userfrosting/vinyl-fs-vpath`](https://github.com/userfrosting/vinyl-fs-vpath). ### Fixed - Flaw in results API surface, results are now correctly separated according to their type (script/style). @@ -67,7 +71,7 @@ This release focuses on simplifying the package for UserFrosting 4 to improve ma ### Added - Raw configuration validation. - Raw configuration merging with collision logic (ported from UserFrosting `gulpfile`). -- Path transformation with support for file replacement based on rule order (later rules superseed earlier ones). +- Path transformation with support for file replacement based on rule order (later rules supersede earlier ones). - Ability to specify base path for resolution of bundle resources and path transformations. - Support for comprehensive logging through a passed logger function. @@ -77,7 +81,7 @@ This release focuses on simplifying the package for UserFrosting 4 to improve ma - As an internal `gulp` pipeline is no longer responsible for bundle generation, custom `Transform` streams (e.g. `gulp-concat-css`) must be provided. - Path transformations will no longer be applied to files due to complexity around how paths are managed in `gulp`. Instead this feature will be used for override logic alone. - Bundle results are now retrieved via a callback which is given a collection of `Vinyl` `NullFiles` to retain as much useful information as possible. -- Moved package under `@userfrosting` organisation in NPM and removed superfluous `uf` from package name. +- Moved package under `@userfrosting` organization in NPM and removed superfluous `uf` from package name. ### Removed - Support for CSS sourcemaps (broken since 2.27.2). @@ -89,7 +93,7 @@ This release focuses on simplifying the package for UserFrosting 4 to improve ma - Automatic HTML tag generation for results file (use results callback to implement this manually). - File copy support (use `gulp.dest` or an equivalent). - Result file support (replaced by callback). -- Removed dependency on `gulp` as per best practises. +- Removed dependency on `gulp` as per best practices. ## [2.28.2] - 2018-02-10 diff --git a/README.md b/README.md index 52722c9a..c6689db8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ | master | [![Continuous Integration](https://github.com/userfrosting/gulp-uf-bundle-assets/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/userfrosting/gulp-uf-bundle-assets/actions?query=branch:master+workflow:"Continuous+Integration") [![codecov](https://codecov.io/gh/userfrosting/gulp-uf-bundle-assets/branch/master/graph/badge.svg)](https://codecov.io/gh/userfrosting/gulp-uf-bundle-assets/branch/master) | | develop | [![Continuous Integration](https://github.com/userfrosting/gulp-uf-bundle-assets/workflows/Continuous%20Integration/badge.svg?branch=develop)](https://github.com/userfrosting/gulp-uf-bundle-assets/actions?query=branch:develop+workflow:"Continuous+Integration") [![codecov](https://codecov.io/gh/userfrosting/gulp-uf-bundle-assets/branch/develop/graph/badge.svg)](https://codecov.io/gh/userfrosting/gulp-uf-bundle-assets/branch/develop) | -Orchastrates JS and CSS bundle creation in an efficient and configurable manner. +Orchestrates JS and CSS bundle creation in an efficient and configurable manner. ## Install @@ -68,7 +68,7 @@ $ gulp bundle The `Bundler` class exposes a `ResultsMap` property containing a Map where the key is the bundle name and value the full path of the generated file. If any transform stream after `Bundler` that changes path names then the results map will no longer be accurate, so use the built in path transforms if possible. -This approach was decided on as it provides the most efficient means to integrate bundles with any system. No need to touch the file system until its absolutely necessary, and less work to optimise the output (e.g. make a `php` file out of it to reduce IO in production by maximising use of bytecode caching). +This approach was decided on as it provides the most efficient means to integrate bundles with any system. No need to touch the file system until its absolutely necessary, and less work to optimise the output (e.g. make a `php` file out of it to reduce IO in production by maximizing use of bytecode caching). ## API @@ -79,9 +79,9 @@ The results reside in [docs/api](./docs/api/index.md). This plugin was originally forked from [gulp-bundle-assets](https://github.com/dowjones/gulp-bundle-assets) to fix a CSS import bug. -It has since been entirely reworked to better suit the requirements of the UserFrosting's Sprinkle system and follow the Gulp plugin guidelines (namely not unncessarily depending on it). Though TypeScript is now the preferred language the output targetted to ES2015 and uses ES Modules (via the `esm` package) to ensure source it can be easily debugged if issues are observed in the wild. +It has since been entirely reworked to better suit the requirements of the UserFrosting's Sprinkle system and follow the Gulp plugin guidelines (namely not unnecessarily depending on it). Though TypeScript is now the preferred language the output targeted to ES2015 and uses ES Modules (via the `esm` package) to ensure source it can be easily debugged if issues are observed in the wild. -This package was previously published under `gulp-uf-bundle-assets` and as of v3 is published under `@userfrosting/gulp-bundle-assets` to assist in longterm project management. +This package was previously published under `gulp-uf-bundle-assets` and as of v3 is published under `@userfrosting/gulp-bundle-assets` to assist in long-term project management. As of v4 virtual path logic was extracted into a separate package [@userfrosting/vinyl-fs-vpath](https://github.com/userfrosting/vinyl-fs-vpath). This change enabled a significant simplification of core logic along with a significantly faster and more efficient way to support virtual path mappings. diff --git a/cspell.json b/cspell.json index b716670d..6f9b348e 100644 --- a/cspell.json +++ b/cspell.json @@ -1,7 +1,34 @@ { - "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json", + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/v5.0.1-alpha.3/cspell.schema.json", + "version": "0.1", + "language": "en-US", + "words": [ + "narthollis", + "Zaleski", + "gregorymaertens", + "Mele", + "Sherland", + "Soares", + "jcarrivick", + "bytecode", + "backported" + ], "ignoreWords": [ "userfrosting", - "errlop" + "errlop", + "preversion", + "postversion", + "codecov", + "vpath", + "gulpplugin", + "gulpfile" + ], + "ignorePaths": [ + "cspell.json", + "package-lock.json", + "api-extractor.json", + "docs/api/", + "dist/", + "temp/" ] } From 7c94eba40c2b4a844ab3b85e47890b06c8a3fc19 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 16:45:30 +1000 Subject: [PATCH 09/11] Fixes #36 Improved logging to note missing bundles, properly process logged errors --- src/bundle-orchestrator.ts | 17 +++++++++++++++-- src/bundle.ts | 12 ++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/bundle-orchestrator.ts b/src/bundle-orchestrator.ts index 1befe381..1a8e3002 100644 --- a/src/bundle-orchestrator.ts +++ b/src/bundle-orchestrator.ts @@ -201,7 +201,20 @@ export class BundleOrchestrator extends Transform { try { // Produce error if there are bundles without all requirements if (this.scriptBundles.size > 0 || this.styleBundles.size > 0) { - throw new Error("Stream completed before all bundles received their dependencies"); + const missingBundles: { + type: BundleType, + name: string, + remainingFiles: string[], + }[] = []; + for (const bundle of this.scriptBundles) { + missingBundles.push(bundle.report()); + } + for (const bundle of this.styleBundles) { + missingBundles.push(bundle.report()); + } + const errMessage = "Stream completed before all bundles received their dependencies"; + this.logger.error(errMessage, missingBundles); + throw new Error(errMessage); } // Invoke results callback @@ -210,7 +223,7 @@ export class BundleOrchestrator extends Transform { callback(); } catch (error) { - this.logger.error("_flush completed with error", { error }); + this.logger.error("_flush completed with error", { error: error?.toString() ?? error }); callback(new PluginError(PluginName, error)); } } diff --git a/src/bundle.ts b/src/bundle.ts index 9a58b41a..f751fefc 100644 --- a/src/bundle.ts +++ b/src/bundle.ts @@ -142,4 +142,16 @@ export class Bundle { return false; } } + + /** + * Returns an object used for reporting bundle status when the stream completes before all required + * files have been received. + */ + public report() { + return { + type: this.type, + name: this.name, + remainingFiles: this.remainingPaths.slice(), + }; + } } From 7e343e0b4bafcb95e1c0124e761dbd80087af2c0 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 16:49:53 +1000 Subject: [PATCH 10/11] Updated changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 280f91d7..f7f546ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. [//]: # (spell-checker:disable) +### Fixed +- Missing bundles and files not being logged when stream completes without providing all required files. + ### Changed - Name of bundle class, existing symbol name preserved to maintain compatibility. -- Deprecated export `BundleOrchastrator` in favour of `BundleOrchestrator` +- Deprecated export `BundleOrchastrator` in favour of `BundleOrchestrator`. [//]: # (spell-checker:enable) From 721fe0db751de0f77147c199c4ca88afbfbea42b Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 18 Apr 2020 17:11:28 +1000 Subject: [PATCH 11/11] `.toString` available to all values (ignoring `undefined` and `null` which we aren't covering), no need for fallback --- src/bundle-orchestrator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle-orchestrator.ts b/src/bundle-orchestrator.ts index 1a8e3002..08acc437 100644 --- a/src/bundle-orchestrator.ts +++ b/src/bundle-orchestrator.ts @@ -223,7 +223,7 @@ export class BundleOrchestrator extends Transform { callback(); } catch (error) { - this.logger.error("_flush completed with error", { error: error?.toString() ?? error }); + this.logger.error("_flush completed with error", { error: error.toString() }); callback(new PluginError(PluginName, error)); } }