-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,691 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
node_modules | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# WebPack Build | ||
build | ||
dist | ||
bundle.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,87 @@ | ||
# enact-dev | ||
# enact-dev | ||
A standalone dev environment for Enact apps using Webpack, Babel, React, and a collection of other tools. | ||
|
||
## Installation | ||
All that's needed to install enact-dev is to use npm to install it globally. For Linux `sudo` may be required. | ||
``` | ||
npm install -g enyojs/enact-dev | ||
``` | ||
|
||
>Note: Node 6.x+ is highly recommended for optimum speed and efficiency, however anything since Node 4.x is compatible. | ||
## Creating a new App | ||
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] | ||
``` | ||
|
||
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. | ||
|
||
>Advanced: If you've used `npm link` on separate installations of the Enact repo, you can include `--link` to the `init` command and NPM will symlink your Enact repo, rather than reinstall. | ||
## Available App Scripts | ||
|
||
Within the project directory, you can run: | ||
|
||
### `npm run serve` | ||
|
||
Builds and serves the app in the development mode.<br> | ||
Open [http://localhost:8080](http://localhost:8080) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br> | ||
|
||
### `npm run pack` and `npm run pack-p` | ||
|
||
Builds the project in the working directory. Specifically, `pack` builds in development mode with code un-minified and with debug code include, whereas `pack-p` builds in production mode, with everything minified and optimized for performance. | ||
|
||
### `npm run watch` | ||
|
||
Builds the project in development mode and keeps watch over the project directory. Whenever files are changed, added, or deleted, the project will automatically get rebuilt using an active shared cache to speed up the process. This is similar to the `serve` task, but without the http server. | ||
|
||
### `npm run clean` | ||
|
||
Deletes previous build fragments from ./dist. | ||
|
||
### `npm run lint` | ||
|
||
Runs the Enact configuration of Eslint on the project for syntax analysis. | ||
|
||
### `npm run test`, `npm run test-json`, and `npm run test-watch` | ||
|
||
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. | ||
|
||
|
||
## Displaying Lint Output in the Editor | ||
|
||
Some editors, including Sublime Text, Atom, and Visual Studio Code, provide plugins for ESLint. | ||
|
||
They are not required for linting. You should see the linter output right in your terminal. However, if you prefer the lint results to appear right in your editor, there are some extra steps you can do. | ||
|
||
You would need to install an ESLint plugin for your editor first. | ||
|
||
>**A note for Atom `linter-eslint` users** | ||
>If you are using the Atom `linter-eslint` plugin, make sure that **Use global ESLint installation** option is checked: | ||
><img src="http://i.imgur.com/yVNNHJM.png" width="300"> | ||
Then add this block to the `package.json` file of your project: | ||
|
||
```js | ||
{ | ||
// ... | ||
"eslintConfig": { | ||
"extends": "enact" | ||
} | ||
} | ||
``` | ||
|
||
Finally, you will need to install some packages *globally*: | ||
|
||
```sh | ||
npm install -g eslint-config-enact eslint-plugin-react eslint-plugin-babel babel-eslint | ||
|
||
``` | ||
|
||
We recognize that this is suboptimal, but it is currently required due to the way we hide the ESLint dependency. The ESLint team is already [working on a solution to this](https://github.com/eslint/eslint/issues/3458) so this may become unnecessary in a couple of months. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
var command = process.argv[2]; | ||
|
||
switch(command) { | ||
case 'init': | ||
case 'serve': | ||
case 'transpile': | ||
case 'pack': | ||
case 'clean': | ||
case 'test': | ||
case 'lint': | ||
var task = require('../global-cli/' + command); | ||
task(process.argv.slice(3)); | ||
break; | ||
case '-v': | ||
case '--version': | ||
var pkg = require('../package.json'); | ||
console.log(pkg.name); | ||
console.log('version: ' + pkg.version); | ||
break; | ||
default: | ||
console.error('Usage: enact init [directory]'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var rimraf = require('rimraf'); | ||
|
||
|
||
module.exports = function() { | ||
rimraf('./build', function(bErr) { | ||
if(bErr) throw bErr; | ||
rimraf('./dist', function(dErr) { | ||
if(dErr) throw dErr; | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var | ||
path = require('path'), | ||
fs = require('fs'), | ||
ncp = require('ncp').ncp, | ||
cp = require('child_process'); | ||
|
||
module.exports = function(args) { | ||
var dest = '.'; | ||
var opts = []; | ||
var i = args.indexOf('--link'); | ||
if(i>=0) { | ||
opts.push('--link'); | ||
args.splice(i, 1); | ||
} | ||
if(args[0]) { | ||
dest = args[0]; | ||
} | ||
console.log('Initializing new project in ' + path.resolve(dest)); | ||
ncp(path.join(__dirname, 'template'), dest, {stopOnErr:true}, function(ncpErr) { | ||
var npm = cp.exec('npm --loglevel error install ' + opts.join(' '), {env:process.env, cwd:path.resolve(dest)}); | ||
npm.stdout.pipe(process.stdout); | ||
npm.stderr.pipe(process.stderr); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var config = require('../..'); | ||
|
||
module.exports = config.karma({ | ||
basePath: process.cwd() | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var config = require('../..'); | ||
|
||
module.exports = config.app(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var | ||
cp = require('child_process'), | ||
utils = require('../src/utils'); | ||
|
||
module.exports = function(args) { | ||
if(!utils.exists('./.eslintrc') && !utils.exists('./.eslintrc.js') && !utils.exists('./.eslintrc.json')) { | ||
args.unshift('--no-eslintrc', '--config', require.resolve('eslint-config-enact/index.js')); | ||
args.unshift('--ignore-pattern', 'node_modules/*'); | ||
args.unshift('--ignore-pattern', 'build/*'); | ||
args.unshift('--ignore-pattern', 'dist/*'); | ||
} | ||
var child = cp.fork(require.resolve('eslint/bin/eslint'), args, {env:process.env, cwd:process.cwd()}); | ||
child.on('close', function(code, signal) { | ||
process.exit(code); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var | ||
cp = require('child_process'), | ||
utils = require('../src/utils'); | ||
|
||
module.exports = function(args) { | ||
if(!utils.exists('./webpack.config.js')) { | ||
args.unshift('--config', require.resolve('./internal/webpack.js')); | ||
} | ||
var child = cp.fork(require.resolve('webpack/bin/webpack'), args, {env:process.env, cwd:process.cwd()}); | ||
child.on('close', function(code, signal) { | ||
process.exit(code); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var | ||
cp = require('child_process'), | ||
utils = require('../src/utils'); | ||
|
||
module.exports = function(args) { | ||
if(!utils.exists('./webpack.config.js')) { | ||
args.unshift('--config', require.resolve('./internal/webpack.js')); | ||
} | ||
var child = cp.fork(require.resolve('webpack-dev-server/bin/webpack-dev-server'), args, {env:process.env, cwd:process.cwd()}); | ||
child.on('close', function(code, signal) { | ||
process.exit(code); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/* | ||
build/* | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# testing | ||
coverage | ||
|
||
# production | ||
build | ||
|
||
# misc | ||
.DS_Store | ||
npm-debug.log |
Oops, something went wrong.