Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from atom/bo-to-js
Browse files Browse the repository at this point in the history
Convert to JS
  • Loading branch information
benogle committed Jul 26, 2015
2 parents 3ed57ec + 7ff8249 commit 58562bd
Show file tree
Hide file tree
Showing 17 changed files with 275 additions and 239 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -3,5 +3,4 @@ node_modules/
npm-debug.log
v8.log
lib/
*.js
.node-version
15 changes: 15 additions & 0 deletions .jshintrc
@@ -0,0 +1,15 @@
{
"asi": true,
"esnext": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"latedef": true,
"onevar": true,
"noarg": true,
"node": true,
"trailing": true,
"undef": true,
"unused": true,
"browser": true
}
49 changes: 0 additions & 49 deletions Gruntfile.coffee

This file was deleted.

58 changes: 58 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,58 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: 'src',
src: ['**/*.js'],
dest: "lib",
ext: ".js"
}]
}
},

jshint: {
options: {
jshintrc: '.jshintrc',
},
all: ['Gruntfile.js', 'src/**/*.js']
},

watch: {
scripts: {
files: ['src/*.js'],
tasks: ['default'],
options: {
spawn: false
},
},
},

shell: {
test: {
command: 'jasmine-focused --captureExceptions --coffee spec/',
options:{
stdout: true,
stderr: true,
failOnError: true
}
}
}
})

grunt.loadNpmTasks('grunt-babel')
grunt.loadNpmTasks('grunt-shell')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-jshint')

grunt.registerTask('clean', function() { require('rimraf').sync('lib') })
grunt.registerTask('lint', ['jshint'])
grunt.registerTask('default', ['lint', 'babel'])
grunt.registerTask('test', ['default', 'shell:test'])
}
22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"test": "grunt test",
"prepublish": "grunt clean lint coffee"
"prepublish": "grunt clean lint babel"
},
"repository": {
"type": "git",
Expand All @@ -24,20 +24,20 @@
"url": "https://github.com/atom/husk-cli/issues"
},
"dependencies": {
"argparse": "~0.1",
"async": "^1.3.0",
"argparse": "^1.0",
"async": "^1.4.0",
"electron-packager": "^5.0.1",
"electron-rebuild": "^0.2.3"
"electron-rebuild": "^0.2.5"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.8",
"grunt-coffeelint": "0.0.6",
"grunt-contrib-coffee": "~0.7.0",
"grunt": "^0.4.5",
"grunt-babel": "^5.0.1",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-shell": "~0.2.2",
"grunt-shell": "^1.1.2",
"jasmine-focused": "1.x",
"rimraf": "~2.1.4",
"temp": "~0.7.0"
"rimraf": "^2.4.2",
"temp": "^0.8.3"
}
}
6 changes: 0 additions & 6 deletions spec/husk-cli-spec.coffee

This file was deleted.

5 changes: 5 additions & 0 deletions spec/husk-cli-spec.js
@@ -0,0 +1,5 @@
describe("husk", function(){
it("does something", function(){

})
})
27 changes: 0 additions & 27 deletions src/bootstrap.coffee

This file was deleted.

28 changes: 28 additions & 0 deletions src/bootstrap.js
@@ -0,0 +1,28 @@
var path = require('path')
var async = require('async')
var Utils = require('./utils')

module.exports = {
execute: function() {
var electronVersion = Utils.getRunnerPacakageJSON().version
var projectNodeModulesPath = path.join(Utils.getProjectPath(), 'node_modules')
var electronPrebuiltPath = path.join(projectNodeModulesPath, 'electron-prebuilt')

async.waterfall([
function(callback) {
console.log('Running npm install')
return Utils.spawnCommand('npm', ['install'], function(code) {
callback(code)
})
}, function(callback) {
var args, cmd
cmd = path.join(__dirname, '..', 'node_modules', '.bin', 'electron-rebuild')
args = ['--version', electronVersion, '--electron-prebuilt-dir', electronPrebuiltPath, '--module-dir', projectNodeModulesPath]
console.log('Running', cmd, args)
return Utils.spawnCommand(cmd, args, function() {
callback()
})
}
])
}
}
62 changes: 0 additions & 62 deletions src/build.coffee

This file was deleted.

64 changes: 64 additions & 0 deletions src/build.js
@@ -0,0 +1,64 @@
var fs = require('fs')
var path = require('path')
var async = require('async')
var Utils = require('./utils')

var compileApp = function(options, callback) {
var projectPath = Utils.getProjectPath()
var projectPackageJSON = Utils.getProjectPackageJSON()
var compileCacheDir = path.join(projectPath, projectPackageJSON.compileCacheDir || 'compile-cache')
var compileDirs = projectPackageJSON.compileDirs

if (!Array.isArray(compileDirs))
compileDirs = ['src']

for (var i = 0; i < compileDirs.length; i++)
compileDirs[i] = path.join(projectPath, compileDirs[i])

var cmd = path.join(projectPath, 'node_modules', '.bin', 'electron-compile')
if (fs.existsSync(cmd)) {
var args = ['--target', compileCacheDir].concat(compileDirs)
console.log('Running', cmd, args)
Utils.spawnCommand(cmd, args, callback)
} else {
callback()
}
}

var packageApp = function(options, callback) {
var projectPath = Utils.getProjectPath()
var projectPackageJSON = Utils.getProjectPackageJSON()
var electronVersion = Utils.getRunnerPacakageJSON().version
var pathsToIgnore = [
path.join('node_modules', 'electron-compile', 'node_modules', 'electron-compilers'),
path.join('node_modules', 'husk-cli'),
path.join('node_modules', '\\.bin')
]
var arch = options.arch || 'x64'
var platform = options.platform || 'darwin'
var cmd = path.join(__dirname, '..', 'node_modules', '.bin', 'electron-packager')
var args = [
projectPath,
projectPackageJSON.appName,
'--overwrite',
'--platform', platform,
'--arch', arch,
'--version', electronVersion,
'--out', path.join(projectPath, 'release'),
'--ignore', pathsToIgnore.join('|')
]
console.log('Running', cmd, args)
Utils.spawnCommand(cmd, args, callback)
}

var execute = function(options) {
async.waterfall([
function(callback) {
compileApp(options, callback)
}, function(callback) {
packageApp(options, callback)
}
])
}

module.exports = { execute: execute }

0 comments on commit 58562bd

Please sign in to comment.