pinokiod 2.15.50 → 2.15.52

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.
@@ -1,38 +1,56 @@
1
1
  const fs = require('fs')
2
+ const path = require('path')
2
3
  const { rimraf } = require('rimraf')
3
4
  class Playwright {
4
5
  async install(req, ondata) {
5
- let c
6
+ // let c
7
+ // if (this.kernel.platform === "win32") {
8
+ // c = `npm config --global set prefix ${this.kernel.bin.path("miniconda")}`
9
+ // } else {
10
+ // c = [
11
+ // `npm config --global set prefix ${this.kernel.bin.path("miniconda")} --loglevel verbose`,
12
+ // `npm config set prefix ${this.kernel.bin.path("miniconda")} --loglevel verbose`
13
+ // ]
14
+ // }
15
+ // await this.kernel.exec({
16
+ // message: c,
17
+ //// path: this.kernel.bin.path("playwright"),
18
+ // env: {
19
+ // PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
20
+ // }
21
+ // }, ondata)
22
+
23
+
24
+ let p
6
25
  if (this.kernel.platform === "win32") {
7
- c = `npm config set prefix ${this.kernel.bin.path("miniconda")}`
26
+ p = this.kernel.path("bin/miniconda")
8
27
  } else {
9
- c = `npm config set prefix ${this.kernel.bin.path("miniconda/lib")}`
28
+ p = this.kernel.path("bin/miniconda/lib")
10
29
  }
11
30
  await this.kernel.exec({
12
31
  message: [
13
32
  // "npm init -y",
14
- c
15
- ],
16
- path: this.kernel.bin.path("playwright"),
17
- env: {
18
- PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
19
- }
20
- }, ondata)
21
- await this.kernel.exec({
22
- message: [
23
- // "npm init -y",
24
- "npm install -g playwright@1.49.0",
33
+ "which npm",
34
+ // "npm config get userconfig",
35
+ // "npm config get globalconfig",
36
+ // "npm config list -l --loglevel verbose",
37
+ // "env",
38
+ //"npm install -g playwright@1.49.0 --loglevel verbose",
39
+ "npm install playwright@1.49.1 --loglevel verbose",
25
40
  // "playwright install chromium",
26
41
  ],
27
- //path: this.kernel.bin.path("playwright"),
42
+ path: p,
28
43
  env: {
29
44
  PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
30
45
  }
31
46
  }, ondata)
47
+ let pw_path = path.resolve(p, "node_modules/playwright/cli.js")
32
48
  await this.kernel.exec({
33
49
  message: [
34
50
  // "npm init -y",
35
- "playwright install firefox",
51
+ `${pw_path} install firefox`,
52
+ // "playwright install firefox",
53
+ // "npx -y playwright install firefox"
36
54
  ],
37
55
  //path: this.kernel.bin.path("playwright"),
38
56
  env: {
@@ -52,16 +70,16 @@ class Playwright {
52
70
  // PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
53
71
  // }
54
72
  // }, ondata)
55
- await this.kernel.exec({
56
- message: [
57
- "pip install playwright==1.48.0",
58
- // "playwright install"
59
- // "npm install playwright --ignore-scripts"
60
- ],
61
- env: {
62
- PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
63
- }
64
- }, ondata)
73
+ // await this.kernel.exec({
74
+ // message: [
75
+ // "pip install playwright==1.48.0",
76
+ //// "playwright install"
77
+ //// "npm install playwright --ignore-scripts"
78
+ // ],
79
+ // env: {
80
+ // PLAYWRIGHT_BROWSERS_PATH: this.kernel.bin.path("playwright/browsers")
81
+ // }
82
+ // }, ondata)
65
83
 
66
84
  let pwpath
67
85
  if (this.kernel.platform === "win32") {
package/kernel/index.js CHANGED
@@ -369,7 +369,13 @@ class Kernel {
369
369
  }
370
370
 
371
371
 
372
- let pwpath = this.bin.path("miniconda/lib/node_modules/playwright")
372
+ let pwpath
373
+ if (this.platform === "win32") {
374
+ pwpath = this.bin.path("miniconda/node_modules/playwright")
375
+ } else {
376
+ pwpath = this.bin.path("miniconda/lib/node_modules/playwright")
377
+ }
378
+ console.log("pwpath", pwpath)
373
379
  process.env.PLAYWRIGHT_BROWSERS_PATH = this.bin.path("playwright/browsers")
374
380
  this.playwright = (await this.loader.load(pwpath)).resolved
375
381
 
package/kernel/shell.js CHANGED
@@ -112,6 +112,10 @@ class Shell {
112
112
 
113
113
  this.env.CMAKE_OBJECT_PATH_MAX = 1024
114
114
  this.env.PYTORCH_ENABLE_MPS_FALLBACK = 1
115
+ // this.env.NPM_CONFIG_USERCONFIG = this.kernel.path("user_npmrc")
116
+ // this.env.NPM_CONFIG_GLOBALCONFIG = this.kernel.path("global_npmrc")
117
+ // this.env.npm_config_userconfig = this.kernel.path("user_npmrc")
118
+ // this.env.npm_config_globalconfig = this.kernel.path("global_npmrc")
115
119
 
116
120
  // First override this.env with system env
117
121
  let system_env = await Environment.get(this.kernel.homedir)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "2.15.50",
3
+ "version": "2.15.52",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -165,11 +165,17 @@ body {
165
165
  </div>
166
166
  <% }) %>
167
167
  </div>
168
- <form method="post" action="/pinokio/install">
168
+ <form id='install-form' method="post" action="/pinokio/install">
169
169
  <input type='hidden' name="requirements" value="<%=JSON.stringify(requirements)%>">
170
170
  <input type='hidden' name='callback' value="<%=current%>">
171
171
  <button class='btn'>Install</button>
172
172
  </form>
173
+ <div class='item'>
174
+ <div class='d'>Not working? <a id='del-bin'>Try a fresh install</a></div>
175
+ <div class='reset-bin-loading hidden'>
176
+ <i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
177
+ </div>
178
+ </div>
173
179
  </div>
174
180
  </div>
175
181
  <% } else { %>
@@ -227,6 +233,33 @@ document.addEventListener("DOMContentLoaded", async () => {
227
233
  }
228
234
  <% } %>
229
235
  <% } %>
236
+ if (document.querySelector("#del-bin")) {
237
+ document.querySelector("#del-bin").addEventListener("click", async (e) => {
238
+ console.log("del-bin")
239
+ let proceed = confirm("Are you sure you wish to delete the bin folder?")
240
+ if (proceed) {
241
+ document.querySelector(".reset-bin-loading").classList.remove("hidden")
242
+ document.querySelector("#del-bin").classList.add("hidden")
243
+ let res = await fetch("/pinokio/delete", {
244
+ method: "post",
245
+ headers: {
246
+ "Content-Type": "application/json"
247
+ },
248
+ body: JSON.stringify({ type: "bin" })
249
+ }).then((res) => {
250
+ return res.json()
251
+ })
252
+ console.log(res)
253
+ document.querySelector(".reset-bin-loading").classList.add("hidden")
254
+ if (res.error) {
255
+ alert(res.error)
256
+ } else {
257
+ //location.href = location.href
258
+ document.querySelector("#install-form").submit()
259
+ }
260
+ }
261
+ })
262
+ }
230
263
  })
231
264
  </script>
232
265
  </body>
@@ -770,7 +770,8 @@ document.addEventListener("DOMContentLoaded", async () => {
770
770
  if (res.error) {
771
771
  alert(res.error)
772
772
  } else {
773
- location.href = location.href
773
+ document.querySelector("#install-form").submit()
774
+ //location.href = location.href
774
775
  }
775
776
  }
776
777
  })
@@ -875,7 +876,7 @@ const reloadMemory = async () => {
875
876
  </div>
876
877
  <% }) %>
877
878
  </div>
878
- <form method="post" action="/pinokio/install">
879
+ <form id='install-form' method="post" action="/pinokio/install">
879
880
  <input type='hidden' name="requirements" value="<%=JSON.stringify(requirements)%>">
880
881
  <input type='hidden' name='callback' value="<%=current%>">
881
882
  <button class='btn'>Install</button>
@@ -739,7 +739,8 @@ document.addEventListener("DOMContentLoaded", async () => {
739
739
  if (res.error) {
740
740
  alert(res.error)
741
741
  } else {
742
- location.href = location.href
742
+ //location.href = location.href
743
+ document.querySelector("#install-form").submit()
743
744
  }
744
745
  }
745
746
  })
@@ -827,7 +828,7 @@ const reloadMemory = async () => {
827
828
  </div>
828
829
  <% }) %>
829
830
  </div>
830
- <form method="post" action="/pinokio/install">
831
+ <form id='install-form' method="post" action="/pinokio/install">
831
832
  <input type='hidden' name="requirements" value="<%=JSON.stringify(requirements)%>">
832
833
  <input type='hidden' name='callback' value="<%=current%>">
833
834
  <button class='btn'>Install</button>