vona-cli-set-api 1.0.60 → 1.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,6 @@ FROM node:24
3
3
  RUN mkdir -p /opt/node/app/dist
4
4
  WORKDIR /opt/node/app
5
5
 
6
- COPY ./dist/docker /opt/node/app/dist/docker
7
6
  COPY ./scripts /opt/node/app/scripts
8
7
 
9
8
  RUN chmod +x /opt/node/app/scripts/*.sh
@@ -13,6 +13,7 @@ services:
13
13
  ports:
14
14
  - '7202:7102'
15
15
  volumes:
16
+ - ./docker-compose/output/dist/docker:/opt/node/app/dist/docker
16
17
  - ./docker-compose/output/app/vona:/root/vona
17
18
  - ./docker-compose/logs/app:/root/logs
18
19
  command: [./scripts/wait-for-it.sh, 'pg:5432', 'mysql:3306', 'redis:6379', -s, --, ./scripts/app-init.sh]
@@ -32,6 +32,8 @@ BUILD_SOURCEMAP = false
32
32
  BUILD_MINIFY = true
33
33
  BUILD_INLINEDYNAMICIMPORTS = true
34
34
  BUILD_LOG_CIRCULAR_DEPENDENCY = false
35
+ BUILD_COPY_DIST =
36
+ BUILD_COPY_RELEASE =
35
37
 
36
38
  # test
37
39
 
@@ -3,6 +3,10 @@
3
3
  SERVER_KEYS = <%=argv.SERVER_KEYS_PROD%>
4
4
  SERVER_WORKERS = 1
5
5
 
6
+ # build
7
+
8
+ BUILD_COPY_DIST = ./docker-compose/output/dist
9
+
6
10
  # database
7
11
 
8
12
  DATABASE_DEFAULT_CLIENT = 'pg' # pg/mysql
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "vona": "^5.0.34"
49
+ "vona": "^5.0.35"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cabloy/lint": "^5.0.16",
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- cp /opt/node/app/dist/* -r /root/output/app/dist
4
- npm run start:backend
3
+ # cp /opt/node/app/dist/* -r /root/output/app/dist
4
+ # npm run start:backend
5
+ node ./dist/docker/bootstrap.js
@@ -17,6 +17,7 @@ export interface IControllerOptionsPassport extends IDecoratorControllerOptions
17
17
  @Controller<IControllerOptionsPassport>('passport')
18
18
  export class ControllerPassport extends BeanBase {
19
19
  @Web.get('current')
20
+ @Passport.public()
20
21
  @Api.body(v.optional(), v.object(DtoPassport))
21
22
  current(): DtoPassport | undefined {
22
23
  return this._combineDtoPassport();
@@ -106,7 +107,7 @@ export class ControllerPassport extends BeanBase {
106
107
 
107
108
  private _combineDtoPassport(): DtoPassport | undefined {
108
109
  const passport = this.bean.passport.getCurrent();
109
- if (!passport) return;
110
+ if (!passport || !passport.auth) return;
110
111
  return {
111
112
  user: passport.user as EntityUser,
112
113
  auth: { id: passport.auth!.id },
@@ -0,0 +1,47 @@
1
+ import fs from 'node:fs';
2
+ import { metadataCustomSnippet } from '@cabloy/cli';
3
+ import { catchError } from '@cabloy/utils';
4
+
5
+ declare module '@cabloy/cli' {
6
+ interface ICommandArgv {
7
+ module: string;
8
+ }
9
+ }
10
+
11
+ const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-database\';\n';
12
+ const __snippet_import2 = 'import { Entity<%=argv.resourceNameCapitalize%> } from \'../entity/<%=argv.resourceName%>.ts\';\n';
13
+ const __snippet_update = `...$tableColumns(
14
+ () => Entity<%=argv.resourceNameCapitalize%>,
15
+ entity => entity.name,
16
+ ),`;
17
+
18
+ export default metadataCustomSnippet({
19
+ file: 'src/bean/meta.index.ts',
20
+ language: 'plain',
21
+ init: async ({ cli, argv, targetFile }) => {
22
+ await catchError(() => {
23
+ return cli.helper.invokeCli([
24
+ ':create:bean',
25
+ 'meta',
26
+ 'index',
27
+ `--module=${argv.module}`,
28
+ ], { cwd: argv.projectPath });
29
+ });
30
+ return fs.readFileSync(targetFile).toString('utf8');
31
+ },
32
+ async transform({ cli, ast }) {
33
+ // import1
34
+ if (!ast.includes(__snippet_import1)) {
35
+ const code = await cli.template.renderContent({ content: __snippet_import1 });
36
+ ast = `${code}${ast}`;
37
+ }
38
+ // import2
39
+ let code = await cli.template.renderContent({ content: __snippet_import2 });
40
+ ast = `${code}${ast}`;
41
+ // update
42
+ code = await cli.template.renderContent({ content: __snippet_update });
43
+ ast = ast.replace('indexes: {', `indexes: {\n${code}`);
44
+ // ok
45
+ return ast;
46
+ },
47
+ });
@@ -48,6 +48,23 @@ export class CliBinBuild extends BeanCliBase {
48
48
  const outReleasesDir = path.join(projectPath, getOutReleasesDir());
49
49
  await rimraf(outReleasesDir);
50
50
  fse.copySync(outDir, outReleasesDir);
51
+ // copy
52
+ if (process.env.BUILD_COPY_DIST) {
53
+ const envDist = path.isAbsolute(process.env.BUILD_COPY_DIST)
54
+ ? process.env.BUILD_COPY_DIST
55
+ : path.join(projectPath, process.env.BUILD_COPY_DIST);
56
+ const outDirCopy = path.join(envDist, path.basename(outDir));
57
+ fse.removeSync(outDirCopy);
58
+ fse.copySync(outDir, outDirCopy);
59
+ }
60
+ if (process.env.BUILD_COPY_RELEASE) {
61
+ const envRelease = path.isAbsolute(process.env.BUILD_COPY_RELEASE)
62
+ ? process.env.BUILD_COPY_RELEASE
63
+ : path.join(projectPath, process.env.BUILD_COPY_RELEASE);
64
+ const outReleasesDirCopy = path.join(envRelease, path.basename(outReleasesDir));
65
+ fse.removeSync(outReleasesDirCopy);
66
+ fse.copySync(outDir, outReleasesDirCopy);
67
+ }
51
68
  }
52
69
  async _assets(_projectPath, modulesMeta, outDir) {
53
70
  const assetsPath = path.join(outDir, 'assets');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
3
  "type": "module",
4
- "version": "1.0.60",
4
+ "version": "1.0.63",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"