pinokiod 3.236.0 → 3.238.0

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/kernel/bin/git.js CHANGED
@@ -21,99 +21,14 @@ class Git {
21
21
  `conda install -y -c conda-forge ${this.cmd()}`
22
22
  ]
23
23
  }, ondata)
24
- await fs.promises.mkdir(this.kernel.path("config/gh"), { recursive: true }).catch((e) => { })
25
-
26
- let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
27
- // check if gitconfig exists
28
- let exists = await this.kernel.api.exists(gitconfig_path)
29
- // if not, create one
30
- if (!exists) {
31
- await fs.promises.copyFile(
32
- path.resolve(__dirname, "..", "gitconfig_template"),
33
- gitconfig_path
34
- )
35
- }
36
-
37
- await fs.promises.mkdir(this.kernel.path("scripts/git"), { recursive: true }).catch((e) => { })
38
-
39
- let gitfork_path = path.resolve(this.kernel.homedir, "scripts/git/fork.json")
40
- await fs.promises.copyFile(
41
- path.resolve(__dirname, "..", "scripts/git/fork"),
42
- gitfork_path
43
- )
44
-
45
- let gitpush_path = path.resolve(this.kernel.homedir, "scripts/git/push.json")
46
- await fs.promises.copyFile(
47
- path.resolve(__dirname, "..", "scripts/git/push"),
48
- gitpush_path
49
- )
50
-
51
- let gitcreate_path = path.resolve(this.kernel.homedir, "scripts/git/create.json")
52
- await fs.promises.copyFile(
53
- path.resolve(__dirname, "..", "scripts/git/create"),
54
- gitcreate_path
55
- )
56
-
57
- let gitcommit_path = path.resolve(this.kernel.homedir, "scripts/git/commit.json")
58
- await fs.promises.copyFile(
59
- path.resolve(__dirname, "..", "scripts/git/commit"),
60
- gitcommit_path
61
- )
62
-
63
- let gitcheckout_path = path.resolve(this.kernel.homedir, "scripts/git/checkout.json")
64
- await fs.promises.copyFile(
65
- path.resolve(__dirname, "..", "scripts/git/checkout"),
66
- gitcheckout_path
67
- )
68
-
69
- let gitreset_commit_path = path.resolve(this.kernel.homedir, "scripts/git/reset_commit.json")
70
- await fs.promises.copyFile(
71
- path.resolve(__dirname, "..", "scripts/git/reset_commit"),
72
- gitreset_commit_path
73
- )
74
-
75
- let gitreset_file_path = path.resolve(this.kernel.homedir, "scripts/git/reset_file.json")
76
- await fs.promises.copyFile(
77
- path.resolve(__dirname, "..", "scripts/git/reset_file"),
78
- gitreset_file_path
79
- )
80
24
  }
81
25
  async installed() {
82
- let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
83
- let exists = await this.kernel.api.exists(gitconfig_path)
84
- if (!exists) {
85
- return false;
86
- }
87
- let gitpush_path = path.resolve(this.kernel.homedir, "scripts/git/push.json")
88
- let exists2 = await this.kernel.api.exists(gitpush_path)
89
- if (!exists2) {
90
- return false;
91
- }
92
- let gitcreate_path = path.resolve(this.kernel.homedir, "scripts/git/create.json")
93
- let exists3 = await this.kernel.api.exists(gitcreate_path)
94
- if (!exists3) {
95
- return false;
96
- }
97
- let gitcommit_path = path.resolve(this.kernel.homedir, "scripts/git/commit.json")
98
- let exists4 = await this.kernel.api.exists(gitcommit_path)
99
- if (!exists4) {
100
- return false;
101
- }
102
- let gitfork_path = path.resolve(this.kernel.homedir, "scripts/git/fork.json")
103
- let exists5 = await this.kernel.api.exists(gitfork_path)
104
- if (!exists5) {
105
- return false;
106
- }
107
-
108
26
  if (this.kernel.platform === "darwin") {
109
- let gh_config_exists = await this.kernel.exists("config/gh")
110
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists
27
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh")
111
28
  } else if (this.kernel.platform === "win32") {
112
- let gh_config_exists = await this.kernel.exists("config/gh")
113
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists && this.kernel.bin.installed.conda.has("git-bash")
29
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && this.kernel.bin.installed.conda.has("git-bash")
114
30
  } else {
115
- let gh_config_exists = await this.kernel.exists("config/gh")
116
- return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh") && gh_config_exists
31
+ return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.conda.has("gh")
117
32
  }
118
33
  }
119
34
  async uninstall(req, ondata) {
package/kernel/git.js CHANGED
@@ -11,6 +11,34 @@ class Git {
11
11
  this.dirs = new Set()
12
12
  this.mapping = {}
13
13
  }
14
+ async init() {
15
+ const ensureDir = (target) => fs.promises.mkdir(target, { recursive: true }).catch(() => { })
16
+ await Promise.all([
17
+ ensureDir(this.kernel.path("config/gh")),
18
+ ensureDir(this.kernel.path("scripts/git"))
19
+ ])
20
+
21
+ const gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
22
+ const gitconfigTemplate = path.resolve(__dirname, "gitconfig_template")
23
+ if (!(await this.kernel.api.exists(gitconfig_path))) {
24
+ await fs.promises.copyFile(gitconfigTemplate, gitconfig_path)
25
+ }
26
+
27
+ const scripts = [
28
+ "fork",
29
+ "push",
30
+ "create",
31
+ "commit",
32
+ "checkout",
33
+ "reset_commit",
34
+ "reset_file"
35
+ ]
36
+ await Promise.all(scripts.map((name) => {
37
+ const src = path.resolve(__dirname, `scripts/git/${name}`)
38
+ const dest = path.resolve(this.kernel.homedir, `scripts/git/${name}.json`)
39
+ return fs.promises.copyFile(src, dest)
40
+ }))
41
+ }
14
42
  async findGitDirs(dir, results = []) {
15
43
  const entries = await fs.promises.readdir(dir, { withFileTypes: true });
16
44
  for (const entry of entries) {
package/kernel/index.js CHANGED
@@ -947,8 +947,10 @@ class Kernel {
947
947
  let ts = Date.now()
948
948
  this.bin.init().then(() => {
949
949
  if (this.homedir) {
950
- this.git.index(this).then(() => {
951
- //console.log(this.git.mapping)
950
+ this.git.init().then(() => {
951
+ this.git.index(this).then(() => {
952
+ //console.log(this.git.mapping)
953
+ })
952
954
  })
953
955
  this.shell.init().then(async () => {
954
956
  this.bin.check({
@@ -977,8 +979,10 @@ class Kernel {
977
979
  }
978
980
  })
979
981
  if (this.bin.installed.conda.has("git")) {
980
- await this.proto.init()
981
- await this.plugin.init()
982
+ await Promise.all([
983
+ this.proto.init(),
984
+ this.plugin.init(),
985
+ ])
982
986
  }
983
987
 
984
988
  this.sys = new Sysinfo()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.236.0",
3
+ "version": "3.238.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {