Support browserification of module

In order for browserify/babel to work with this module and ES6 imports,
we need a little helper package that enables readFileSync
transformation. This only works with static paths however, so we need
to change these, too.
This commit is contained in:
Basti 2017-06-05 20:14:38 +02:00
parent 8b12d5f432
commit 56d4da5ab1
3 changed files with 14 additions and 14 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,15 +1,7 @@
const fs = require('fs');
const path = require('path');
let collection = {};
let schemas = [
"contributor",
"contribution"
];
schemas.forEach((schema) => {
let filePath = path.join(__dirname, 'schemas', `${schema}.json`);
collection[schema] = JSON.parse(fs.readFileSync(filePath));
});
module.exports = collection;
module.exports = {
"contribution": JSON.parse(fs.readFileSync(path.join(__dirname, 'schemas', 'contribution.json'))),
"contributor": JSON.parse(fs.readFileSync(path.join(__dirname, 'schemas', 'contributor.json')))
};

View File

@ -12,11 +12,18 @@
"remotestorage"
],
"author": "Kosmos Contributors <mail@kosmos.org>",
"contributors": [
],
"contributors": [],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/67P/kosmos-schemas.git"
},
"devDependencies": {
"brfs-babel": "^1.0.0"
},
"browserify": {
"transform": [
"brfs-babel"
]
}
}