Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace '"' to '' for the tutorial path of windows #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions modules/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,34 @@ let config = module.exports = {
host: env.HOST || 'localhost'
},

appKeys: [secret.sessionKey],
appKeys: [secret.sessionKey],
adminKey: secret.adminKey,

certDir: path.join(secret.dir, 'cert'),
lang: lang,

lang: lang,

plnkrAuthId: secret.plnkrAuthId,

assetVersioning: env.ASSET_VERSIONING === 'file' ? 'file' :
env.ASSET_VERSIONING === 'query' ? 'query' : null,
env.ASSET_VERSIONING === 'query' ? 'query' : null,

pug: {
pug: {
basedir: path.join(process.cwd(), 'templates'),
cache: env.NODE_ENV !== 'development'
cache: env.NODE_ENV !== 'development'
},

supportEmail: '[email protected]',

projectRoot: process.cwd(),
projectRoot: process.cwd(),
// public files, served by nginx
publicRoot: path.join(process.cwd(), 'public', lang),
publicRoot: path.join(process.cwd(), 'public', lang),
// private files, for expiring links, not directly accessible
tutorialRoot: env.TUTORIAL_ROOT || path.join(process.cwd(), 'repo', `${env.TUTORIAL_LANG || lang}.javascript.info`),
tmpRoot: path.join(process.cwd(), 'tmp', lang),
tutorialRoot: env.TUTORIAL_ROOT || path.join(process.cwd(), 'repo', `${(env.TUTORIAL_LANG || lang).replace(/"/g, '')}.javascript.info`),
tmpRoot: path.join(process.cwd(), 'tmp', lang),
// js/css build versions
cacheRoot: path.join(process.cwd(), 'cache', lang),
assetsRoot: path.join(process.cwd(), 'assets'),
cacheRoot: path.join(process.cwd(), 'cache', lang),
assetsRoot: path.join(process.cwd(), 'assets'),

handlers: require('./handlers')
};
Expand All @@ -71,13 +71,13 @@ let repo = `javascript-tutorial/${config.lang}.javascript.info`;

config.tutorialRepo = {
github: repo,
url: new URL('https://github.com/' + repo),
tree: new URL('https://github.com/' + repo + '/tree/master'),
blob: new URL('https://github.com/' + repo + '/blob/master')
url: new URL('https://github.com/' + repo),
tree: new URL('https://github.com/' + repo + '/tree/master'),
blob: new URL('https://github.com/' + repo + '/blob/master')
};


require.extensions['.yml'] = function(module, filename) {
require.extensions['.yml'] = function (module, filename) {
module.exports = yaml.load(fs.readFileSync(filename, 'utf-8'));
};

Expand All @@ -95,7 +95,7 @@ createRoot(config.publicRoot);
createRoot(config.cacheRoot);
createRoot(config.tmpRoot);

function createRoot(root) {
function createRoot (root) {
// may be existing symlink
if (fs.existsSync(root) && fs.statSync(root).isFile()) {
fs.unlinkSync(root);
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "2.0.0",
"private": true,
"scripts": {
"start":"cross-env PORT=8888 ./edit zh",
"en":"cross-env PORT=8888 ./edit en",
"fixperms": "sudo chown -R `id -u` .* * ~/.n*",
"//": "test must exit with status 1 if fails, don't use | or ensure the right exit code if you do",
"test": "cross-env SELENIUM_LOCAL=1 NODE_ENV=test NODE_PATH=./modules ./node_modules/.bin/gulp test",
Expand Down