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

View File

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