ebet-payroll 1.0.1 → 1.0.2

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,7 @@
3
3
  var path = require('path');
4
4
  var os = require('os');
5
5
  var jdeployHomeDir = process.env.JDEPLOY_HOME || path.join(os.homedir(), '.jdeploy');
6
- var jarName = "payroll-desktop-1.0.1.jar";
6
+ var jarName = "payroll-desktop-1.0.2.jar";
7
7
  var mainClass = "{{MAIN_CLASS}}";
8
8
  var classPath = "{{CLASSPATH}}";
9
9
  var port = "0";
@@ -32,6 +32,16 @@ function njreWrap() {
32
32
  const yauzl = require('yauzl')
33
33
  const tar = require('tar')
34
34
 
35
+ function cleanupDir (dir) {
36
+ try {
37
+ if (fs.existsSync(dir)) {
38
+ fs.rmSync(dir, { recursive: true, force: true })
39
+ }
40
+ } catch (e) {
41
+ // Ignore cleanup errors
42
+ }
43
+ }
44
+
35
45
  function createDir (dir) {
36
46
  return new Promise((resolve, reject) => {
37
47
  fs.access(dir, err => {
@@ -278,7 +288,7 @@ function njreWrap() {
278
288
 
279
289
  Object.keys(options).forEach(key => { url += key + '=' + options[key] + '&' })
280
290
 
281
- const tmpdir = path.join(os.tmpdir(), 'njre')
291
+ const tmpdir = path.join(os.tmpdir(), 'njre-' + process.pid)
282
292
 
283
293
  return fetch(url)
284
294
  .then(response => response.json())
@@ -286,6 +296,7 @@ function njreWrap() {
286
296
  .then(verify)
287
297
  .then(move)
288
298
  .then(extract)
299
+ .finally(() => cleanupDir(tmpdir))
289
300
  }
290
301
 
291
302
  function installZulu(version = 11, options = {}, arch) {
@@ -327,7 +338,7 @@ function njreWrap() {
327
338
  let url = zuluBaseURL;
328
339
  Object.keys(q).forEach(key => { url += key + '=' + q[key] + '&' });
329
340
 
330
- const tmpdir = path.join(os.tmpdir(), 'njre');
341
+ const tmpdir = path.join(os.tmpdir(), 'njre-' + process.pid);
331
342
 
332
343
  // Function to handle the download and extraction
333
344
  const attemptDownload = (url) => {
@@ -342,7 +353,8 @@ function njreWrap() {
342
353
  console.error("Download failed: ", err);
343
354
  // Exit with non-zero status code to signal failure to CI/CD systems
344
355
  process.exit(1);
345
- });
356
+ })
357
+ .finally(() => cleanupDir(tmpdir));
346
358
  }
347
359
 
348
360
 
package/package.json CHANGED
@@ -1 +1 @@
1
- {"license":"ISC","author":"EBET","bin":{"ebet-payroll":"jdeploy-bundle/jdeploy.js"},"name":"ebet-payroll","description":"EBET Payroll desktop application","files":["jdeploy-bundle"],"main":"index.js","preferGlobal":true,"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.1","jdeploy":{"jdk":false,"checksums":{},"generateLegacyBundles":false,"mainClass":"app.Main","javaVersion":"17","jar":"target/payroll-desktop-1.0.1.jar","javafx":false,"title":"EBET Payroll"},"dependencies":{"command-exists-promise":"^2.0.2","node-fetch":"2.6.7","tar":"^4.4.8","yauzl":"^2.10.0","shelljs":"^0.8.4"}}
1
+ {"license":"ISC","author":"EBET","bin":{"ebet-payroll":"jdeploy-bundle/jdeploy.js"},"name":"ebet-payroll","description":"EBET Payroll desktop application","files":["jdeploy-bundle"],"main":"index.js","preferGlobal":true,"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.2","jdeploy":{"jdk":false,"checksums":{},"generateLegacyBundles":false,"mainClass":"app.Main","javaVersion":"17","jar":"target/payroll-desktop-1.0.2.jar","javafx":false,"title":"EBET Payroll"},"dependencies":{"command-exists-promise":"^2.0.2","node-fetch":"2.6.7","tar":"^4.4.8","yauzl":"^2.10.0","shelljs":"^0.8.4"}}