Archived
0
0
Fork 0

fix problems with new package versions

This commit is contained in:
Daryl Ronningen 2023-01-12 11:11:56 -08:00
parent e50b5c2e78
commit e703b0b4fe
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
5 changed files with 20 additions and 687 deletions

View file

@ -28,7 +28,6 @@
"@types/tar": "^6.1.3", "@types/tar": "^6.1.3",
"@typescript-eslint/eslint-plugin": "^5.48.1", "@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1", "@typescript-eslint/parser": "^5.48.1",
"@yarnpkg/sdks": "3.0.0-rc.35",
"eslint": "^8.31.0", "eslint": "^8.31.0",
"pkg": "^5.8.0", "pkg": "^5.8.0",
"typescript": "^4.9.4" "typescript": "^4.9.4"

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
import chalk from 'chalk'; import chalk from 'chalk';
import fs from 'fs-extra'; import fs from 'fs-extra';
import * as lowdb from 'lowdb'; import { Low } from 'lowdb';
import { JSONFile, TextFile } from 'lowdb/node';
import crypto from 'node:crypto'; import crypto from 'node:crypto';
import path from 'node:path'; import path from 'node:path';
import os from 'node:os'; import os from 'node:os';
@ -48,8 +49,8 @@ export default class Install {
const getWahInfo = parseWahInfo(readWahInfo.toString()); const getWahInfo = parseWahInfo(readWahInfo.toString());
const dbFile = `${this.options.sysroot}/var/lib/wahpkg/pkgs.json`; const dbFile = `${this.options.sysroot}/var/lib/wahpkg/pkgs.json`;
const adapter = new lowdb.JSONFile<dbData>(dbFile); const adapter = new JSONFile<dbData>(dbFile);
const db = new lowdb.Low(adapter); const db = new Low(adapter);
await db.read(); await db.read();
@ -66,7 +67,7 @@ export default class Install {
await fs.mkdirp(`${this.options.sysroot}/var/lib/wahpkg/pkgs/${getWahInfo.name}`); await fs.mkdirp(`${this.options.sysroot}/var/lib/wahpkg/pkgs/${getWahInfo.name}`);
await fs.writeFile(`${this.options.sysroot}/var/lib/wahpkg/pkgs/${getWahInfo.name}/MD5HASHES`, ''); await fs.writeFile(`${this.options.sysroot}/var/lib/wahpkg/pkgs/${getWahInfo.name}/MD5HASHES`, '');
const md5Adapter = new lowdb.TextFile(`${this.options.sysroot}/var/lib/wahpkg/pkgs/${getWahInfo.name}/MD5HASHES`); const md5Adapter = new TextFile(`${this.options.sysroot}/var/lib/wahpkg/pkgs/${getWahInfo.name}/MD5HASHES`);
await md5Adapter.read(); await md5Adapter.read();
@ -81,7 +82,7 @@ export default class Install {
await md5Adapter.write(toWriteToFile); await md5Adapter.write(toWriteToFile);
await fs.copy(path.join(makeExtractDir, 'ROOT'), path.join(this.options.sysroot), { overwrite: true, dereference: false, preserveTimestamps: true, recursive: true }); await fs.copy(path.join(makeExtractDir, 'ROOT'), path.join(this.options.sysroot), { overwrite: true, dereference: false, preserveTimestamps: true });
await fs.rm(path.join(makeExtractDir), { recursive: true, force: true }); await fs.rm(path.join(makeExtractDir), { recursive: true, force: true });
console.log(chalk.bold.green`Package %s has been installed!`, getWahInfo.name); console.log(chalk.bold.green`Package %s has been installed!`, getWahInfo.name);

View file

@ -1,4 +1,5 @@
import * as lowdb from 'lowdb'; import { Low } from 'lowdb';
import { JSONFile } from 'lowdb/node';
import { GlobalOptions } from '../index.js'; import { GlobalOptions } from '../index.js';
import { makeDbFile } from '../utils.js'; import { makeDbFile } from '../utils.js';
@ -15,8 +16,8 @@ export default class List {
await makeDbFile(this.options.sysroot); await makeDbFile(this.options.sysroot);
const dbFile = `${this.options.sysroot}/var/lib/wahpkg/pkgs.json`; const dbFile = `${this.options.sysroot}/var/lib/wahpkg/pkgs.json`;
const adapter = new lowdb.JSONFile<dbData>(dbFile); const adapter = new JSONFile<dbData>(dbFile);
const db = new lowdb.Low(adapter); const db = new Low(adapter);
await db.read(); await db.read();

View file

@ -1,6 +1,7 @@
import chalk from 'chalk'; import chalk from 'chalk';
import fs from 'fs-extra'; import fs from 'fs-extra';
import * as lowdb from 'lowdb'; import { Low } from 'lowdb';
import { JSONFile } from 'lowdb/node';
import crypto from 'node:crypto'; import crypto from 'node:crypto';
import path from 'node:path'; import path from 'node:path';
import { lock, unlock } from 'proper-lockfile'; import { lock, unlock } from 'proper-lockfile';
@ -25,8 +26,8 @@ export default class Uninstall {
await lock(`${this.options.sysroot}/var/lib/wahpkg`, { lockfilePath: `${this.options.sysroot}/var/lib/wahpkg/wahpkg.lock` }); await lock(`${this.options.sysroot}/var/lib/wahpkg`, { lockfilePath: `${this.options.sysroot}/var/lib/wahpkg/wahpkg.lock` });
const dbFile = `${this.options.sysroot}/var/lib/wahpkg/pkgs.json`; const dbFile = `${this.options.sysroot}/var/lib/wahpkg/pkgs.json`;
const adapter = new lowdb.JSONFile<dbData>(dbFile); const adapter = new JSONFile<dbData>(dbFile);
const db = new lowdb.Low(adapter); const db = new Low(adapter);
await db.read(); await db.read();