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:
parent
8b12d5f432
commit
56d4da5ab1
|
@ -0,0 +1 @@
|
|||
node_modules
|
16
index.js
16
index.js
|
@ -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')))
|
||||
};
|
||||
|
|
11
package.json
11
package.json
|
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue