Skip to content

Commit dc95c5e

Browse files
committed
Adds skipSetup option
1 parent 45b4f36 commit dc95c5e

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

package-lock.json

Lines changed: 4 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nodegui/artifact-installer",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "An artifact or prebuilt binary installer for for nodegui",
55
"main": "dist/index.js",
66
"scripts": {
@@ -31,7 +31,6 @@
3131
},
3232
"dependencies": {
3333
"7zip-min": "^1.1.1",
34-
"empty-dir": "^2.0.0",
3534
"env-paths": "^2.2.0",
3635
"make-dir": "^3.0.0",
3736
"node-fetch": "^2.6.0",

src/setup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { download } from './downloader';
22
import { extract } from './extractor';
33
import path from 'path';
44
import envPaths from 'env-paths';
5-
import emptyDir from 'empty-dir';
65
import mkdirp from 'make-dir';
76

87
type SetupOptions = {
@@ -12,6 +11,7 @@ type SetupOptions = {
1211
cacheDir?: string;
1312
force?: boolean;
1413
displayName?: string;
14+
skipSetup: () => Promise<boolean>;
1515
};
1616

1717
export async function setupArtifact(options: SetupOptions): Promise<string> {
@@ -24,7 +24,7 @@ export async function setupArtifact(options: SetupOptions): Promise<string> {
2424

2525
await mkdirp(outDir);
2626

27-
if (!(await emptyDir(outDir)) && !force) {
27+
if ((await options.skipSetup()) && !force) {
2828
console.log(`Skipping setup for ${displayName}...`);
2929
return outDir;
3030
}

src/tests/darwin.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ describe('Setup QT for darwin', () => {
77
const osType = 'darwin';
88
const outDir = outputDir(osType);
99
let outPath = '';
10-
10+
const skipSetup = async (): Promise<boolean> => {
11+
return fs.existsSync(path.resolve(outDir, '5.13.0', 'clang_64', 'lib'));
12+
};
1113
beforeAll(async () => {
12-
outPath = await setupArtifact({ outDir, downloadLink: metadata.darwin, id: 'nodeguiqt' });
14+
outPath = await setupArtifact({ outDir, downloadLink: metadata.darwin, skipSetup, id: 'nodeguiqt' });
1315
}, TIMEOUT);
1416

1517
test('check if output path is same as specified: ', () => {

src/tests/linux.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ describe('Setup QT for linux', () => {
77
const osType = 'linux';
88
const outDir = outputDir(osType);
99
let outPath = '';
10-
10+
const skipSetup = async (): Promise<boolean> => {
11+
return fs.existsSync(path.resolve(outDir, '5.13.0', 'gcc_64', 'lib'));
12+
};
1113
beforeAll(async () => {
12-
outPath = await setupArtifact({ outDir, downloadLink: metadata.linux, id: 'nodeguiqt' });
14+
outPath = await setupArtifact({ outDir, skipSetup, downloadLink: metadata.linux, id: 'nodeguiqt' });
1315
}, TIMEOUT);
1416

1517
test('check if output path is same as specified: ', () => {

src/tests/win32.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ describe('Setup QT for win32', () => {
77
const osType = 'win32';
88
const outDir = outputDir(osType);
99
let outPath = '';
10-
10+
const skipSetup = async (): Promise<boolean> => {
11+
return fs.existsSync(path.resolve(outDir, '5.13.0', 'msvc2017_64', 'lib'));
12+
};
1113
beforeAll(async () => {
12-
outPath = await setupArtifact({ outDir, downloadLink: metadata.win32, id: 'nodeguiqt' });
14+
outPath = await setupArtifact({ outDir, skipSetup, downloadLink: metadata.win32, id: 'nodeguiqt' });
1315
}, TIMEOUT);
1416

1517
test('check if output path is same as specified: ', () => {

0 commit comments

Comments
 (0)