Skip to content

Commit

Permalink
fix: define __dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
abichinger committed Oct 21, 2024
1 parent 6e64ed2 commit 4e855ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path';
import type { Context } from './@types/semantic-release/index.js';
import { DefaultConfig } from './default-options.js';
import { PluginConfig } from './types.js';
import { normalizeVersion, pipe, setopt, spawn } from './util.js';
import { __dirname, normalizeVersion, pipe, setopt, spawn } from './util.js';
import { assertExitCode, isLegacyBuildInterface } from './verify.js';

async function setVersionPy(setupPy: string, version: string) {
Expand Down
3 changes: 3 additions & 0 deletions lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { execa, Options, ResultPromise } from 'execa';
import path from 'path';
import url from 'url';
import { Context } from './@types/semantic-release/index.js';

export const __dirname = path.dirname(url.fileURLToPath(import.meta.url));

async function normalizeVersion(
version: string,
options: Options = {},
Expand Down
2 changes: 1 addition & 1 deletion lib/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from 'path';
import { Context } from './@types/semantic-release/index.js';
import { DefaultConfig } from './default-options.js';
import { PluginConfig } from './types.js';
import { pipe, spawn } from './util.js';
import { __dirname, pipe, spawn } from './util.js';

function assertEnvVar(name: string) {
if (!process.env[name]) {
Expand Down
4 changes: 2 additions & 2 deletions test/prepare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ describe('prepare: build functions', () => {
legacyInterface: t.useLegacyInterface,
});
await expect(
sDistPackage(config.srcDir, config.distDir, context),
sDistPackage(config.srcDir, config.distDir, pipe(context)),
).resolves.toBe(undefined);
await expect(
bDistPackage(config.srcDir, config.distDir, context),
bDistPackage(config.srcDir, config.distDir, pipe(context)),
).resolves.toBe(undefined);
},
60000,
Expand Down

0 comments on commit 4e855ad

Please sign in to comment.