-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'es6-hello-world/master'
- Loading branch information
Showing
10 changed files
with
165 additions
and
59 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
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
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,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Martin Zagora | ||
|
||
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. | ||
|
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,10 @@ | ||
# brackets-es6-hello-world | ||
Boilerplate for a Brackets extension written in ES6 | ||
|
||
## gulp tasks | ||
|
||
`gulp test` - lint your sources with ESLint | ||
|
||
`gulp build` - build your ES6 files into ES5 so Brackets is able to run them | ||
|
||
`gulp watch` - watch files for changes and compile them as you go |
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
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,20 +1,16 @@ | ||
/*globals define*/ | ||
|
||
'use strict'; | ||
|
||
define(function (require, exports, module) { | ||
'use strict'; | ||
|
||
// styling | ||
var ExtensionUtils = brackets.getModule('utils/ExtensionUtils'); | ||
ExtensionUtils.loadStyleSheet(module, 'styles/main.less'); | ||
|
||
|
||
// require('dist/browser-polyfill'); | ||
// require('dist/main')(); | ||
// launch compiled js code | ||
require('dist/main'); | ||
|
||
/* | ||
if (window.isBracketsTestWindow) { | ||
} | ||
// TODO: provide base for writing unit tests | ||
if (window.isBracketsTestWindow) { } | ||
*/ | ||
|
||
}); |
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,40 +1,37 @@ | ||
{ | ||
"name": "brackets-npm-registry", | ||
"version": "0.0.1", | ||
"description": "Download extensions from NPM", | ||
"keywords": [ | ||
"extensions", | ||
"npm" | ||
], | ||
"main": "main.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"name": "brackets-es6-hello-world", | ||
"version": "0.0.2", | ||
"description": "Boilerplate for a Brackets extension written in ES6", | ||
"keywords": ["brackets-extension", "boilerplate", "hello-world"], | ||
"homepage": "https://github.com/zaggino/brackets-es6-hello-world", | ||
"bugs": "https://github.com/zaggino/brackets-es6-hello-world/issues", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Martin Zagora", | ||
"email": "zaggino@gmail.com", | ||
"url": "https://github.com/zaggino" | ||
}, | ||
"homepage": "https://github.com/zaggino/brackets-npm-registry", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zaggino/brackets-git.git" | ||
"url": "https://github.com/zaggino/brackets-es6-hello-world.git" | ||
}, | ||
"license": "MIT", | ||
"engines": { | ||
"brackets": ">=1.1.0" | ||
"scripts": { | ||
"test": "gulp test", | ||
"install": "gulp build" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^2.9.13", | ||
"npm": "^2.6.1" | ||
}, | ||
"devDependencies": { | ||
"babelify": "^5.0.4", | ||
"browserify": "^9.0.3", | ||
"babel-core": "^4.6.6", | ||
"eslint": "^0.15.1", | ||
"esprima-fb": "^13001.1.0-dev-harmony-fb", | ||
"gulp": "^3.8.11", | ||
"gulp-babel": "^4.0.0", | ||
"gulp-eslint": "^0.5.0", | ||
"gulp-sourcemaps": "^1.5.0", | ||
"gulp-util": "^3.0.4", | ||
"through2": "^0.6.3" | ||
}, | ||
"engines": { | ||
"brackets": ">=1.2.0" | ||
} | ||
} |
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 @@ | ||
{ | ||
"paths": { | ||
"bluebird": "./node_modules/bluebird/js/browser/bluebird.min" | ||
} | ||
} |
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,26 +1,32 @@ | ||
'use strict'; | ||
define(function (require) { | ||
'use strict'; | ||
|
||
let co = require('bluebird').coroutine; | ||
let SUCCESS = Symbol(); | ||
let AppInit = brackets.getModule('utils/AppInit'); | ||
let co = require('bluebird').coroutine; | ||
let Logger = require('./utils/Logger'); | ||
let SUCCESS = Symbol(); | ||
|
||
function promiseResponse() { | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
resolve(SUCCESS); | ||
}, 1); | ||
function promiseResponse() { | ||
return new Promise(function (resolve) { | ||
setTimeout(function () { | ||
resolve(SUCCESS); | ||
}, 1); | ||
}); | ||
} | ||
|
||
let tryGenerators = co(function* () { | ||
let response = yield promiseResponse(); | ||
if (response === SUCCESS) { | ||
Logger.log('Hello world!'); | ||
} else { | ||
throw new Error('Response has unexpected value: ' + response); | ||
} | ||
}); | ||
} | ||
|
||
let tryGenerators = co(function* () { | ||
var response = yield promiseResponse(); | ||
if (response === SUCCESS) { | ||
console.log('ES6 generators work!'); | ||
} else { | ||
console.error('ES6 generators failed...'); | ||
} | ||
}); | ||
AppInit.appReady(function () { | ||
// co functions return promises | ||
tryGenerators() | ||
.catch(e => Logger.error(e)); | ||
}); | ||
|
||
module.exports = function () { | ||
console.log('brackets-npm-registry is starting...'); | ||
tryGenerators(); | ||
}; | ||
}); |
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 @@ | ||
define(function (require, exports, module) { | ||
'use strict'; | ||
|
||
let packageInfo = JSON.parse(require('text!../../package.json')); | ||
|
||
class Logger { | ||
|
||
constructor() { | ||
this.prefix = `[${packageInfo.name}] `; | ||
} | ||
|
||
log(...args) { | ||
console.log(this.prefix + args.join(' ')); | ||
} | ||
|
||
error(...args) { | ||
console.error(this.prefix + args.join(' ')); | ||
} | ||
|
||
} | ||
|
||
module.exports = new Logger(); | ||
|
||
}); |