1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-12 17:26:17 +00:00

refactor build config

This commit is contained in:
Rokt33r
2015-06-21 02:40:06 +09:00
parent 9e53bec631
commit 25eccacb4c
81 changed files with 6418 additions and 450 deletions

7
.gitignore vendored
View File

@@ -1,5 +1,6 @@
/build
/node_modules
/electron_build
build/
node_modules/
electron_build/
.env
dist/
vendor/

View File

@@ -1,118 +1,26 @@
require('dotenv').load()
var env = process.env
var gulp = require('gulp')
var styl = require('gulp-stylus')
var autoprefixer = require('gulp-autoprefixer')
var templateCache = require('gulp-angular-templatecache')
var globby = require('globby')
var template = require('gulp-template')
var del = require('del')
var runSequence = require('run-sequence')
var plumber = require('gulp-plumber')
var notify = require('gulp-notify')
var changed = require('gulp-changed')
var rename = require('gulp-rename')
var livereload = require('gulp-livereload')
var inject = require('gulp-inject')
// for Dist
var rev = require('gulp-rev')
var ngAnnotate = require('gulp-ng-annotate')
var templateCache = require('gulp-angular-templatecache')
var uglify = require('gulp-uglify')
var minifyCss = require('gulp-minify-css')
var merge = require('merge-stream')
var concat = require('gulp-concat')
var streamqueue = require('streamqueue')
var minifyHtml = require('gulp-minify-html')
var config = require('./build.config.js')
gulp.task('js', function () {
return streamqueue({objectMode: true},
gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.BUILD_API_URL
})),
gulp.src(['src/**/*.js'])
)
.pipe(changed('build'))
.pipe(gulp.dest('build'))
})
gulp.task('dist', function () {
var js = streamqueue({objectMode: true},
gulp.src(['src/**/*.js']),
gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.DIST_API_URL
})),
gulp.src('src/**/*.tpl.html')
.pipe(templateCache())
)
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(gulp.dest('dist'))
var css = gulp.src('src/styles/main.styl')
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(styl())
.pipe(autoprefixer())
.pipe(minifyCss())
.pipe(gulp.dest('dist'))
var index = gulp.src('src/index.html')
.pipe(template({
scripts: ['app.js'],
styles: ['main.css'],
env: 'dist'
}))
.pipe(minifyHtml())
.pipe(gulp.dest('dist'))
return merge(js, css, index)
})
gulp.task('styl', function () {
return gulp.src('src/styles/main.styl')
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(styl())
.pipe(autoprefixer())
.pipe(gulp.dest('build'))
.pipe(notify('Stylus!!'))
.pipe(livereload())
})
gulp.task('tpls', function () {
return gulp.src('src/**/*.tpl.html')
.pipe(templateCache())
.pipe(notify('Tpls Done!! :)'))
.pipe(gulp.dest('build'))
})
gulp.task('index', function () {
var files = globby.sync(['build/**/*', '!build/vendor/**/*'])
var filter = function (files, ext) {
return files.filter(function (file) {
var reg = new RegExp('.+\.' + ext + '$')
return file.match(reg)
}).map(function (file) {
return file.replace('build/', '')
})
}
var scripts = filter(files, 'js')
var styles = filter(files, 'css')
return gulp.src('src/index.html')
.pipe(template({
scripts: scripts,
styles: styles,
env: 'build'
}))
.pipe(gulp.dest('build'))
.pipe(livereload())
})
gulp.task('vendor', function () {
var vendors = config.vendors
@@ -125,29 +33,53 @@ gulp.task('vendor', function () {
vendorFiles.push('node_modules/font-awesome/**/FontAwesome.*')
return gulp.src(vendorFiles)
.pipe(gulp.dest('build/vendor'))
.pipe(gulp.dest('src/browser/vendor'))
})
gulp.task('resources', function () {
return gulp.src('resources/**/*')
.pipe(changed('build/resources'))
.pipe(gulp.dest('build/resources'))
gulp.task('styl', function () {
return gulp.src('src/**/app.styl')
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(styl())
.pipe(autoprefixer())
.pipe(gulp.dest('src'))
.pipe(notify('Stylus!!'))
.pipe(livereload())
})
gulp.task('build', function (cb) {
runSequence(['js', 'styl', 'tpls', 'vendor', 'resources'], 'index', cb)
gulp.task('bs', function () {
return gulp.src('src/**/bootstrap.styl')
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(styl())
.pipe(autoprefixer())
.pipe(gulp.dest('src'))
.pipe(notify('Bootstrap compiled!!'))
.pipe(livereload())
})
gulp.task('watch', function (cb) {
gulp.watch(['.env', 'tpls/env.js', 'src/**/*.js'], ['js'])
gulp.task('inject', function (cb) {
runSequence('inject-main', 'inject-popup', cb)
})
gulp.watch('src/styles/**/*.styl', ['styl'])
gulp.task('inject-main', function () {
return gulp.src('src/browser/main/index.inject.html')
.pipe(inject(gulp.src(['src/browser/main/**/*.js', 'src/browser/main/**/*.css', 'src/browser/shared/**/*.js', 'src/browser/shared/**/*.css'], {read: false}), {
relative: true
}))
.pipe(rename(function (path) {
path.basename = 'index'
}))
.pipe(gulp.dest('src/browser/main/'))
})
gulp.watch('src/**/*.tpl.html', ['tpls'])
gulp.watch(['build/**/*.js', 'src/index.html'], ['index'])
livereload.listen()
gulp.task('inject-popup', function () {
return gulp.src('src/browser/popup/index.inject.html')
.pipe(inject(gulp.src(['src/browser/popup/**/*.js', 'src/browser/popup/**/*.css', 'src/browser/shared/**/*.js', 'src/browser/shared/**/*.css'], {read: false}), {
relative: true
}))
.pipe(rename(function (path) {
path.basename = 'index'
}))
.pipe(gulp.dest('src/browser/popup/'))
})
gulp.task('del', function (cb) {
@@ -157,5 +89,3 @@ gulp.task('del', function (cb) {
gulp.task('default', function (cb) {
runSequence('del', 'build', 'watch', cb)
})
require('./gulp-electron')(gulp)

View File

@@ -1,13 +0,0 @@
@import '../../src/styles/_vars'
@import '../../src/styles/mixins/*'
@import '../../src/styles/_bootstrap'
@import '../../src/styles/_index'
@import '../../src/styles/_shared'
@import '../../src/styles/modals/*'
@import '../../src/styles/directives/*'
@import '../../src/styles/states/*'
@import '_popup'

View File

@@ -1,139 +0,0 @@
require('dotenv').load()
var env = process.env
var styl = require('gulp-stylus')
var autoprefixer = require('gulp-autoprefixer')
var templateCache = require('gulp-angular-templatecache')
var globby = require('globby')
var template = require('gulp-template')
var del = require('del')
var runSequence = require('run-sequence')
var plumber = require('gulp-plumber')
var notify = require('gulp-notify')
var changed = require('gulp-changed')
var livereload = require('gulp-livereload')
var merge = require('merge-stream')
var config = require('./build.config.js')
module.exports = function (gulp) {
gulp.task('elec-env', function () {
return gulp.src('tpls/env.js')
.pipe(template({
apiUrl: env.ELEC_API_URL
}))
.pipe(gulp.dest('electron_build/config'))
})
gulp.task('elec-js', function () {
var main = gulp.src('src/**/*.js')
.pipe(changed('electron_build'))
.pipe(gulp.dest('electron_build'))
var electron = gulp.src('electron_src/**/*.js')
.pipe(changed('electron_build/electron'))
.pipe(gulp.dest('electron_build/electron'))
return merge(main, electron)
})
gulp.task('elec-styl', function () {
return gulp.src('electron_src/styles/main.styl')
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(styl())
.pipe(autoprefixer())
.pipe(gulp.dest('electron_build'))
.pipe(notify('Stylus!!'))
.pipe(livereload())
})
gulp.task('elec-tpls', function () {
var main = gulp.src('src/**/*.tpl.html')
.pipe(templateCache())
.pipe(gulp.dest('electron_build'))
var electron = gulp.src('electron_src/**/*.tpl.html')
.pipe(templateCache())
.pipe(gulp.dest('electron_build/electron'))
return merge(main, electron)
})
gulp.task('elec-index', function () {
var files = globby.sync(['electron_build/**/*', '!electron_build/vendor/**/*', '!electron_build/electron/**/*'])
var filter = function (files, ext) {
return files.filter(function (file) {
var reg = new RegExp('.+\.' + ext + '$')
return file.match(reg)
}).map(function (file) {
return file.replace('electron_build/', '')
})
}
var scripts = filter(files, 'js')
var styles = filter(files, 'css')
var main = gulp.src('src/index.html')
.pipe(template({
scripts: scripts,
styles: styles,
env: 'build'
}))
.pipe(gulp.dest('electron_build'))
.pipe(livereload())
var electron = gulp.src('electron_src/**/index.html')
.pipe(gulp.dest('electron_build/electron'))
return merge(main, electron)
})
gulp.task('elec-vendor', function () {
var vendors = config.vendors
var vendorFiles = vendors.map(function (vendor) {
return vendor.src
})
vendorFiles.push('node_modules/font-awesome/**/font-awesome.css')
vendorFiles.push('node_modules/font-awesome/**/fontawesome-webfont.*')
vendorFiles.push('node_modules/font-awesome/**/FontAwesome.*')
return gulp.src(vendorFiles)
.pipe(gulp.dest('electron_build/vendor'))
})
gulp.task('elec-resources', function () {
return gulp.src('resources/**/*')
.pipe(changed('electron_build/resources'))
.pipe(gulp.dest('electron_build/resources'))
})
gulp.task('elec-build', function (cb) {
runSequence(['elec-env', 'elec-js', 'elec-styl', 'elec-tpls', 'elec-vendor', 'elec-resources'], 'elec-index', cb)
})
gulp.task('elec-watch', function (cb) {
gulp.watch(['.env', 'tpls/env.js'], ['elec-env'])
gulp.watch(['src/**/*.js', 'electron_src/**/*.js'], ['elec-js'])
gulp.watch(['src/styles/**/*.styl', 'electron_src/styles/**/*.styl'], ['elec-styl'])
gulp.watch('src/**/*.tpl.html', ['elec-tpls'])
gulp.watch(['electron_build/**/*.js', 'src/index.html', 'src/index.html', 'electron_src/**/index.html'], ['elec-index'])
livereload.listen()
})
gulp.task('elec-del', function (cb) {
del(['electron_build/**/*'], cb)
})
gulp.task('elec', function (cb) {
runSequence('elec-del', 'elec-build', 'elec-watch', cb)
})
}

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

View File

@@ -1,8 +1,7 @@
{
"name": "codexen-app",
"version": "0.0.1",
"description": "CodeXen App",
"main": "index.js",
"name": "codexen-app-builder",
"version": "0.2.0",
"description": "CodeXen App Builder",
"scripts": {
"install": "gulp build",
"start": "http-server build",
@@ -31,6 +30,11 @@
},
"homepage": "https://github.com/Rokt33r/codexen-app#readme",
"dependencies": {
"dotenv": "^1.1.0",
"robotjs": "^0.1.2",
"node-notifier": "^4.2.1"
},
"devDependencies": {
"@rokt33r/ace-builds": "^1.1.9",
"@rokt33r/angular-ui-ace": "^0.2.3",
"angular": "^1.3.15",
@@ -39,38 +43,34 @@
"angular-md5": "^0.1.7",
"angular-sanitize": "^1.3.15",
"angular-ui-router": "^0.2.15",
"bootstrap-sass": "^3.3.4",
"bootstrap-styl": "^4.0.4",
"del": "^1.2.0",
"dotenv": "^1.1.0",
"electron-prebuilt": "^0.27.2",
"electron-rebuild": "^0.2.1",
"font-awesome": "^4.3.0",
"globby": "^2.0.0",
"gulp": "^3.8.11",
"gulp-angular-templatecache": "^1.6.0",
"gulp-autoprefixer": "^2.3.0",
"gulp-cached": "^1.1.0",
"gulp-changed": "^1.2.1",
"gulp-concat": "^2.5.2",
"gulp-inject": "^1.3.1",
"gulp-livereload": "^3.8.0",
"gulp-minify-css": "^1.1.1",
"gulp-minify-html": "^1.0.3",
"gulp-ng-annotate": "^0.5.3",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.0.1",
"gulp-remember": "^0.3.0",
"gulp-rename": "^1.2.2",
"gulp-rev": "^4.0.0",
"gulp-stylus": "^2.0.3",
"gulp-template": "^3.0.0",
"gulp-uglify": "^1.2.0",
"merge-stream": "^0.1.7",
"moment": "^2.10.3",
"node-notifier": "^4.2.1",
"robotjs": "^0.1.2",
"run-sequence": "^1.1.0",
"satellizer": "^0.10.1",
"streamqueue": "^1.1.0",
"ui-select": "^0.11.2"
},
"devDependencies": {
"gulp-concat": "^2.5.2",
"gulp-minify-html": "^1.0.3",
"streamqueue": "^1.1.0"
}
}

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -1,5 +1,6 @@
/* global angular */
angular.module('codexen', [
'codexen.shared',
'ngSanitize',
'ui.select',
'ui.ace',
@@ -8,4 +9,5 @@ angular.module('codexen', [
'satellizer',
'angular-md5',
'templates'])
.constant('appName', 'main')
angular.module('templates', [])

View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html ng-app="codexen">
<head>
<title>
CodeXen App
</title>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="description" content="CodeXen - Short code storage service">
<title>Codexen!</title>
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<!-- inject:css -->
<link rel="stylesheet" href="styles/app.css">
<link rel="stylesheet" href="../shared/styles/bootstrap.css">
<!-- endinject -->
</head>
<body ng-controller="AppController as app">
<div side-nav id="side-view"></div>
<div ui-view name="main-view" id="main-view"></div>
<script src="../vendor/ace.js"></script>
<script src="../vendor/angular.js"></script>
<script src="../vendor/angular-sanitize.js"></script>
<script src="../vendor/angular-ui-router.js"></script>
<script src="../vendor/ui-bootstrap-tpls.js"></script>
<script src="../vendor/select.js"></script>
<script src="../vendor/satellizer.js"></script>
<script src="../vendor/angular-md5.js"></script>
<script src="../vendor/moment.js"></script>
<!-- inject:js -->
<script src="app.js"></script>
<script src="config/states.js"></script>
<script src="controllers/AppController.js"></script>
<script src="filters/from-now.js"></script>
<script src="filters/search-snippets.js"></script>
<script src="directives/btn-delete-snippet.js"></script>
<script src="directives/btn-edit-snippet.js"></script>
<script src="directives/btn-new-snippet.js"></script>
<script src="directives/side-nav.js"></script>
<script src="directives/snippet-item.js"></script>
<script src="directives/tag-item.js"></script>
<script src="directives/tag-list.js"></script>
<script src="services/Modal.js"></script>
<script src="services/Settings.js"></script>
<script src="services/Tag.js"></script>
<script src="services/User.js"></script>
<script src="controllers/directives/SideNavController.js"></script>
<script src="controllers/modals/DeleteSnippetModalController.js"></script>
<script src="controllers/modals/EditSnippetModalController.js"></script>
<script src="controllers/modals/NewSnippetModalController.js"></script>
<script src="controllers/states/AuthRegisterController.js"></script>
<script src="controllers/states/AuthSignInController.js"></script>
<script src="controllers/states/HomeController.js"></script>
<script src="controllers/states/SettingsController.js"></script>
<script src="controllers/states/SnippetsDetailController.js"></script>
<script src="controllers/states/SnippetsListController.js"></script>
<script src="../shared/shared.js"></script>
<script src="../shared/config/ace.js"></script>
<script src="../shared/config/env.js"></script>
<script src="../shared/config/satellizer.js"></script>
<script src="../shared/directives/ui-ace.js"></script>
<script src="../shared/services/Snippet.js"></script>
<!-- endinject -->
</body>
</html>

View File

@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html ng-app="codexen">
<head>
<title>
CodeXen App
</title>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="description" content="CodeXen - Short code storage service">
<title>Codexen!</title>
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<!-- inject:css -->
<!-- endinject -->
</head>
<body ng-controller="AppController as app">
<div side-nav id="side-view"></div>
<div ui-view name="main-view" id="main-view"></div>
<script src="../vendor/ace.js"></script>
<script src="../vendor/angular.js"></script>
<script src="../vendor/angular-sanitize.js"></script>
<script src="../vendor/angular-ui-router.js"></script>
<script src="../vendor/ui-bootstrap-tpls.js"></script>
<script src="../vendor/select.js"></script>
<script src="../vendor/satellizer.js"></script>
<script src="../vendor/angular-md5.js"></script>
<script src="../vendor/moment.js"></script>
<!-- inject:js -->
<!-- endinject -->
</body>
</html>

View File

@@ -0,0 +1,378 @@
.new-snippet-modal .ace_editor {
height: 200px;
}
#side-view .nav-control-group {
margin: 0 5px;
}
#side-view ul.nav.nav-pills {
margin-top: 10px;
}
#side-view ul.nav.nav-pills li hr {
margin: 5px 0;
border-top: none;
border-bottom: solid 1px #001a20;
}
#side-view ul.nav.nav-pills li a {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
-webkit-transition: 0.2s;
transition: 0.2s;
}
#side-view ul.nav.nav-pills li.active > a,
#side-view ul.nav.nav-pills .nav-pills > li.active > a:hover,
#side-view ul.nav.nav-pills .nav-pills > li.active > a:focus {
background-color: #004b5f;
}
/*
* ui-select
* http://github.com/angular-ui/ui-select
* Version: 0.11.2 - 2015-03-17T04:08:46.478Z
* License: MIT
*/
.ui-select-highlight {
font-weight: bold;
}
.ui-select-offscreen {
clip: rect(0 0 0 0) !important;
width: 1px !important;
height: 1px !important;
border: 0 !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
position: absolute !important;
outline: 0 !important;
left: 0px !important;
top: 0px !important;
}
.ng-dirty.ng-invalid > a.select2-choice {
border-color: #d44950;
}
.select2-result-single {
padding-left: 0;
}
.select2-locked > .select2-search-choice-close {
display: none;
}
.select-locked > .ui-select-match-close {
display: none;
}
body > .select2-container.open {
z-index: 9999;
}
.selectize-input.selectize-focus {
border-color: #007fbb !important;
}
.selectize-control > .selectize-input > input {
width: 100%;
}
.selectize-control > .selectize-dropdown {
width: 100%;
}
.ng-dirty.ng-invalid > div.selectize-input {
border-color: #d44950;
}
.btn-default-focus {
color: #333;
background-color: #ebebeb;
border-color: #adadad;
text-decoration: none;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(102,175,233,0.6);
}
.ui-select-bootstrap .ui-select-toggle {
position: relative;
border-radius: $input-border-radius;
}
.ui-select-bootstrap .ui-select-toggle .ui-select-placeholder {
color: #99b2b8;
}
.ui-select-bootstrap .ui-select-toggle > .caret {
position: absolute;
height: 10px;
top: 50%;
right: 10px;
margin-top: -2px;
}
.input-group > .ui-select-bootstrap.dropdown {
/* Instead of relative */
position: static;
}
.input-group > .ui-select-bootstrap > input.ui-select-search.form-control {
border-radius: $input-border-radius;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.ui-select-bootstrap > .ui-select-match > .btn {
/* Instead of center because of .btn */
text-align: left !important;
padding-right: 25px;
border-radius: $input-border-radius;
border: solid 1px #001a20;
}
.ui-select-bootstrap > .ui-select-match > .caret {
position: absolute;
top: 45%;
right: 15px;
}
.ui-select-bootstrap > .ui-select-choices {
width: 100%;
height: auto;
max-height: 200px;
overflow-x: hidden;
margin-top: -1px;
}
body > .ui-select-bootstrap.open {
z-index: 1000;
}
.ui-select-multiple.ui-select-bootstrap {
height: auto;
padding: 3px 3px 0 10px;
}
.ui-select-multiple.ui-select-bootstrap.open {
border-color: #52dcff;
outline: 0;
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075), 0 0 8px rgba(82,220,255,0.6);
}
.ui-select-multiple.ui-select-bootstrap input.ui-select-search {
background-color: transparent !important;
border: none;
outline: none;
height: 1.666666em;
margin-bottom: 3px;
}
.ui-select-multiple.ui-select-bootstrap .ui-select-match .close {
font-size: 1.6em;
line-height: 0.75;
}
.ui-select-multiple.ui-select-bootstrap .ui-select-match-item {
outline: 0;
margin: 0 3px 3px 0;
}
.ui-select-multiple .ui-select-match-item {
position: relative;
}
.ui-select-multiple .ui-select-match-item.dropping-before:before {
content: "";
position: absolute;
top: 0;
right: 100%;
height: 100%;
margin-right: 2px;
border-left: 1px solid #428bca;
}
.ui-select-multiple .ui-select-match-item.dropping-after:after {
content: "";
position: absolute;
top: 0;
left: 100%;
height: 100%;
margin-left: 2px;
border-right: 1px solid #428bca;
}
.ui-select-bootstrap .ui-select-choices-row>a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #99b2b8;
white-space: nowrap;
}
.ui-select-bootstrap .ui-select-choices-row>a:hover,
.ui-select-bootstrap .ui-select-choices-row>a:focus {
text-decoration: none;
color: #fff;
background-color: #004b5f;
}
.ui-select-bootstrap .ui-select-choices-row.active>a {
color: #fff;
text-decoration: none;
outline: 0;
background-color: #004b5f;
}
.ui-select-bootstrap .ui-select-choices-row.disabled>a,
.ui-select-bootstrap .ui-select-choices-row.active.disabled>a {
color: #777;
cursor: not-allowed;
background-color: #fff;
}
.ui-select-match.ng-hide-add,
.ui-select-search.ng-hide-add {
display: none !important;
}
.ui-select-bootstrap.ng-dirty.ng-invalid > button.btn.ui-select-match {
border-color: #d44950;
}
.auth-state .panel {
margin-top: 50px;
}
.auth-state h1 {
margin: 15px 0;
}
.auth-state .auth-control {
margin: 10px 0;
}
.home-state {
padding: 10px;
}
.settings-state .panel {
margin-top: 15px;
}
.settings-state h1 {
margin: 30px 0;
}
.settings-state .section h4 {
margin-bottom: 15px;
}
.snippets-list-state {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.snippets-list-state .left-pane {
border-right: 1px solid #001a20;
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 275px;
overflow: hidden;
}
.snippets-list-state .left-pane .snippet-search {
position: absolute;
top: 0;
height: 50px;
left: 0;
right: 0;
border-right: 1px solid #001a20;
padding: 7px 5px;
}
.snippets-list-state .left-pane .snippet-list {
position: absolute;
top: 50px;
bottom: 0;
left: 0;
right: 0;
overflow-x: hidden;
overflow-y: auto;
list-style: none;
padding: 0;
}
.snippets-list-state .left-pane .snippet-list li {
cursor: pointer;
padding: 5px;
border-right: 1px solid #001a20;
border-bottom: 1px solid #001a20;
}
.snippets-list-state .left-pane .snippet-list li:nth-child(even) {
background-color: #002b36;
}
.snippets-list-state .left-pane .snippet-list li:nth-child(odd) {
background-color: #00323f;
}
.snippets-list-state .left-pane .snippet-list li h4 {
margin: 0;
}
.snippets-list-state .left-pane .snippet-list li:hover {
background-color: #004b5f;
}
.snippets-list-state .left-pane .snippet-list li p {
margin: 0;
}
.snippets-list-state .left-pane .snippet-list li p.call-sign {
font-size: 0.8em;
}
.snippets-list-state .left-pane .snippet-list li p.created-at {
font-size: 0.8em;
opacity: 0.8;
}
.snippets-list-state .left-pane .snippet-list li.active {
color: #fff;
background-color: #088cff;
}
.snippets-list-state .left-pane .snippet-list li.active a {
color: #fff;
}
.snippets-list-state .right-pane {
position: absolute;
top: 0;
bottom: 0;
left: 275px;
right: 0;
overflow-x: hidden;
overflow-y: auto;
background-color: #00323f;
}
.snippets-detail-state {
position: absolute;
top: 0;
width: 100%;
bottom: 0;
overflow: hidden;
}
.snippets-detail-state .detail-header {
position: absolute;
top: 0;
width: 100%;
background-color: #003d4d;
padding: 5px 10px;
height: 50px;
border-bottom: solid 1px #001a20;
}
.snippets-detail-state .detail-header .detail-header-title {
color: #d5dfe2;
line-height: 40px;
font-size: 1.2em;
}
.snippets-detail-state .detail-header .detail-header-title small {
font-size: 0.6em;
color: #99b2b8;
}
.snippets-detail-state .detail-header .detail-header-control {
padding: 3px;
}
.snippets-detail-state .detail-body {
position: absolute;
top: 50px;
width: 100%;
bottom: 0;
padding: 5px 10px;
overflow-y: auto;
}
.snippets-detail-state .detail-body .ace_editor {
min-height: 300px;
border: solid 1px $border-color;
border-radius: 5px;
margin-bottom: 5px;
}
.tags {
word-break: break-all;
}
.tags a {
margin: 0 2px;
}
#side-view {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 200px;
background-color: #002b36;
border-right: solid 2px #004b5f;
box-sizing: border-box;
padding: 10px 0 10px 10px;
}
#main-view {
position: absolute;
top: 0;
bottom: 0;
left: 200px;
right: 0;
overflow-x: hidden;
overflow-y: auto;
background-color: $bgDarker;
}

View File

@@ -1,28 +1,9 @@
@import '../../shared/styles/_vars'
@import '../../shared/styles/mixins/*'
html
overflow: hidden
height: 100%
body
height: 100%
overflow: auto
font-family: "Lato", sans-serif
color $textColor
background-color: $appBackgroundColor
label
font-family: "Lato", sans-serif
color $textColor
h1, h2, h3, h4, h5
color $textColorHighlight
margin 0
textarea
resize: vertical
hr
border-color $baseBorderColor
@import 'modals/*'
@import 'directives/*'
@import 'states/*'
#side-view
position:absolute

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html ng-app="codexen.popup">
<head>
<title>
CodeXen App
</title>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="description" content="CodeXen - Short code storage service">
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<!-- inject:css -->
<link rel="stylesheet" href="../shared/styles/bootstrap.css">
<!-- endinject -->
</head>
<body class="popup-body" ng-controller="PopUpController">
<div class="search-block">
<input ng-change="filterList(searchNeedle)" search-input id="search-input" type="text" class="form-control" ng-model="searchNeedle" ng-change="refreshResult">
</div>
<div class="result-block row-fluid">
<ul id="result-list" class="result-list left-pane">
<li ng-click="selectSnippet($index)" ng-repeat="snippet in filteredSnippets" ng-class="{active:$index == selectIndex}"><a href="#"> <span ng-bind="snippet.callSign"></span> <small ng-bind="snippet.description"></small></a></li>
</ul>
<div class="right-pane">
<div class="result-detail-control">
<button ng-click="writeCode(selectedItem.content)" id="btnClipboard" type="button" name="button" class="btn btn-default"><i class="fa fa-clipboard"></i></button>
<!-- <button ng-click="editSnippet(selectedItem.id)" id="btnEdit" type="button" name="button" class="btn btn-default"><i class="fa fa-edit"></i></button> -->
<!-- <button id="btnShare" type="button" name="button" class="btn btn-default"><i class="fa fa-share"></i></button> -->
</div>
<div id="aceView" class="result-detail-content"
ui-ace="{
showGutter: false,
useWrapMode: true,
mode:selectedItem.mode.toLowerCase(),
onLoad: aceLoaded,
theme: 'solarized_dark'
}"
readonly
ng-model="selectedItem.content"
></div>
</div>
</div>
<script src="../vendor/ace.js"></script>
<script src="../vendor/angular.js" charset="utf-8"></script>
<script src="../vendor/satellizer.js"></script>
<script src="../vendor/hotkeys.js" charset="utf-8"></script>
<!-- inject:js -->
<script src="popup.js"></script>
<script src="services/snippet.js"></script>
<script src="../shared/shared.js"></script>
<script src="../shared/config/ace.js"></script>
<script src="../shared/config/env.js"></script>
<script src="../shared/config/satellizer.js"></script>
<script src="../shared/directives/ui-ace.js"></script>
<script src="../shared/services/Snippet.js"></script>
<!-- endinject -->
</body>
</html>

View File

@@ -10,8 +10,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="description" content="CodeXen - Short code storage service">
<link rel="stylesheet" href="../../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="../../main.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="../vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<!-- inject:css -->
<!-- endinject -->
</head>
<body class="popup-body" ng-controller="PopUpController">
@@ -44,12 +47,12 @@
></div>
</div>
</div>
<script src="../../vendor/ace.js"></script>
<script src="../../vendor/angular.js" charset="utf-8"></script>
<script src="../../directives/ui-ace.js"></script>
<script src="../../vendor/satellizer.js"></script>
<script src="../../vendor/hotkeys.js" charset="utf-8"></script>
<script src="popup.js" charset="utf-8"></script>
<script src="services/snippet.js" charset="utf-8"></script>
<script src="../vendor/ace.js"></script>
<script src="../vendor/angular.js" charset="utf-8"></script>
<script src="../vendor/satellizer.js"></script>
<script src="../vendor/hotkeys.js" charset="utf-8"></script>
<!-- inject:js -->
<!-- endinject -->
</body>
</html>

View File

@@ -6,10 +6,12 @@ var ipc = require('ipc')
var resultList = document.getElementById('result-list')
angular.module('codexen.popup', [
'codexen.shared',
'ui.ace',
'satellizer',
'cfp.hotkeys'
])
.constant('appName', 'popup')
.controller('PopUpController', function ($scope, Snippet, $auth, $window, hotkeys, $document, $filter) {
// Setup Events
remote.getCurrentWindow().on('focus', function () {

View File

@@ -0,0 +1,4 @@
@import '../../shared/styles/_vars'
@import '../../shared/styles/mixins/*'
@import '_popup'

View File

@@ -1,3 +1,3 @@
/* global angular */
angular.module('codexen')
angular.module('codexen.shared')
.constant('aceModes', ['ABAP', 'ABC', 'ActionScript', 'ADA', 'Apache_Conf', 'AsciiDoc', 'Assembly_x86', 'AutoHotKey', 'BatchFile', 'C9Search', 'C_Cpp', 'Cirru', 'Clojure', 'Cobol', 'coffee', 'ColdFusion', 'CSharp', 'CSS', 'Curly', 'D', 'Dart', 'Diff', 'Dockerfile', 'Dot', 'Dummy', 'DummySyntax', 'Eiffel', 'EJS', 'Elixir', 'Elm', 'Erlang', 'Forth', 'FTL', 'Gcode', 'Gherkin', 'Gitignore', 'Glsl', 'golang', 'Groovy', 'HAML', 'Handlebars', 'Haskell', 'haXe', 'HTML', 'HTML_Ruby', 'INI', 'Io', 'Jack', 'Jade', 'Java', 'JavaScript', 'JSON', 'JSONiq', 'JSP', 'JSX', 'Julia', 'LaTeX', 'Lean', 'LESS', 'Liquid', 'Lisp', 'LiveScript', 'LogiQL', 'LSL', 'Lua', 'LuaPage', 'Lucene', 'Makefile', 'Markdown', 'Mask', 'MATLAB', 'MEL', 'MUSHCode', 'MySQL', 'Nix', 'ObjectiveC', 'OCaml', 'Pascal', 'Perl', 'pgSQL', 'PHP', 'Powershell', 'Praat', 'Prolog', 'Properties', 'Protobuf', 'Python', 'R', 'RDoc', 'RHTML', 'Ruby', 'Rust', 'SASS', 'SCAD', 'Scala', 'Scheme', 'SCSS', 'SH', 'SJS', 'Smarty', 'snippets', 'Soy_Template', 'Space', 'SQL', 'SQLServer', 'Stylus', 'SVG', 'Tcl', 'Tex', 'Text', 'Textile', 'Toml', 'Twig', 'Typescript', 'Vala', 'VBScript', 'Velocity', 'Verilog', 'VHDL', 'XML', 'XQuery', 'YAML', 'Django'])

View File

@@ -0,0 +1,4 @@
/* global angular */
angular.module('codexen.shared')
.constant('apiUrl', 'http://localhost:8000/')
// .constant('apiUrl', 'http://codexen-server-dev.elasticbeanstalk.com/')

View File

@@ -1,6 +1,6 @@
/* global angular */
angular.module('codexen')
.config(function ($authProvider, $httpProvider, apiUrl) {
angular.module('codexen.shared')
.config(function ($authProvider, $httpProvider, apiUrl, appName) {
$authProvider.baseUrl = apiUrl
$httpProvider.defaults.useXDomain = true
@@ -10,8 +10,15 @@ angular.module('codexen')
responseError: function (res) {
switch (res.status) {
case 401:
var $state = $injector.get('$state')
$state.go('auth.signin')
switch (appName) {
case 'main' :
var $state = $injector.get('$state')
$state.go('auth.signin')
break
case 'popup' :
// TODO: hide popup
break
}
break
}

View File

@@ -1,5 +1,5 @@
/* global angular */
angular.module('codexen')
angular.module('codexen.shared')
.factory('Snippet', function ($http, $auth, apiUrl) {
var findByUser = function (user) {
var url = apiUrl + 'snippets/search'

View File

@@ -0,0 +1,3 @@
angular.module('codexen.shared', [
'satellizer'
])

View File

@@ -0,0 +1,24 @@
html
overflow: hidden
height: 100%
body
height: 100%
overflow: auto
font-family: "Lato", sans-serif
color $textColor
background-color: $appBackgroundColor
label
font-family: "Lato", sans-serif
color $textColor
h1, h2, h3, h4, h5
color $textColorHighlight
margin 0
textarea
resize: vertical
hr
border-color $baseBorderColor

5639
src/browser/shared/styles/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
// Override vars and mixins
@import '_vars'
@import 'mixins/*'
// Core variables and mixins
@import '../../../../node_modules/bootstrap-styl/bootstrap/variables'
@import '../../../../node_modules/bootstrap-styl/bootstrap/mixins'
// Utilities
@import '../../../../node_modules/bootstrap-styl/bootstrap/utilities'
@import '../../../../node_modules/bootstrap-styl/bootstrap/responsive-utilities'
// Reset and dependencies
@import '../../../../node_modules/bootstrap-styl/bootstrap/normalize'
@import '../../../../node_modules/bootstrap-styl/bootstrap/print'
// Core CSS
@import '../../../../node_modules/bootstrap-styl/bootstrap/scaffolding'
@import '../../../../node_modules/bootstrap-styl/bootstrap/type'
// @import '../../../../node_modules/bootstrap-styl/bootstrap/code'
@import '../../../../node_modules/bootstrap-styl/bootstrap/grid'
@import '../../../../node_modules/bootstrap-styl/bootstrap/tables'
@import '../../../../node_modules/bootstrap-styl/bootstrap/forms'
@import '../../../../node_modules/bootstrap-styl/bootstrap/buttons'
// Components
@import '../../../../node_modules/bootstrap-styl/bootstrap/component-animations'
@import '../../../../node_modules/bootstrap-styl/bootstrap/dropdowns'
@import '../../../../node_modules/bootstrap-styl/bootstrap/button-groups'
@import '../../../../node_modules/bootstrap-styl/bootstrap/input-groups'
@import '../../../../node_modules/bootstrap-styl/bootstrap/navs'
@import '../../../../node_modules/bootstrap-styl/bootstrap/navbar'
// @import '../../../../node_modules/bootstrap-styl/bootstrap/breadcrumbs'
// @import '../../../../node_modules/bootstrap-styl/bootstrap/pagination'
// @import '../../../../node_modules/bootstrap-styl/bootstrap/pager'
@import '../../../../node_modules/bootstrap-styl/bootstrap/labels'
@import '../../../../node_modules/bootstrap-styl/bootstrap/badges'
@import '../../../../node_modules/bootstrap-styl/bootstrap/jumbotron'
@import '../../../../node_modules/bootstrap-styl/bootstrap/thumbnails'
@import '../../../../node_modules/bootstrap-styl/bootstrap/alerts'
@import '../../../../node_modules/bootstrap-styl/bootstrap/progress-bars'
@import '../../../../node_modules/bootstrap-styl/bootstrap/media'
@import '../../../../node_modules/bootstrap-styl/bootstrap/list-group'
@import '../../../../node_modules/bootstrap-styl/bootstrap/panels'
@import '../../../../node_modules/bootstrap-styl/bootstrap/responsive-embed'
@import '../../../../node_modules/bootstrap-styl/bootstrap/wells'
@import '../../../../node_modules/bootstrap-styl/bootstrap/close'
// Components w/ JavaScript
@import '../../../../node_modules/bootstrap-styl/bootstrap/modals'
@import '../../../../node_modules/bootstrap-styl/bootstrap/tooltip'
@import '../../../../node_modules/bootstrap-styl/bootstrap/popovers'
// @import '../../../../node_modules/bootstrap-styl/bootstrap/carousel'
// Overrides
@import '_shared'
@import '_index'

View File

@@ -1,63 +0,0 @@
<!DOCTYPE html>
<html ng-app="codexen">
<head>
<title>
CodeXen App
</title>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta name="description" content="CodeXen - Short code storage service">
<title>Codexen!</title>
<% if(env === 'dist') { %>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<% } %>
<% if(env === 'build') { %>
<link rel="stylesheet" href="vendor/css/font-awesome.css" media="screen" title="no title" charset="utf-8">
<% } %>
<% styles.forEach(function(style){ %>
<link rel="stylesheet" href="<%=style %>" media="screen" title="no title" charset="utf-8">
<% }) %>
</head>
<body ng-controller="AppController as app">
<div side-nav id="side-view"></div>
<div ui-view name="main-view" id="main-view"></div>
<% if(env === 'dist') { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-sanitize.min.js" charset="utf-8"></script>
<script src="https://cdn.rawgit.com/angular-ui/ui-router/0.2.15/release/angular-ui-router.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.0/ui-bootstrap-tpls.min.js" charset="utf-8"></script>
<script src="https://cdn.rawgit.com/angular-ui/ui-select/v0.12.0/dist/select.min.js" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/satellizer/0.11.2/satellizer.min.js"></script>
<script src="https://cdn.rawgit.com/gdi2290/angular-md5/v0.1.7/angular-md5.min.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js" charset="utf-8"></script>
<% } %>
<% if(env === 'build') { %>
<script src="vendor/ace.js"></script>
<script src="vendor/angular.js"></script>
<script src="vendor/angular-sanitize.js"></script>
<script src="vendor/angular-ui-router.js"></script>
<script src="vendor/ui-bootstrap-tpls.js"></script>
<script src="vendor/select.js"></script>
<script src="vendor/satellizer.js"></script>
<script src="vendor/angular-md5.js"></script>
<script src="vendor/moment.js"></script>
<% } %>
<% scripts.forEach(function(script){ %>
<script src="<%=script %>"></script>
<% }) %>
</body>
</html>

View File

@@ -19,7 +19,7 @@ var notifier = require('node-notifier')
var appIcon = null
app.on('ready', function () {
appIcon = new Tray('./icon.png')
appIcon = new Tray(__dirname + '/tray-icon.png')
appIcon.setToolTip('This is my application.')
appIcon.on('clicked', function () {
if (mainWindow == null) {
@@ -43,7 +43,7 @@ app.on('ready', function () {
}
})
popUpWindow.loadUrl('file://' + __dirname + '/electron_build/electron/popup/index.html')
popUpWindow.loadUrl('file://' + __dirname + '/browser/popup/index.html')
app.on('activate-with-no-open-windows', function () {
if (mainWindow == null) {
@@ -237,7 +237,7 @@ app.on('ready', function () {
}
})
mainWindow.loadUrl('file://' + __dirname + '/electron_build/index.html')
mainWindow.loadUrl('file://' + __dirname + '/browser/main/index.html')
mainWindow.on('closed', function () {
console.log('main closed')

32
src/package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "codexen-app",
"version": "0.2.0",
"description": "CodeXen App",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"codexen",
"snippet",
"template",
"task",
"runner",
"remote",
"automator",
"code",
"storage",
"short code"
],
"author": "Dick Choi <fluke8259@gmail.com> (http://kazup.co)",
"license": "No License",
"bugs": {
"url": "https://github.com/Rokt33r/codexen-app/issues"
},
"homepage": "https://codexen.github.io",
"dependencies": {
"dotenv": "^1.1.0",
"robotjs": "^0.1.2",
"node-notifier": "^4.2.1"
},
}

View File

@@ -1,49 +0,0 @@
// Core variables and mixins
@import '../../node_modules/bootstrap-styl/bootstrap/variables'
@import '../../node_modules/bootstrap-styl/bootstrap/mixins'
// Utilities
@import '../../node_modules/bootstrap-styl/bootstrap/utilities'
@import '../../node_modules/bootstrap-styl/bootstrap/responsive-utilities'
// Reset and dependencies
@import '../../node_modules/bootstrap-styl/bootstrap/normalize'
@import '../../node_modules/bootstrap-styl/bootstrap/print'
// Core CSS
@import '../../node_modules/bootstrap-styl/bootstrap/scaffolding'
@import '../../node_modules/bootstrap-styl/bootstrap/type'
// @import '../../node_modules/bootstrap-styl/bootstrap/code'
@import '../../node_modules/bootstrap-styl/bootstrap/grid'
@import '../../node_modules/bootstrap-styl/bootstrap/tables'
@import '../../node_modules/bootstrap-styl/bootstrap/forms'
@import '../../node_modules/bootstrap-styl/bootstrap/buttons'
// Components
@import '../../node_modules/bootstrap-styl/bootstrap/component-animations'
@import '../../node_modules/bootstrap-styl/bootstrap/dropdowns'
@import '../../node_modules/bootstrap-styl/bootstrap/button-groups'
@import '../../node_modules/bootstrap-styl/bootstrap/input-groups'
@import '../../node_modules/bootstrap-styl/bootstrap/navs'
@import '../../node_modules/bootstrap-styl/bootstrap/navbar'
// @import '../../node_modules/bootstrap-styl/bootstrap/breadcrumbs'
// @import '../../node_modules/bootstrap-styl/bootstrap/pagination'
// @import '../../node_modules/bootstrap-styl/bootstrap/pager'
@import '../../node_modules/bootstrap-styl/bootstrap/labels'
@import '../../node_modules/bootstrap-styl/bootstrap/badges'
@import '../../node_modules/bootstrap-styl/bootstrap/jumbotron'
@import '../../node_modules/bootstrap-styl/bootstrap/thumbnails'
@import '../../node_modules/bootstrap-styl/bootstrap/alerts'
@import '../../node_modules/bootstrap-styl/bootstrap/progress-bars'
@import '../../node_modules/bootstrap-styl/bootstrap/media'
@import '../../node_modules/bootstrap-styl/bootstrap/list-group'
@import '../../node_modules/bootstrap-styl/bootstrap/panels'
@import '../../node_modules/bootstrap-styl/bootstrap/responsive-embed'
@import '../../node_modules/bootstrap-styl/bootstrap/wells'
@import '../../node_modules/bootstrap-styl/bootstrap/close'
// Components w/ JavaScript
@import '../../node_modules/bootstrap-styl/bootstrap/modals'
@import '../../node_modules/bootstrap-styl/bootstrap/tooltip'
@import '../../node_modules/bootstrap-styl/bootstrap/popovers'
// @import '../../node_modules/bootstrap-styl/bootstrap/carousel'

View File

@@ -1,11 +0,0 @@
@import '_vars'
@import 'mixins/*'
@import '_bootstrap'
@import '_index'
@import '_shared'
@import 'modals/*'
@import 'directives/*'
@import 'states/*'

BIN
src/tray-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

View File

@@ -1,3 +0,0 @@
/* global angular */
angular.module('codexen')
.constant('apiUrl', '<%= apiUrl %>')