diff --git a/package.json b/package.json index 5321d14..2bccf65 100644 --- a/package.json +++ b/package.json @@ -31,43 +31,43 @@ "homepage": "https://github.com/wix/react-templates", "dependencies": { "chalk": "^1.1.3", - "cheerio": "^0.20.0", + "cheerio": "^0.22.0", "css": "^2.2.1", - "escodegen": "^1.8.0", - "esprima": "^2.7.1", - "lodash": "^4.11.1", + "escodegen": "^1.8.1", + "esprima": "^3.0.0", + "lodash": "^4.16.2", "normalize-html-whitespace": "^0.2.0", - "optionator": "^0.8.0", + "optionator": "^0.8.2", "text-table": "^0.2.0" }, "devDependencies": { - "babel-cli": "^6.10.1", - "babel-core": "^6.10.4", - "babel-loader": "^6.2.4", - "babel-preset-es2015": "^6.9.0", + "babel-cli": "^6.14.0", + "babel-core": "^6.14.0", + "babel-loader": "^6.2.5", + "babel-preset-es2015": "^6.14.0", "brace": "^0.8.0", "brfs": "^1.4.1", - "coveralls": "^2.11.9", - "eslint": "^3.0.1", + "coveralls": "^2.11.14", + "eslint": "^3.6.1", "eslint-config-wix-editor": "^0.2.3", - "eslint-plugin-lodash": "^1.9.4", - "eslint-plugin-react": "^5.2.2", + "eslint-plugin-lodash": "^1.10.3", + "eslint-plugin-react": "^6.3.0", "eslint-plugin-wix-editor": "^1.1.1", "grunt": "1.0.1", "grunt-babel": "^6.0.0", "grunt-browserify": "5.0.0", "grunt-contrib-requirejs": "1.0.0", - "grunt-contrib-uglify": "1.0.1", + "grunt-contrib-uglify": "^2.0.0", "grunt-contrib-watch": "1.0.0", "grunt-eslint": "19.0.0", "grunt-tape": "^0.1.0", - "istanbul": "^0.4.4", + "istanbul": "^0.4.5", "json-loader": "^0.5.4", - "react": "^15.2.0", - "react-dom": "^15.2.0", + "react": "^15.3.2", + "react-dom": "^15.3.2", "react-native": "^0.29.0", "tape": "^4.6.0", - "webpack": "^1.13.1" + "webpack": "^1.13.2" }, "keywords": [ "templates", diff --git a/src/cli.js b/src/cli.js index cc7b049..bccdd10 100755 --- a/src/cli.js +++ b/src/cli.js @@ -80,14 +80,15 @@ function handleSingleFile(currentOptions, filename) { * @returns {int} The exit code for the operation. */ function execute(args) { - let currentOptions; try { - currentOptions = options.parse(args); + const currentOptions = options.parse(args); + console.log(JSON.stringify(currentOptions)); + + return executeOptions(currentOptions); } catch (error) { console.error(error.message); return 1; } - return executeOptions(currentOptions); } module.exports = { diff --git a/src/reactTemplates.js b/src/reactTemplates.js index 55b1c29..5f8979e 100644 --- a/src/reactTemplates.js +++ b/src/reactTemplates.js @@ -231,7 +231,7 @@ function handleStyleProp(val, node, context) { .map(i => { const pair = i.split(':'); const key = pair[0].trim(); - if (/\{|\}/g.test(key)) { + if (/\{|}/g.test(key)) { throw RTCodeError.build(context, node, 'style attribute keys cannot contain { } expressions'); } const value = pair.slice(1).join(':').trim(); @@ -257,7 +257,7 @@ function convertTagNameToConstructor(tagName, context) { isHtmlTag = isHtmlTag || tagName.match(/^\w+(-\w+)$/); return isHtmlTag ? `'${tagName}'` : tagName; } - return isHtmlTag ? 'React.DOM.' + tagName : tagName; + return isHtmlTag ? `React.DOM.${tagName}` : tagName; } /** diff --git a/test/src/rt-html-valid.spec.js b/test/src/rt-html-valid.spec.js index 3d75c0c..ef8c8d9 100644 --- a/test/src/rt-html-valid.spec.js +++ b/test/src/rt-html-valid.spec.js @@ -45,16 +45,16 @@ module.exports = { let code = ''; try { const html = fs.readFileSync(filename).toString(); - const expected = testUtils.normalizeHtml(readFileNormalized(filename + '.html')); + const expected = testUtils.normalizeHtml(readFileNormalized(`${filename}.html`)); code = reactTemplates.convertTemplateToReact(html, options).replace(/\r/g, ''); const actual = testUtils.normalizeHtml(testUtils.codeToHtml(code)); const equal = compareAndWriteHtml(t, actual, expected, filename); if (!equal) { - fs.writeFileSync(filename + '.code.js', code); + fs.writeFileSync(`${filename}.code.js`, code); } } catch (e) { console.log(testFile, e); - fs.writeFileSync(filename + '.code.js', code); + fs.writeFileSync(`${filename}.code.js`, code); t.fail(e); } }); diff --git a/test/src/testUtils.js b/test/src/testUtils.js index 364985c..593af2c 100644 --- a/test/src/testUtils.js +++ b/test/src/testUtils.js @@ -28,7 +28,7 @@ function normalizeHtml(html) { function compareAndWrite(t, actual, expected, filename) { t.equal(actual, expected, filename); if (actual !== expected) { - fs.writeFileSync(filename + '.actual.js', actual); + fs.writeFileSync(`${filename}.actual.js`, actual); return false; } return true;