diff --git a/gulp/tasks/build.js b/gulp/tasks/build.js index 9012433..8200b8d 100644 --- a/gulp/tasks/build.js +++ b/gulp/tasks/build.js @@ -16,7 +16,9 @@ gulp.task('build', function(done) { ); } else { runSequence( - 'clean', + // 'clean', + // 'fetchEnhancements', + // 'updates', 'watch', 'browser-sync', 'html', diff --git a/gulp/tasks/fetchEnhancements.js b/gulp/tasks/fetchEnhancements.js index 077cac2..9f5d232 100644 --- a/gulp/tasks/fetchEnhancements.js +++ b/gulp/tasks/fetchEnhancements.js @@ -1,7 +1,7 @@ var gulp = require('gulp'); var GitHubApi = require('github'); var _ = require('lodash'); -var fs = require('fs'); +var fs = require('fs-extra'); var template = require('gulp-template'); gulp.task('fetchEnhancements', function(done) { @@ -23,7 +23,8 @@ gulp.task('fetchEnhancements', function(done) { }) .value(); - fs.writeFileSync('src/js/enhancements.json', JSON.stringify(enhancements, null, 4)); + fs.ensureFileSync('.tmp/enhancements.json'); + fs.writeFileSync('.tmp/enhancements.json', JSON.stringify(enhancements, null, 4)); done(); }); diff --git a/gulp/tasks/readme.js b/gulp/tasks/readme.js index d023768..fc47c8c 100644 --- a/gulp/tasks/readme.js +++ b/gulp/tasks/readme.js @@ -7,7 +7,7 @@ gulp.task('readme', function() { return gulp.src('src/_README.md') .pipe(data(function() { return { - enhancements: require('../../src/js/enhancements.json') + enhancements: require('../../.tmp/enhancements.json') }; })) .pipe(template()) diff --git a/gulp/tasks/updates.js b/gulp/tasks/updates.js index 2fdba1a..70c20e1 100644 --- a/gulp/tasks/updates.js +++ b/gulp/tasks/updates.js @@ -6,11 +6,11 @@ var template = require('gulp-template'); gulp.task('updates', function(done) { - var enhancements = JSON.parse(fs.readFileSync('src/js/enhancements.json', 'utf8')); + var enhancements = JSON.parse(fs.readFileSync('.tmp/enhancements.json', 'utf8')); var updates = _.filter(enhancements, {'state': 'closed'}); - fs.writeFileSync('src/js/updates.json', JSON.stringify(updates, null, 4)); + fs.writeFileSync('.tmp/updates.json', JSON.stringify(updates, null, 4)); done(); }); \ No newline at end of file diff --git a/gulp/tasks/webpack.js b/gulp/tasks/webpack.js index 6b887e4..4383b3f 100644 --- a/gulp/tasks/webpack.js +++ b/gulp/tasks/webpack.js @@ -36,7 +36,7 @@ gulp.task('webpack', function() { }); } - return gulp.src('src/js/Livecoding.jsx') + return gulp.src('src/js/components/Livecoding.jsx') .pipe(webpack(config)) .pipe(rename('bundle.js')) .pipe(gulp.dest(util.env.prod ? 'dist' : '.tmp')) diff --git a/package.json b/package.json index 4d88247..c4a289b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "css-loader": "^0.9.0", "del": "^0.1.3", "exports-loader": "^0.6.2", + "fs-extra": "^0.12.0", "github": "^0.2.2", "gulp": "^3.8.9", "gulp-csso": "^0.2.9", diff --git a/src/js/Editor.jsx b/src/js/components/Editor.jsx similarity index 90% rename from src/js/Editor.jsx rename to src/js/components/Editor.jsx index 2d84a91..093f121 100644 --- a/src/js/Editor.jsx +++ b/src/js/components/Editor.jsx @@ -5,26 +5,26 @@ var React = require('react'); // Include libraries. var PubSub = require('pubsub-js'); -var util = require('./util.js'); +var util = require('../util/util.js'); // We'll use CodeMirror as the code editor. var CodeMirror = require('codemirror'); // Load CodeMirror HTML/JS/CSS modes. -require('../../node_modules/codemirror/mode/htmlmixed/htmlmixed.js'); +require('../../../node_modules/codemirror/mode/htmlmixed/htmlmixed.js'); // Require lint framework. -require('../../node_modules/codemirror/addon/lint/lint.js'); +require('../../../node_modules/codemirror/addon/lint/lint.js'); // Add CSSLint to window, window.CSSLint = require('csslint').CSSLint; // because this file expects it to be on window. -require('../../node_modules/codemirror/addon/lint/css-lint.js'); +require('../../../node_modules/codemirror/addon/lint/css-lint.js'); // Require our custom linters. -require('./html-lint.js'); -require('./javascript-lint.js'); +require('../util/html-lint.js'); +require('../util/javascript-lint.js'); // Create the component. var Editor = React.createClass({ diff --git a/src/js/Livecoding.jsx b/src/js/components/Livecoding.jsx similarity index 98% rename from src/js/Livecoding.jsx rename to src/js/components/Livecoding.jsx index e31aa81..0972f6c 100644 --- a/src/js/Livecoding.jsx +++ b/src/js/components/Livecoding.jsx @@ -13,7 +13,7 @@ var MenuBar = require('./MenuBar.jsx'); var Output = require('./Output.jsx'); var Editor = require('./Editor.jsx'); var Updates = require('./Updates.jsx'); -var updateData = require('./updates.json'); +var updateData = require('../../../.tmp/updates.json'); // Create the React component. var Livecoding = React.createClass({ diff --git a/src/js/Menubar.jsx b/src/js/components/MenuBar.jsx similarity index 99% rename from src/js/Menubar.jsx rename to src/js/components/MenuBar.jsx index 0e149d6..a500680 100644 --- a/src/js/Menubar.jsx +++ b/src/js/components/MenuBar.jsx @@ -5,7 +5,7 @@ var React = require('react/addons'); // Include libraries. var PubSub = require('pubsub-js'); -var util = require('./util.js'); +var util = require('../util/util.js'); // Create the component. var MenuBar = React.createClass({ diff --git a/src/js/Output.jsx b/src/js/components/Output.jsx similarity index 100% rename from src/js/Output.jsx rename to src/js/components/Output.jsx diff --git a/src/js/Updates.jsx b/src/js/components/Updates.jsx similarity index 95% rename from src/js/Updates.jsx rename to src/js/components/Updates.jsx index 22a42a6..cbf53e1 100644 --- a/src/js/Updates.jsx +++ b/src/js/components/Updates.jsx @@ -1,13 +1,16 @@ -var React = require('react/addons'); -var _ = require('lodash'); -var util = require('./util.js'); -var Moment = require('moment'); - // This component gets a list of updates from Livecoding. // It then displays only those which the user hasn't dismissed. // When the user closes this drawer it is equivalent to dismissing all updates // presently visible. We store this information on localStorage. +// Include React. +var React = require('react'); + +// Include libraries. +var _ = require('lodash'); +var util = require('../util/util.js'); +var Moment = require('moment'); + var Updates = React.createClass({ statics: { diff --git a/src/js/enhancements.json b/src/js/enhancements.json deleted file mode 100644 index 2832fc0..0000000 --- a/src/js/enhancements.json +++ /dev/null @@ -1,80 +0,0 @@ -[ - { - "title": "Add livecoding handle to editor.", - "number": 122, - "closed_at": null, - "state": "open" - }, - { - "title": "Add ability to load old livecoding.io gists.", - "number": 121, - "closed_at": null, - "state": "open" - }, - { - "title": "Add ability to load external JS libraries.", - "number": 120, - "closed_at": null, - "state": "open" - }, - { - "title": "Add ability to save current gist as anonymous gist.", - "number": 119, - "closed_at": null, - "state": "open" - }, - { - "title": "Add css linting messages to line gutters.", - "number": 118, - "closed_at": "2014-11-13T21:33:17Z", - "state": "closed" - }, - { - "title": "Validate css code before sending to output screen.", - "number": 117, - "closed_at": null, - "state": "open" - }, - { - "title": "Add js linting messages to line gutters.", - "number": 116, - "closed_at": "2014-11-23T01:21:11Z", - "state": "closed" - }, - { - "title": "Validate js code before sending to output screen.", - "number": 115, - "closed_at": "2014-11-23T01:35:59Z", - "state": "closed" - }, - { - "title": "Add html linting messages to line gutters.", - "number": 114, - "closed_at": "2014-11-13T21:32:40Z", - "state": "closed" - }, - { - "title": "Validate html code before sending to output screen.", - "number": 113, - "closed_at": null, - "state": "open" - }, - { - "title": "Add js mode", - "number": 112, - "closed_at": "2014-11-22T05:33:47Z", - "state": "closed" - }, - { - "title": "Add updates screen", - "number": 110, - "closed_at": "2014-11-12T07:40:06Z", - "state": "closed" - }, - { - "title": "Support preprocessors, e.g. jade, sass, coffeescript", - "number": 106, - "closed_at": null, - "state": "open" - } -] \ No newline at end of file diff --git a/src/js/updates.json b/src/js/updates.json deleted file mode 100644 index 75f2684..0000000 --- a/src/js/updates.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "title": "Add css linting messages to line gutters.", - "number": 118, - "closed_at": "2014-11-13T21:33:17Z", - "state": "closed" - }, - { - "title": "Add js linting messages to line gutters.", - "number": 116, - "closed_at": "2014-11-23T01:21:11Z", - "state": "closed" - }, - { - "title": "Validate js code before sending to output screen.", - "number": 115, - "closed_at": "2014-11-23T01:35:59Z", - "state": "closed" - }, - { - "title": "Add html linting messages to line gutters.", - "number": 114, - "closed_at": "2014-11-13T21:32:40Z", - "state": "closed" - }, - { - "title": "Add js mode", - "number": 112, - "closed_at": "2014-11-22T05:33:47Z", - "state": "closed" - }, - { - "title": "Add updates screen", - "number": 110, - "closed_at": "2014-11-12T07:40:06Z", - "state": "closed" - } -] \ No newline at end of file diff --git a/src/js/html-lint.js b/src/js/util/html-lint.js similarity index 100% rename from src/js/html-lint.js rename to src/js/util/html-lint.js diff --git a/src/js/javascript-lint.js b/src/js/util/javascript-lint.js similarity index 100% rename from src/js/javascript-lint.js rename to src/js/util/javascript-lint.js diff --git a/src/js/util.js b/src/js/util/util.js similarity index 100% rename from src/js/util.js rename to src/js/util/util.js