@reasonabletech/config-tsup 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/package.json +8 -4
- package/dist/index.js.map +0 -1
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @reasonabletech/config-tsup
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- - Automated release.
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`cedb66e`](https://github.com/ReasonableTech/core-utils/commit/cedb66e321e1f3cf695822467560c6f6b9f5d84c) Thanks [@WillieCubed](https://github.com/WillieCubed)! - De-duplicate TypeScript preset packaging by making `lib/*.json` the only canonical source and removing redundant top-level wrapper files. Documentation and examples were also updated to use valid `.json` preset paths and the currently supported preset surface.
|
|
14
|
+
|
|
15
|
+
Standardize release verification scripts across `config-typescript` and `config-tsup` with a shared naming contract (`verify:package`, `verify:consumer`, `verify:release`) and switch root release verification orchestration to Turbo.
|
|
16
|
+
|
|
17
|
+
## [Unreleased]
|
|
18
|
+
|
|
19
|
+
Initial release preparation. See [README.md](./README.md) for usage.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
_Changelog entries are automatically generated from [changesets](https://github.com/changesets/changesets) on release._
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reasonabletech/config-tsup",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Shared tsup configuration for ReasonableTech packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reasonabletech",
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist",
|
|
27
|
-
"
|
|
27
|
+
"!dist/**/*.map",
|
|
28
|
+
"!dist/**/*.tsbuildinfo",
|
|
29
|
+
"docs/**/*",
|
|
30
|
+
"README.md",
|
|
31
|
+
"CHANGELOG.md"
|
|
28
32
|
],
|
|
29
33
|
"publishConfig": {
|
|
30
34
|
"access": "public",
|
|
@@ -38,8 +42,8 @@
|
|
|
38
42
|
"tsup": "8.5.1",
|
|
39
43
|
"typescript": "5.9.3",
|
|
40
44
|
"vitest": "4.0.18",
|
|
41
|
-
"@reasonabletech/config
|
|
42
|
-
"@reasonabletech/config-typescript": "0.1.
|
|
45
|
+
"@reasonabletech/eslint-config": "0.2.1",
|
|
46
|
+
"@reasonabletech/config-typescript": "0.1.2"
|
|
43
47
|
},
|
|
44
48
|
"license": "MIT",
|
|
45
49
|
"author": "Reasonable Tech Company",
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts"],"names":[],"mappings":";;;;AAMA,SAAS,iBACP,GAAA,EACyB;AACzB,EAAA,MAAM,SAAkC,EAAC;AACzC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,GAAG,CAAA,EAAG;AAC9C,IAAA,IAAI,UAAU,MAAA,EAAW;AACvB,MAAA,MAAA,CAAO,GAAG,CAAA,GAAI,KAAA;AAAA,IAChB;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,+BAAA,GAAsD;AAC7D,EAAA,MAAM,qBAAA,GAAwB,qBAAA;AAC9B,EAAA,MAAM,eAAA,GAAkB,QAAQ,GAAA,CAAI,gBAAA;AAEpC,EAAA,IAAI,oBAAoB,MAAA,EAAW;AACjC,IAAA,MAAM,UAAA,GAAa,IAAA,CAAK,OAAA,CAAQ,eAAe,CAAA;AAC/C,IAAA,MAAM,m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AU,CAAC,qBAAqB,CAAA;AAAA,EAEhC,eAAe,OAAA,EAAiC;AAC9C,IAAA,OAAO;AAAA,MACL,GAAG,OAAA;AAAA,MACH,GAAA,EAAK;AAAA,KACP;AAAA,EACF;AACF,CAAC;AAKM,IAAM,aAAa,gBAAA,CAAiB;AAAA,EACzC,QAAA,EAAU,MAAA;AAAA,EACV,QAAA,EAAU,CAAC,QAAQ;AACrB,CAAC","file":"index.js","sourcesContent":["import { type Options } from \"tsup\";\nimport type { BuildOptions } from \"esbuild\";\nimport { existsSync } from \"node:fs\";\nimport path from \"node:path\";\n\n// Local utility to avoid circular dependency with @reasonabletech/utils\nfunction includeIfDefined<T extends Record<string, unknown>>(\n obj: T,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction resolveDefaultBuildTsconfigPath(): string | undefined {\n const buildTsconfigFileName = \"tsconfig.build.json\";\n const packageJsonPath = process.env.npm_package_json;\n\n if (packageJsonPath !== undefined) {\n const packageDir = path.dirname(packageJsonPath);\n const packageTsconfigPath = path.join(packageDir, buildTsconfigFileName);\n if (existsSync(packageTsconfigPath)) {\n return packageDir === process.cwd()\n ? buildTsconfigFileName\n : packageTsconfigPath;\n }\n }\n\n const cwdTsconfigPath = path.join(process.cwd(), buildTsconfigFileName);\n if (existsSync(cwdTsconfigPath)) {\n return buildTsconfigFileName;\n }\n\n return undefined;\n}\n\n/**\n * Function signature for customizing tsup's `esbuildOptions`.\n */\nexport type EsbuildOptionsFunction = (\n options: Readonly<BuildOptions>,\n) => BuildOptions;\n\n/**\n * Configuration options for creating a tsup build configuration.\n */\nexport interface TsupConfigOptions {\n /**\n * Entry points for the build. Can be a string, array, or object.\n * Defaults to { index: \"src/index.ts\" }\n */\n readonly entry?:\n | Readonly<Record<string, string>>\n | string\n | readonly string[];\n\n /**\n * Output formats. Defaults to [\"esm\"].\n * ESM is the standard - other formats are strongly discouraged except with compelling justification.\n */\n readonly format?: ReadonlyArray<\"esm\" | \"cjs\" | \"iife\">;\n\n /**\n * External dependencies that should not be bundled.\n * If not provided, sensible defaults are used based on platform.\n * To override defaults completely, use noExternal: [/.*\\/] and provide exact externals.\n */\n readonly external?: readonly string[];\n\n /**\n * Dependencies that should always be bundled (opposite of external).\n * Use [/.*\\/] to bundle everything except what's in external array.\n */\n readonly noExternal?: ReadonlyArray<string | RegExp>;\n\n /**\n * Whether to generate TypeScript declaration files. Defaults to false.\n */\n readonly dts?: boolean;\n\n /**\n * Whether to generate source maps. Defaults to true.\n */\n readonly sourcemap?: boolean;\n\n /**\n * Whether to bundle dependencies. Defaults to true.\n */\n readonly bundle?: boolean;\n\n /**\n * Whether to clean the output directory before building. Defaults to false.\n *\n * Rationale: A non-clean default avoids deleting artifacts unexpectedly in\n * multi-step builds and keeps incremental local workflows predictable.\n * Packages that need cleaning can explicitly set clean=true.\n */\n readonly clean?: boolean;\n\n /**\n * Whether to enable tree shaking. Defaults to true.\n */\n readonly treeshake?: boolean;\n\n /**\n * Whether to enable code splitting. Defaults to false for better compatibility.\n */\n readonly splitting?: boolean;\n\n /**\n * Target platform. Defaults to \"neutral\" for libraries.\n */\n readonly platform?: \"node\" | \"browser\" | \"neutral\";\n\n /**\n * Target environment. Defaults to \"ES2023\" (Node.js 22 compatible).\n */\n readonly target?: string;\n\n /**\n * Path to TypeScript config file.\n */\n readonly tsconfig?: string;\n\n /**\n * Additional esbuild plugins.\n */\n readonly esbuildPlugins?: readonly unknown[];\n\n /**\n * Custom esbuild options function.\n */\n readonly esbuildOptions?: (options: Readonly<BuildOptions>) => BuildOptions;\n\n /**\n * Build-time environment variable definitions.\n */\n readonly define?: Readonly<Record<string, string>>;\n\n /**\n * Custom onSuccess callback.\n */\n readonly onSuccess?: () => void | Promise<void>;\n\n /**\n * Minification options.\n */\n readonly minify?: boolean | \"terser\";\n\n /**\n * Terser-specific options (when minify: \"terser\").\n */\n readonly terserOptions?: {\n readonly compress?: Record<string, unknown>;\n readonly mangle?: Record<string, unknown>;\n };\n\n /**\n * Whether to generate metafile for bundle analysis.\n */\n readonly metafile?: boolean;\n}\n\n/**\n * Base tsup configuration for packages in the ReasonableTech project.\n *\n * This configuration provides sensible defaults for most packages while allowing\n * for customization through options or by extending this configuration.\n * @param options Configuration options to customize the tsup build\n * @returns Configured tsup build settings\n */\nexport function createTsupConfig(\n options: TsupConfigOptions = {},\n): Options {\n const {\n entry = { index: \"src/index.ts\" },\n format = [\"esm\"],\n external,\n noExternal,\n dts = false,\n bundle,\n clean = false,\n sourcemap = true,\n treeshake = true,\n splitting = false,\n platform = \"neutral\",\n target = \"ES2023\",\n tsconfig,\n esbuildPlugins = [],\n esbuildOptions,\n define,\n onSuccess,\n minify,\n terserOptions,\n metafile,\n } = options;\n\n // Default externals - only used if user doesn't provide noExternal\n const defaultExternal = [\n // Peer dependencies\n \"react\",\n \"react-dom\",\n \"next\",\n \"next/headers\",\n \"next/navigation\",\n \"next/server\",\n \"express\",\n \"electron\",\n // Node.js built-ins\n \"fs\",\n \"path\",\n \"os\",\n \"crypto\",\n \"child_process\",\n \"http\",\n \"https\",\n \"url\",\n \"events\",\n \"util\",\n \"stream\",\n \"buffer\",\n \"querystring\",\n ];\n\n // Determine final external list\n let finalExternal: string[] | undefined;\n if (noExternal !== undefined) {\n // If noExternal is provided, only use the explicit external list\n finalExternal = external !== undefined ? [...external] : undefined;\n } else {\n // Default behavior: merge user external with defaults\n finalExternal =\n external !== undefined\n ? [...defaultExternal, ...external]\n : defaultExternal;\n }\n\n const resolvedTsconfig = tsconfig ?? resolveDefaultBuildTsconfigPath();\n\n const config: Options = {\n dts,\n splitting,\n sourcemap,\n clean,\n treeshake,\n platform,\n target,\n outExtension() {\n return { js: `.js` };\n },\n ...includeIfDefined({\n entry: entry as Options[\"entry\"],\n format: format as Options[\"format\"],\n external: finalExternal as Options[\"external\"],\n noExternal: noExternal as Options[\"noExternal\"],\n bundle,\n tsconfig: resolvedTsconfig,\n esbuildPlugins,\n esbuildOptions,\n define,\n onSuccess,\n minify,\n terserOptions,\n metafile,\n }),\n };\n // ...(tsconfig !== undefined ? { tsconfig } : {}),\n // ...(esbuildPlugins.length > 0\n // ? { esbuildPlugins: esbuildPlugins as Options[\"esbuildPlugins\"] }\n // : {}),\n // ...(esbuildOptions !== undefined\n // ? { esbuildOptions: esbuildOptions as Options[\"esbuildOptions\"] }\n // : {}),\n // ...(define !== undefined ? { define: define as Options[\"define\"] } : {}),\n // ...(onSuccess !== undefined\n // ? { onSuccess: onSuccess as Options[\"onSuccess\"] }\n // : {}),\n // };\n\n return config;\n}\n\n/**\n * Pre-configured tsup config for build/config packages.\n */\nexport const configPackageConfig = createTsupConfig({\n external: [\"tsup\", \"esbuild\"],\n});\n\n/**\n * Pre-configured tsup config for React component libraries.\n */\nexport const reactConfig = createTsupConfig({\n external: [\"@mui/icons-material\"],\n\n esbuildOptions(options: Readonly<BuildOptions>) {\n return {\n ...options,\n jsx: \"automatic\",\n };\n },\n});\n\n/**\n * Pre-configured tsup config for Node.js applications/CLIs.\n */\nexport const nodeConfig = createTsupConfig({\n platform: \"node\",\n external: [\"dotenv\"],\n});\n"]}
|
package/dist/src/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuC5C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACnC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,KAC5B,YAAY,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EACX,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAChC,MAA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