grunt-react-page-templates
Advanced tools
Comparing version
@@ -51,3 +51,3 @@ { | ||
}, | ||
"version": "2.11.0" | ||
"version": "2.12.0" | ||
} |
@@ -43,12 +43,12 @@ //'use strict'; | ||
var argv = [ | ||
"node", | ||
"tsc.js", | ||
"--nolib", | ||
"--target", | ||
options.targetES5 ? "ES5" : "ES3", !!options.moduleKind ? "--module" : "", !!options.moduleKind ? options.moduleKind : "", | ||
"--jsx", | ||
"react", | ||
libPath, | ||
tsdPath, | ||
fileName | ||
"node", | ||
"tsc.js", | ||
"--nolib", | ||
"--target", | ||
options.targetES5 ? "ES5" : "ES3", !!options.moduleKind ? "--module" : "", !!options.moduleKind ? options.moduleKind : "", | ||
"--jsx", | ||
"react", | ||
libPath, | ||
tsdPath, | ||
fileName | ||
]; | ||
@@ -121,15 +121,15 @@ | ||
var sf = "import _template = require('./" + pathInfo.name.replace(/\.rti/ig, '-rt').replace(/\.rt/ig, '-rt') + "');\r\n" + | ||
"import * as _ from 'lodash';\r\n" + | ||
"import * as React from 'react';\r\n" + | ||
"import * as ReactDOM from 'react-dom';\r\n" + | ||
"\r\n" + | ||
"class template extends React.Component<{}, {}> {\r\n" + | ||
" constructor(props) {\r\n" + | ||
" super(props);\r\n" + | ||
" }\r\n" + | ||
//" public render() { return _template(); }\r\n" + | ||
"}\r\n" + | ||
"template.prototype.render = _template as any;\r\n" + | ||
"export = template;"; | ||
var sf = "import _template = require('./" + pathInfo.name.replace(/\.rti/ig, '-rt').replace(/\.rt/ig, '-rt') + "');\r\n" + | ||
"import * as _ from 'lodash';\r\n" + | ||
"import * as React from 'react';\r\n" + | ||
"import * as ReactDOM from 'react-dom';\r\n" + | ||
"\r\n" + | ||
"class template extends React.Component<{}, {}> {\r\n" + | ||
" constructor(props) {\r\n" + | ||
" super(props);\r\n" + | ||
" }\r\n" + | ||
//" public render() { return _template(); }\r\n" + | ||
"}\r\n" + | ||
"template.prototype.render = _template as any;\r\n" + | ||
"export = template;"; | ||
@@ -191,4 +191,12 @@ if (!grunt.file.exists(scaffoldFile)) { | ||
if (generateKeystoneRoutes) { | ||
} | ||
catch (scaffoldError) { | ||
grunt.log.error("Scaffold File Error: " + scaffoldFile + "\r\n"); | ||
grunt.log.errorlns(scaffoldError.message); | ||
} | ||
if (generateKeystoneRoutes) { | ||
try { | ||
grunt.file.copy(path.resolve(pathInfo.dir + '/' + pathInfo.name.replace(/\.rti/ig, '.js').replace(/\.rt/ig, '.js')), path.resolve(templateFolder + '/' + pathInfo.name.replace(/\.rti/ig, '.js').replace(/\.rt/ig, '.js')), {}); | ||
@@ -198,28 +206,19 @@ | ||
//if (buildIso) { | ||
// //grunt.file.copy(path.resolve(pathInfo.dir + '/' + pathInfo.name.replace(/.rti/ig, '.js')), path.resolve(clientJSFolder + '/' + pathInfo.name.replace(/.rti/ig, '.js')), {}); | ||
// /// COPY THE TEMPLATE TO THE JS DIRECTORY | ||
// ///grunt.file.copy(path.resolve(pathInfo.dir + '/' + pathInfo.name.replace(/.rti/ig, '-rt.js')), path.resolve(clientJSFolder + '/' + pathInfo.name.replace(/.rti/ig, '-rt.js')), {}); | ||
//} | ||
if (!grunt.file.exists(routeFile)) { | ||
grunt.file.write(routeFile, | ||
/// TS VERSION | ||
"import * as keystone from 'keystone';\r\n" + | ||
"module.exports = function (req, res) {\r\n" + | ||
"\r\n" + | ||
" var view = new keystone.View(req, res);\r\n" + | ||
" var locals = res.locals;\r\n" + | ||
" locals.req = req;\r\n" + | ||
" locals.res = res;\r\n" + | ||
"\r\n" + | ||
" locals.section = '" + (folderInfo == "" ? "" : folderInfo.substr(1) + "/") + pathInfo.name.replace(/\.rti/ig, '').replace(/\.rt/ig, '') + "';\r\n" + | ||
"\r\n" + | ||
" // Render the view\r\n" + | ||
" view.render('" + (folderInfo == "" ? "" : folderInfo.substr(1) + "/") + pathInfo.name.replace(/\.rti/ig, '').replace(/\.rt/ig, '') + "');\r\n" + | ||
"}\r\n", { encoding: 'utf8' }); | ||
/// TS VERSION | ||
"import * as keystone from 'keystone';\r\n" + | ||
"module.exports = function (req, res) {\r\n" + | ||
"\r\n" + | ||
" var view = new keystone.View(req, res);\r\n" + | ||
" var locals = res.locals;\r\n" + | ||
" locals.req = req;\r\n" + | ||
" locals.res = res;\r\n" + | ||
"\r\n" + | ||
" locals.section = '" + (folderInfo == "" ? "" : folderInfo.substr(1) + "/") + pathInfo.name.replace(/\.rti/ig, '').replace(/\.rt/ig, '') + "';\r\n" + | ||
"\r\n" + | ||
" // Render the view\r\n" + | ||
" view.render('" + (folderInfo == "" ? "" : folderInfo.substr(1) + "/") + pathInfo.name.replace(/\.rti/ig, '').replace(/\.rt/ig, '') + "');\r\n" + | ||
"}\r\n", { encoding: 'utf8' }); | ||
@@ -243,7 +242,9 @@ // JS VERSION | ||
} | ||
catch (routeError) { | ||
grunt.log.error("Route File Error: " + routeFile + "\r\n"); | ||
grunt.log.errorlns(routeError.message); | ||
} | ||
} | ||
catch (scaffoldError) { | ||
grunt.log.error("Scaffold File Error: " + scaffoldFile + "\r\n"); | ||
grunt.log.errorlns(scaffoldError.message); | ||
} | ||
} | ||
@@ -250,0 +251,0 @@ else if (pathInfo.ext == ".tsx") { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
227
0.44%23017
-1.55%