# HG changeset patch # User ymh # Date 1456395669 -3600 # Node ID 31a5c314d575cc91943f508e373d39f7076faf06 # Parent fac22d8c2df87047b1b7aa59fd2fa46d324dc2bc format is not the same for fixtures diff -r fac22d8c2df8 -r 31a5c314d575 cms/app-client/app/mirage/fixtures/documents.js --- a/cms/app-client/app/mirage/fixtures/documents.js Thu Feb 25 10:20:01 2016 +0100 +++ b/cms/app-client/app/mirage/fixtures/documents.js Thu Feb 25 11:21:09 2016 +0100 @@ -1,4 +1,4 @@ -module.exports = [ +export default [ { "id": "corpusparole:crdo-09-CAYCHAX_SOUND", "uri": "http://corpusdelaparole.huma-num.fr/corpus/res/crdo-09-CAYCHAX_SOUND", diff -r fac22d8c2df8 -r 31a5c314d575 cms/app-client/package.json --- a/cms/app-client/package.json Thu Feb 25 10:20:01 2016 +0100 +++ b/cms/app-client/package.json Thu Feb 25 11:21:09 2016 +0100 @@ -11,7 +11,7 @@ "build": "ember build --environment=production", "start": "ember serve --environment=development", "test": "ember test", - "dl-fixtures": "ember dl-fixtures -u http://127.0.0.1:8000/api/v1/documents/ -d app/mirage/fixtures/documents.js -p 2" + "dl-fixtures": "ember dl-fixtures -u http://127.0.0.1:8000/api/v1/documents/ -d app/mirage/fixtures/documents.js -p 2 -f es6" }, "repository": "", "engines": { diff -r fac22d8c2df8 -r 31a5c314d575 common/corpus-common-addon/lib/commands/dl-fixtures.js --- a/common/corpus-common-addon/lib/commands/dl-fixtures.js Thu Feb 25 10:20:01 2016 +0100 +++ b/common/corpus-common-addon/lib/commands/dl-fixtures.js Thu Feb 25 11:21:09 2016 +0100 @@ -45,12 +45,14 @@ { name: 'url', type: String, aliases: ['u'], description: "Source url" }, { name: 'dest', type: String, aliases: ['d'], description: "File destination" }, { name: 'page', type: Number, default: 1 , aliases: ['p'], description: "number of page to download"}, + { name: 'format', type: String, default: 'es6' , aliases: ['f'], description: "Format for module export, es6 or require"}, ], run: function(commandOptions, rawArgs) { //TODO: check that commandOptions.url is not empty var dest = commandOptions.dest || "." + path.sep + commandOptions.type + ".js" + var format = commandOptions.format || 'es6'; var ids = []; var pageIndex = 1; @@ -100,7 +102,8 @@ })); }).then(function(res) { var deferred = Q.defer(); - fs.writeFile(dest, "module.exports = " + JSON.stringify(res,null,2) + ";", function(err) { + var prefix = (format==='es6')?'export default ':"module.exports = "; + fs.writeFile(dest, prefix + JSON.stringify(res,null,2) + ";", function(err) { if(err) { return deferred.reject(err); } diff -r fac22d8c2df8 -r 31a5c314d575 server/bo_client/package.json --- a/server/bo_client/package.json Thu Feb 25 10:20:01 2016 +0100 +++ b/server/bo_client/package.json Thu Feb 25 11:21:09 2016 +0100 @@ -11,7 +11,7 @@ "build": "ember build", "start": "ember server", "test": "ember test", - "dl-fixtures": "ember dl-fixtures -u http://127.0.0.1:8000/api/v1/documents/ -d server/fixtures/documents.js -p 2" + "dl-fixtures": "ember dl-fixtures -u http://127.0.0.1:8000/api/v1/documents/ -d server/fixtures/documents.js -p 2 -f require" }, "repository": "", "engines": {