Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Remove old way of specifying demos using javascript. (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeChampion authored May 18, 2017
1 parent f60dd33 commit 7a172e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions lib/tasks/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ module.exports = function(gulp, config) {
// can keep on compiling demos of older versions of modules
let configPaths = [
'demos/src/config.json',
'demos/src/config.js',
'origami.json'
];
let configPath;
Expand All @@ -281,7 +280,16 @@ module.exports = function(gulp, config) {
if (configPath) {
log.primary('Building' + (config.dist ? ' build service' : ' local') + ' demos (config: ' + configPath + ')');

const demosConfig = require(configPath);
let demosConfig;

try {
demosConfig = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
} catch (error) {
const demoConfigError = `${configPath} is not valid JSON.`;
const demoConfigErrorStream = errorStream(demoStream, demoConfigError);
return demoConfigErrorStream;
}

const demos = [];
builtFiles.css = [];
builtFiles.js = [];
Expand Down
4 changes: 2 additions & 2 deletions test/tasks/demo.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global describe, it, before, after */
/* eslint-env mocha */
'use strict';

const expect = require('expect.js');
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('Demo task', function() {
fs.writeFileSync('bower.json', '{"name":"o-test"}', 'utf8');
demo(gulp)
.on('error', function(err) {
expect(err.message).to.be('Couldn\'t find demos config path, checked: origami.json,demos/src/config.js,demos/src/config.json');
expect(err.message).to.be('Couldn\'t find demos config path, checked: origami.json,demos/src/config.json');
fs.unlink(path.resolve(obtPath, 'bower.json'));
process.chdir(demoTestPath);
done();
Expand Down

0 comments on commit 7a172e7

Please sign in to comment.