Skip to content

Commit

Permalink
upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
a7ul committed Oct 3, 2021
1 parent b7dbf2f commit 7eaa356
Show file tree
Hide file tree
Showing 6 changed files with 1,747 additions and 674 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nodegui/packer",
"version": "1.4.0",
"version": "1.4.1",
"files": [
"dist",
"template",
Expand All @@ -19,19 +19,19 @@
"author": "[email protected]",
"license": "MIT",
"devDependencies": {
"@nodegui/nodegui": "^0.15.0-alpha-4",
"@types/fs-extra": "^8.0.0",
"@types/node": "^13.9.0",
"@nodegui/nodegui": "^0.39.1",
"@types/fs-extra": "^9.0.13",
"@types/node": "^16.10.2",
"@types/plist": "^3.0.2",
"typescript": "^3.5.3"
"typescript": "^4.4.3"
},
"peerDependencies": {
"@nodegui/nodegui": ">=0.15.0"
},
"dependencies": {
"@nodegui/artifact-installer": "^1.0.0",
"@nodegui/artifact-installer": "^1.1.0",
"commander": "^4.0.1",
"fs-extra": "^8.1.0",
"plist": "^3.0.1"
"fs-extra": "^10.0.0",
"plist": "^3.0.4"
}
}
4 changes: 2 additions & 2 deletions src/darwin/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function runMacDeployQt({
`${appName}.app`,
"-verbose=3",
`-libpath=${qode.qtHome}`,
'-dmg',
"-dmg",
...addonCommands(allAddons),
];

Expand All @@ -81,7 +81,7 @@ export async function runMacDeployQt({

macDeployQt.on("exit", function (code) {
if (!code) {
return resolve();
return resolve(true);
}
return reject("child process exited with code " + code);
});
Expand Down
36 changes: 21 additions & 15 deletions src/linux/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import { qtHome } from "@nodegui/nodegui/config/qtConfig";
const cwd = process.cwd();
const deployDirectory = path.resolve(cwd, "deploy");
const configFile = path.resolve(deployDirectory, "config.json");
const linuxDeployQtBin = path.resolve(__dirname, "..", "..", "deps", "linuxdeployqt");
const linuxDeployQtBin = path.resolve(
__dirname,
"..",
"..",
"deps",
"linuxdeployqt"
);

const copyQode = async (dest: string) => {
const qodeBinaryFile = qode.qodePath;
Expand All @@ -18,16 +24,16 @@ const copyQode = async (dest: string) => {

const copyAppDist = async (distPath: string, resourceDir: string) => {
await fs.copy(distPath, path.resolve(resourceDir, "dist"), {
recursive: true
recursive: true,
});
};

function getAllNodeAddons(dirPath: string) {
const addonExt = "node";
let dir = fs.readdirSync(dirPath);
return dir
.filter(elm => elm.match(new RegExp(`.*\.(${addonExt}$)`, "ig")))
.map(eachElement => path.resolve(dirPath, eachElement));
.filter((elm) => elm.match(new RegExp(`.*\.(${addonExt}$)`, "ig")))
.map((eachElement) => path.resolve(dirPath, eachElement));
}

const addonCommands = (addonPaths: string[]): string[] => {
Expand All @@ -37,12 +43,10 @@ const addonCommands = (addonPaths: string[]): string[] => {
}, []);
};


const runLinuxDeployQt = async (appName: string, buildDir: string) => {

const distPath = path.resolve(buildDir, "dist");
const allAddons = getAllNodeAddons(distPath);
const LD_LIBRARY_PATH=`${qtHome}/lib:${process.env.LD_LIBRARY_PATH}`;
const LD_LIBRARY_PATH = `${qtHome}/lib:${process.env.LD_LIBRARY_PATH}`;

const linuxDeployQt = spawn(
linuxDeployQtBin,
Expand All @@ -52,23 +56,23 @@ const runLinuxDeployQt = async (appName: string, buildDir: string) => {
"-bundle-non-qt-libs",
"-appimage",
`-qmake=${path.resolve(qtHome, "bin", "qmake")}`,
...addonCommands(allAddons)
...addonCommands(allAddons),
],
{ cwd: buildDir, env: {...process.env, LD_LIBRARY_PATH} }
{ cwd: buildDir, env: { ...process.env, LD_LIBRARY_PATH } }
);

return new Promise((resolve, reject) => {
linuxDeployQt.stdout.on("data", function(data) {
linuxDeployQt.stdout.on("data", function (data) {
console.log("stdout: " + data.toString());
});

linuxDeployQt.stderr.on("data", function(data) {
linuxDeployQt.stderr.on("data", function (data) {
console.log("stderr: " + data.toString());
});

linuxDeployQt.on("exit", function(code) {
linuxDeployQt.on("exit", function (code) {
if (!code) {
return resolve();
return resolve(true);
}
return reject("child process exited with code " + code);
});
Expand All @@ -77,7 +81,7 @@ const runLinuxDeployQt = async (appName: string, buildDir: string) => {

export const init = async (appName: string) => {
const config = {
appName: null
appName: null,
};
const templateDirectory = path.resolve(__dirname, "../../template/linux");
const userTemplate = path.resolve(deployDirectory, "linux");
Expand Down Expand Up @@ -108,5 +112,7 @@ export const pack = async (distPath: string) => {
await copyAppDist(distPath, buildAppPackage);
console.log(`running linuxdeployqt`);
await runLinuxDeployQt(appName, buildAppPackage);
console.log(`Build successful. Find the AppImage at ${buildAppPackage}. Look for an executable file with extension .AppImage`);
console.log(
`Build successful. Find the AppImage at ${buildAppPackage}. Look for an executable file with extension .AppImage`
);
};
20 changes: 10 additions & 10 deletions src/win32/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ const copyQode = async (dest: string) => {

const copyAppDist = async (distPath: string, resourceDir: string) => {
await fs.copy(distPath, path.resolve(resourceDir, "dist"), {
recursive: true
recursive: true,
});
};

function getAllNodeAddons(dirPath: string) {
const addonExt = "node";
let dir = fs.readdirSync(dirPath);
return dir
.filter(elm => elm.match(new RegExp(`.*\.(${addonExt}$)`, "ig")))
.map(eachElement => path.resolve(dirPath, eachElement));
.filter((elm) => elm.match(new RegExp(`.*\.(${addonExt}$)`, "ig")))
.map((eachElement) => path.resolve(dirPath, eachElement));
}

const runWinDeployQt = async (appName: string, buildDir: string) => {
Expand All @@ -46,25 +46,25 @@ const runWinDeployQt = async (appName: string, buildDir: string) => {
"--release",
"--no-translations",
"--compiler-runtime",
`--dir=${buildDir}`
`--dir=${buildDir}`,
],
{
cwd: buildDir
cwd: buildDir,
}
);

return new Promise((resolve, reject) => {
winDeployQt.stdout.on("data", function(data) {
winDeployQt.stdout.on("data", function (data) {
console.log("stdout: " + data.toString());
});

winDeployQt.stderr.on("data", function(data) {
winDeployQt.stderr.on("data", function (data) {
console.log("stderr: " + data.toString());
});

winDeployQt.on("exit", function(code) {
winDeployQt.on("exit", function (code) {
if (!code) {
return resolve();
return resolve(true);
}
return reject("child process exited with code " + code);
});
Expand All @@ -73,7 +73,7 @@ const runWinDeployQt = async (appName: string, buildDir: string) => {

export const init = async (appName: string) => {
const config = {
appName: null
appName: null,
};
const templateDirectory = path.resolve(__dirname, "../../template/win32");
const userTemplate = path.resolve(deployDirectory, "win32");
Expand Down
Loading

0 comments on commit 7eaa356

Please sign in to comment.