id-presets-builder v4.0.0
id-presets-builder
Build preset files for iDEditor
Will take a collection of iD preset, field and category definition files, verify that the schema is correct and definitions are valid, and builds a preset file, translations, and a YAML file for translation. Useful for deploying iD Editor with custom preset files.
Table of Contents
Install
$ npm install --global id-presets-builderUsage
$ id-presets buildLooks for iD preset files in ./presets/, field files in ./fields/, categories in ./categories/ and defaults in ./defaults.json. Please see the iD Presets README.md for details about iD presets. Outputs presets.json, translations.json and translate.yaml in ./build/.
$ id-presets lintLints the presets files without writing anything.
API
var presetsBuilder = require('id-presets-builder')presetsBuilder.generatePresets([dir], callback)
Looks for preset, field and category files in dirs ${dir}/presets/, ${dir}/fields/, ${dir}/categories/ and ${dir}/defaults.json. dir defaults to process.cwd(). Callback is called with a presets object:
{
  presets: {...},
  categories: {...},
  fields: {...},
  defaults: {...}
}presetsBuilder.generateTranslations(categories, fields, presets)
Generates an object of localized names for presets that can be used in iD editor for localized names of presets in the UI.
presetsBuilder.generateTranslate(fields, presets, translations)
Generates a translate object that defines preset terms that need translation, for use in transifex or similar localization platform.
Contribute
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
License
MIT © Gregor MacLennan / Digital Democracy
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago