From 283a4aaab9c0ef13e65546cbb537cbb05dc5ddce Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 14 Oct 2020 00:08:22 +0800 Subject: [PATCH] feat: support freebsd in napi build command --- ava.config.js => ava.config.cjs | 10 +++------- src/build.ts | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) rename ava.config.js => ava.config.cjs (64%) diff --git a/ava.config.js b/ava.config.cjs similarity index 64% rename from ava.config.js rename to ava.config.cjs index dfc3550c..b5b82e40 100644 --- a/ava.config.js +++ b/ava.config.cjs @@ -1,17 +1,13 @@ -import { platform } from 'os' - -const platformName = platform() - const configuration = { extensions: ['ts', 'tsx'], files: ['test_module/__test__/**/*.spec.ts'], require: [ - platformName === 'freebsd' + require('os').platform() === 'freebsd' ? 'ts-node/register/transpile-only' : '@swc-node/register', ], environmentVariables: { - SWC_NODE_PROJECT: './test_module/tsconfig.json', + TS_NODE_PROJECT: './test_module/tsconfig.json', }, } @@ -19,4 +15,4 @@ if (parseInt(process.versions.napi, 10) < 4) { configuration.compileEnhancements = false } -export default configuration +module.exports = configuration diff --git a/src/build.ts b/src/build.ts index ca4e124f..06667d36 100644 --- a/src/build.ts +++ b/src/build.ts @@ -84,6 +84,7 @@ export class BuildCommand extends Command { libExt = '.dll' break case 'linux': + case 'freebsd': dylibName = `lib${dylibName}` libExt = '.so' break