Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You should not move or change the `js/extension/plugins/Extension.jsx` file, but

Moreover you can edit:

- `assets/index.json`: to customize extension dependencies.
- `assets/index.json`: to customize extension dependencies, title and description. The `title`, `description` and `version` at the top level describe the extension, and MapStore shows them in the Extensions page of the manager (2027.01.00 or later), with the version of each plugin. The `glyph` of a plugin is its icon in the context creator and in the Extensions page. The build sets both versions from `version` in `package.json`. The context creator reads `title`, `description` and `version` of the first plugin, so keep them in the plugin entry too.
- `assets/translations/`: to set up your translations.

### Build Extension
Expand Down
6 changes: 6 additions & 0 deletions assets/index.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"title": "Sample Extension",
"description": "A sample extension that adds a plugin to the toolbar",
"version": "@@VERSION@@",
"plugins": [
{
"name": "SampleExtension",
"title": "Sample Extension",
"description": "A sample extension that adds a plugin to the toolbar",
"version": "@@VERSION@@",
"glyph": "plus",
"dependencies": [
"Toolbar"
]
Expand Down
3 changes: 2 additions & 1 deletion build/extension/prod-webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const {name} = require('../../config');
const commons = require('./commons');

// read version and produce a temporary updated index.json
// read version and produce a temporary updated index.json, with the version of the extension and of its plugin
const { version: versionText } = require('../../package.json');
const indexSrc = path.resolve(__dirname, "..", "..", "assets", "index.json");
const tmpIndex = path.resolve(__dirname, "..", "..", "assets", "index.json.tmp");
try {
const indexContent = JSON.parse(fs.readFileSync(indexSrc, 'utf8'));
indexContent.version = versionText;
if (Array.isArray(indexContent.plugins)) {
indexContent.plugins = indexContent.plugins.map(p => p && p.name === name ? { ...p, version: versionText } : p);
}
Expand Down
Loading