Skip to content

Commit d6bac98

Browse files
committed
Build tools, bower
1 parent b8153a7 commit d6bac98

8 files changed

+58
-10
lines changed

Gruntfile.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
module.exports = function(grunt) {
22
grunt.initConfig({
33
pkg: grunt.file.readJSON('package.json'),
4+
cssmin: {
5+
target: {
6+
src : "<%= pkg.name %>.css",
7+
dest : "build/<%= pkg.name %>.min.css"
8+
}
9+
},
10+
jshint: {
11+
files: ['Gruntfile.js', '<%= pkg.name %>'],
12+
options: {
13+
esnext: true
14+
}
15+
},
416
uglify: {
517
options: {
6-
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
18+
banner: '/*! <%= pkg.name %>\n<%= pkg.homepage %>\n<%= grunt.template.today("yyyy-mm-dd") %> */\n'
719
},
820
build: {
921
src: '<%= pkg.name %>',
@@ -13,5 +25,7 @@ module.exports = function(grunt) {
1325
});
1426

1527
grunt.loadNpmTasks('grunt-contrib-uglify-es');
16-
grunt.registerTask('default', ['uglify']);
28+
grunt.loadNpmTasks('grunt-contrib-jshint');
29+
grunt.loadNpmTasks('grunt-contrib-cssmin');
30+
grunt.registerTask('default', ['jshint','uglify', 'cssmin']);
1731
};

bower.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "plainterm.js",
3+
"description": "A dead simple lightweight pure Javascript terminal \"emulator\" that mimics terminal behaviour in browser.",
4+
"main": [
5+
"build/plainterm.js.min.js",
6+
"build/plainterm.js.min.css"
7+
],
8+
"authors": [
9+
"Mikhail Korolev"
10+
],
11+
"license": "GPL-3.0",
12+
"keywords": [
13+
"javascript",
14+
"js",
15+
"terminal",
16+
"bash",
17+
"console",
18+
"commands",
19+
"term",
20+
"simple"
21+
],
22+
"homepage": "https://github.com/mkrl/plainterm.js",
23+
"ignore": [
24+
"**/.*",
25+
"node_modules",
26+
"bower_components",
27+
"test",
28+
"tests"
29+
]
30+
}

build/plainterm.js.min.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/plainterm.js.min.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<title>plainterm.js</title>
6-
<link rel="stylesheet" href="plainterm.css">
6+
<link rel="stylesheet" href="./build/plainterm.js.min.css">
77
<style>
88
.container > div {
99
margin: 0 auto;

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "plainterm.js",
66
"devDependencies": {
77
"grunt": "~0.4.5",
8+
"grunt-contrib-cssmin": "^3.0.0",
89
"grunt-contrib-jshint": "~0.10.0",
910
"grunt-contrib-uglify": "~0.5.0",
1011
"grunt-contrib-uglify-es": "^3.3.0"

plainterm.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var plainterm = (function() {
1010
};
1111

1212
//Master command constructor
13-
function Command(name, description, parameters = [], func) {
13+
function Command(name, description, func, parameters = []) {
1414
this.name = name;
1515
this.description = description;
1616
this.parameters = parameters;
@@ -21,7 +21,7 @@ var plainterm = (function() {
2121
}
2222
this.func = function(params) {
2323
params = params || false;
24-
if ((params == false)||(params.length < parameters.length)) {
24+
if ((params === false)||(params.length < parameters.length)) {
2525
println("usage: " + name + pnames);
2626
} else {
2727
func(params);
@@ -80,7 +80,7 @@ var plainterm = (function() {
8080
}
8181

8282
function addcommand(cmd) {
83-
bash.commands[cmd.name] = new Command(cmd.name, cmd.description, cmd.parameters, cmd.func);
83+
bash.commands[cmd.name] = new Command(cmd.name, cmd.description, cmd.func, cmd.parameters);
8484
}
8585

8686

@@ -151,7 +151,7 @@ var plainterm = (function() {
151151
bash.container.area.style.display = "none";
152152
var line = document.createElement("p");
153153
bash.container.display.appendChild(line);
154-
if (command == true) {
154+
if (command === true) {
155155
line.innerHTML = bash.prompt;
156156
}
157157
var i = 0;
@@ -193,7 +193,7 @@ var plainterm = (function() {
193193

194194
//Constructing default help command
195195
function bind_help(help_active) {
196-
if (help_active == true) {
196+
if (help_active === true) {
197197
bash.commands.help = new Command("help","shows a help message", [],
198198
function(){
199199
Object.getOwnPropertyNames(bash.commands).map(function(cmd){

plainterm.css plainterm.js.css

File renamed without changes.

0 commit comments

Comments
 (0)