gorig-cli 1.0.9 → 1.0.11
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/commands/init.js +20 -2
- package/package.json +1 -1
- package/templates/gitignore.ejs +61 -0
package/commands/init.js
CHANGED
|
@@ -81,8 +81,8 @@ const askStartConfirmation = () => {
|
|
|
81
81
|
// 设置5秒超时
|
|
82
82
|
const timeout = setTimeout(() => {
|
|
83
83
|
rl.close();
|
|
84
|
-
resolve(
|
|
85
|
-
},
|
|
84
|
+
resolve(true);
|
|
85
|
+
}, 6000);
|
|
86
86
|
|
|
87
87
|
rl.question('\nDo you want to start the project now? (y/N): ', (answer) => {
|
|
88
88
|
clearTimeout(timeout);
|
|
@@ -199,6 +199,24 @@ const initModule = async (args) => {
|
|
|
199
199
|
await fs.writeFile(cronGoPath, cronGoContent);
|
|
200
200
|
console.log(chalk.green(`Successfully created ${chalk.bold('cron.go')} file`));
|
|
201
201
|
|
|
202
|
+
// 创建.gitignore 文件 从 templates 目录中复制 gitignore.ejs 文件
|
|
203
|
+
const gitignoreTemplatePath = path.join(__dirname, '../templates/gitignore.ejs');
|
|
204
|
+
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
205
|
+
await fs.copyFile(gitignoreTemplatePath, gitignorePath);
|
|
206
|
+
|
|
207
|
+
// 检测如果本机存在git,则初始化git仓库
|
|
208
|
+
try {
|
|
209
|
+
exec('git', ['--version']);
|
|
210
|
+
exec('git init', { cwd: projectDir }, (err) => {
|
|
211
|
+
if (err) {
|
|
212
|
+
console.error(chalk.red('Git initialization failed:'), err);
|
|
213
|
+
} else {
|
|
214
|
+
console.log(chalk.green('Git repository initialized.'));
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
} catch {
|
|
218
|
+
console.log(chalk.yellow('Git is not installed on this system. Skipping Git initialization.'));
|
|
219
|
+
}
|
|
202
220
|
// 运行 go mod tidy
|
|
203
221
|
console.log(chalk.blue('Organizing Go module dependencies (go mod tidy), please wait...'));
|
|
204
222
|
await runGoModTidy(projectDir);
|
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Binaries and other executable files
|
|
2
|
+
/bin/
|
|
3
|
+
/pkg/
|
|
4
|
+
/vendor/
|
|
5
|
+
|
|
6
|
+
# Output of the Go build process
|
|
7
|
+
# If you prefer the allow list template instead of the deny list, see community template:
|
|
8
|
+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
|
9
|
+
#
|
|
10
|
+
# Binaries for programs and plugins
|
|
11
|
+
*.exe
|
|
12
|
+
*.exe~
|
|
13
|
+
*.dll
|
|
14
|
+
*.so
|
|
15
|
+
*.dylib
|
|
16
|
+
*.test
|
|
17
|
+
|
|
18
|
+
# Output of the go coverage tool, specifically when used with LiteIDE
|
|
19
|
+
*.out
|
|
20
|
+
|
|
21
|
+
# Dependency directories (remove the comment below to include it)
|
|
22
|
+
# vendor/
|
|
23
|
+
|
|
24
|
+
# Ignore profile files that may be created
|
|
25
|
+
cpu.out
|
|
26
|
+
mem.out
|
|
27
|
+
trace.out
|
|
28
|
+
|
|
29
|
+
# IDEs and editors
|
|
30
|
+
.vscode/
|
|
31
|
+
.idea/
|
|
32
|
+
*.swp
|
|
33
|
+
*.swo
|
|
34
|
+
*.swn
|
|
35
|
+
*~
|
|
36
|
+
|
|
37
|
+
# Operating system files
|
|
38
|
+
.DS_Store
|
|
39
|
+
Thumbs.db
|
|
40
|
+
|
|
41
|
+
# If using dotenv for configuration, ignore the environment file
|
|
42
|
+
.env
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Ignore everything
|
|
46
|
+
*.sh
|
|
47
|
+
*.log
|
|
48
|
+
*.jsonl
|
|
49
|
+
.logs
|
|
50
|
+
_bin/
|
|
51
|
+
*.yaml
|
|
52
|
+
*.pem
|
|
53
|
+
*.crt
|
|
54
|
+
/test/output/
|
|
55
|
+
*.html
|
|
56
|
+
*.json
|
|
57
|
+
# Go workspace file
|
|
58
|
+
go.work
|
|
59
|
+
go.work.sum
|
|
60
|
+
|
|
61
|
+
# env file
|