Permalink
Browse files

place under version control

  • Loading branch information...
1 parent 5e24d50 commit c38321fa1b7206a32cc3377cd19f4320d5770864 @rse committed Apr 6, 2015
Showing with 724 additions and 2 deletions.
  1. +22 −0 LICENSE.txt
  2. +33 −2 README.md
  3. +44 −0 app-browser-buildproc/Gruntfile.js
  4. +11 −0 app-browser-buildproc/index.html
  5. +34 −0 app-browser-buildproc/jshint.json
  6. +22 −0 app-browser-buildproc/package.json
  7. +12 −0 app-browser-buildproc/src/app.js
  8. +5 −0 app-browser-buildproc/src/lib.js
  9. +12 −0 app-browser-onthefly/index.html
  10. +8 −0 app-browser-onthefly/package.json
  11. +5 −0 app-browser-onthefly/src/app.js
  12. +32 −0 app-node-buildproc/Gruntfile.js
  13. +5 −0 app-node-buildproc/app.js
  14. +34 −0 app-node-buildproc/jshint.json
  15. +17 −0 app-node-buildproc/package.json
  16. +7 −0 app-node-buildproc/src/app-main.js
  17. +7 −0 app-node-buildproc/src/app-mod1.js
  18. +7 −0 app-node-buildproc/src/app-mod2.js
  19. +8 −0 app-node-onthefly/app.js
  20. +8 −0 app-node-onthefly/package.json
  21. +7 −0 app-node-onthefly/src/app-main.js
  22. +7 −0 app-node-onthefly/src/app-mod1.js
  23. +7 −0 app-node-onthefly/src/app-mod2.js
  24. +6 −0 grunt-onthefly/Gruntfile-main.js
  25. +10 −0 grunt-onthefly/Gruntfile.js
  26. +9 −0 grunt-onthefly/package.json
  27. +75 −0 lib-node-browser-buildproc/Gruntfile.js
  28. +167 −0 lib-node-browser-buildproc/eslint.json
  29. +34 −0 lib-node-browser-buildproc/jshint.json
  30. +7 −0 lib-node-browser-buildproc/lib/example.js
  31. +1 −0 lib-node-browser-buildproc/lib/example.map
  32. +23 −0 lib-node-browser-buildproc/package.json
  33. +13 −0 lib-node-browser-buildproc/src/example.js
  34. +8 −0 lib-node-browser-buildproc/tst/common.js
  35. +17 −0 lib-node-browser-buildproc/tst/example.js
