diff --git a/documentation/docs/build/configuration.md b/documentation/docs/build/configuration.md index d389d925..8a3c1e21 100644 --- a/documentation/docs/build/configuration.md +++ b/documentation/docs/build/configuration.md @@ -13,11 +13,13 @@ next: # Configuration -The jitar build process is configured using a `jitar.json` file. This file is optional and defines the location of the `source`, `target`, `segments`, and `resources` folders. These values are used to split the application in separate deployable bundles and create the necessary configuration files for the jitar runtime. +The jitar build process and runtime environment is configured using a JSON file. This file is optional and can be added to a project at any time. ## Jitar configuration file -The `jitar.json` file is a JSON file that contains the following properties: +By default, Jitar looks for a `jitar.json` file in the project's root directory, but you can use a different filename and specify it when running the CLI. + +A basic configuration contains the following properties: ```json { @@ -37,7 +39,7 @@ The configuration also supports environment variables. They can be used by wrapp ``` ::: -There are four properties in the configuration file: +There are four main properties in the configuration file: * `source` - the location of the source files (default `./src`). * `target` - the location of the target files (default `./dist`). * `segments` - the location of the segment configuration files (default `./segments`). @@ -50,3 +52,18 @@ For a TypeScript project, the `source` folder should be the target folder after ::: warning IMPORTANT The build process deletes the files in the `target` folder during the build process. Make sure that it doesn't point to the `src` folder. ::: + +## Specific build options + +Additionally, the configuration supports specific build options. + +```json +{ + "source": "./src", + "build": { + "ignore": ["app/**/*"] + } +} +``` + +* `build.ignore` - list of glob patterns, relative to the source folder, specifying files that should be ignored during the build (default `[]`). \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e224a688..d6868aae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jitar-monorepo", - "version": "0.11.1", + "version": "0.11.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "jitar-monorepo", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "workspaces": [ "packages/*", @@ -5364,12 +5364,12 @@ }, "packages/analysis": { "name": "@jitar/analysis", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT" }, "packages/build": { "name": "@jitar/build", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/analysis": "*", @@ -5381,7 +5381,7 @@ }, "packages/cli": { "name": "@jitar/cli", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/build": "*", @@ -5395,7 +5395,7 @@ }, "packages/configuration": { "name": "@jitar/configuration", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/sourcing": "*", @@ -5405,12 +5405,12 @@ }, "packages/errors": { "name": "@jitar/errors", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT" }, "packages/execution": { "name": "@jitar/execution", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/errors": "*", @@ -5419,7 +5419,7 @@ }, "packages/health": { "name": "@jitar/health", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/errors": "*", @@ -5428,7 +5428,7 @@ }, "packages/http": { "name": "@jitar/http", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/execution": "*", @@ -5445,11 +5445,11 @@ }, "packages/init": { "name": "@jitar/init", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT" }, "packages/jitar": { - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "dotenv": "17.4.2", @@ -5923,12 +5923,12 @@ }, "packages/logging": { "name": "@jitar/logging", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT" }, "packages/middleware": { "name": "@jitar/middleware", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/errors": "*", @@ -5937,7 +5937,7 @@ }, "packages/plugin-vite": { "name": "@jitar/plugin-vite", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "devDependencies": { "vite": "^7.3.0" @@ -6029,7 +6029,7 @@ }, "packages/runtime": { "name": "@jitar/runtime", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/configuration": "*", @@ -6045,7 +6045,7 @@ }, "packages/scheduling": { "name": "@jitar/scheduling", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/logging": "*" @@ -6053,7 +6053,7 @@ }, "packages/serialization": { "name": "@jitar/serialization", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/analysis": "*" @@ -6061,7 +6061,7 @@ }, "packages/services": { "name": "@jitar/services", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/errors": "*", @@ -6074,7 +6074,7 @@ }, "packages/sourcing": { "name": "@jitar/sourcing", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "glob": "13.0.6", @@ -6086,7 +6086,7 @@ }, "packages/validation": { "name": "@jitar/validation", - "version": "0.11.1", + "version": "0.11.2", "license": "MIT", "dependencies": { "@jitar/errors": "*", @@ -6095,7 +6095,7 @@ }, "tools/eslint-plugin": { "name": "eslint-plugin-jitar", - "version": "0.11.1" + "version": "0.11.2" } } } diff --git a/package.json b/package.json index 2ce4c81b..0ed751d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jitar-monorepo", - "version": "0.11.1", + "version": "0.11.2", "private": true, "description": "Monorepo configuration for Jitar.", "license": "MIT", diff --git a/packages/analysis/package.json b/packages/analysis/package.json index e60895c6..61855a94 100644 --- a/packages/analysis/package.json +++ b/packages/analysis/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/analysis", - "version": "0.11.1", + "version": "0.11.2", "description": "Application analysis library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/build/package.json b/packages/build/package.json index 96414aba..18d754e4 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/build", - "version": "0.11.1", + "version": "0.11.2", "description": "Application building library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/build/src/BuildHelper.ts b/packages/build/src/BuildHelper.ts index 0d9651fb..ea1dbc31 100644 --- a/packages/build/src/BuildHelper.ts +++ b/packages/build/src/BuildHelper.ts @@ -26,12 +26,13 @@ export default class BuildHelper const resources = this.#fileHelper.makePathAbsolute(configuration.resources, configuration.meta.root); const segments = this.#fileHelper.makePathAbsolute(configuration.segments, configuration.meta.root); - const sourceFileManager = new LocalFileManager(source); - const targetFileManager = new LocalFileManager(target); - const resourceFileManager = new LocalFileManager(resources); - const segmentFileManager = new LocalFileManager(segments); - - this.#fileManager = new ProjectFileManager(sourceFileManager, targetFileManager, resourceFileManager, segmentFileManager); + this.#fileManager = new ProjectFileManager( + new LocalFileManager(source), + new LocalFileManager(target), + new LocalFileManager(resources), + new LocalFileManager(segments), + configuration.build.ignore + ); this.#applicationReader = new ApplicationReader(this.#fileManager); } @@ -42,7 +43,7 @@ export default class BuildHelper const resourceFileManager = this.#fileManager.resource; const segmentFileManager = this.#fileManager.segment; - const moduleFiles = await sourceFileManager.filter(Files.MODULE_PATTERN); + const moduleFiles = await sourceFileManager.filterWithIgnores(Files.MODULE_PATTERN, this.#fileManager.sourceIgnores); const resourceFiles = await resourceFileManager.filter(Files.RESOURCE_PATTERN); const segmentFiles = await segmentFileManager.filter(Files.SEGMENT_PATTERN); diff --git a/packages/build/src/BuildManager.ts b/packages/build/src/BuildManager.ts index 067902d9..4d5823f0 100644 --- a/packages/build/src/BuildManager.ts +++ b/packages/build/src/BuildManager.ts @@ -29,12 +29,13 @@ export default class BuildManager const resources = this.#fileHelper.makePathAbsolute(configuration.resources, configuration.meta.root); const segments = this.#fileHelper.makePathAbsolute(configuration.segments, configuration.meta.root); - const sourceFileManager = new LocalFileManager(source); - const targetFileManager = new LocalFileManager(target); - const resourceFileManager = new LocalFileManager(resources); - const segmentFileManager = new LocalFileManager(segments); - - this.#fileManager = new ProjectFileManager(sourceFileManager, targetFileManager, resourceFileManager, segmentFileManager); + this.#fileManager = new ProjectFileManager( + new LocalFileManager(source), + new LocalFileManager(target), + new LocalFileManager(resources), + new LocalFileManager(segments), + configuration.build.ignore + ); this.#applicationReader = new ApplicationReader(this.#fileManager); this.#applicationBuilder = new ApplicationBuilder(this.#fileManager, this.#logger); @@ -46,7 +47,7 @@ export default class BuildManager const resourceFileManager = this.#fileManager.resource; const segmentFileManager = this.#fileManager.segment; - const moduleFiles = await sourceFileManager.filter(Files.MODULE_PATTERN); + const moduleFiles = await sourceFileManager.filterWithIgnores(Files.MODULE_PATTERN, this.#fileManager.sourceIgnores); const resourceFiles = await resourceFileManager.filter(Files.RESOURCE_PATTERN); const segmentFiles = await segmentFileManager.filter(Files.SEGMENT_PATTERN); diff --git a/packages/build/src/ProjectFileManager.ts b/packages/build/src/ProjectFileManager.ts index 3b8f5d4e..2a52ad36 100644 --- a/packages/build/src/ProjectFileManager.ts +++ b/packages/build/src/ProjectFileManager.ts @@ -7,13 +7,15 @@ export default class ProjectFileManager readonly #target: FileManager; readonly #resource: FileManager; readonly #segment: FileManager; + readonly #sourceIgnores: string[]; - constructor(source: FileManager, target: FileManager, resource: FileManager, segment: FileManager) + constructor(source: FileManager, target: FileManager, resource: FileManager, segment: FileManager, sourceIgnores: string[]) { this.#source = source; this.#target = target; this.#resource = resource; this.#segment = segment; + this.#sourceIgnores = sourceIgnores; } get source() { return this.#source; } @@ -23,4 +25,6 @@ export default class ProjectFileManager get resource() { return this.#resource; } get segment() { return this.#segment; } + + get sourceIgnores() { return this.#sourceIgnores; } } diff --git a/packages/cli/package.json b/packages/cli/package.json index cdb8264c..3cec3b1a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/cli", - "version": "0.11.1", + "version": "0.11.2", "description": "CLI tool for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/configuration/package.json b/packages/configuration/package.json index d47cc6ee..7cade330 100644 --- a/packages/configuration/package.json +++ b/packages/configuration/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/configuration", - "version": "0.11.1", + "version": "0.11.2", "description": "Configuration library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/configuration/src/runtime/ConfigurationBuilder.ts b/packages/configuration/src/runtime/ConfigurationBuilder.ts index 6d7a8a64..a7c4634d 100644 --- a/packages/configuration/src/runtime/ConfigurationBuilder.ts +++ b/packages/configuration/src/runtime/ConfigurationBuilder.ts @@ -31,6 +31,8 @@ export default class ConfigurationBuilder configuration.target ??= DefaultValues.TARGET; configuration.segments ??= DefaultValues.SEGMENTS; configuration.resources ??= DefaultValues.RESOURCES; + configuration.build ??= DefaultValues.BUILD; + configuration.build.ignore ??= DefaultValues.BUILD_IGNORE; configuration.meta = { diff --git a/packages/configuration/src/runtime/definitions/RuntimeConfiguration.ts b/packages/configuration/src/runtime/definitions/RuntimeConfiguration.ts index 736e242d..c08068b6 100644 --- a/packages/configuration/src/runtime/definitions/RuntimeConfiguration.ts +++ b/packages/configuration/src/runtime/definitions/RuntimeConfiguration.ts @@ -8,6 +8,11 @@ type RuntimeConfiguration = segments: string; resources: string; + build: + { + ignore: string[]; + } + meta: { root: string; @@ -23,15 +28,25 @@ const DefaultValues = SOURCE: './src', TARGET: './dist', SEGMENTS: './segments', - RESOURCES: './resources' -} as const; + RESOURCES: './resources', + BUILD: { ignore: [] }, + BUILD_IGNORE: [] +}; const validationScheme: ValidationScheme = { source: { type: 'string', required: false }, target: { type: 'string', required: false }, segments: { type: 'string', required: false }, - resources: { type: 'string', required: false } + resources: { type: 'string', required: false }, + + build: { + type: 'group', + fields: { + ignore: { type: 'list', items: { type: 'string' }, required: false }, + }, + required: false + } } as const; export { DefaultValues, validationScheme }; diff --git a/packages/configuration/test/runtime/ConfigurationBuilder.spec.ts b/packages/configuration/test/runtime/ConfigurationBuilder.spec.ts index 505e529b..a8ff7edc 100644 --- a/packages/configuration/test/runtime/ConfigurationBuilder.spec.ts +++ b/packages/configuration/test/runtime/ConfigurationBuilder.spec.ts @@ -19,6 +19,13 @@ describe('runtime/ConfigurationBuilder', () => await expect(promise).resolves.toEqual(CONFIGURATIONS.RESULT.RUNTIME); }); + it('should build a valid runtime configuration with build configuration', async () => + { + const promise = configurationBuilder.build(FILENAMES.BUILD); + + await expect(promise).resolves.toEqual(CONFIGURATIONS.RESULT.BUILD); + }); + it('should build a default runtime when the configuration file does not exist', async () => { const promise = configurationBuilder.build(FILENAMES.MISSING); diff --git a/packages/configuration/test/runtime/fixtures/configuration.fixture.ts b/packages/configuration/test/runtime/fixtures/configuration.fixture.ts index 931c8e58..e4429150 100644 --- a/packages/configuration/test/runtime/fixtures/configuration.fixture.ts +++ b/packages/configuration/test/runtime/fixtures/configuration.fixture.ts @@ -1,7 +1,7 @@ import { RuntimeConfiguration } from '../../../src/runtime'; -const defaultInput: Record = +const defaultInput: Record = { source: './src', target: './dist', @@ -15,6 +15,10 @@ const defaultResult: RuntimeConfiguration = target: './dist', segments: './segments', resources: './resources', + build: + { + ignore: [] + }, meta: { configFile: './jitar.json', @@ -22,7 +26,7 @@ const defaultResult: RuntimeConfiguration = } } as const; -const runtimeInput: Record = +const runtimeInput: Record = { source: './source', target: './target', @@ -36,6 +40,10 @@ const runtimeResult: RuntimeConfiguration = target: './target', segments: './segment', resources: './resource', + build: + { + ignore: [] + }, meta: { configFile: 'valid-runtime-configuration.json', @@ -43,12 +51,41 @@ const runtimeResult: RuntimeConfiguration = } } as const; +const buildInput: Record = +{ + build: + { + ignore: ['app/**/*'] + } +} as const; + +const buildResult: RuntimeConfiguration = +{ + source: './src', + target: './dist', + segments: './segments', + resources: './resources', + build: + { + ignore: ['app/**/*'] + }, + meta: + { + configFile: 'build-runtime-configuration.json', + root: '.' + } +} as const; + const missingResult: RuntimeConfiguration = { source: './src', target: './dist', segments: './segments', resources: './resources', + build: + { + ignore: [] + }, meta: { configFile: 'missing-runtime-configuration.json', @@ -56,9 +93,9 @@ const missingResult: RuntimeConfiguration = } } as const; -const invalidInput: Record = +const invalidInput: Record = { - invalid: 'true' + invalid: true } as const; export const CONFIGURATIONS = @@ -67,12 +104,14 @@ export const CONFIGURATIONS = { DEFAULT: defaultInput, RUNTIME: runtimeInput, + BUILD: buildInput, INVALID: invalidInput }, RESULT: { DEFAULT: defaultResult, RUNTIME: runtimeResult, + BUILD: buildResult, MISSING: missingResult } } as const; diff --git a/packages/configuration/test/runtime/fixtures/filenames.fixture.ts b/packages/configuration/test/runtime/fixtures/filenames.fixture.ts index 1f1bd925..d951d6cd 100644 --- a/packages/configuration/test/runtime/fixtures/filenames.fixture.ts +++ b/packages/configuration/test/runtime/fixtures/filenames.fixture.ts @@ -2,6 +2,7 @@ export const FILENAMES = { DEFAULT: './jitar.json', VALID: 'valid-runtime-configuration.json', + BUILD: 'build-runtime-configuration.json', INVALID: 'invalid-runtime-configuration.json', MISSING: 'missing-runtime-configuration.json', } as const; diff --git a/packages/configuration/test/runtime/fixtures/files.fixture.ts b/packages/configuration/test/runtime/fixtures/files.fixture.ts index 39f60a3d..ef647999 100644 --- a/packages/configuration/test/runtime/fixtures/files.fixture.ts +++ b/packages/configuration/test/runtime/fixtures/files.fixture.ts @@ -8,5 +8,6 @@ export const FILES: Record = { DEFAULT: new File(FILENAMES.DEFAULT, 'text/json', JSON.stringify(CONFIGURATIONS.INPUT.DEFAULT)), VALID: new File(FILENAMES.VALID, 'text/json', JSON.stringify(CONFIGURATIONS.INPUT.RUNTIME)), + BUILD: new File(FILENAMES.BUILD, 'text/json', JSON.stringify(CONFIGURATIONS.INPUT.BUILD)), INVALID: new File(FILENAMES.INVALID, 'text/json', JSON.stringify(CONFIGURATIONS.INPUT.INVALID)) } as const; diff --git a/packages/errors/package.json b/packages/errors/package.json index 1b0572d4..4e55dc6b 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/errors", - "version": "0.11.1", + "version": "0.11.2", "description": "Error library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/execution/package.json b/packages/execution/package.json index 8fb4303b..822417b2 100644 --- a/packages/execution/package.json +++ b/packages/execution/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/execution", - "version": "0.11.1", + "version": "0.11.2", "description": "Execution library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/health/package.json b/packages/health/package.json index aa0719cd..d8e69e1c 100644 --- a/packages/health/package.json +++ b/packages/health/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/health", - "version": "0.11.1", + "version": "0.11.2", "description": "Health library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/http/package.json b/packages/http/package.json index 7c0534d9..3bb0bcfa 100644 --- a/packages/http/package.json +++ b/packages/http/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/http", - "version": "0.11.1", + "version": "0.11.2", "description": "HTTP implementations library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/init/package.json b/packages/init/package.json index d88489bf..cbf498d9 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/init", - "version": "0.11.1", + "version": "0.11.2", "description": "Init utility for creating new Jitar applications quickly.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/jitar/package.json b/packages/jitar/package.json index 9bc2fe74..46b1d3b3 100644 --- a/packages/jitar/package.json +++ b/packages/jitar/package.json @@ -1,6 +1,6 @@ { "name": "jitar", - "version": "0.11.1", + "version": "0.11.2", "description": "Distributed runtime for JavaScript and TypeScript to chop monolithic applications into micros.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/logging/package.json b/packages/logging/package.json index dd84dc15..cf5c7d2c 100644 --- a/packages/logging/package.json +++ b/packages/logging/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/logging", - "version": "0.11.1", + "version": "0.11.2", "description": "Logging library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/middleware/package.json b/packages/middleware/package.json index 7e20152f..e6095ab7 100644 --- a/packages/middleware/package.json +++ b/packages/middleware/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/middleware", - "version": "0.11.1", + "version": "0.11.2", "description": "Middleware library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/plugin-vite/package.json b/packages/plugin-vite/package.json index 560671de..b110e975 100644 --- a/packages/plugin-vite/package.json +++ b/packages/plugin-vite/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/plugin-vite", - "version": "0.11.1", + "version": "0.11.2", "description": "Vite plugin for Jitar.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 54393b2c..73f217ad 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/runtime", - "version": "0.11.1", + "version": "0.11.2", "description": "Client and server runtime library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/scheduling/package.json b/packages/scheduling/package.json index 4ad9fd77..a1021019 100644 --- a/packages/scheduling/package.json +++ b/packages/scheduling/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/scheduling", - "version": "0.11.1", + "version": "0.11.2", "description": "Task scheduling library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/serialization/package.json b/packages/serialization/package.json index a9bce391..6f289b24 100644 --- a/packages/serialization/package.json +++ b/packages/serialization/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/serialization", - "version": "0.11.1", + "version": "0.11.2", "description": "Serialization library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/services/package.json b/packages/services/package.json index 0a5830fb..4477db7c 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/services", - "version": "0.11.1", + "version": "0.11.2", "description": "Services library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/sourcing/package.json b/packages/sourcing/package.json index 47315712..daa42441 100644 --- a/packages/sourcing/package.json +++ b/packages/sourcing/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/sourcing", - "version": "0.11.1", + "version": "0.11.2", "description": "Sourcing library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/packages/sourcing/src/files/FileManager.ts b/packages/sourcing/src/files/FileManager.ts index ec2d1c70..f6636e99 100644 --- a/packages/sourcing/src/files/FileManager.ts +++ b/packages/sourcing/src/files/FileManager.ts @@ -130,6 +130,17 @@ export default class FileManager implements FileReader return filenames.map(filename => this.#fileSystem.normalize(filename)); } + async filterWithIgnores(pattern: string, ignorePatterns: string[]): Promise + { + const allFilenames = await this.filter(pattern); + + const ignoreFilters = ignorePatterns.map(pattern => this.filter(pattern)); + const ignoredFilenames = await Promise.all(ignoreFilters); + const ignoredSet = new Set(ignoredFilenames.flat()); + + return allFilenames.filter(filename => ignoredSet.has(filename) === false); + } + #validateLocation(location: string, filename: string): void { if (location.startsWith(this.#rootLocation) === false) diff --git a/packages/validation/package.json b/packages/validation/package.json index 47cbe16f..84d3be7f 100644 --- a/packages/validation/package.json +++ b/packages/validation/package.json @@ -1,6 +1,6 @@ { "name": "@jitar/validation", - "version": "0.11.1", + "version": "0.11.2", "description": "Validation library for the Jitar runtime.", "author": "Masking Technology (https://jitar.dev)", "license": "MIT", diff --git a/tools/eslint-plugin/package.json b/tools/eslint-plugin/package.json index d6fdada3..e3f8aac5 100644 --- a/tools/eslint-plugin/package.json +++ b/tools/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-jitar", - "version": "0.11.1", + "version": "0.11.2", "private": true, "type": "commonjs", "scripts": {}