Skip to content

Commit

Permalink
feat: @waline/cloudbase init
Browse files Browse the repository at this point in the history
  • Loading branch information
lizheming committed Nov 28, 2020
1 parent 8bbfc5a commit 02f1955
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 335 deletions.
4 changes: 0 additions & 4 deletions packages/cloudbase/app.js

This file was deleted.

17 changes: 0 additions & 17 deletions packages/cloudbase/cloudbaserc.json

This file was deleted.

32 changes: 32 additions & 0 deletions packages/cloudbase/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const os = require('os');
const path = require('path');
const Application = require('thinkjs');
const Loader = require('thinkjs/lib/loader');

const ROOT_PATH = path.dirname( require.resolve('@waline/vercel') );
const instance = new Application({
ROOT_PATH,
APP_PATH: path.join(ROOT_PATH, 'src'),
RUNTIME_PATH: path.join(os.tmpdir(), 'runtime'),
proxy: true,
env: 'cloudbase'
});

module.expors = function(config = {}) {
const loader = new Loader(instance.options);
loader.loadAll('worker');

for(const k in config) {
think.config(k, config[k]);
}

return {
async tcbGetApp() {
await think.beforeStartServer().catch(err => think.logger.error(err));
await instance._getWorkerInstance(instance.parseArgv()).startServer();
think.app.emit('appReady');

return think.app;
}
};
}
17 changes: 7 additions & 10 deletions packages/cloudbase/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"name": "cloudbase",
"version": "1.0.0",
"description": "",
"name": "@waline/cloudbase",
"version": "1.0.1",
"description": "cloudbase server for waline comment system",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"author": "lizheming<i@imnerd.org>",
"license": "MIT",
"dependencies": {
"@waline/vercel": "file:../server"
"@waline/vercel": "^0.7.0",
"thinkjs": "^3.2.12"
}
}
115 changes: 0 additions & 115 deletions packages/cloudbase/waline/.gitignore

This file was deleted.

57 changes: 0 additions & 57 deletions packages/cloudbase/waline/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions packages/cloudbase/waline/app.js

This file was deleted.

90 changes: 0 additions & 90 deletions packages/cloudbase/waline/bin/www

This file was deleted.

17 changes: 0 additions & 17 deletions packages/cloudbase/waline/cloudbaserc.json

This file was deleted.

17 changes: 0 additions & 17 deletions packages/cloudbase/waline/package.json

This file was deleted.

0 comments on commit 02f1955

Please sign in to comment.