mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-09 15:35:25 +02:00
move code to /src
This commit is contained in:
parent
40cab08392
commit
b613f3b492
24 changed files with 51 additions and 30 deletions
22
.db/pages.db
Normal file
22
.db/pages.db
Normal file
|
@ -0,0 +1,22 @@
|
|||
{"_id":"SuEkh6Yntj0DqTXH","title":"Page 2","body":"Page 2 body"}
|
||||
{"_id":"TPzu5FlP8sSk1sw2","title":"Page 1","body":"Page 1 body"}
|
||||
{"_id":"QbhUo8GKhCmGpWAG","title":"Test page","body":"Test page body"}
|
||||
{"_id":"QbhUo8GKhCmGpWAG","title":"Updated test page","body":"Updated test page body"}
|
||||
{"$$deleted":true,"_id":"QbhUo8GKhCmGpWAG"}
|
||||
{"_id":"n3BCUhBuahuud0j9","title":"Test page","body":"Test page body"}
|
||||
{"$$deleted":true,"_id":"n3BCUhBuahuud0j9"}
|
||||
{"_id":"5Vxa7B2O5eyafWlh","title":"Page 1","body":"Page 1 body"}
|
||||
{"_id":"MjlC5zMfL79xW1Wp","title":"Page 2","body":"Page 2 body"}
|
||||
{"_id":"yU6Yb0igW7OETm4f","title":"Parent page","body":"Parent page body"}
|
||||
{"_id":"Sf6LIWuXqOrOT8Br","title":"Child page","body":"Child page body","parent":"yU6Yb0igW7OETm4f"}
|
||||
{"$$deleted":true,"_id":"yU6Yb0igW7OETm4f"}
|
||||
{"$$deleted":true,"_id":"Sf6LIWuXqOrOT8Br"}
|
||||
{"_id":"AIQ0Q5j7lzEsjlQA","title":"Test page","body":"Test page body"}
|
||||
{"$$deleted":true,"_id":"AIQ0Q5j7lzEsjlQA"}
|
||||
{"_id":"jBEBKXUIHSjTTYW3","title":"Test page","body":"Test page body"}
|
||||
{"$$deleted":true,"_id":"jBEBKXUIHSjTTYW3"}
|
||||
{"_id":"mHBnGkfWxJ8eH3IC","title":"Test page","body":"Test page body"}
|
||||
{"_id":"mHBnGkfWxJ8eH3IC","title":"Updated test page","body":"Updated test page body"}
|
||||
{"$$deleted":true,"_id":"mHBnGkfWxJ8eH3IC"}
|
||||
{"_id":"32l7Wg0P971HuSkx","title":"Test page","body":"Test page body"}
|
||||
{"$$deleted":true,"_id":"32l7Wg0P971HuSkx"}
|
4
bin/www
4
bin/www
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
const app = require('../app');
|
||||
const app = require('../src/app');
|
||||
const debug = require('debug')('codex.editor.docs:server');
|
||||
const http = require('http');
|
||||
|
||||
|
@ -88,4 +88,4 @@ function onListening() {
|
|||
debug('Listening on ' + bind);
|
||||
}
|
||||
|
||||
module.exports = {server, app};
|
||||
module.exports = {server, app};
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
const Datastore = require('nedb');
|
||||
|
||||
const db = new Datastore({filename: './db/pages.db', autoload: true});
|
||||
|
||||
module.exports = db;
|
|
@ -5,8 +5,8 @@
|
|||
"scripts": {
|
||||
"start": "nodemon ./bin/www",
|
||||
"test": "mocha --recursive ./test",
|
||||
"lint": "eslint --fix --cache ./**/*.js",
|
||||
"build": "webpack ./frontend/js/app.js --o='./public/dist/bundle.js' --output-library=Docs -d",
|
||||
"lint": "eslint --fix --cache ./src/**/*.js",
|
||||
"build": "webpack ./src/frontend/js/app.js --o='./public/dist/bundle.js' --output-library=Docs -d",
|
||||
"precommit": "yarn lint && yarn test --exit"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
18
public/dist/bundle.js
vendored
18
public/dist/bundle.js
vendored
|
@ -1,9 +1,9 @@
|
|||
var Docs=function(n){var e={};function t(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return n[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}return t.m=n,t.c=e,t.d=function(n,e,o){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:o})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)t.d(o,r,function(e){return n[e]}.bind(null,r));return o},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s="./frontend/js/app.js")}({"./frontend/js/app.js":
|
||||
/*!****************************!*\
|
||||
!*** ./frontend/js/app.js ***!
|
||||
\****************************/
|
||||
/*! no static exports found */function(module,exports,__webpack_require__){"use strict";eval('\n\nvar _main = __webpack_require__(/*! ../styles/main.pcss */ "./frontend/styles/main.pcss");\n\nvar _main2 = _interopRequireDefault(_main);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nmodule.exports = function Docs() {\n _classCallCheck(this, Docs);\n\n console.log(\'CodeX Docs initialized\');\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9mcm9udGVuZC9qcy9hcHAuanMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Eb2NzLy4vZnJvbnRlbmQvanMvYXBwLmpzPzNhMmUiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGNzcyBmcm9tICcuLi9zdHlsZXMvbWFpbi5wY3NzJztcblxubW9kdWxlLmV4cG9ydHMgPSBjbGFzcyBEb2NzIHtcbiAgY29uc3RydWN0b3IoKXtcbiAgICBjb25zb2xlLmxvZygnQ29kZVggRG9jcyBpbml0aWFsaXplZCcpO1xuXG4gIH1cbn1cbiJdLCJtYXBwaW5ncyI6Ijs7QUFBQTtBQUNBOzs7Ozs7O0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFFQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./frontend/js/app.js\n')},"./frontend/styles/main.pcss":
|
||||
/*!***********************************!*\
|
||||
!*** ./frontend/styles/main.pcss ***!
|
||||
\***********************************/
|
||||
/*! no static exports found */function(module,exports){eval("// removed by extract-text-webpack-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9mcm9udGVuZC9zdHlsZXMvbWFpbi5wY3NzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vRG9jcy8uL2Zyb250ZW5kL3N0eWxlcy9tYWluLnBjc3M/NmFjOCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyByZW1vdmVkIGJ5IGV4dHJhY3QtdGV4dC13ZWJwYWNrLXBsdWdpbiJdLCJtYXBwaW5ncyI6IkFBQUEiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./frontend/styles/main.pcss\n")}});
|
||||
var Docs=function(n){var e={};function c(t){if(e[t])return e[t].exports;var r=e[t]={i:t,l:!1,exports:{}};return n[t].call(r.exports,r,r.exports,c),r.l=!0,r.exports}return c.m=n,c.c=e,c.d=function(n,e,t){c.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},c.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},c.t=function(n,e){if(1&e&&(n=c(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(c.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)c.d(t,r,function(e){return n[e]}.bind(null,r));return t},c.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return c.d(e,"a",e),e},c.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},c.p="",c(c.s="./src/frontend/js/app.js")}({"./src/frontend/js/app.js":
|
||||
/*!********************************!*\
|
||||
!*** ./src/frontend/js/app.js ***!
|
||||
\********************************/
|
||||
/*! no static exports found */function(module,exports,__webpack_require__){"use strict";eval('\n\nvar _main = __webpack_require__(/*! ../styles/main.pcss */ "./src/frontend/styles/main.pcss");\n\nvar _main2 = _interopRequireDefault(_main);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nmodule.exports =\n/**\n * @constructor\n */\nfunction Docs() {\n _classCallCheck(this, Docs);\n\n console.log(\'CodeX Docs initialized\');\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvZnJvbnRlbmQvanMvYXBwLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vRG9jcy8uL3NyYy9mcm9udGVuZC9qcy9hcHAuanM/YmM1NSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBObyBpbnNwZWN0aW9uIGZvciB1bnVzZWQgdmFyIGBjc3NgIGJlY2F1c2UgaXQncyB1c2VkIGZvciBjc3MgYnVuZGxlXG4vLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tdW51c2VkLXZhcnNcbmltcG9ydCBjc3MgZnJvbSAnLi4vc3R5bGVzL21haW4ucGNzcyc7XG5cbm1vZHVsZS5leHBvcnRzID0gY2xhc3MgRG9jcyB7XG4gIC8qKlxuICAgKiBAY29uc3RydWN0b3JcbiAgICovXG4gIGNvbnN0cnVjdG9yKCkge1xuICAgIGNvbnNvbGUubG9nKCdDb2RlWCBEb2NzIGluaXRpYWxpemVkJyk7XG4gIH1cbn07XG4iXSwibWFwcGluZ3MiOiI7O0FBRUE7QUFDQTs7Ozs7OztBQUNBO0FBQ0E7OztBQUdBO0FBQUE7QUFDQTtBQUFBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/frontend/js/app.js\n')},"./src/frontend/styles/main.pcss":
|
||||
/*!***************************************!*\
|
||||
!*** ./src/frontend/styles/main.pcss ***!
|
||||
\***************************************/
|
||||
/*! no static exports found */function(module,exports){eval("// removed by extract-text-webpack-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvZnJvbnRlbmQvc3R5bGVzL21haW4ucGNzcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0RvY3MvLi9zcmMvZnJvbnRlbmQvc3R5bGVzL21haW4ucGNzcz83N2VjIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIHJlbW92ZWQgYnkgZXh0cmFjdC10ZXh0LXdlYnBhY2stcGx1Z2luIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/frontend/styles/main.pcss\n")}});
|
|
@ -16,7 +16,7 @@ app.use(logger('dev'));
|
|||
app.use(express.json());
|
||||
app.use(express.urlencoded({extended: true}));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use(express.static(path.join(__dirname, '../public')));
|
||||
|
||||
app.use('/', routes);
|
||||
// catch 404 and forward to error handler
|
|
@ -1,4 +1,4 @@
|
|||
const {pages} = require('../database');
|
||||
const {pages} = require('../utils/database/index');
|
||||
|
||||
/**
|
||||
* @typedef {Object} PageData
|
||||
|
@ -157,4 +157,4 @@ class Page {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = Page;
|
||||
module.exports = Page;
|
5
src/utils/database/pages.js
Normal file
5
src/utils/database/pages.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
const Datastore = require('nedb');
|
||||
|
||||
const db = new Datastore({filename: './.db/pages.db', autoload: true});
|
||||
|
||||
module.exports = db;
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
<link rel='stylesheet' href='/dist/bundle.css' />
|
||||
<link rel="stylesheet" href="/dist/bundle.css" />
|
||||
<script src="/dist/bundle.js" onload="new Docs()"></script>
|
||||
</head>
|
||||
<body>
|
|
@ -1 +0,0 @@
|
|||
body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,Helvetica,Arial,Verdana}a{color:#00b7ff}
|
|
@ -1,7 +1,7 @@
|
|||
const fs = require('fs');
|
||||
const {expect} = require('chai');
|
||||
|
||||
const {class: Database} = require('../database');
|
||||
const {class: Database} = require('../src/utils/database');
|
||||
const Datastore = require('nedb');
|
||||
|
||||
describe('Database', () => {
|
||||
|
@ -175,4 +175,4 @@ describe('Database', () => {
|
|||
fs.unlinkSync(pathToDB);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const {expect} = require('chai');
|
||||
const Page = require('../../models/page');
|
||||
const {pages} = require('../../database');
|
||||
const Page = require('../../src/models/page');
|
||||
const {pages} = require('../../src/utils/database');
|
||||
|
||||
describe('Page model', () => {
|
||||
it('Working with empty model', async () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const {app} = require('../../bin/www');
|
||||
const model = require('../../models/page');
|
||||
const model = require('../../src/models/page');
|
||||
|
||||
const chai = require('chai');
|
||||
const chaiHTTP = require('chai-http');
|
||||
|
@ -199,4 +199,4 @@ describe('Pages REST: ', () => {
|
|||
expect(success).to.be.false;
|
||||
expect(error).to.equal('Page with given id does not exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = (env) => {
|
|||
loader: 'postcss-loader',
|
||||
options: {
|
||||
config: {
|
||||
path: './frontend/'
|
||||
path: './src/frontend/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue