fix(core): update
This commit is contained in:
8
assets/templates/service/ts/00_commitinfo_data.ts
Normal file
8
assets/templates/service/ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '{{module.name}}',
|
||||
version: '1.0.0',
|
||||
description: '{{module.description}}'
|
||||
}
|
4
assets/templates/service/ts/index.ts
Normal file
4
assets/templates/service/ts/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from './00_commitinfo_data.js';
|
||||
import { {{module.name}} } from './{{module.name}}.classes.{{module.name}}.js'
|
||||
|
||||
export const runCli = async () => {}
|
30
assets/templates/service/ts/some.classes.some.db.ts
Normal file
30
assets/templates/service/ts/some.classes.some.db.ts
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
fileName: {{module.name}}.classes.{{module.name}}db.ts
|
||||
---
|
||||
import * as plugins from './{{module.name}}.plugins.js';
|
||||
import { {{module.name}} } from './{{module.name}}.classes.{{module.name}}.js';
|
||||
|
||||
|
||||
|
||||
export class {{module.name}}Db {
|
||||
public smartdataDb: plugins.smartdata.SmartdataDb;
|
||||
public {{module.name}}Ref: {{module.name}};
|
||||
|
||||
constructor({{module.name}}RefArg: {{module.name}}) {
|
||||
this.{{module.name}}Ref = {{module.name}}RefArg;
|
||||
}
|
||||
|
||||
public async start() {
|
||||
this.smartdataDb = new plugins.smartdata.SmartdataDb({
|
||||
mongoDbUser: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_USER'),
|
||||
mongoDbName: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_NAME'),
|
||||
mongoDbPass: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_PASS'),
|
||||
mongoDbUrl: this.{{module.name}}Ref.serviceQenv.getEnvVarOnDemand('MONGO_DB_URL'),
|
||||
});
|
||||
await this.smartdataDb.init();
|
||||
}
|
||||
|
||||
public async stop() {
|
||||
await this.smartdataDb.close();
|
||||
}
|
||||
}
|
27
assets/templates/service/ts/some.classes.some.ts
Normal file
27
assets/templates/service/ts/some.classes.some.ts
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
fileName: {{module.name}}.classes.{{module.name}}.ts
|
||||
---
|
||||
import * as plugins from './{{module.name}}.plugins.js';
|
||||
import * as paths from './{{module.name}}.paths.js';
|
||||
import { {{module.name}}Db } from './{{module.name}}.db.js'
|
||||
|
||||
export class {{module.name}} {
|
||||
public projectinfo: plugins.projectinfo.ProjectInfo;
|
||||
public serverInstance: plugins.loleServiceserver.ServiceServer;
|
||||
public serviceQenv = new plugins.qenv.Qenv('./', './.nogit');
|
||||
public {{module.name}}Db: {{module.name}}Db;
|
||||
|
||||
public async start() {
|
||||
this.{{module.name}}Db = new {{module.name}}Db;
|
||||
this.projectinfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
|
||||
this.serverInstance = new plugins.loleServiceserver.ServiceServer({
|
||||
serviceDomain: '{{module.domain}}',
|
||||
serviceName: '{{module.name}}',
|
||||
serviceVersion: this.projectinfo.npm.version,
|
||||
addCustomRoutes: async (serverArg) => {
|
||||
// any custom route configs go here
|
||||
}
|
||||
});
|
||||
await this.serverInstance.start();
|
||||
}
|
||||
}
|
9
assets/templates/service/ts/some.paths.ts
Normal file
9
assets/templates/service/ts/some.paths.ts
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
fileName: {{module.name}}.paths.ts
|
||||
---
|
||||
import * as plugins from './{{module.name}}.plugins.js';
|
||||
|
||||
export const packageDir = plugins.path.join(
|
||||
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||
'../'
|
||||
);
|
25
assets/templates/service/ts/some.plugins.ts
Normal file
25
assets/templates/service/ts/some.plugins.ts
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
fileName: {{module.name}}.plugins.ts
|
||||
---
|
||||
// node native
|
||||
import * as path from 'path';
|
||||
|
||||
export {
|
||||
path
|
||||
}
|
||||
|
||||
// @api.global scope
|
||||
import * as loleServiceserver from '@api.global/typedserver';
|
||||
|
||||
export {
|
||||
loleServiceserver
|
||||
}
|
||||
|
||||
// pushrocks scope
|
||||
// pushrocks scope
|
||||
import * as projectinfo from '@push.rocks/projectinfo';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
import * as smartdata from '@push.rocks/smartdata';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
|
||||
export { projectinfo, qenv, smartdata, smartpath };
|
Reference in New Issue
Block a user