Skip to content

Commit dd2eced

Browse files
committed
up
1 parent 0be98e3 commit dd2eced

6 files changed

Lines changed: 26 additions & 31 deletions

File tree

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ sftp-config.json
2121
Thumbs.db
2222

2323
# database dump for tutorial export
24-
dump/
24+
/dump
2525

2626
# NPM packages folder.
2727
node_modules/
2828

2929
# TMP folder (run-time tmp)
30-
tmp/
30+
/tmp
3131

3232
# Manifest (build-generated content, versions)
33-
cache/
33+
/cache
3434

3535
# contains v8 executable for linux-tick-processor (run from project root)
3636
out/*

cache/.gitkeep

Whitespace-only changes.

gulpfile.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,43 +58,23 @@ gulp.task("test", lazyRequireTask('./tasks/test', {
5858
}));
5959

6060

61-
gulp.task('watch', lazyRequireTask('./tasks/watch', {
62-
root: __dirname,
63-
// for performance, watch only these dirs under root
64-
dirs: ['assets', 'styles'],
65-
taskMapping: [
66-
{
67-
watch: 'assets/**',
68-
task: 'sync-resources'
69-
}
70-
]
71-
}));
72-
7361
gulp.task('deploy', function(callback) {
7462
runSequence("deploy:build", "deploy:update", callback);
7563
});
7664

77-
gulp.task("sync-resources", lazyRequireTask('./tasks/syncResources', {
78-
assets: 'public'
79-
}));
80-
8165

8266
gulp.task('webpack', lazyRequireTask('./tasks/webpack'));
8367
// gulp.task('webpack-dev-server', lazyRequireTask('./tasks/webpackDevServer'));
8468

8569

86-
gulp.task('build', function(callback) {
87-
runSequence("sync-resources", 'webpack', callback);
88-
});
70+
gulp.task('build', ['webpack']);
8971

9072
gulp.task('server', lazyRequireTask('./tasks/server'));
9173

92-
gulp.task('edit', ['webpack', 'jsengine:koa:tutorial:importWatch', "sync-resources", 'livereload', 'server']);
74+
gulp.task('edit', ['webpack', 'jsengine:koa:tutorial:importWatch', 'livereload', 'server']);
9375

9476

95-
gulp.task('dev', function(callback) {
96-
runSequence("sync-resources", ['nodemon', 'livereload', 'webpack', 'watch'], callback);
97-
});
77+
gulp.task('dev', ['nodemon', 'livereload', 'webpack']);
9878

9979
gulp.on('err', function(gulpErr) {
10080
if (gulpErr.err) {

modules/config/index.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let path = require('path');
2-
let fs = require('fs');
2+
let fs = require('fs-extra');
33
let yaml = require('js-yaml');
44
let env = process.env;
55

@@ -54,12 +54,13 @@ let config = module.exports = {
5454

5555
projectRoot: process.cwd(),
5656
// public files, served by nginx
57-
publicRoot: path.join(process.cwd(), 'public'),
57+
publicRoot: path.join(process.cwd(), 'public', lang),
5858
// private files, for expiring links, not directly accessible
5959
tutorialRoot: env.TUTORIAL_ROOT || path.join(process.cwd(), '..', 'javascript-tutorial-' + lang),
60-
tmpRoot: path.join(process.cwd(), 'tmp'),
60+
tmpRoot: path.join(process.cwd(), 'tmp', lang),
6161
// js/css build versions
62-
cacheRoot: path.join(process.cwd(), 'cache'),
62+
cacheRoot: path.join(process.cwd(), 'cache', lang),
63+
assetsRoot: path.join(process.cwd(), 'assets'),
6364

6465
handlers: require('./handlers')
6566
};
@@ -89,3 +90,17 @@ t.requireHandlerLocales();
8990
// we have a loop dep here
9091
config.webpack = require('./webpack');
9192

93+
94+
createRoot(config.publicRoot);
95+
createRoot(config.cacheRoot);
96+
createRoot(config.tmpRoot);
97+
98+
function createRoot(root) {
99+
// may be existing symlink
100+
if (fs.existsSync(root) && fs.statSync(root).isFile()) {
101+
fs.unlinkSync(root);
102+
}
103+
if (!fs.existsSync(root)) {
104+
fs.ensureDirSync(root);
105+
}
106+
}

modules/config/webpack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = function () {
4646
/**
4747
* handler/client/assets/* goes to public/assets/
4848
*/
49-
let assetPaths = [];
49+
let assetPaths = [config.assetsRoot];
5050
for (let handlerName in config.handlers) {
5151
let handlerPath = config.handlers[handlerName].path;
5252
let from = `${handlerPath}/client/assets`;

tmp/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)