Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Sep 25, 2016
1 parent d687dd4 commit 61e9067
Show file tree
Hide file tree
Showing 114 changed files with 6,819 additions and 6,838 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"rules": {
"indent": [
"error",
4
2
],
"linebreak-style": [
"error",
Expand Down
78 changes: 37 additions & 41 deletions src/cli/Builder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import fse from 'fs-extra'
import extend from 'extend'
import mkdirp from 'mkdirp'
import {saveHtml} from './controllers/Save'
import path from 'path'

Expand All @@ -10,67 +8,65 @@ import {
config,
fileUtils,
fileAttr,
cli,
log,
getTemplate,
Page
} from './'

class Builder {

constructor(root, folder, dest, flow){
this.pathToJson = path.join(root, config.data.url)
var files = fileAttr.filterLatestVersion(FileParser.getFiles(this.pathToJson, config.data.url), flow)
constructor(root, folder, dest, flow){
this.pathToJson = path.join(root, config.data.url)
var files = fileAttr.filterLatestVersion(FileParser.getFiles(this.pathToJson, config.data.url), flow)

if(flow === 'publish') {
files = FileParser.getFiles(path.join(root, config.publish.url), new RegExp('.' + config.files.templates.extension))
}
if(flow === 'publish') {
files = FileParser.getFiles(path.join(root, config.publish.url), new RegExp('.' + config.files.templates.extension))
}

var build = function (index) {
var file = files[index]
if(file.path.indexOf('.' + config.files.templates.extension) > -1){
file.path = file.path.replace(config.publish.url, config.data.url)
var build = function (index) {
var file = files[index]
if(file.path.indexOf('.' + config.files.templates.extension) > -1){
file.path = file.path.replace(config.publish.url, config.data.url)
.replace('.' + config.files.templates.extension, '.json')

var json = fse.readJsonSync(file.path)
var text = getTemplate(json.abe_meta.template)
var json = fse.readJsonSync(file.path)
var text = getTemplate(json.abe_meta.template)

Util.getDataList(fileUtils.removeLast(json.abe_meta.link), text, json)
Util.getDataList(fileUtils.removeLast(json.abe_meta.link), text, json)
.then(() => {
var page = new Page(json.abe_meta.template, text, json, true)
saveHtml(path.join(root, dest + json.abe_meta.link), page.html)
if(files[index + 1]) build(index + 1)
var page = new Page(json.abe_meta.template, text, json, true)
saveHtml(path.join(root, dest + json.abe_meta.link), page.html)
if(files[index + 1]) build(index + 1)
}).catch(function(e) {
console.error(e)
if(files[index + 1]) build(index + 1)
console.error(e)
if(files[index + 1]) build(index + 1)
})
}
else if(file.path.indexOf('.json') > -1){
var json = fse.readJsonSync(file.path)
var text = getTemplate(json.abe_meta.template)
}
else if(file.path.indexOf('.json') > -1){
var json = fse.readJsonSync(file.path)
var text = getTemplate(json.abe_meta.template)

Util.getDataList(fileUtils.removeLast(json.abe_meta.link), text, json)
Util.getDataList(fileUtils.removeLast(json.abe_meta.link), text, json)
.then(() => {
var page = new Page(json.abe_meta.template, text, json, true)
saveHtml(path.join(root, dest + json.abe_meta.link), page.html)
if(files[index + 1]) build(index + 1)
var page = new Page(json.abe_meta.template, text, json, true)
saveHtml(path.join(root, dest + json.abe_meta.link), page.html)
if(files[index + 1]) build(index + 1)
}).catch(function(e) {
console.error(e)
if(files[index + 1]) build(index + 1)
console.error(e)
if(files[index + 1]) build(index + 1)
})
}
else if(files[index + 1]) build(index + 1)
}
}
else if(files[index + 1]) build(index + 1)
}

build(0)
build(0)

}
}

}

if(process.env.ROOT && process.env.FOLDER && process.env.DEST){
config.set({root: process.env.ROOT})
var dest = process.env.DEST || 'tmp'
var flow = process.env.FLOW || 'draft'
new Builder(process.env.ROOT, process.env.FOLDER, dest, flow)
config.set({root: process.env.ROOT})
var dest = process.env.DEST || 'tmp'
var flow = process.env.FLOW || 'draft'
new Builder(process.env.ROOT, process.env.FOLDER, dest, flow)
}
44 changes: 22 additions & 22 deletions src/cli/Create.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ import {

export default class Create {

constructor() {}
constructor() {}

init(path) {
path = path.split('/')
path[path.length - 1] = slugify(path[path.length - 1])
path = path.join('/')
this.addFolder(path)
init(path) {
path = path.split('/')
path[path.length - 1] = slugify(path[path.length - 1])
path = path.join('/')
this.addFolder(path)
.then(() => {
process.chdir(path)
this.addFolder(config.publish.url)
this.addFolder(config.templates.url)
this.addFolder(config.structure.url)
this.addFolder(config.reference.url)
this.addFolder(config.data.url)
this.addFolder(config.draft.url)
process.chdir(path)
this.addFolder(config.publish.url)
this.addFolder(config.templates.url)
this.addFolder(config.structure.url)
this.addFolder(config.reference.url)
this.addFolder(config.data.url)
this.addFolder(config.draft.url)
}).catch(function(e) {
console.error(e)
console.error(e)
})
}
}

addFolder(folder){
var p = new Promise((resolve, reject) => {
mkdirp(folder)
resolve()
})
addFolder(folder){
var p = new Promise((resolve, reject) => {
mkdirp(folder)
resolve()
})

return p
}
return p
}
}
202 changes: 101 additions & 101 deletions src/cli/config/abe-config.js
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
var config = {
root: '',
localeFolder: 'locale',
intlData: {
locales: 'en-US'
},
plugins: {
url:'plugins'
},
root: '',
localeFolder: 'locale',
intlData: {
locales: 'en-US'
},
plugins: {
url:'plugins'
},
templates: {
url: 'templates'
},
structure: {
url: 'structure'
},
upload: {
image: 'image',
fileSizelimit: 10485760
},
data: {
url: 'data'
},
draft: {
url: 'draft'
},
publish: {
url: 'site'
},
reference: {
url: 'reference'
},
csp: {
scriptSrc: [],
styleSrc: [],
imgSrc: [],
childSrc: [],
frameAncestors: [],
mediaSrc: [],
fontSrc: [],
connectSrc: []
},
security: true,
htmlWhiteList: {
'blockquote': ['style'],
'span': ['style'],
'font': ['style', 'color'],
'div': ['style'],
'sup': ['style'],
'sub': ['style'],
'ul': ['style'],
'li': ['style'],
'p': ['style'],
'b': ['style'],
'strong': ['style'],
'i': ['style'],
'u': ['style'],
'a': ['style', 'href'],
'br': [],
'h1': ['style'],
'h2': ['style'],
'h3': ['style'],
'h4': ['style'],
'pre': ['style'],
'code': ['style']
},
files: {
exclude: /^[.]/,
templates: {
url: 'templates'
},
structure: {
url: 'structure'
},
upload: {
image: 'image',
fileSizelimit: 10485760
},
data: {
url: 'data'
},
draft: {
url: 'draft'
},
publish: {
url: 'site'
},
reference: {
url: 'reference'
},
csp: {
scriptSrc: [],
styleSrc: [],
imgSrc: [],
childSrc: [],
frameAncestors: [],
mediaSrc: [],
fontSrc: [],
connectSrc: []
},
security: true,
htmlWhiteList: {
'blockquote': ['style'],
'span': ['style'],
'font': ['style', 'color'],
'div': ['style'],
'sup': ['style'],
'sub': ['style'],
'ul': ['style'],
'li': ['style'],
'p': ['style'],
'b': ['style'],
'strong': ['style'],
'i': ['style'],
'u': ['style'],
'a': ['style', 'href'],
'br': [],
'h1': ['style'],
'h2': ['style'],
'h3': ['style'],
'h4': ['style'],
'pre': ['style'],
'code': ['style']
},
files: {
exclude: /^[.]/,
templates: {
extension: 'html',
assets: '_files',
check: /\.hbs|\.shtml|\.html|\.htm/,
precompile: false
}
},
log: {
active: false,
path: 'abe-logs',
allowed: /(.*?)/
},
meta: {
name: 'abe_meta'
},
source: {
name: 'abe_source'
},
hooks: {
url: 'hooks'
},
cookie: {
secure: false
},
sessionSecret: 'ThIsIsAbE',
abeEngine: '../views/template-engine',
defaultPartials: '../../../server/views/partials',
pluginsPartials: 'partials',
partials: 'templates/partials',
custom: 'custom',
siteUrl: false,
sitePort: false,
redis: {
enable: false,
port: '6379',
host:'127.0.0.1'
extension: 'html',
assets: '_files',
check: /\.hbs|\.shtml|\.html|\.htm/,
precompile: false
}
},
log: {
active: false,
path: 'abe-logs',
allowed: /(.*?)/
},
meta: {
name: 'abe_meta'
},
source: {
name: 'abe_source'
},
hooks: {
url: 'hooks'
},
cookie: {
secure: false
},
sessionSecret: 'ThIsIsAbE',
abeEngine: '../views/template-engine',
defaultPartials: '../../../server/views/partials',
pluginsPartials: 'partials',
partials: 'templates/partials',
custom: 'custom',
siteUrl: false,
sitePort: false,
redis: {
enable: false,
port: '6379',
host:'127.0.0.1'
}
}

export default config
Loading

0 comments on commit 61e9067

Please sign in to comment.