mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
refactor: build system
This commit is contained in:
@@ -19,14 +19,11 @@ import {join} from 'path';
|
||||
import {executeConnector, isValidSCNamespace} from './common.js';
|
||||
import {MinimalConnector} from './minimal-connector.js';
|
||||
|
||||
process.on('unhandledRejection', (error) => {
|
||||
process.on('unhandledRejection', error => {
|
||||
throw error;
|
||||
});
|
||||
|
||||
const connectorVersion = JSON.parse(
|
||||
readFileSync(join(__dirname, '..', 'package.json'))
|
||||
.toString(),
|
||||
).version;
|
||||
const connectorVersion = JSON.parse(readFileSync(join(__dirname, '..', 'package.json')).toString()).version;
|
||||
|
||||
const commander = new Command();
|
||||
|
||||
@@ -41,25 +38,25 @@ commander
|
||||
.command('run <backendURL> <origin> <licensePlate>')
|
||||
.version(connectorVersion)
|
||||
.action(async (backendURL: string, origin: string, licensePlate: string) => {
|
||||
if (backendURL.length === 0) {
|
||||
throw new Error('Param "backend" needs to have a length greater zero.');
|
||||
}
|
||||
const originRegex = /^[a-z\-\_0-9]+$/;
|
||||
if (!originRegex.test(origin)) {
|
||||
throw new Error(
|
||||
'Origin name can only consist of lowercase letters from a-z, "-", "_" and integer numbers.',
|
||||
);
|
||||
}
|
||||
|
||||
if (backendURL.length === 0) {
|
||||
throw new Error('Param "backend" needs to have a length greater zero.');
|
||||
}
|
||||
const originRegex = /^[a-z\-\_0-9]+$/;
|
||||
if (!originRegex.test(origin)) {
|
||||
throw new Error('Origin name can only consist of lowercase letters from a-z, "-", "_" and integer numbers.');
|
||||
}
|
||||
if (!isValidSCNamespace(licensePlate)) {
|
||||
throw new Error('Not a valid license plate. Please register a namespace with a unique-id in "core"');
|
||||
}
|
||||
|
||||
if (!isValidSCNamespace(licensePlate)) {
|
||||
throw new Error('Not a valid license plate. Please register a namespace with a unique-id in "core"');
|
||||
}
|
||||
// TODO for connector-developers: set your connector here
|
||||
const connector = new MinimalConnector(licensePlate, origin);
|
||||
|
||||
// TODO for connector-developers: set your connector here
|
||||
const connector = new MinimalConnector(licensePlate, origin);
|
||||
|
||||
await executeConnector(backendURL, connector);
|
||||
Logger.ok('Done');
|
||||
},
|
||||
);
|
||||
await executeConnector(backendURL, connector);
|
||||
Logger.ok('Done');
|
||||
});
|
||||
|
||||
commander.parse(process.argv);
|
||||
|
||||
Reference in New Issue
Block a user