View
@@ -0,0 +1,22 @@
+
+Copyright (c) 2015 Ralf S. Engelschall <rse@engelschall.com>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
View
@@ -1,2 +1,33 @@
-# es6-support
-ECMAScript 6: Support Hints &amp; Examples
+
+# ECMAScript 6
+
+## Support Hints &amp; Examples
+
+This is a small collection of hints and examples to show how ECMAScript 6
+can be used today in practice in various scenarios.
+
+### Examples
+
+- (app-browser-buildproc)[./app-browser-buildproc/]
+ This shows a browser application, based on a Grunt-based build process.
+ The key points are: (Grunt)[http://gruntjs.com/] uses
+ (Browserify)[http://browserify.org/] which itself uses the Browserify
+ plugin (babelify)[https://github.com/babel/babelify] to transpile ES5
+ to ES6 with (Babel)[http://babeljs.io/].
+
+- app-browser-onthefly
+
+- app-node-buildproc
+
+- app-node-onthefly
+
+- grunt-onthefly
+
+- lib-node-browser-buildproc
+
+### Tools
+
+- WebStorm
+- Sublime Text
+- Vim
+
@@ -0,0 +1,44 @@
+
+/* global module: true */
+module.exports = function (grunt) {
+ grunt.loadNpmTasks("grunt-contrib-jshint");
+ grunt.loadNpmTasks("grunt-contrib-clean");
+ grunt.loadNpmTasks("grunt-browserify");
+
+ grunt.initConfig({
+ jshint: {
+ options: {
+ jshintrc: "jshint.json"
+ },
+ "gruntfile": [ "Gruntfile.js" ],
+ "src": [ "src/**/*.js" ]
+ },
+ browserify: {
+ "example": {
+ files: {
+ "bld/app.js": [ "src/app.js" ]
+ },
+ options: {
+ transform: [
+ "babelify",
+ "browserify-shim"
+ ],
+ plugin: [
+ [ "minifyify", { map: "app.map", output: "bld/app.map" } ]
+ ],
+ browserifyOptions: {
+ standalone: "Example",
+ debug: true
+ }
+ }
+ }
+ },
+ clean: {
+ clean: [],
+ distclean: [ "node_modules" ]
+ }
+ });
+
+ grunt.registerTask("default", [ "jshint", "browserify" ]);
+};
+
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <title>Example</title>
+ <script type="text/javascript" src="bld/app.js"></script>
+ <script type="text/javascript">Example.main()</script>
+ </head>
+ <body>
+ </body>
+</html>
@@ -0,0 +1,34 @@
+{
+ "esnext": true,
+ "asi": true,
+ "maxerr": 200,
+ "bitwise": true,
+ "camelcase": false,
+ "curly": false,
+ "eqeqeq": true,
+ "forin": false,
+ "immed": true,
+ "latedef": true,
+ "newcap": false,
+ "noarg": false,
+ "noempty": false,
+ "nonew": true,
+ "plusplus": false,
+ "quotmark": "double",
+ "regexp": false,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+ "trailing": true,
+ "maxparams": 9,
+ "maxdepth": 7,
+ "maxstatements": 150,
+ "maxlen": 200,
+ "loopfunc": true,
+ "-W014": false,
+ "globals": {
+ "require": false,
+ "console": false,
+ "module": false
+ }
+}
@@ -0,0 +1,22 @@
+{
+ "name": "example",
+ "version": "0.0.0",
+ "main": "app/example.js",
+ "dependencies": {
+ "jquery": "~2.1.3",
+ "babel-core": "~5.0.8"
+ },
+ "devDependencies": {
+ "grunt": "~0.4.5",
+ "grunt-cli": "~0.1.13",
+ "grunt-contrib-jshint": "~0.11.1",
+ "grunt-contrib-clean": "~0.6.0",
+ "grunt-browserify": "~3.6.0",
+ "babelify": "~6.0.1",
+ "minifyify": "~6.4.0",
+ "browserify-header": "~0.9.2",
+ "browserify-derequire": "~0.9.4",
+ "browserify-shim": "~3.8.2"
+ },
+ "browserify-shim": "./src/lib.js"
+}
@@ -0,0 +1,12 @@
+
+let window = require("window")
+let $ = require("jquery")
+
+export default class Example {
+ static main () {
+ $(window.document).ready(() => {
+ $("body").append("Hello World from ES6!")
+ })
+ }
+}
+
@@ -0,0 +1,5 @@
+
+module.exports = {
+ "window": { "exports": "global:window" }
+}
+
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <title>Example</title>
+ <script src="node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
+ <script src="node_modules/babel-core/browser.js" type="text/javascript"></script>
+ <script src="src/app.js" type="text/babel"></script>
+ </head>
+ <body>
+ </body>
+</html>
@@ -0,0 +1,8 @@
+{
+ "name": "example",
+ "version": "0.0.0",
+ "dependencies": {
+ "jquery": "~2.1.3",
+ "babel-core": "~5.0.8"
+ }
+}
@@ -0,0 +1,5 @@
+
+(($) => {
+ $("body").append("Hello World from ES6!")
+})(jQuery)
+
@@ -0,0 +1,32 @@
+
+module.exports = function (grunt) {
+ grunt.loadNpmTasks("grunt-contrib-jshint")
+ grunt.loadNpmTasks("grunt-contrib-clean")
+ grunt.loadNpmTasks("grunt-babel")
+ grunt.initConfig({
+ jshint: {
+ options: {
+ jshintrc: "jshint.json"
+ },
+ "gruntfile": [ "Gruntfile.js" ],
+ "example": [ "src/**/*.js" ]
+ },
+ babel: {
+ options: {
+ sourceMap: true
+ },
+ dist: {
+ files: [
+ {
+ expand: true,
+ cwd: "src",
+ src: [ "*.js" ],
+ dest: "bld/"
+ }
+ ]
+ }
+ }
+ })
+ grunt.registerTask("default", [ "jshint", "babel" ])
+}
+
@@ -0,0 +1,5 @@
+
+require("source-map-support").install()
+
+require("./bld/app-main.js")
+
@@ -0,0 +1,34 @@
+{
+ "esnext": true,
+ "asi": true,
+ "maxerr": 200,
+ "bitwise": true,
+ "camelcase": false,
+ "curly": false,
+ "eqeqeq": true,
+ "forin": false,
+ "immed": true,
+ "latedef": true,
+ "newcap": false,
+ "noarg": false,
+ "noempty": false,
+ "nonew": true,
+ "plusplus": false,
+ "quotmark": "double",
+ "regexp": false,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+ "trailing": true,
+ "maxparams": 9,
+ "maxdepth": 7,
+ "maxstatements": 150,
+ "maxlen": 200,
+ "loopfunc": true,
+ "-W014": false,
+ "globals": {
+ "require": false,
+ "console": false,
+ "module": false
+ }
+}
@@ -0,0 +1,17 @@
+{
+ "name": "app",
+ "version": "0.0.0",
+ "dependencies": {
+ "chalk": "~1.0.0",
+ "source-map-support": "~0.2.10"
+ },
+ "devDependencies": {
+ "grunt": "~0.4.5",
+ "grunt-cli": "~0.1.13",
+ "grunt-contrib-jshint": "~0.11.1",
+ "grunt-contrib-clean": "~0.6.0",
+ "grunt-browserify": "~3.6.0",
+ "grunt-babel": "~5.0.0",
+ "babelify": "~6.0.1"
+ }
+}
@@ -0,0 +1,7 @@
+
+import mod1 from "./app-mod1"
+import mod2 from "./app-mod2"
+
+mod1()
+mod2()
+
@@ -0,0 +1,7 @@
+
+import chalk from "chalk"
+
+export default () => {
+ console.log(`Hello from ${chalk.green("Module 1")}`)
+}
+
@@ -0,0 +1,7 @@
+
+import chalk from "chalk"
+
+export default () => {
+ console.log(`Hello from ${chalk.green("Module 2")}`)
+}
+
@@ -0,0 +1,8 @@
+
+require("babel/register")({
+ extensions: [ ".js" ],
+ ignore: /node_modules/
+})
+
+require("./src/app-main.js")
+
@@ -0,0 +1,8 @@
+{
+ "name": "app",
+ "version": "0.0.0",
+ "dependencies": {
+ "babel": "~5.0.8",
+ "chalk": "~1.0.0"
+ }
+}
@@ -0,0 +1,7 @@
+
+import mod1 from "./app-mod1"
+import mod2 from "./app-mod2"
+
+mod1()
+mod2()
+
@@ -0,0 +1,7 @@
+
+import chalk from "chalk"
+
+export default () => {
+ console.log(`Hello from ${chalk.green("Module 1")}`)
+}
+
@@ -0,0 +1,7 @@
+
+import chalk from "chalk"
+
+export default () => {
+ console.log(`Hello from ${chalk.green("Module 2")}`)
+}
+
@@ -0,0 +1,6 @@
+
+export default (grunt) => {
+ grunt.initConfig({})
+ grunt.registerTask("default", [])
+}
+
@@ -0,0 +1,10 @@
+
+require("babel/register")({
+ extensions: [ ".js" ],
+ ignore: /node_modules/
+})
+
+module.exports = function (grunt) {
+ require("./Gruntfile-main.js")(grunt)
+}
+
Oops, something went wrong.

0 comments on commit c38321f

Please sign in to comment.