Skip to content

Commit

Permalink
Add Versioning to Mock Firebolt & Clean Up (#144)
Browse files Browse the repository at this point in the history
* add versioning to app

* update docs & remove discovery openrpc

* update changelog

* re-add npm run dev command
  • Loading branch information
ksentak authored Oct 26, 2023
1 parent 374a04f commit 9111c68
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 121 deletions.
30 changes: 27 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Release Notes
# Change Log

## 0.1.1
All notable changes to this project will be documented in this file.

- Initial creation
## [1.0.1] - 2023-10-18

### Added

* Introduced official versioning for the application.

### Changed

* The application now starts using the command `npm start` as opposed to the previously used `npm run dev`.
* Refactored script commands in `server/package.json` for better clarity and organization.
* Eliminated `firebolt-discovery-openrpc` as an optional dependency. It will no longer be utilized in the application.
* Deleted `package-lock.json` from the root directory.
* Updated documentation for greater clarity and accuracy.

### Fixed

## [0.1.1] - 2022-02-16

### Added

* Initial creation of the application.

### Changed

### Fixed
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ ENV PATH=${PATH}:/usr/src/firebolt/mock-firebolt/cli
WORKDIR /usr/src/firebolt/mock-firebolt/server

ENTRYPOINT [ "npm", "run", "start" ]
# By default, core/manage OpenRPC retrieved from HTTP is enabled. When using 'docker run', users can pass --discovery as command-line parameters
# By default, core/manage OpenRPC retrieved from HTTP is enabled.
CMD [ ]
31 changes: 7 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Note, too, that since the SDK does not validate parameters on method calls, app
- Controllable Mock Firebolt server (NodeJS websocket + HTTP server)
- Control mock method responses via control plane RESTful API, CLI, web admin UI (soon), browser extension (soon)
- 100% OpenRPC-driven; no SDK-specific details within the implementation
- Supports Firebolt SDKs: **core** (always), **manage** (always), **discovery** (optional)
- Supports Firebolt SDKs: **core** & **manage**
- Complete documentation
- Docker support
- Validation (based on OpenRPC specifications) of all parameters sent on method calls
Expand Down Expand Up @@ -87,10 +87,7 @@ The next two sections presume you are using the out-of-the-box `.mf.config.json`

# Firebolt SDK Support

Mock Firebolt supports these Firebolt SDKs: **core**, **manage**, **discovery**.

For developers building "operator apps" / "search and discover apps" which need one or more of these SDKs, when running the Mock Firebolt server, you can pass flags like `--discovery` to enable the specific SDK desired. Note of course that ultimately, when running on a real device, your app will only have whatever permissions it has been given.

Mock Firebolt supports these Firebolt SDKs: **core** & **manage**.

# $badger Support

Expand Down Expand Up @@ -121,23 +118,18 @@ npm install
# If you want support for Firebolt Core/Manage SDK
# Run in a separate terminal window/tab, or use '&' to background
npm run dev
# If you want support for the Firebolt Discovery SDK
# Include the flag(s) you require
# Note the extra double dash!
npm run dev -- --discovery
npm start
# If you need to use non-standard ports for any reason:
npm run dev -- --httpPort 3456 --socketPort 9876 --wsSessionServerPort 1234
npm start -- --httpPort 3456 --socketPort 9876 --wsSessionServerPort 1234
#If you wish to enable conduit functionality*
npm run dev -- --conduit
npm start -- --conduit
*Note*: Requires Conduit to be running. See the Conduit documentation (./conduit/README.md) for more information.
# If you need to use proxy connection for any reason:
npm run dev -- --proxy <ip>:<port>
npm start -- --proxy <ip>:<port>
Refer more about proxy mode in ./docs/ProxyMode.md
# To use the control CLI (assuming you're in the top-level directory for this repo)
Expand All @@ -153,8 +145,7 @@ Click the "Load Unpacked" button (top left corner of browser window)
Navigate to the directory under browser-extensions which contains a manifest.json file and click "Select"
```

Now you can access core/manage OpenRPC from HTTP by adding `"url": "https://rdkcentral.github.io/firebolt/requirements/latest/specifications/firebolt-open-rpc.json"` in mf.config.SAMPLE.json and copying to mf.config.json and can add `@firebolt-js/discovery-sdk` in your app's `package.json` file, import `@firebolt-js/discovery-sdk` optionally in your code in case to make discovery calls

Now you can access core/manage OpenRPC from HTTP by adding `"url": "https://rdkcentral.github.io/firebolt/requirements/latest/specifications/firebolt-open-rpc.json"` in `mf.config.SAMPLE.json` and copying to `mf.config.json`.

# Usage (via Docker, if you prefer)

Expand Down Expand Up @@ -182,14 +173,6 @@ docker run -d \
-p 9998:9998 \
$MF_DOCKER_USER/mock-firebolt
# Run the image, enabling the discovery SDK (not typical)
docker run -d \
--name mf \
--mount type=bind,source="$(pwd)",target=/usr/src/firebolt/host-files \
-p 3333:3333 \
-p 9998:9998 \
$MF_DOCKER_USER/mock-firebolt -- --discovery
# Get container ID
docker ps | grep mf
Expand Down
21 changes: 3 additions & 18 deletions conduit/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions conduit/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Conduit",
"name": "conduit",
"description": "A TV app that works in concert with Mock Firebolt in Reverse Proxy mode",
"version": "1.0.1",
"private": true,
Expand All @@ -16,9 +16,6 @@
"@firebolt-js/sdk": "^0.6.0",
"json": "^11.0.0"
},
"optionalDependencies": {
"@firebolt-js/discovery-sdk": "0.1.0-alpha.2"
},
"devDependencies": {
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.6.0",
Expand Down
19 changes: 7 additions & 12 deletions docs/DotConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ Mock Firebolt: mf.config.json(Supported SDK's)
=======================
## Supported SDK's

Mock Firebolt supports these Firebolt SDKs: **core** (always), **manage** (always), **discovery** (optional)
mf.config.json file contains a list of OpenRPC/SDK's supported by Mock Firebolt, out of which core/manage OpenRPC is supported by default and `discovery` is optional.
and it contains associated command-line flags you provide when you start the server.
# If you're only using the Firebolt Core/Manage OpenRPC
Mock Firebolt supports these Firebolt SDKs: **core** & **manage**.

The `mf.config.json` file contains a list of OpenRPC/SDK's supported by Mock Firebolt, out of which core/manage OpenRPC is supported by default.

# Starting Mock Firebolt
Run Mock Firebolt server as:
```
npm run dev
```

# If you want support for the Firebolt Discovery SDK
# Include the flag you require
# Note the extra double dash!
```
npm run dev -- --discovery
npm start
```

Out of the box, Mock Firebolt contains a .mf.config.SAMPLE.json file. You should copy this file to .mf.config.json (in the same directory) and then make any changes to the new file.
Expand Down Expand Up @@ -44,5 +39,5 @@ By default, Mock Firebolt will validate incoming method names and parameters and
Example:
```
cd server
npm run dev -- --novalidate method --novalidate response
npm start -- --novalidate method --novalidate response
```
4 changes: 2 additions & 2 deletions docs/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ node cli.mjs --sequence ../examples/device-onDeviceNameChanged.sequence.json

See `server/src/triggers/lifecycle.ready/post.mjs`, etc.

Run Mock Firebolt like: `npm run dev -- --triggers ./src/triggers`
Run Mock Firebolt like: `npm start -- --triggers ./src/triggers`

#### novalidate Flag

By default, Mock Firebolt will validate incoming method names and parameters and outgoing events. If you want to prevent some or all of these validation checks, you must either set the value of validate in mf.config.json to a subset of the default values (["method", "params", "response", "event"]) or pass one or more --novalidate command line arguments when you start Mock Firebolt.

Run Mock Firebolt like: `npm run dev -- --novalidate response --novalidate params`
Run Mock Firebolt like: `npm start -- --novalidate response --novalidate params`

### Web Admin UI
```
Expand Down
2 changes: 1 addition & 1 deletion docs/ProxyMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ When Mock Firebolt starts up, it will check for `--proxy` in command line argume
# Usage
If you need to use proxy connection for any reason:

```npm run dev -- --proxy 192.168.0.100:9998```
```npm start -- --proxy 192.168.0.100:9998```

Default port will be 9998 if not passed expliclity.

Expand Down
2 changes: 1 addition & 1 deletion docs/Triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To enable triggers, you must provide one or more directories which contain trigg
Example:
```
cd server
npm run dev -- --triggers ./src/triggers --triggers /some/other/dir/with/triggers
npm start -- --triggers ./src/triggers --triggers /some/other/dir/with/triggers
```

As shown in the example above, you may load triggers from multiple directories. This allows you to organize your triggers as you see fit, and load subsets of them when you start Mock Firebolt.
Expand Down
90 changes: 90 additions & 0 deletions docs/Versioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Versioning Guidelines for Mock Firebolt

This document outlines the guidelines we follow for versioning Mock Firebolt. Our aim is to ensure clarity, consistency, and predictability in our releases, making it easier for both developers and users to understand the state and stability of the software.

## Versioning

We use [semantic versioning](https://semver.org/) which uses the `MAJOR.MINOR.PATCH` format:

* **MAJOR** version for incompatible changes that require user intervention.

* **MINOR** version for backward-compatible new features and enhancements.

* **PATCH** version for backward-compatible bug fixes.

## When to Cut a New Version

1. **Major Releases:**

* Breaking changes have been introduced.

* Major rewrites or architectural changes have been completed.

* When significant features that might affect the application's overall behavior are added.

2. **Minor Releases:**

* New, backward-compatible functionality has been added.

* Deprecated functions or features are marked (to be removed in the next major version).

* Performance enhancements or sizable improvements that don't disrupt existing functionality.

3. **Patch Releases:**

* Backward-compatible bug fixes.

* Minor updates that resolve issues affecting the stability of the application.

4. **Documentation Changes:**
* Minor documentation changes do no necessitate a new version.

* Significant documentation overhauls, especially those reflecting changes in the software's behavior or features, should accompany a minor or major release.

## Changelog Maintenance

With every new version, a corresponding update should be made to [CHANGELOG.md](../CHANGELOG.md).

* Clearly specify the version number.

* Enumerate all changes, categorized by "Added", "Changed", and "Fixed".

* Provide a brief description of each change.

Use the following template to update the Change Log:

```
## [Unreleased] - yyyy-mm-dd
### Added
### Changed
### Fixed
```


## Steps to Create a New Version

1. Update the `package.json` files with the new version number you intend to release. This ensures that the project's metadata accurately reflects the current version.

2. Update [CHANGELOG.md](../CHANGELOG.md) with the details of the release.

3. Navigate to the [tags section](https://github.com/rdkcentral/mock-firebolt/tags) of the `mock-firebolt` repository on GitHub.

4. Click on the "Create a new release" button.

5. In the "Choose a tag" dropdown, the default action is set to "Create a new tag on publish". If you leave the dropdown as-is, it will automatically create a new tag using the release name.

6. Keep the release target to be the `main` branch.

7. For "Release title", you can use the same version number of the release.

8. In the description box, provide a brief summary of the changes or simply reference your updated `CHANGELOG.md`.

9. If you have any binaries, assets, or additional files to distribute with this release, attach them in the "Attach binaries by dropping them here or selecting them" section.

10. Once everything looks good, click on the "Publish release" button.

11. Notify the team and users (if applicable) of the new release.
4 changes: 2 additions & 2 deletions functional/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion functional/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@firebolt-js/mock-firebolt-functional-tests",
"version": "0.0.1",
"version": "1.0.1",
"description": "Command-line interface for controlling the Mock Firebolt server",
"scripts": {
"test": "NODE_ENV=test npx jest --config=jest.config.js --silent -i",
Expand Down
2 changes: 1 addition & 1 deletion functional/tests/utilities.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import WebSocket from "ws";
import path from "path";

let mfProcess;
let startMf = "npm run dev";
let startMf = "npm start";
const mfStarted = "Listening on HTTP port";
const mfHost = "localhost";
const mfUserHeader = "x-mockfirebolt-userid";
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

This file was deleted.

Loading

0 comments on commit 9111c68

Please sign in to comment.