Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev dependencies and some TypeScript stuff #169

Merged
merged 9 commits into from
Mar 5, 2024
Merged
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
],
"parser": "@typescript-eslint/parser",
"plugins": [
"prettier"
"prettier",
"import"
],
"rules": {
"prettier/prettier": [
Expand Down
4,667 changes: 2,332 additions & 2,335 deletions package-lock.json

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,33 @@
"url": "https://github.com/webosbrew/webos-homebrew-channel/issues"
},
"devDependencies": {
"@babel/core": "^7.14.0",
"@babel/plugin-transform-object-assign": "^7.12.13",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@types/bluebird": "^3.5.34",
"@types/node-fetch": "^2.5.10",
"@types/progress-stream": "^2.0.1",
"@types/webos-service": "^0.4.1",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.22.1",
"@webosose/ares-cli": "^2.1.0",
"babel-loader": "^8.2.2",
"@babel/core": "^7.24.0",
"@babel/plugin-transform-object-assign": "^7.23.3",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@types/bluebird": "^3.5.42",
"@types/node": "^20.11.24",
"@types/node-fetch": "^2.6.11",
"@types/progress-stream": "^2.0.5",
"@types/webos-service": "^0.4.6",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"@webosose/ares-cli": "^2.4.0",
"babel-loader": "^9.1.3",
"enyo-dev": "^1.0.0",
"eslint": "^7.25.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"esm": "^3.2.25",
"fork-ts-checker-webpack-plugin": "^6.2.10",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"typescript": "^4.2.4",
"webpack": "^5.33.2",
"webpack-cli": "^4.6.0",
"webpack-shebang-plugin": "^1.1.7"
"prettier": "^3.2.5",
"typescript": "^5.3.3",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4",
"webpack-shebang-plugin": "^1.1.8"
},
"dependencies": {
"bluebird": "^3.7.2",
Expand All @@ -82,7 +83,7 @@
"progress-stream": "^2.0.0",
"regenerator-runtime": "^0.13.7",
"stream.pipeline-shim": "^1.1.0",
"webos-service": "git+https://github.com/webosose/nodejs-module-webos-service.git#59172863e61abb53b2f3f174ab9a23c655819188"
"webos-service": "github:webosose/nodejs-module-webos-service#1dd2c9d6cd21eb5d84f7619432ed6d2784bb56f9"
},
"homepage": "https://github.com/webosbrew/webos-homebrew-channel#readme"
}
3 changes: 1 addition & 2 deletions services/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// import 'core-js/stable';
// import 'regenerator-runtime/runtime';
import './buffer-shim';

import fs from 'fs';
Expand All @@ -24,6 +22,7 @@ fetch.Promise = Bluebird.Promise;
// Sadly these need to be manually typed according to
// https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
// since types infered from Bluebird.Promise.promisify are wrong.
// @ts-ignore
export const asyncPipeline: (
...args: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>
) => Promise<void> = Bluebird.Promise.promisify(pipeline);
Expand Down
4 changes: 2 additions & 2 deletions services/elevate-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { existsSync, statSync, readFileSync, writeFileSync } from 'fs';
import { execFile } from 'child_process';
import { dirname, resolve } from 'path';

process.env.PATH = `/usr/sbin:${process.env.PATH}`;
process.env['PATH'] = `/usr/sbin:${process.env['PATH']}`;

function isFile(path: string): boolean {
try {
Expand Down Expand Up @@ -40,7 +40,7 @@ function patchServiceFile(serviceFile: string): boolean {
serviceFileNew = serviceFileNew.replace(/^Exec=\/usr\/bin\/run-js-service/gm, `Exec=${runJsServicePath}`);
} else if (serviceFileNew.indexOf('/jailer') !== -1) {
console.info(`[ ] ${serviceFile} is a native service`);
serviceFileNew = serviceFileNew.replace(/^Exec=\/usr\/bin\/jailer .* ([^ ]*)$/gm, (match, binaryPath) => `Exec=${binaryPath}`);
serviceFileNew = serviceFileNew.replace(/^Exec=\/usr\/bin\/jailer .* ([^ ]*)$/gm, (_, binaryPath) => `Exec=${binaryPath}`);
} else if (serviceFileNew.indexOf('Exec=/media') === -1) {
// Ignore elevated native services...
console.info(`[~] ${serviceFile}: unknown service type, this may cause some troubles`);
Expand Down
12 changes: 6 additions & 6 deletions services/protocol.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
type Response<T extends Record<string, any>> = T & {
interface Response {
returnValue: true;
};
}

type Error<T extends Record<string, any>> = T & {
interface ErrorResponse {
returnValue: false;
errorText: string;
};
}

export function makeSuccess<T>(payload: T): Response<T> {
export function makeSuccess(payload: Record<string, any>): Response {
return { returnValue: true, ...payload };
}

export function makeError<T>(error: string, payload?: T): Error<T> {
export function makeError(error: string, payload?: Record<string, any>): ErrorResponse {
return { returnValue: false, errorText: error, ...payload };
}
Loading