Skip to content

Commit

Permalink
fix: correctly set the devDir path for node-gyp (#596)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
  • Loading branch information
k15a and malept authored Feb 6, 2021
1 parent efd73ef commit 5dadede
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/module-rebuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ export class ModuleRebuilder {
`--target=${this.rebuilder.electronVersion}`,
`--arch=${this.rebuilder.arch}`,
`--dist-url=${this.rebuilder.headerURL}`,
'--build-from-source',
`--devdir="${ELECTRON_GYP_DIR}"`
'--build-from-source'
];

if (process.env.DEBUG) {
Expand Down Expand Up @@ -206,6 +205,7 @@ export class ModuleRebuilder {

const nodeGyp = NodeGyp();
nodeGyp.parseArgv(nodeGypArgs);
nodeGyp.devDir = ELECTRON_GYP_DIR;
let command = nodeGyp.todo.shift();
const originalWorkingDir = process.cwd();
try {
Expand Down
7 changes: 7 additions & 0 deletions test/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ describe('rebuilder', () => {
await expectNativeModuleToNotBeRebuilt(testModulePath, 'ffi-napi');
});

it('should not download files in the module directory', async () => {
const modulePath = path.resolve(testModulePath, 'node_modules/ref-napi');
const fileNames = await fs.readdir(modulePath);

expect(fileNames).to.not.contain(testElectronVersion);
});

after(async () => {
delete process.env.ELECTRON_REBUILD_TESTS;
await cleanupTestModule();
Expand Down

0 comments on commit 5dadede

Please sign in to comment.