gorig-cli 1.0.12 → 1.0.21

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.
package/bin/cli.js CHANGED
@@ -3,53 +3,53 @@
3
3
  import chalk from 'chalk';
4
4
  import path from 'path';
5
5
 
6
- // 获取命令行参数
6
+ // Get command line arguments
7
7
  const args = process.argv.slice(2);
8
8
 
9
- // 验证是否提供了命令
9
+ // Validate if a command is provided
10
10
  if (args.length < 1) {
11
- console.error(chalk.red('请提供一个有效的命令,例如: create init'));
11
+ console.error(chalk.red('Please provide a valid command, e.g.: create or init'));
12
12
  process.exit(1);
13
13
  }
14
14
 
15
- // 提取命令
15
+ // Extract command
16
16
  const command = args[0];
17
17
 
18
- // 获取当前文件的目录
18
+ // Get current file directory
19
19
  const __dirname = path.dirname(new URL(import.meta.url).pathname);
20
20
 
21
- // 根据命令执行不同的逻辑
21
+ // Execute different logic based on command
22
22
  switch (command) {
23
23
  case 'create':
24
- // 动态导入 create.js,命令放在 commands 目录下
24
+ // Dynamically import create.js, commands are placed in the commands directory
25
25
  import(path.join(__dirname, '../commands/create.js')).then(module => {
26
26
  const createModule = module.default;
27
- createModule(args.slice(1)); // 将命令行的其他参数传递给 create.js
27
+ createModule(args.slice(1)); // Pass other command line arguments to create.js
28
28
  }).catch(error => {
29
- console.error(chalk.red('无法加载 create 命令模块:', error.message));
29
+ console.error(chalk.red('Failed to load create command module:', error.message));
30
30
  });
31
31
  break;
32
32
 
33
33
  case 'init':
34
- // 动态导入 init.js
34
+ // Dynamically import init.js
35
35
  import(path.join(__dirname, '../commands/init.js')).then(module => {
36
36
  const initModule = module.default;
37
- initModule(args.slice(1)); // 将命令行的其他参数传递给 init.js
37
+ initModule(args.slice(1)); // Pass other command line arguments to init.js
38
38
  }).catch(error => {
39
- console.error(chalk.red('无法加载 init 命令模块:', error.message));
39
+ console.error(chalk.red('Failed to load init command module:', error.message));
40
40
  });
41
41
  break;
42
42
  case 'doc':
43
43
  import(path.join(__dirname, '../commands/doc.js')).then(module => {
44
44
  const docModule = module.default;
45
- docModule(); // 执行 doc 命令
45
+ docModule(); // Execute doc command
46
46
  }).catch(error => {
47
- console.error(chalk.red('无法加载 doc 命令模块:', error.message));
47
+ console.error(chalk.red('Failed to load doc command module:', error.message));
48
48
  });
49
49
  break;
50
50
 
51
51
  default:
52
- console.error(chalk.red(`未知的命令: ${command}`));
53
- console.error(chalk.yellow('可用的命令: create, init'));
52
+ console.error(chalk.red(`Unknown command: ${command}`));
53
+ console.error(chalk.yellow('Available commands: create, init'));
54
54
  process.exit(1);
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gorig-cli",
3
- "version": "1.0.12",
3
+ "version": "1.0.21",
4
4
  "type": "module",
5
5
  "description": "gorig build tool",
6
6
  "main": "bin/cli.js",
@@ -1,16 +1,17 @@
1
1
  package cron
2
2
 
3
3
  import (
4
+ "context"
4
5
  "fmt"
5
6
  "github.com/jom-io/gorig/cronx"
6
7
  "github.com/jom-io/gorig/utils/logger"
7
8
  "time"
8
9
  )
9
10
 
10
- func test() {
11
- logger.Info(nil, fmt.Sprintf("hello, now is %s", time.Now().Format("2006-01-02 15:04:05")))
11
+ func test(ctx context.Context) {
12
+ logger.Info(ctx, fmt.Sprintf("hello, now is %s", time.Now().Format("2006-01-02 15:04:05")))
12
13
  }
13
14
 
14
15
  func init() {
15
- cronx.AddTask("*/10 * * * * *", test)
16
+ cronx.AddCronTask("*/10 * * * * *", test, 0)
16
17
  }
@@ -54,6 +54,9 @@ _bin/
54
54
  /test/output/
55
55
  *.html
56
56
  *.json
57
+ *.cache
58
+ *.cache.json
59
+
57
60
  # Go workspace file
58
61
  go.work
59
62
  go.work.sum
@@ -2,6 +2,7 @@ package domain
2
2
 
3
3
  import (
4
4
  "github.com/gin-gonic/gin"
5
+ "github.com/jom-io/gorig/apix/response"
5
6
  "github.com/jom-io/gorig/httpx"
6
7
  "github.com/jom-io/gorig/serv"
7
8
  configure "github.com/jom-io/gorig/utils/cofigure"
@@ -11,7 +12,7 @@ import (
11
12
  func init() {
12
13
  httpx.RegisterRouter(func(groupRouter *gin.RouterGroup) {
13
14
  groupRouter.GET("/", func(ctx *gin.Context) {
14
- httpx.Success(ctx, "hello world, this is <%= projectNameUpper %> project generated by gorig-cli")
15
+ response.Success(ctx, "Hello world, this is <%= projectNameUpper %> project generated by gorig-cli", nil)
15
16
  })
16
17
  })
17
18
  err := serv.RegisterService(
@@ -29,7 +29,7 @@ func (s service) Save<%= ModuleName %>(ctx *gin.Context, req *req.<%= ModuleName
29
29
  <%= moduleName %>M.Options = get<%= ModuleName %>.Options
30
30
  }
31
31
  <%= moduleName %>M.ParseReq(req)
32
- if _, e := domainx.SaveOrUpdate(<%= moduleName %>M.Con, <%= moduleName %>M); e != nil {
32
+ if _, e := domainx.Save(<%= moduleName %>M.Con, <%= moduleName %>M, 0); e != nil {
33
33
  return e
34
34
  }
35
35
  return nil
package/yarn-error.log DELETED
@@ -1,208 +0,0 @@
1
- Arguments:
2
- /usr/local/bin/node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js publish
3
-
4
- PATH:
5
- /Users/doz/.docker/bin:/Users/doz/.rbenv/shims:/Users/doz/.rbenv/shims:/Users/doz/.rbenv/shims:/Users/doz/.rbenv/bin:/Users/doz/.docker/bin:/Users/doz/.local/share/solana/install/active_release/bin:/Users/doz/.rbenv/shims:/Users/doz/.rbenv/bin:/Users/doz/.docker/bin:/Users/doz/Library/Java/JavaVirtualMachines/corretto-1.8.0_352/Contents/Home/bin:/Users/doz/.local/share/solana/install/active_release/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/doz/.docker/bin:/Users/doz/.rbenv/shims:/Users/doz/.rbenv/bin:/Users/doz/.local/share/solana/install/active_release/bin:/Users/doz/Library/Java/JavaVirtualMachines/corretto-1.8.0_352/Contents/Home/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/doz/.cargo/bin:.:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin:/Users/doz/Library/Android/sdk/tools:/Users/doz/Library/Android/sdk/platform-tools:.:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin:/Users/doz/Library/Android/sdk/tools:/Users/doz/Library/Android/sdk/platform-tools
6
-
7
- Yarn version:
8
- 1.22.19
9
-
10
- Node version:
11
- 21.1.0
12
-
13
- Platform:
14
- darwin arm64
15
-
16
- Trace:
17
- Error: https://mirrors.huaweicloud.com/repository/npm/-/user/org.couchdb.user:jom-io: Incorrect username or password!
18
- at params.callback [as _callback] (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:66145:18)
19
- at self.callback (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:140890:22)
20
- at Request.emit (node:events:515:28)
21
- at Request.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:141862:10)
22
- at Request.emit (node:events:515:28)
23
- at IncomingMessage.<anonymous> (/opt/homebrew/Cellar/yarn/1.22.19/libexec/lib/cli.js:141784:12)
24
- at Object.onceWrapper (node:events:629:28)
25
- at IncomingMessage.emit (node:events:527:35)
26
- at endReadableNT (node:internal/streams/readable:1589:12)
27
- at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
28
-
29
- npm manifest:
30
- {
31
- "name": "gorig-cli",
32
- "version": "1.0.0",
33
- "type": "module",
34
- "description": "gorig构建工具",
35
- "main": "bin/cli.js",
36
- "bin": {
37
- "gorig-cli": "./bin/cli.js"
38
- },
39
- "scripts": {
40
- "start": "node bin/cli.js"
41
- },
42
- "keywords": [
43
- "go",
44
- "cli",
45
- "gorig"
46
- ],
47
- "author": "jom",
48
- "license": "MIT",
49
- "dependencies": {
50
- "chalk": "^5.3.0",
51
- "commander": "^12.1.0",
52
- "ejs": "^3.1.10",
53
- "fs-extra": "^11.2.0"
54
- }
55
- }
56
-
57
- yarn manifest:
58
- No manifest
59
-
60
- Lockfile:
61
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
62
- # yarn lockfile v1
63
-
64
-
65
- ansi-styles@^4.1.0:
66
- version "4.3.0"
67
- resolved "https://mirrors.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
68
- integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
69
- dependencies:
70
- color-convert "^2.0.1"
71
-
72
- async@^3.2.3:
73
- version "3.2.6"
74
- resolved "https://mirrors.huaweicloud.com/repository/npm/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce"
75
- integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==
76
-
77
- balanced-match@^1.0.0:
78
- version "1.0.2"
79
- resolved "https://mirrors.huaweicloud.com/repository/npm/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
80
- integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
81
-
82
- brace-expansion@^1.1.7:
83
- version "1.1.11"
84
- resolved "https://mirrors.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
85
- integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
86
- dependencies:
87
- balanced-match "^1.0.0"
88
- concat-map "0.0.1"
89
-
90
- brace-expansion@^2.0.1:
91
- version "2.0.1"
92
- resolved "https://mirrors.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
93
- integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
94
- dependencies:
95
- balanced-match "^1.0.0"
96
-
97
- chalk@^4.0.2:
98
- version "4.1.2"
99
- resolved "https://mirrors.huaweicloud.com/repository/npm/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
100
- integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
101
- dependencies:
102
- ansi-styles "^4.1.0"
103
- supports-color "^7.1.0"
104
-
105
- chalk@^5.3.0:
106
- version "5.3.0"
107
- resolved "https://mirrors.huaweicloud.com/repository/npm/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
108
- integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==
109
-
110
- color-convert@^2.0.1:
111
- version "2.0.1"
112
- resolved "https://mirrors.huaweicloud.com/repository/npm/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
113
- integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
114
- dependencies:
115
- color-name "~1.1.4"
116
-
117
- color-name@~1.1.4:
118
- version "1.1.4"
119
- resolved "https://mirrors.huaweicloud.com/repository/npm/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
120
- integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
121
-
122
- commander@^12.1.0:
123
- version "12.1.0"
124
- resolved "https://mirrors.huaweicloud.com/repository/npm/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3"
125
- integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==
126
-
127
- concat-map@0.0.1:
128
- version "0.0.1"
129
- resolved "https://mirrors.huaweicloud.com/repository/npm/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
130
- integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
131
-
132
- ejs@^3.1.10:
133
- version "3.1.10"
134
- resolved "https://mirrors.huaweicloud.com/repository/npm/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b"
135
- integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==
136
- dependencies:
137
- jake "^10.8.5"
138
-
139
- filelist@^1.0.4:
140
- version "1.0.4"
141
- resolved "https://mirrors.huaweicloud.com/repository/npm/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5"
142
- integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==
143
- dependencies:
144
- minimatch "^5.0.1"
145
-
146
- fs-extra@^11.2.0:
147
- version "11.2.0"
148
- resolved "https://mirrors.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b"
149
- integrity sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==
150
- dependencies:
151
- graceful-fs "^4.2.0"
152
- jsonfile "^6.0.1"
153
- universalify "^2.0.0"
154
-
155
- graceful-fs@^4.1.6, graceful-fs@^4.2.0:
156
- version "4.2.11"
157
- resolved "https://mirrors.huaweicloud.com/repository/npm/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
158
- integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
159
-
160
- has-flag@^4.0.0:
161
- version "4.0.0"
162
- resolved "https://mirrors.huaweicloud.com/repository/npm/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
163
- integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
164
-
165
- jake@^10.8.5:
166
- version "10.9.2"
167
- resolved "https://mirrors.huaweicloud.com/repository/npm/jake/-/jake-10.9.2.tgz#6ae487e6a69afec3a5e167628996b59f35ae2b7f"
168
- integrity sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==
169
- dependencies:
170
- async "^3.2.3"
171
- chalk "^4.0.2"
172
- filelist "^1.0.4"
173
- minimatch "^3.1.2"
174
-
175
- jsonfile@^6.0.1:
176
- version "6.1.0"
177
- resolved "https://mirrors.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
178
- integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
179
- dependencies:
180
- universalify "^2.0.0"
181
- optionalDependencies:
182
- graceful-fs "^4.1.6"
183
-
184
- minimatch@^3.1.2:
185
- version "3.1.2"
186
- resolved "https://mirrors.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
187
- integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
188
- dependencies:
189
- brace-expansion "^1.1.7"
190
-
191
- minimatch@^5.0.1:
192
- version "5.1.6"
193
- resolved "https://mirrors.huaweicloud.com/repository/npm/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
194
- integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
195
- dependencies:
196
- brace-expansion "^2.0.1"
197
-
198
- supports-color@^7.1.0:
199
- version "7.2.0"
200
- resolved "https://mirrors.huaweicloud.com/repository/npm/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
201
- integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
202
- dependencies:
203
- has-flag "^4.0.0"
204
-
205
- universalify@^2.0.0:
206
- version "2.0.1"
207
- resolved "https://mirrors.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d"
208
- integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==