Skip to content

Commit

Permalink
Merge pull request #433 from mocks-server/release
Browse files Browse the repository at this point in the history
Release v3.12.0
  • Loading branch information
javierbrea authored Sep 1, 2022
2 parents eeb9b1e + 146b414 commit ab1fdb6
Show file tree
Hide file tree
Showing 21 changed files with 626 additions and 487 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
branches:
- master
- release
- feat-384-openapi
pull_request:
jobs:
get-affected:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"graph": "nx graph"
},
"devDependencies": {
"@babel/core": "7.18.10",
"@babel/core": "7.18.13",
"@babel/eslint-parser": "7.18.9",
"@babel/preset-env": "7.18.10",
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.18.6",
"@cypress/webpack-preprocessor": "5.12.0",
"@cypress/webpack-preprocessor": "5.12.2",
"@nrwl/cli": "13.8.3",
"@nrwl/eslint-plugin-nx": "13.8.3",
"@nrwl/tao": "13.8.3",
Expand All @@ -52,7 +52,7 @@
"cypress": "9.7.0",
"cypress-fail-fast": "3.4.1",
"deepmerge": "4.2.2",
"eslint": "8.21.0",
"eslint": "8.22.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.7.0",
"eslint-plugin-no-only-tests": "2.6.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Removed

## [1.4.0] - 2022-09-01

### Added
- feat: Add 'fileSearchFrom' and 'fileSearchStop' options

## [1.3.0] - 2022-08-25

### Added
Expand Down
4 changes: 3 additions & 1 deletion packages/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Once options and namespaces are added, and the `load` method is called, the libr

* __Default option value__. When the option is created, it can contain a `default` property. That value will be assigned if no other one is found.
* __Programmatic config__. An object containing initial configuration can be provided to the `load` or `init` methods.
* __Configuration files__. Configuration files in `process.cwd()`. [Cosmiconfig](https://github.com/davidtheclark/cosmiconfig) is used to provide this feature, so it is compatible with next files formats:
* __Configuration file__. It searches for a configuration file in the `process.cwd()` folder (or any other folders using built-in [options](#built-in-options)). [Cosmiconfig](https://github.com/davidtheclark/cosmiconfig) is used to provide this feature, so it is compatible with next files formats:
* A `[moduleName]` property in a `package.json` file
* A `.[moduleName]rc file with JSON or YAML syntax.`
* A `.[moduleName]rc.json`, `.[moduleName]rc.yaml`, `.[moduleName].yml`, `.[moduleName]rc.js`, or `.[moduleName]rc.cjs` file.
Expand Down Expand Up @@ -306,6 +306,8 @@ All of the built-in options are defined in the `config` namespace:
* __`config.readArguments`__ _(Boolean)_: _Default: `true`_. Determines whether the arguments are read or not. It can be defined only using programmatic configuration.
* __`config.readEnvironment`__ _(Boolean)_: _Default: `true`_. Determines whether the environment variables are read or not. It can be defined using programmatic configuration or command line arguments.
* __`config.fileSearchPlaces`__ _(Array)_: _Default from cosmiconfig_. An array of places to search for the configuration file. It can be defined in any source, except configuration files.
* __`config.fileSearchFrom`__ _(String)_: _Default process.cwd_. Start searching for the configuration file from this folder, and keep searching up in the parent directories until arriving at the `config.fileSearchStop` folder.
* __`config.fileSearchStop`__ _(Array)_: _Default process.cwd_. Directory where the search for the configuration file will stop.
* __`config.allowUnknownArguments`__ _(Boolean)_: _Default `false`_. When set to `true`, it allows to define unknown command line arguments. It can be defined in any source.

## Lifecycle
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mocks-server/config",
"version": "1.3.0",
"version": "1.4.0",
"description": "Modular configuration provider. Read it from file, environment and arguments",
"keywords": [
"configuration",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.organization=mocks-server
sonar.projectKey=mocks-server_main_config
sonar.projectName=config
sonar.projectVersion=1.3.0
sonar.projectVersion=1.4.0

sonar.javascript.file.suffixes=.js
sonar.sourceEncoding=UTF-8
Expand Down
14 changes: 14 additions & 0 deletions packages/config/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ const CONFIG_OPTIONS = [
type: types.ARRAY,
itemsType: types.STRING,
},
{
name: "fileSearchFrom",
description: "Start searching for the configuration file from this folder",
type: types.STRING,
},
{
name: "fileSearchStop",
description: "Directory where the search for the configuration file will stop",
type: types.STRING,
},
{
name: "allowUnknownArguments",
description: "Allow unknown arguments",
Expand Down Expand Up @@ -72,6 +82,8 @@ class Config {
this._readArguments,
this._readEnvironment,
this._fileSearchPlaces,
this._fileSearchFrom,
this._fileSearchStop,
this._allowUnknownArguments,
] = this._configNamespace.addOptions(CONFIG_OPTIONS);
}
Expand All @@ -82,6 +94,8 @@ class Config {
}
return this._files.read(this._programmaticConfig, {
searchPlaces: this._fileSearchPlaces.value,
searchFrom: this._fileSearchFrom.value,
searchStop: this._fileSearchStop.value,
});
}

Expand Down
6 changes: 3 additions & 3 deletions packages/config/src/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class Files {
return config;
}

async read(initConfig, { searchPlaces }) {
async read(initConfig, { searchPlaces, searchFrom, searchStop }) {
const options = {
stopDir: process.cwd(),
stopDir: searchStop || process.cwd(),
};
if (searchPlaces) {
options.searchPlaces = searchPlaces;
}
const explorer = cosmiconfig.cosmiconfig(this._moduleName, options);
const result = await explorer.search();
const result = await explorer.search(searchFrom);

if (!result) {
return {};
Expand Down
6 changes: 6 additions & 0 deletions packages/config/test/src/getValidationSchema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ describe("getValidationSchema method", () => {
readArguments: { type: "boolean" },
readEnvironment: { type: "boolean" },
fileSearchPlaces: { type: "array", items: { type: "string" } },
fileSearchFrom: { type: "string" },
fileSearchStop: { type: "string" },
allowUnknownArguments: { type: "boolean" },
},
additionalProperties: false,
Expand All @@ -59,6 +61,8 @@ describe("getValidationSchema method", () => {
readArguments: { type: "boolean" },
readEnvironment: { type: "boolean" },
fileSearchPlaces: { type: "array", items: { type: "string" } },
fileSearchFrom: { type: "string" },
fileSearchStop: { type: "string" },
allowUnknownArguments: { type: "boolean" },
},
additionalProperties: false,
Expand Down Expand Up @@ -88,6 +92,8 @@ describe("getValidationSchema method", () => {
readArguments: { type: "boolean" },
readEnvironment: { type: "boolean" },
fileSearchPlaces: { type: "array", items: { type: "string" } },
fileSearchFrom: { type: "string" },
fileSearchStop: { type: "string" },
allowUnknownArguments: { type: "boolean" },
},
additionalProperties: true,
Expand Down
5 changes: 5 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
### Removed

## [3.12.0] - 2022-09-01

### Added
- feat: Update @mocks-server/config to 1.4.0. Add 'config.fileSearchFrom' and 'config.fileSearchStop' options

## [3.11.0] - 2022-08-25

### Added
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mocks-server/core",
"version": "3.11.0",
"version": "3.12.0",
"description": "Pluggable mock server supporting multiple route variants and mocks",
"keywords": [
"mocks",
Expand Down Expand Up @@ -38,7 +38,7 @@
"test:unit": "jest"
},
"dependencies": {
"@babel/core": "7.18.10",
"@babel/core": "7.18.13",
"@babel/register": "7.18.9",
"@hapi/boom": "9.1.4",
"@mocks-server/config": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.organization=mocks-server
sonar.projectKey=mocks-server_main_core
sonar.projectName=core
sonar.projectVersion=3.11.0
sonar.projectVersion=3.12.0

sonar.javascript.file.suffixes=.js
sonar.sourceEncoding=UTF-8
Expand Down
5 changes: 5 additions & 0 deletions packages/main/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
### Breaking change

## [3.12.0] - 2022-09-01

### Added
- feat: Update @mocks-server/core to 3.12.0. Add 'config.fileSearchFrom' and 'config.fileSearchStop' options

## [3.11.0] - 2022-08-25

### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/main/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mocks-server/main",
"version": "3.11.0",
"version": "3.12.0",
"description": "Mock Server supporting multiple route variants and mocks",
"keywords": [
"mock",
Expand Down
2 changes: 1 addition & 1 deletion packages/main/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sonar.organization=mocks-server
sonar.projectKey=mocks-server_main
sonar.projectName=main
sonar.projectVersion=3.11.0
sonar.projectVersion=3.12.0

sonar.javascript.file.suffixes=.js
sonar.sourceEncoding=UTF-8
Expand Down
Loading

0 comments on commit ab1fdb6

Please sign in to comment.