Skip to content

Commit c25abaa

Browse files
authored
tsup for stack-shared (stack-auth#647)
1 parent 4b0b96a commit c25abaa

File tree

30 files changed

+265
-477
lines changed

30 files changed

+265
-477
lines changed

apps/backend/.eslintrc.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const defaults = require("../../eslint-configs/defaults.js");
2-
const publicVars = require("../../eslint-configs/extra-rules.js");
1+
const defaults = require("../../configs/eslint/defaults.js");
2+
const publicVars = require("../../configs/eslint/extra-rules.js");
33

44
module.exports = {
5-
extends: ["../../eslint-configs/defaults.js", "../../eslint-configs/next.js"],
5+
extends: ["../../configs/eslint/defaults.js", "../../configs/eslint/next.js"],
66
ignorePatterns: ["/*", "!/src", "!/scripts", "!/prisma"],
77
rules: {
88
"no-restricted-syntax": [

apps/backend/prisma/tsup.config.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
import { defineConfig } from 'tsup';
2+
import { createBasePlugin } from '../../../configs/tsup/plugins';
3+
4+
const customNoExternal = new Set([
5+
'@stackframe/stack-shared',
6+
'@prisma/client',
7+
'@prisma/extension-accelerate',
8+
'jose',
9+
'yup',
10+
'json-diff',
11+
'svix',
12+
]);
213

314
// tsup config to build the self-hosting seed script so it can be
415
// run in the Docker container with no extra dependencies.
@@ -8,6 +19,9 @@ export default defineConfig({
819
outDir: 'dist',
920
target: 'node22',
1021
platform: 'node',
11-
noExternal: ['@stackframe/stack-shared', '@prisma/client', '@prisma/extension-accelerate', 'jose', 'yup', 'json-diff'],
12-
clean: true
22+
noExternal: [...customNoExternal],
23+
clean: true,
24+
esbuildPlugins: [
25+
createBasePlugin({ customNoExternal }),
26+
],
1327
});

apps/dashboard/.eslintrc.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const defaults = require("../../eslint-configs/defaults.js");
2-
const publicVars = require("../../eslint-configs/extra-rules.js");
1+
const defaults = require("../../configs/eslint/defaults.js");
2+
const publicVars = require("../../configs/eslint/extra-rules.js");
33

44
module.exports = {
5-
extends: ["../../eslint-configs/defaults.js", "../../eslint-configs/next.js"],
5+
extends: ["../../configs/eslint/defaults.js", "../../configs/eslint/next.js"],
66
ignorePatterns: ["/*", "!/src", "!/prisma"],
77
rules: {
88
"no-restricted-imports": [

apps/e2e/.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
"extends": [
3-
"../../eslint-configs/defaults.js",
3+
"../../configs/eslint/defaults.js",
44
],
55
"ignorePatterns": ['/*', '!/tests'],
66
"rules": {

apps/mcp-server/.eslintrc.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
"extends": [
3-
"../../eslint-configs/defaults.js",
4-
"../../eslint-configs/next.js",
3+
"../../configs/eslint/defaults.js",
4+
"../../configs/eslint/next.js",
55
],
66
"ignorePatterns": ['/*', '!/src']
77
};

apps/mock-oauth-server/.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
"extends": [
3-
"../../eslint-configs/defaults.js",
4-
"../../eslint-configs/next.js",
3+
"../../configs/eslint/defaults.js",
4+
"../../configs/eslint/next.js",
55
],
66
"ignorePatterns": ['/*', '!/src']
77
};
File renamed without changes.
File renamed without changes.
File renamed without changes.

configs/tsup/js-library.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { defineConfig } from 'tsup';
2+
import { createBasePlugin } from './plugins';
3+
4+
const customNoExternal = new Set([
5+
"oauth4webapi",
6+
]);
7+
8+
export default function createJsLibraryTsupConfig(options: { barrelFile: boolean }) {
9+
return defineConfig({
10+
entryPoints: ['src/**/*.(ts|tsx|js|jsx)'],
11+
sourcemap: true,
12+
clean: false,
13+
noExternal: [...customNoExternal],
14+
dts: options.barrelFile ? 'src/index.ts' : true, // we only generate types for the barrel file because it drastically decreases the memory needed for tsup https://github.com/egoist/tsup/issues/920#issuecomment-2454732254
15+
outDir: 'dist',
16+
format: ['esm', 'cjs'],
17+
legacyOutput: true,
18+
esbuildPlugins: [
19+
createBasePlugin({ customNoExternal }),
20+
],
21+
});
22+
}

0 commit comments

Comments
 (0)