diff --git a/CHANGELOG.md b/CHANGELOG.md index c1847124..683cfcf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,29 @@ +## 0.4.0 + +### create + +* Renamed `init` command to `create` for clarity of purpose. + +### transpile + +* Fixed fs-extra depreciation warning about using a RegExp in copying + +### pack + +* Fixes App rendering in isomorphic code layout, where apps exported as ES6 default would fail to render. + +### test + +* Properly ignore ./dist and ./build directories when searching for tests. +* Removed sourcemap support as it was causing issues. + + ## 0.3.0 (November 7, 2016) ### init * Sanitizes directory name so only valid characters are included as the package name. +* Template updated for Enact 1.0.0-alpha.3 ### pack @@ -29,6 +50,7 @@ * Verifies the user has a compatible Node version. * Verifies the destination directory is safe to create a project in. * Template now include webOS meta files (appinfo.json, icons.png, etc.). +* Template updated for Enact 1.0.0-alpha.2 * The package.json and appinfo.json will update their respective `name`/`id` to the project directory's name. * Added `--verbose` flag option to provide detailed logging. * Added `--link` flag option to link any dependencies that have been `npm link` rathen than install. diff --git a/README.md b/README.md index 6c01b0d9..f7d53972 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ npm install -g enyojs/enact-dev The only time you're ever want to directly use the Enact CLI is when you want to create a new project. ```sh -enact init [directory] +enact create [directory] ``` This will generate a basic App template, complete with npm scripts and dependencies setup. If no directory path is specified, it will be generated within the working directory. @@ -52,6 +52,31 @@ Runs the Enact configuration of Eslint on the project for syntax analysis. These tasks will execute all valid tests (files that end in `-specs.js`) that are within the project directory. The `test` is a standard execution pass, `test-json` uses a json reporter for output, and `test-watch` will set up a watcher to re-execute tests when files change. +## Enact Build Options + +The enact-dev tool will check the project's `package.json` looking for an optional `enact` object for a few customization options: + +* `template` _[string]_ - Filepath to an alternate HTML template to use with the [Webpack html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin). +* `isomorphic` _[boolean|string]_ - If `true`, it indicates the default entrypoint is isomorphic-compatible (and can be built via the `--isomorphic` enact-dev flag). If the value is a string, then it will use that value as a filepath to a custom isomorphic-compatible entrypoint. +* `title` _[string]_ - Title text that should be put within the HTML's `` tags. Note: if this is a webOS-project, the title by default will be auto-detected from the appinfo.json content. +* `ri` _[object]_ - Resolution independence options to be forwarded to the [LESS plugin](https://github.com/enyojs/less-plugin-resolution-independence). +* `proxy` _[string]_ - Proxy target during project `serve` to be used within the [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware). + +For example: +```js +{ + ... + "enact": { + "isomorphic": true, + "ri": { + "baseSize":24 + } + } + ... +} +``` + + ## Displaying Lint Output in the Editor Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint. diff --git a/bin/enact.js b/bin/enact.js index fef7afcd..a3778152 100755 --- a/bin/enact.js +++ b/bin/enact.js @@ -9,8 +9,14 @@ if(process.argv.indexOf('-v')>=0 || process.argv.indexOf('--version')>=0) { console.log(); } else { var command = process.argv[2]; + switch(command) { case 'init': + var chalk = require('chalk'); + console.log(chalk.gray('Warning: \'enact init\' is depreciated.' + + ' Please use \'enact create\'')); + command = 'create'; + case 'create': case 'serve': case 'transpile': case 'pack': @@ -21,7 +27,7 @@ if(process.argv.indexOf('-v')>=0 || process.argv.indexOf('--version')>=0) { task(process.argv.slice(3)); break; default: - var init = require('../global-cli/init'); - init(['--help']); + var create = require('../global-cli/create'); + create(['--help']); } } diff --git a/config/.babelrc b/config/.babelrc index 53eec96c..e70fbf6b 100644 --- a/config/.babelrc +++ b/config/.babelrc @@ -1,9 +1,9 @@ -{ - "presets": ["es2015", "stage-0", "react"], - "plugins": ["dev-expression"], - "env": { - "production": { - "plugins": ["transform-react-inline-elements","transform-react-constant-elements"] - } - } +{ + "presets": ["es2015", "stage-0", "react"], + "plugins": ["dev-expression"], + "env": { + "production": { + "plugins": ["transform-react-inline-elements","transform-react-constant-elements"] + } + } } \ No newline at end of file diff --git a/config/EnactFrameworkPlugin.js b/config/EnactFrameworkPlugin.js index b0d84da2..827cb351 100644 --- a/config/EnactFrameworkPlugin.js +++ b/config/EnactFrameworkPlugin.js @@ -1,104 +1,104 @@ -var - path = require('path'), - fs = require('fs'), - DllEntryPlugin = require('webpack/lib/DllEntryPlugin'), - DllModule = require('webpack/lib/DllModule'), - RawSource = require("webpack/lib/RawSource"); - -var pkgCache = {}; -var checkPkgMain = function(dir) { - if(pkgCache[dir]) { - return pkgCache[dir].main; - } else { - try { - var text = fs.readFileSync(path.join(dir, 'package.json'), {encoding:'utf8'}); - pkgCache[dir] = JSON.parse(text); - return pkgCache[dir].main; - } catch(e) { - return undefined; - } - } -}; - -function normalizeModuleID(id) { - var parent = path.dirname(id); - var main = checkPkgMain(parent); - if(main && path.resolve(id)===path.resolve(path.join(parent, main))) { - id = parent; - } - id = id.replace(/\\/g, '/'); - - // Remove any leading ./node_modules prefix - var nodeModulesPrefix = './node_modules/'; - if(id.indexOf(nodeModulesPrefix)===0) { - id = id.substring(nodeModulesPrefix.length); - } - if(id.indexOf('node_modules')===-1) { - // Remove any js file extension - if(id.indexOf('.js')===id.length-3) { - id = id.substring(0, id.length-3); - } - // Remove any /index suffix as we want the user-accessible ID - if(id.indexOf('/index')===id.length-6 && id.length>6) { - id = id.substring(0, id.length-6); - } - } - return id; -} - -DllModule.prototype.source = function() { - var header = ''; - if(DllModule.entries[this.name]) { - header += '__webpack_require__.load = function(loader) {\n'; - header += '\tloader = loader || __webpack_require__;' - for(var i=0; i6) { + id = id.substring(0, id.length-6); + } + } + return id; +} + +DllModule.prototype.source = function() { + var header = ''; + if(DllModule.entries[this.name]) { + header += '__webpack_require__.load = function(loader) {\n'; + header += '\tloader = loader || __webpack_require__;' + for(var i=0; i', '
' + code + '
'); - } catch(e) { - console.log(); - console.log(chalk.yellow('Unable to generate prerender of app state HTML')); - console.log('Reason: ' + e.message || e); - if(e.stack) { - console.log(e.stack); - } - console.log(); - console.log('Continuing build without prerendering...'); - } - callback && callback(); - }); - } - }); -}; +var + path = require('path'), + fs = require('fs'), + chalk = require('chalk'), + requireFromString = require('require-from-string'); + +function PrerenderPlugin(options) { + this.options = options || {}; +} +module.exports = PrerenderPlugin; +PrerenderPlugin.prototype.apply = function(compiler) { + var NodeOutputFileSystem = null; + try { + NodeOutputFileSystem = require('webpack/lib/node/NodeOutputFileSystem'); + } catch(e) { + console.error('PrerenderPlugin loader is not compatible with standalone global installs of Webpack.'); + return; + } + compiler.plugin('compilation', function(compilation) { + if(compiler.outputFileSystem.writeFile===NodeOutputFileSystem.prototype.writeFile) { + compilation.plugin('html-webpack-plugin-after-html-processing', function(params, callback) { + var appFile = path.join(compiler.context, compiler.options.output.path, 'main.js'); + + // Attempt to resolve 'react-dom/server' relative to the project itself with internal as fallback + var ReactDOMServer; + try { + ReactDOMServer = require(path.join(compiler.context, 'node_modules', 'react-dom', 'server')); + } catch(e) { + ReactDOMServer = require('react-dom/server'); + } + + // Add fetch to the global variables + if (!global.fetch) { + global.fetch = require('node-fetch'); + global.Response = global.fetch.Response; + global.Headers = global.fetch.Headers; + global.Request = global.fetch.Request; + } + try { + var src = compilation.assets['main.js'].source(); + if(params.plugin.options.externalFramework) { + // Add external Enact framework filepath if it's used + src = src.replace(/require\(["']enact_framework["']\)/g, 'require("' + params.plugin.options.externalFramework + '")'); + } + var App = requireFromString(src, 'main.js'); + var code = ReactDOMServer.renderToString(App['default'] || App); + params.html = params.html.replace('
', '
' + code + '
'); + } catch(e) { + console.log(); + console.log(chalk.yellow('Unable to generate prerender of app state HTML')); + console.log('Reason: ' + e.message || e); + if(e.stack) { + console.log(e.stack); + } + console.log(); + console.log('Continuing build without prerendering...'); + } + callback && callback(); + }); + } + }); +}; diff --git a/config/SnapshotPlugin.js b/config/SnapshotPlugin.js new file mode 100644 index 00000000..778751e2 --- /dev/null +++ b/config/SnapshotPlugin.js @@ -0,0 +1,84 @@ +var + path = require('path'), + fs = require('fs'), + cp = require('child_process'), + chalk = require('chalk'); + +function isNodeOutputFS(compiler) { + try { + var NodeOutputFileSystem = require('webpack/lib/node/NodeOutputFileSystem'); + return (compiler.outputFileSystem.writeFile===NodeOutputFileSystem.prototype.writeFile); + } catch(e) { + console.error('SnapshotPlugin loader is not compatible with standalone global installs of Webpack.'); + return false; + } +} + +function getBlobName(args) { + for(var i=0; i0) { + compilation.assets[blob] = { + size: function() { return stat.size; }, + emitted: true + }; + } else { + // Temporary fix: mksnapshot may create a 0-byte blob on error + err = new Error(child.stdout + '\n' + child.stderr); + } + } catch(e) { + // Temporary fix: mksnapshot always returns exit code 0, even on error. + // Exception thrown when file not found + err = new Error(child.stdout + '\n' + child.stderr); + } + } else { + err = new Error(child.stdout + '\n' + child.stderr); + } + + if(err) { + console.log(chalk.red('Snapshot blob generation failed.')); + } + callback(err); + } else { + callback(); + } + }); +}; diff --git a/config/html-template-isomorphic.ejs b/config/html-template-isomorphic.ejs index 4297bdfb..6c6e3f36 100644 --- a/config/html-template-isomorphic.ejs +++ b/config/html-template-isomorphic.ejs @@ -1,54 +1,66 @@ - - - - - - - <%= htmlWebpackPlugin.options.title %> - - <% for(var i=0; i<% } %> - - -
- - - + + + + + + + <%= htmlWebpackPlugin.options.title %> + + <% for(var i=0; i<% } %> + + +
+ + + \ No newline at end of file diff --git a/config/html-template.ejs b/config/html-template.ejs index 282a0b77..4f5a4edc 100644 --- a/config/html-template.ejs +++ b/config/html-template.ejs @@ -1,12 +1,12 @@ - - - - - - - <%= htmlWebpackPlugin.options.title %> - - -
- - + + + + + + + <%= htmlWebpackPlugin.options.title %> + + +
+ + diff --git a/config/karma.conf.js b/config/karma.conf.js index 04582ca3..c4e20fe5 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -29,14 +29,14 @@ module.exports = function(karma) { files: [ require.resolve('./polyfills'), require.resolve('./proptype-checker'), - './!(node_modules)/**/*-specs.js' + './!(node_modules|dist|build)/**/*-specs.js' ], preprocessors: { // add webpack as preprocessor - './!(node_modules)/**/*.js': ['webpack', 'sourcemap'], - [require.resolve('./polyfills')]: ['webpack', 'sourcemap'], - [require.resolve('./proptype-checker')]: ['webpack', 'sourcemap'] + './!(node_modules|dist|build)/**/*.js': ['webpack'], + [require.resolve('./polyfills')]: ['webpack'], + [require.resolve('./proptype-checker')]: ['webpack'] }, failOnEmptyTestSuite: false, @@ -44,7 +44,7 @@ module.exports = function(karma) { webpack: { // Use essentially the same webpack config as from the development build setup. // We do not include an entry value as Karma will control that. - devtool: 'inline-source-map', + devtool: null, output: { path: './dist', filename: '[name].js' @@ -153,7 +153,6 @@ module.exports = function(karma) { 'karma-mocha', 'karma-chai', 'karma-dirty-chai', - 'karma-sourcemap-loader', 'karma-chrome-launcher', 'karma-phantomjs-launcher', 'karma-json-reporter' diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index c51d9b41..1e1782cc 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -221,7 +221,7 @@ module.exports = { // be determined automatically from any appinfo.json files discovered. title: enact.title || '', inject: 'body', - template: path.join(__dirname, 'html-template.ejs'), + template: enact.template || path.join(__dirname, 'html-template.ejs'), xhtml: true }), // Makes some environment variables available to the JS code, for example: diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index c83254d9..4355e281 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -196,7 +196,7 @@ module.exports = { // be determined automatically from any appinfo.json files discovered. title: enact.title || '', inject: 'body', - template: path.join(__dirname, 'html-template.ejs'), + template: enact.template || path.join(__dirname, 'html-template.ejs'), xhtml: true, minify: { removeComments: true, diff --git a/global-cli/init.js b/global-cli/create.js similarity index 98% rename from global-cli/init.js rename to global-cli/create.js index ca09817b..8ef85d7a 100755 --- a/global-cli/init.js +++ b/global-cli/create.js @@ -8,7 +8,7 @@ var exists = require('path-exists').sync; // @TODO: switch back to master when 0.2.0 releases -var ENACT_DEV_NPM = 'enyojs/enact-dev#develop'; +var ENACT_DEV_NPM = 'enyojs/enact-dev'; function createApp(output, template, link, local, verbose) { var root = path.resolve(output); @@ -208,7 +208,7 @@ function isSafeToCreateProjectIn(root) { function displayHelp() { console.log(' Usage'); - console.log(' enact init [options] []'); + console.log(' enact create [options] []'); console.log(); console.log(' Arguments'); console.log(' directory Optional project destination directory'); diff --git a/global-cli/pack.js b/global-cli/pack.js index 1b0fa5d6..50b98ccc 100755 --- a/global-cli/pack.js +++ b/global-cli/pack.js @@ -24,6 +24,7 @@ var EnactFrameworkPlugin = require('../config/EnactFrameworkPlugin'), EnactFrameworkRefPlugin = require('../config/EnactFrameworkRefPlugin'), PrerenderPlugin = require('../config/PrerenderPlugin'), + SnapshotPlugin = require('../config/SnapshotPlugin'), BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin, checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'), recursive = require('recursive-readdir'), @@ -56,7 +57,7 @@ function getDifferenceLabel(currentSize, previousSize) { // Print a detailed summary of build files. function printFileSizes(stats, previousSizeMap) { var assets = stats.toJson().assets - .filter(asset => /\.(js|css)$/.test(asset.name)) + .filter(asset => /\.(js|css|bin)$/.test(asset.name)) .map(asset => { var fileContents = fs.readFileSync('./dist/' + asset.name); var size = fs.statSync('./dist/' + asset.name).size; @@ -121,7 +122,12 @@ function setupFramework(config) { './node_modules/**/*.*', '**/tests/*.js' ] - }).concat(['react', 'react-dom', 'react/lib/ReactPerf']); + }).concat(['react', 'react-dom']); + if(!exists(path.join(process.cwd(), 'node_modules', 'react-dom', 'lib', 'ReactPerf.js'))) { + entry.push('react/lib/ReactPerf'); + } else { + entry.push('react-dom/lib/ReactPerf'); + } config.entry = {enact:entry}; // Use universal module definition to allow usage and name as 'enact_framework' @@ -139,12 +145,12 @@ function setupFramework(config) { config.plugins.push(new EnactFrameworkPlugin()); } -function setupIsomorphic(config) { +function setupIsomorphic(config, snapshot) { var meta = readJSON('package.json') || {}; var enact = meta.enact || {}; // Only use isomorphic if an isomorphic entrypoint is specified if(enact.isomorphic || enact.prerender) { - var reactDOM = path.join(process.cwd(), 'node_modules', 'react-dom'); + var reactDOM = path.join(process.cwd(), 'node_modules', 'react-dom', 'index.js'); if(!exists(reactDOM)) { reactDOM = require.resolve('react-dom'); } @@ -178,11 +184,35 @@ function setupIsomorphic(config) { // Include plugin to prerender the html into the index.html config.plugins.push(new PrerenderPlugin()); + + // Apply snapshot specialization options if needed + if(snapshot) { + setupSnapshot(config); + } } else { console.log(chalk.yellow('Isomorphic entrypoint not found in package.json; building normally')); } } +function setupSnapshot(config, isFramework) { + if(!isFramework) { + // Update HTML webpack plugin to mark it as snapshot mode for the isomorphic template + config.plugins[0].options.snapshot = true; + + // Expose iLib so we can update _platform value once page loads, if used + config.module.loaders.push({ + test: path.join(process.cwd(), 'node_modules', '@enact', 'i18n', 'ilib', 'lib', 'ilib.js'), + loader: 'expose?iLib' + }); + } + + // Include plugin to attempt generation of v8 snapshot binary if V8_MKSNAPSHOT env var is set + config.plugins.push(new SnapshotPlugin({ + target: (isFramework ? 'enact.js' : 'main.js'), + append: (isFramework ? '\nenact_framework.load();\n' : undefined) + })); +} + function statsAnalyzer(config) { config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static', @@ -232,7 +262,7 @@ function watch(config) { } else { console.log('Creating an optimized production build and watching for changes...'); } - webpack(config).watch((err, stats) => { + webpack(config).watch({}, (err, stats) => { if (err) { console.error('Failed to create ' + process.env.NODE_ENV + ' build. Reason:'); console.error(err.message || err); @@ -257,8 +287,9 @@ function displayHelp() { console.log(); /* Hidden Options: - --framework Builds the @enact/*, react, and react-dom into an external framework + --snapshot Extension of isomorphic code layout which builds for V8 snapshot support --no-minify Will skip minification during production build + --framework Builds the @enact/*, react, and react-dom into an external framework --externals Specify a local directory path to the standalone external framework --externals-inject Remote public path to the external framework for use injecting into HTML */ @@ -267,7 +298,7 @@ function displayHelp() { module.exports = function(args) { var opts = minimist(args, { - boolean: ['minify', 'framework', 's', 'stats', 'p', 'production', 'i', 'isomorphic', 'w', 'watch', 'h', 'help'], + boolean: ['minify', 'framework', 's', 'stats', 'p', 'production', 'i', 'isomorphic', 'snapshot', 'w', 'watch', 'h', 'help'], string: ['externals', 'externals-inject'], default: {minify:true}, alias: {s:'stats', p:'production', i:'isomorphic', w:'watch', h:'help'} @@ -293,9 +324,16 @@ module.exports = function(args) { if(opts.framework) { setupFramework(config); + if(opts.snapshot) { + setupSnapshot(config, true); + } } else { + // Backwards compatibility for <15.4.0 React + if(!exists(path.join(process.cwd(), 'node_modules', 'react-dom', 'lib', 'ReactPerf.js'))) { + config.resolve.alias['react-dom/lib/ReactPerf'] = 'react/lib/ReactPerf'; + } if(opts.isomorphic) { - setupIsomorphic(config); + setupIsomorphic(config, (opts.snapshot && !opts.externals)); } if(opts.externals) { externalFramework(config, opts.externals, opts['externals-inject']); @@ -303,6 +341,10 @@ module.exports = function(args) { } if(opts.stats) { + if(opts.production && opts.isomorphic) { + console.log(chalk.yellow('Notice: Due to limitations, the stats analyzer is incompatible with isomorphic code' + + ' layout in production mode, and will display pre-minified sizes only.')); + } statsAnalyzer(config); } @@ -318,7 +360,7 @@ module.exports = function(args) { // This lets us display how much they changed later. recursive('dist', (err, fileNames) => { var previousSizeMap = (fileNames || []) - .filter(fileName => /\.(js|css)$/.test(fileName)) + .filter(fileName => /\.(js|css|bin)$/.test(fileName)) .reduce((memo, fileName) => { var key = shortFilename(fileName); memo[key] = fs.statSync(fileName).size; diff --git a/global-cli/transpile.js b/global-cli/transpile.js index 3d92ca48..9898f8fc 100755 --- a/global-cli/transpile.js +++ b/global-cli/transpile.js @@ -29,7 +29,7 @@ module.exports = function(args) { var buildRoot = opts.output || './build'; console.log('Transpiling via Babel to ' + path.resolve(buildRoot)); - fs.copy(sourceRoot, buildRoot, {filter:/^(?!.*(node_modules|build|dist|\\.git)).*$/, stopOnErr:true}, function(cpErr) { + fs.copy(sourceRoot, buildRoot, {filter:function(f) { return /^(?!.*(node_modules|build|dist|\\.git)).*$/.test(f); }, stopOnErr:true}, function(cpErr) { if(cpErr) { console.error(cpErr); } else { diff --git a/package.json b/package.json index 23e9d9ed..0f533bbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "enact-dev", - "version": "0.3.0", + "version": "0.4.0", "description": "Full-featured build environment for Enact applications.", "main": "index.js", "author": "Jason Robitaille ", @@ -10,10 +10,10 @@ "enact": "./bin/enact.js" }, "dependencies": { - "autoprefixer": "~6.5.2", + "autoprefixer": "~6.5.3", "babel-core": "~6.18.2", - "babel-eslint": "~7.1.0", - "babel-loader": "~6.2.7", + "babel-eslint": "~7.1.1", + "babel-loader": "~6.2.8", "babel-plugin-dev-expression": "~0.2.1", "babel-plugin-transform-react-constant-elements": "~6.9.1", "babel-plugin-transform-react-inline-elements": "~6.8.0", @@ -25,17 +25,17 @@ "chalk": "~1.1.3", "connect-history-api-fallback": "~1.3.0", "cross-spawn": "~5.0.1", - "css-loader": "~0.25.0", - "detect-port": "~1.0.5", + "css-loader": "~0.26.1", + "detect-port": "~1.0.6", "dirty-chai": "~1.2.2", "enyo-console-spy": "enyojs/enyo-console-spy", - "enzyme": "~2.5.1", - "eslint": "~3.9.1", + "enzyme": "~2.6.0", + "eslint": "~3.11.1", "eslint-config-enact": "enyojs/eslint-config-enact#1.1.1", "eslint-loader": "~1.6.1", - "eslint-plugin-babel": "~3.3.0", + "eslint-plugin-babel": "~4.0.0", "eslint-plugin-enact": "enyojs/eslint-plugin-enact#0.1.0", - "eslint-plugin-react": "~6.6.0", + "eslint-plugin-react": "~6.8.0", "expose-loader": "~0.7.1", "extract-text-webpack-plugin": "~1.0.1", "file-loader": "~0.9.0", @@ -54,27 +54,27 @@ "karma-chrome-launcher": "~2.0.0", "karma-dirty-chai": "~1.0.2", "karma-json-reporter": "~1.2.0", - "karma-mocha": "~1.2.0", + "karma-mocha": "~1.3.0", "karma-phantomjs-launcher": "~1.0.2", "karma-sourcemap-loader": "~0.3.7", "karma-webpack": "~1.8.0", "less": "~2.7.1", "less-loader": "~2.2.3", "minimist": "~1.2.0", - "mocha": "~3.1.2", + "mocha": "~3.2.0", "ncp": "~2.0.0", "node-fetch": "^1.6.3", "object-assign": "~4.1.0", "path-exists": "~3.0.0", "phantomjs-prebuilt": "~2.1.13", - "postcss-loader": "~1.1.0", + "postcss-loader": "~1.2.0", "postcss-remove-classes": "~1.0.2", "promise": "~7.1.1", - "react": "~15.3.2", - "react-addons-perf": "~15.3.2", - "react-addons-test-utils": "~15.3.2", - "react-dev-utils": "~0.3.0", - "react-dom": "~15.3.2", + "react": "~15.4.0", + "react-addons-perf": "~15.4.0", + "react-addons-test-utils": "~15.4.0", + "react-dev-utils": "~0.4.0", + "react-dom": "~15.4.0", "recursive-readdir": "~2.1.0", "require-from-string": "^1.2.1", "resolution-independence": "~0.0.3", @@ -87,8 +87,8 @@ "style-loader": "~0.13.1", "webos-meta-webpack-plugin": "enyojs/webos-meta-webpack-plugin#0.1.1", "webpack": "~1.13.3", - "webpack-bundle-analyzer": "~1.4.1", + "webpack-bundle-analyzer": "~2.1.1", "webpack-dev-server": "~1.16.2", - "whatwg-fetch": "~1.0.0" + "whatwg-fetch": "~2.0.1" } } diff --git a/template/README.md b/template/README.md index df4d722b..9ebe6976 100644 --- a/template/README.md +++ b/template/README.md @@ -63,6 +63,30 @@ Runs the Enact configuration of Eslint on the project for syntax analysis. These tasks will execute all valid tests (files that end in `-specs.js`) that are within the project directory. The `test` is a standard execution pass, `test-json` uses a json reporter for output, and `test-watch` will set up a watcher to re-execute tests when files change. +## Enact Build Options + +The enact-dev tool will check the project's `package.json` looking for an optional `enact` object for a few customization options: + +* `template` _[string]_ - Filepath to an alternate HTML template to use with the [Webpack html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin). +* `isomorphic` _[boolean|string]_ - If `true`, it indicates the default entrypoint is isomorphic-compatible (and can be built via the `--isomorphic` enact-dev flag). If the value is a string, then it will use that value as a filepath to a custom isomorphic-compatible entrypoint. +* `title` _[string]_ - Title text that should be put within the HTML's `` tags. Note: if this is a webOS-project, the title by default will be auto-detected from the appinfo.json content. +* `ri` _[object]_ - Resolution independence options to be forwarded to the [LESS plugin](https://github.com/enyojs/less-plugin-resolution-independence). +* `proxy` _[string]_ - Proxy target during project `serve` to be used within the [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware). + +For example: +```js +{ + ... + "enact": { + "isomorphic": true, + "ri": { + "baseSize":24 + } + } + ... +} +``` + ## Displaying Lint Output in the Editor Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint. diff --git a/template/package.json b/template/package.json index 514686d6..c42d3175 100644 --- a/template/package.json +++ b/template/package.json @@ -28,13 +28,13 @@ "extends": "enact" }, "dependencies": { - "@enact/core": "^1.0.0-alpha.3", - "@enact/ui": "^1.0.0-alpha.3", - "@enact/moonstone": "^1.0.0-alpha.3", - "@enact/spotlight": "^1.0.0-alpha.3", - "@enact/i18n": "^1.0.0-alpha.3", - "@enact/webos": "^1.0.0-alpha.3", - "react": "^15.3.2", - "react-dom": "^15.3.2" + "@enact/core": "^1.0.0-alpha.4", + "@enact/ui": "^1.0.0-alpha.4", + "@enact/moonstone": "^1.0.0-alpha.4", + "@enact/spotlight": "^1.0.0-alpha.4", + "@enact/i18n": "^1.0.0-alpha.4", + "@enact/webos": "^1.0.0-alpha.4", + "react": "^15.4.0", + "react-dom": "^15.4.0" } }