Skip to content

Commit 2f5429a

Browse files
authored
Merge pull request #1452 from finos/fdc3-for-web-impl-commonjs
Fdc3 for web impl commonjs
2 parents bf67434 + d9529a9 commit 2f5429a

13 files changed

Lines changed: 2075 additions & 1703 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
2323
* Added utility functions `isStandardContextType(contextType: string)`, `isStandardIntent(intent: string)`,`getPossibleContextsForIntent(intent: StandardIntent)`. ([#1139](https://github.com/finos/FDC3/pull/1139))
2424
* 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))
2525
* Added new `CreateOrUpdateProfile` intent. ([#1359](https://github.com/finos/FDC3/pull/1359))
26+
* Added separate `fdc3-commonjs` module for compatibility with older projects that use CommonJS. ([#1452](https://github.com/finos/FDC3/pull/1452))
2627

2728
### Changed
2829

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ This project (the FDC3 Standard repo) is now a monorepo containing the following
9393
| `toolbox/fdc3-explained` | [Here](https://fdc3.finos.org/toolbox/fdc3-explained) | [Readme Here](toolbox/fdc3-explained/README.md) | |
9494
| `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 |
9595
| `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) | |
96-
| `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 | |
96+
| `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 | |
97+
| `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. | |
98+
9799

98100
### Building and Running The FDC3 Modules
99101

package-lock.json

Lines changed: 187 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"toolbox/fdc3-for-web/fdc3-web-impl",
2727
"packages/fdc3-get-agent",
2828
"packages/fdc3",
29+
"packages/fdc3-commonjs",
2930
"toolbox/fdc3-for-web/reference-ui",
3031
"toolbox/fdc3-for-web/demo",
3132
"toolbox/fdc3-workbench"
@@ -64,4 +65,4 @@
6465
"lint-staged": {
6566
"**/*": "prettier --write --ignore-unknown"
6667
}
67-
}
68+
}

packages/fdc3-commonjs/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# FDC3 CommonJS Module
2+
3+
This is the CommonJS module version of the Financial Desktop Connectivity and Collaboration Consortium (FDC3) javascript API.
4+
5+
## Warning
6+
7+
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.
8+
9+
## Installation
10+
11+
To install the FDC3 CommonJS module, use npm:
12+
13+
```bash
14+
npm install @finos/fdc3-commonjs
15+
```
16+
17+
## Usage
18+
19+
To use the FDC3 CommonJS module in your project, require it as follows:
20+
21+
```javascript
22+
const fdc3CommonJs = require('@finos/fdc3-commonjs');
23+
24+
// getAgent() returns the FDC3 Desktop Agent
25+
const fdc3 = fdc3CommonJs.getAgent();
26+
27+
// Example usage
28+
const contact = {
29+
type: 'fdc3.contact',
30+
name: 'Jane Doe',
31+
id: {
32+
email: 'jane@mail.com'
33+
}
34+
};
35+
36+
fdc3.raiseIntent('ViewProfile', contact);
37+
```
38+
39+
## Documentation
40+
41+
For detailed documentation and API reference, please visit the [official FDC3 documentation](https://fdc3.finos.org/docs/api/overview).
42+
43+
## Contributing
44+
45+
We welcome contributions to the FDC3 project. Please see our [contributing guidelines](https://github.com/finos/FDC3/blob/main/CONTRIBUTING.md) for more information.
46+
47+
## License
48+
49+
This project is licensed under the [Apache 2.0 License](LICENSE).
50+
51+
## Contact
52+
53+
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).
54+
55+
## Further Details
56+
57+
Further details are avilable in the main [FDC3 Project README](https://github.com/finos/FDC3)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@kite9/fdc3-commonjs",
3+
"version": "2.2.0-beta.29",
4+
"author": "Fintech Open Source Foundation (FINOS)",
5+
"homepage": "https://fdc3.finos.org",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/finos/FDC3.git"
9+
},
10+
"publishConfig": {
11+
"tag": "latest"
12+
},
13+
"exports": {
14+
"require": "./dist/index.cjs"
15+
},
16+
"license": "Apache-2.0",
17+
"files": [
18+
"dist"
19+
],
20+
"scripts": {
21+
"clean": "npx rimraf dist",
22+
"build": "npx rollup -c rollup.config.mjs"
23+
},
24+
"dependencies": {
25+
"@kite9/fdc3": "2.2.0-beta.29"
26+
},
27+
"devDependencies": {
28+
"@rollup/plugin-commonjs": "^28.0.1",
29+
"@rollup/plugin-json": "^6.1.0",
30+
"@rollup/plugin-node-resolve": "^15.3.0",
31+
"@rollup/plugin-typescript": "^12.1.1",
32+
"rollup": "^4.27.4"
33+
}
34+
}

0 commit comments

Comments
 (0)