Skip to content

Commit

Permalink
Merge pull request #1452 from finos/fdc3-for-web-impl-commonjs
Browse files Browse the repository at this point in the history
Fdc3 for web impl commonjs
  • Loading branch information
robmoffat authored Dec 18, 2024
2 parents bf67434 + d9529a9 commit 2f5429a
Show file tree
Hide file tree
Showing 13 changed files with 2,075 additions and 1,703 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Added utility functions `isStandardContextType(contextType: string)`, `isStandardIntent(intent: string)`,`getPossibleContextsForIntent(intent: StandardIntent)`. ([#1139](https://github.com/finos/FDC3/pull/1139))
* Added support for event listening outside of intent or context listnener. Added new function `addEventListener`, type `EventHandler`, enum `FDC3EventType` and interfaces `FDC3Event` and `FDC3ChannelChangedEvent`. ([#1207](https://github.com/finos/FDC3/pull/1207))
* Added new `CreateOrUpdateProfile` intent. ([#1359](https://github.com/finos/FDC3/pull/1359))
* Added separate `fdc3-commonjs` module for compatibility with older projects that use CommonJS. ([#1452](https://github.com/finos/FDC3/pull/1452))

### Changed

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ This project (the FDC3 Standard repo) is now a monorepo containing the following
| `toolbox/fdc3-explained` | [Here](https://fdc3.finos.org/toolbox/fdc3-explained) | [Readme Here](toolbox/fdc3-explained/README.md) | |
| `toolbox/fdc3-for-web/fdc3-web-impl` | `@finos/fdc3-web-impl` (npm) | Portable and reusable implementation of the FDC3 For-The-Web Desktop Agent-Side protocol, | Cucumber, NYC |
| `toolbox/fdc3-for-web/demo` | -not released- | A reference implementation of an FDC3-For-The-Web Desktop Agent, using the above implementation and conforming to FDC3 2.0 from the [FDC3 Conformance Framework](https://github.com/finos/FDC3-conformance-framework) | |
| `packages/fdc3` | `@finos/fdc3` (npm) | A complete roll-up of the `fdc3-agent-proxy`, `fdc3-context`, `fdc3-schema` and `fdc3-get-agent` sub-modules. This is intended to be the main entry point for typescript / javascript applications using FDC3 | |
| `packages/fdc3` | `@finos/fdc3` (npm) | Imports `fdc3-standard`, `fdc3-context`, `fdc3-schema` and `fdc3-get-agent` sub-modules. This is intended to be the main entry point for typescript / javascript applications using FDC3 | |
| `packages/fdc3-commonjs` | `@finos/fdc3-commonjs` (npm) | A roll-up of the `fdc3` sub-module. This is for **backwards compatibility where CommonJS is required**. May not be provided in future versions of FDC3. | |


### Building and Running The FDC3 Modules

Expand Down
188 changes: 187 additions & 1 deletion package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"toolbox/fdc3-for-web/fdc3-web-impl",
"packages/fdc3-get-agent",
"packages/fdc3",
"packages/fdc3-commonjs",
"toolbox/fdc3-for-web/reference-ui",
"toolbox/fdc3-for-web/demo",
"toolbox/fdc3-workbench"
Expand Down Expand Up @@ -64,4 +65,4 @@
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
}
}
}
57 changes: 57 additions & 0 deletions packages/fdc3-commonjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# FDC3 CommonJS Module

This is the CommonJS module version of the Financial Desktop Connectivity and Collaboration Consortium (FDC3) javascript API.

## Warning

CommonJS is no longer the recommended module system for JavaScript. We recommend using the FDC3 ES6 module at `@finos/fdc3` instead. The FDC3 CommonJS module is provided for compatibility with older projects that use CommonJS.

## Installation

To install the FDC3 CommonJS module, use npm:

```bash
npm install @finos/fdc3-commonjs
```

## Usage

To use the FDC3 CommonJS module in your project, require it as follows:

```javascript
const fdc3CommonJs = require('@finos/fdc3-commonjs');

// getAgent() returns the FDC3 Desktop Agent
const fdc3 = fdc3CommonJs.getAgent();

// Example usage
const contact = {
type: 'fdc3.contact',
name: 'Jane Doe',
id: {
email: 'jane@mail.com'
}
};

fdc3.raiseIntent('ViewProfile', contact);
```

## Documentation

For detailed documentation and API reference, please visit the [official FDC3 documentation](https://fdc3.finos.org/docs/api/overview).

## Contributing

We welcome contributions to the FDC3 project. Please see our [contributing guidelines](https://github.com/finos/FDC3/blob/main/CONTRIBUTING.md) for more information.

## License

This project is licensed under the [Apache 2.0 License](LICENSE).

## Contact

For any questions or support, please reach out to the FDC3 community on our [Slack channel](https://finos-lf.slack.com/archives/CJ8Q8H4Q1) or [mailing list](mailto:fdc3@finos.org).

## Further Details

Further details are avilable in the main [FDC3 Project README](https://github.com/finos/FDC3)
34 changes: 34 additions & 0 deletions packages/fdc3-commonjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@kite9/fdc3-commonjs",
"version": "2.2.0-beta.29",
"author": "Fintech Open Source Foundation (FINOS)",
"homepage": "https://fdc3.finos.org",
"repository": {
"type": "git",
"url": "git+https://github.com/finos/FDC3.git"
},
"publishConfig": {
"tag": "latest"
},
"exports": {
"require": "./dist/index.cjs"
},
"license": "Apache-2.0",
"files": [
"dist"
],
"scripts": {
"clean": "npx rimraf dist",
"build": "npx rollup -c rollup.config.mjs"
},
"dependencies": {
"@kite9/fdc3": "2.2.0-beta.29"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"rollup": "^4.27.4"
}
}
Loading

0 comments on commit 2f5429a

Please sign in to comment.