mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
fix: should now compile and work
This commit is contained in:
1213
package-lock.json
generated
1213
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@@ -19,24 +19,23 @@
|
|||||||
"push": "git push && git push origin \"v$npm_package_version\""
|
"push": "git push && git push origin \"v$npm_package_version\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@openstapps/api": "0.16.0",
|
"@openstapps/api": "0.22.0",
|
||||||
"@openstapps/core": "0.27.0",
|
"@openstapps/core": "0.35.0",
|
||||||
"@openstapps/core-tools": "0.8.0",
|
"@openstapps/core-tools": "0.14.0",
|
||||||
"@openstapps/logger": "0.4.0",
|
"@openstapps/logger": "0.5.0",
|
||||||
"@types/node": "12.7.1",
|
"express": "4.16.4",
|
||||||
"commander": "3.0.1",
|
"commander": "5.1.0",
|
||||||
"express": "4.17.0",
|
|
||||||
"express-promise-router": "3.0.3",
|
|
||||||
"ts-node": "8.3.0"
|
"ts-node": "8.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@openstapps/configuration": "0.21.1",
|
"@openstapps/configuration": "0.24.0",
|
||||||
"@types/express": "4.17.1",
|
"@types/node": "12.7.1",
|
||||||
|
"@types/express": "4.16.1",
|
||||||
"conventional-changelog-cli": "2.0.23",
|
"conventional-changelog-cli": "2.0.23",
|
||||||
"prepend-file-cli": "1.0.6",
|
"prepend-file-cli": "1.0.6",
|
||||||
"rimraf": "3.0.0",
|
"rimraf": "3.0.0",
|
||||||
"tslint": "5.19.0",
|
"tslint": "5.19.0",
|
||||||
"typedoc": "0.15.0",
|
"typedoc": "0.16.11",
|
||||||
"typescript": "3.6.2"
|
"typescript": "3.7.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/cli.ts
29
src/cli.ts
@@ -17,7 +17,7 @@ import {HttpClient} from '@openstapps/api/lib/http-client';
|
|||||||
import {PluginClient} from '@openstapps/api/lib/plugin-client';
|
import {PluginClient} from '@openstapps/api/lib/plugin-client';
|
||||||
import {Converter} from '@openstapps/core-tools/lib/schema';
|
import {Converter} from '@openstapps/core-tools/lib/schema';
|
||||||
import {Logger} from '@openstapps/logger';
|
import {Logger} from '@openstapps/logger';
|
||||||
import * as commander from 'commander';
|
import {Command} from 'commander';
|
||||||
import {readFileSync} from 'fs';
|
import {readFileSync} from 'fs';
|
||||||
import {join, resolve} from 'path';
|
import {join, resolve} from 'path';
|
||||||
import {MinimalPlugin} from './plugin/minimal-plugin';
|
import {MinimalPlugin} from './plugin/minimal-plugin';
|
||||||
@@ -31,23 +31,23 @@ process.on('unhandledRejection', (error) => {
|
|||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
|
|
||||||
commander
|
const program = new Command()
|
||||||
.version(pluginVersion)
|
.version(pluginVersion)
|
||||||
.command('run')
|
.option('-b, --backend-url <string>', 'URL of the StApps backend deployment', 'http://localhost:3000')
|
||||||
.option('-b <backenUrl>', 'URL of the StApps backend deployment', 'http://localhost:3000')
|
.option('-n, --plugin-name <string>', 'The name of the plugin', 'minimal-plugin') // TODO: adjust default
|
||||||
.option('-n <name>', 'The name of the plugin', 'minimal-plugin') // TODO: adjust default
|
.option('-r, --route-name <string>', 'The name of the route', 'minimalPlugin') // TODO: adjust default
|
||||||
.option('-r <routeName>', 'The name of the route', 'minimalPlugin') // TODO: adjust default
|
.option('-u, --url <string>', 'The url of the plugin', 'http://localhost') // TODO: adjust default
|
||||||
.option('-u <url>', 'The url of the plugin', 'http://localhost') // TODO: adjust default
|
.option('-p, --port <number>', 'The port of the plugin', '4000') // TODO: adjust default
|
||||||
// tslint:disable-next-line:no-magic-numbers
|
.parse(process.argv);
|
||||||
.option('-p <port>', 'The port of the plugin', 4000) // TODO: adjust default
|
|
||||||
.action(async (backendUrl: string, name: string, routeName: string, url: string, port: number) => {
|
|
||||||
|
|
||||||
// create an instance of the PluginClient
|
// create an instance of the PluginClient
|
||||||
const pluginClient = new PluginClient(new HttpClient(), backendUrl);
|
const pluginClient = new PluginClient(new HttpClient(), program.backendUrl);
|
||||||
|
|
||||||
// create an instance of your plugin
|
// create an instance of your plugin
|
||||||
const plugin = new MinimalPlugin(port, name, url, `/${routeName}`, backendUrl,
|
const plugin = new MinimalPlugin(
|
||||||
new Converter(resolve(__dirname, '..', 'src/plugin', 'protocol')), // an instance of the converter. Required
|
// tslint:disable-next-line:no-magic-numbers
|
||||||
|
Number.parseInt(program.port, 10), program.pluginName, program.url, `/${program.routeName}`, program.backendUrl,
|
||||||
|
new Converter(resolve(__dirname, '..', 'src', 'plugin', 'protocol', '*.ts')), // an instance of the converter. Required
|
||||||
// because your requests and response schemas are defined in the plugin. The path should lead to your request and
|
// because your requests and response schemas are defined in the plugin. The path should lead to your request and
|
||||||
// response interfaces
|
// response interfaces
|
||||||
'SCMinimalRequest', // the name of the request interface TODO: adjust
|
'SCMinimalRequest', // the name of the request interface TODO: adjust
|
||||||
@@ -63,6 +63,3 @@ commander
|
|||||||
.catch((err: Error) => {
|
.catch((err: Error) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
commander.parse(process.argv);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user