Skip to content

Commit

Permalink
feat(js): Adding version propery to the ECL object - FRONT-4638 (#3657)
Browse files Browse the repository at this point in the history
* feat(js): Adding version propery to the ECL object - FRONT-4638

* chore(js): Adding docs - FRONT-4638

---------

Co-authored-by: Romain Emery <[email protected]>
  • Loading branch information
planctus and emeryro committed Oct 1, 2024
1 parent 9823084 commit a008649
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ This means that when you include the `ECL` library in your pages, you will have

![ECL library in your browser's console](./assets/ECLjs.png)

## Version in use

You can get the ECL version you are using running `ECL.version` in the console of your devtools.

## Instantiation

Each component contains `.init()` and `.destroy()` methods.
Expand Down
3 changes: 3 additions & 0 deletions src/tools/builder/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const commonjs = require('rollup-plugin-commonjs');
const { uglify } = require('rollup-plugin-uglify');
const svg = require('rollup-plugin-svg');
const getSystem = require('../utils/getSystem');
const pkg = require('../package.json');

module.exports = (input, dest, options) => {
const uglifyCode =
Expand All @@ -32,6 +33,7 @@ module.exports = (input, dest, options) => {
'getSystem()': JSON.stringify(getSystem()),
delimiters: ['', ''],
preventAssignment: true,
__VERSION__: JSON.stringify(pkg.version),
}),
resolve(),
commonjs(),
Expand All @@ -58,6 +60,7 @@ module.exports = (input, dest, options) => {
sourcemap: options.sourcemap || options.sourceMap,
exports: 'named',
globals: options.globals || {},
footer: `ECL.version = "${pkg.version}";`,
};

rollup.rollup(inputOptions).then((bundle) => bundle.write(outputOptions));
Expand Down
2 changes: 2 additions & 0 deletions src/website/src/pages/ec/getting-started/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ Then, in the footer of the document (or whenever the document is ready), call `E
</html>
```

You can get the ECL version you are using running `ECL.version` in the console of your devtools.

### Datepicker

ECL uses [Pikaday](https://github.com/Pikaday/Pikaday) and this library is not bundled by ECL.
Expand Down

1 comment on commit a008649

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.