-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ItsOnlyBinary/update
Update
- Loading branch information
Showing
58 changed files
with
9,339 additions
and
21,036 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> 1% | ||
last 2 versions | ||
not dead |
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,9 +1,7 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
[*.{js,jsx,ts,tsx,vue}] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 100 |
This file was deleted.
Oops, something went wrong.
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,58 +1,40 @@ | ||
const rulesDirPlugin = require('eslint-plugin-rulesdir'); | ||
rulesDirPlugin.RULES_DIR = 'config/eslint/rules/'; | ||
|
||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
parser: 'babel-eslint', | ||
sourceType: 'module' | ||
env: { | ||
node: true, | ||
}, | ||
extends: [ | ||
'airbnb-base', | ||
'plugin:vue/recommended', | ||
'standard' | ||
'plugin:vue/essential', | ||
'@vue/airbnb', | ||
], | ||
env: { | ||
'browser': true, | ||
parserOptions: { | ||
parser: 'babel-eslint', | ||
}, | ||
// required to lint *.vue files | ||
plugins: [ | ||
'rulesdir', | ||
'vue', | ||
], | ||
// add your custom rules here | ||
'rules': { | ||
// 'rulesdir/class-name-prefix': 'warn', | ||
'class-methods-use-this': 0, | ||
'comma-dangle': ['error', { | ||
'arrays': 'always-multiline', | ||
'objects': 'always-multiline', | ||
'imports': 'never', | ||
'exports': 'never', | ||
'functions': 'ignore' | ||
}], | ||
'import/extensions': 0, | ||
'import/no-extraneous-dependencies': 0, | ||
'import/no-unresolved': 0, | ||
'import/prefer-default-export': 0, | ||
'indent': ['error', 4], | ||
'no-continue': 0, | ||
'no-multi-assign': 0, | ||
'no-param-reassign': ['error', { 'props': false }], | ||
rules: { | ||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | ||
indent: ['error', 4], | ||
'no-plusplus': 0, | ||
'no-prototype-builtins': 0, | ||
'prefer-promise-reject-errors': 0, | ||
'no-control-regex': 0, | ||
'object-shorthand': 0, | ||
'operator-linebreak': 0, | ||
'operator-linebreak': ['error', 'after'], | ||
// Temp | ||
'prefer-const': 0, | ||
'arrow-parens': 0, | ||
'prefer-destructuring': 0, | ||
'prefer-template': 0, | ||
'semi': ['error', 'always'], | ||
'space-before-function-paren': ['error', 'never'], | ||
'vue/html-indent': ['error', 4], | ||
'vue/max-attributes-per-line': 0, | ||
'vue/require-prop-types': 0, | ||
'vue/require-default-prop': 0, | ||
} | ||
} | ||
'no-underscore-dangle': 0, | ||
'object-shorthand': 0, | ||
'no-param-reassign': 0, | ||
'max-classes-per-file': 0, | ||
|
||
}, | ||
overrides: [ | ||
{ | ||
files: [ | ||
'**/__tests__/*.{j,t}s?(x)', | ||
'**/tests/unit/**/*.spec.{j,t}s?(x)', | ||
], | ||
env: { | ||
jest: true, | ||
}, | ||
}, | ||
], | ||
}; |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
# .gitignore syntax (uses node-ignore behind the scenes) |
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,9 @@ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'stylelint-config-standard', | ||
], | ||
rules: { | ||
indentation: 4, | ||
}, | ||
}; |
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,30 +1,29 @@ | ||
# client-builder | ||
|
||
> A Vue.js project | ||
## Build Setup | ||
|
||
``` bash | ||
# install dependencies | ||
npm install | ||
|
||
# serve with hot reload at localhost:8080 | ||
npm run dev | ||
|
||
# build for production with minification | ||
npm run build | ||
## Project setup | ||
``` | ||
yarn install | ||
``` | ||
|
||
# build for production and view the bundle analyzer report | ||
npm run build --report | ||
### Compiles and hot-reloads for development | ||
``` | ||
yarn dev | ||
``` | ||
|
||
# run unit tests | ||
npm run unit | ||
### Compiles and minifies for production | ||
``` | ||
yarn build | ||
``` | ||
|
||
# run e2e tests | ||
npm run e2e | ||
### Run your unit tests | ||
``` | ||
yarn test:unit | ||
``` | ||
|
||
# run all tests | ||
npm test | ||
### Lints and fixes files | ||
``` | ||
yarn lint | ||
``` | ||
|
||
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). | ||
### Customize configuration | ||
See [Configuration Reference](https://cli.vuejs.org/config/). |
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 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset', | ||
], | ||
}; |
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,12 @@ | ||
{ | ||
"name": "client-builder-backend", | ||
"version": "1.0.0", | ||
"main": "server.js", | ||
"license": "Unknown", | ||
"private": true, | ||
"dependencies": { | ||
"koa": "^2.13.0", | ||
"koa-body": "^4.2.0", | ||
"koa-router": "^9.4.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,76 @@ | ||
const fs = require('fs'); | ||
const crypto = require('crypto'); | ||
|
||
const Koa = require('koa'); | ||
const koaBody = require('koa-body'); | ||
const Router = require('koa-router'); | ||
|
||
const host = '127.0.0.1'; | ||
const port = 8181; | ||
const path = '/client-builder'; | ||
const store = './configs'; | ||
|
||
const app = new Koa(); | ||
const router = new Router(); | ||
|
||
if (!fs.existsSync(store)) { | ||
fs.mkdirSync(store); | ||
} | ||
|
||
app.use(koaBody({ multipart: true, includeUnparsed: true })); | ||
app.use(async (ctx, next) => { | ||
ctx.set('Access-Control-Allow-Origin', '*'); | ||
ctx.set('Access-Control-Allow-Headers', 'x-auth-token'); | ||
await next(); | ||
}); | ||
app.use(router.routes()); | ||
app.use(router.allowedMethods()); | ||
|
||
router.post(`${path}/save`, async (ctx) => { | ||
let id = false; // Object.keys(ctx.request.query)[0]; | ||
|
||
ctx.response.status = 500; | ||
ctx.response.body = { error: 'Error saving settings' }; | ||
|
||
if (typeof ctx.request.body !== 'object') { | ||
ctx.response.status = 400; | ||
return; | ||
} | ||
|
||
if (!id || id.length !== 32) { | ||
id = crypto.randomBytes(16).toString('hex'); | ||
} | ||
|
||
await fs.promises.writeFile(`configs/${id}.json`, JSON.stringify(ctx.request.body)) | ||
.then(() => { | ||
ctx.response.status = 201; | ||
ctx.response.body = { status: 'success', settings_id: id }; | ||
}) | ||
.catch((err) => { | ||
console.log('save error:', err); | ||
}); | ||
}); | ||
|
||
router.get(`${path}`, async (ctx) => { | ||
let id = ctx.request.query.settings; | ||
|
||
ctx.response.status = 500; | ||
ctx.response.body = { error: 'Bad request' }; | ||
|
||
if (!id || id.length !== 32) { | ||
return; | ||
} | ||
|
||
await fs.promises.readFile(`configs/${id}.json`) | ||
.then((data) => { | ||
ctx.response.status = 200; | ||
ctx.response.body = JSON.parse(data); | ||
}) | ||
.catch((err) => { | ||
console.log('read error:', err); | ||
}); | ||
}); | ||
|
||
app.listen(port, host, () => { | ||
console.log(`Server running at http://${host}:${port}/`); | ||
}); |
Oops, something went wrong.