fix(core): update
This commit is contained in:
34
assets/templates/service/.package.json
Normal file
34
assets/templates/service/.package.json
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
fileName: package.json
|
||||
---
|
||||
{
|
||||
"name": "{{module.npmPackagename}}",
|
||||
"version": "1.0.1",
|
||||
"description": "{{module.description}}",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"author": "{{service.author}}",
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"start": "(node --max_old_space_size=100 ./cli.js)",
|
||||
"startTs": "(node cli.ts.js)",
|
||||
"build": "(tsbuild --web --allowimplicitany)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.17",
|
||||
"@git.zone/tsrun": "^1.2.8",
|
||||
"@git.zone/tstest": "^1.0.28",
|
||||
"@git.zone/tswatch": "^2.0.1",
|
||||
"@push.rocks/tapbundle": "^5.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@api.global/typedserver": "^1.0.24",
|
||||
"@push.rocks/projectinfo": "^5.0.1",
|
||||
"@push.rocks/qenv": "^4.0.10",
|
||||
"@push.rocks/smartdata": "^5.0.7",
|
||||
"@push.rocks/smartpath": "^5.0.5",
|
||||
"@push.rocks/smartstate": "^2.0.0"
|
||||
}
|
||||
}
|
21
assets/templates/service/.smartscaf.yml
Normal file
21
assets/templates/service/.smartscaf.yml
Normal file
@ -0,0 +1,21 @@
|
||||
defaults:
|
||||
module.name: smartmodule
|
||||
module.description: a smart description
|
||||
module.author: Anonymous
|
||||
module.license: UNLICENSED
|
||||
module.githost: gitlab.com
|
||||
projectType: service
|
||||
|
||||
dependencies:
|
||||
merge:
|
||||
- ../gitignore
|
||||
- ../ci_docker
|
||||
- ../dockerfile_service
|
||||
- ../tsconfig_update
|
||||
- ../cli
|
||||
- ../readme
|
||||
- ../vscode
|
||||
|
||||
runafter:
|
||||
- pnpm install
|
||||
- gitzone format
|
24
assets/templates/service/npmextra.json
Normal file
24
assets/templates/service/npmextra.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"projectType": "{{projectType}}",
|
||||
"module": {
|
||||
"githost": "{{module.githost}}",
|
||||
"gitscope": "{{module.gitscope}}",
|
||||
"gitrepo": "{{module.gitrepo}}",
|
||||
"description": "{{module.description}}",
|
||||
"npmPackagename": "{{module.npmPackagename}}",
|
||||
"license": "{{module.license}}",
|
||||
"projectDomain": "{{module.projectDomain}}"
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"dockerRegistryRepoMap": {
|
||||
"registry.gitlab.com": "{{dockerTargetImagePath}}"
|
||||
},
|
||||
"dockerBuildargEnvMap": {
|
||||
"NPMCI_TOKEN_NPM2": "NPMCI_TOKEN_NPM2"
|
||||
},
|
||||
"npmRegistryUrl": "{{npmPrivateRegistry}}"
|
||||
}
|
||||
}
|
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