mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 16:27:46 +00:00
Try to fix tsup as well
This commit is contained in:
+17
-13
@@ -2,8 +2,8 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import fs from "fs/promises";
|
import fs from "fs/promises";
|
||||||
import {replaceTscAliasPaths} from "tsc-alias";
|
import { replaceTscAliasPaths } from "tsc-alias";
|
||||||
import {defineConfig} from "tsup";
|
import { defineConfig } from "tsup";
|
||||||
|
|
||||||
// Instead of using tsx or tsc for building, consider using tsup.
|
// Instead of using tsx or tsc for building, consider using tsup.
|
||||||
// TSX serves as an alternative to Node.js, allowing you to build directly on the Node.js runtime.
|
// TSX serves as an alternative to Node.js, allowing you to build directly on the Node.js runtime.
|
||||||
@@ -45,22 +45,26 @@ export default defineConfig({
|
|||||||
const isRelativePath = args.path.startsWith(".");
|
const isRelativePath = args.path.startsWith(".");
|
||||||
const absPath = isRelativePath
|
const absPath = isRelativePath
|
||||||
? path.join(args.resolveDir, args.path)
|
? path.join(args.resolveDir, args.path)
|
||||||
: path.join(args.path.replace("@app", "./src"));
|
: path.join(
|
||||||
|
args.path
|
||||||
|
.replace("@app", "./src")
|
||||||
|
.replace("@bdd_routes/bdd-nock-router", "./src/server/routes/bdd/bdd-nock-router.ts")
|
||||||
|
);
|
||||||
|
|
||||||
const isFile = await fs
|
const isFile = await fs
|
||||||
.stat(`${absPath}.ts`)
|
.stat(`${absPath}.ts`)
|
||||||
.then((el) => el.isFile)
|
.then((el) => el.isFile)
|
||||||
.catch(async (err) => {
|
.catch(async (err) => {
|
||||||
if (err.code === "ENOTDIR") {
|
if (err.code === "ENOTDIR") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If .ts file doesn't exist, try checking for .tsx file
|
// If .ts file doesn't exist, try checking for .tsx file
|
||||||
return fs
|
return fs
|
||||||
.stat(`${absPath}.tsx`)
|
.stat(`${absPath}.tsx`)
|
||||||
.then((el) => el.isFile)
|
.then((el) => el.isFile)
|
||||||
.catch((err) => err.code === "ENOTDIR");
|
.catch((err) => err.code === "ENOTDIR");
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
path: isFile ? `${args.path}.mjs` : `${args.path}/index.mjs`,
|
path: isFile ? `${args.path}.mjs` : `${args.path}/index.mjs`,
|
||||||
|
|||||||
Reference in New Issue
Block a user