@workleap/tsup-configs 1.0.0 → 1.0.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @workleap/tsup-configs
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#74](https://github.com/workleap/wl-web-configs/pull/74) [`43c9eb1`](https://github.com/workleap/wl-web-configs/commit/43c9eb11e61896855666c44beb0e711c82a560a3) Thanks [@alexasselin008](https://github.com/alexasselin008)! - Updated installation documentation
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  ### Major Changes
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # `@workleap/tsup-configs`
1
+ # @workleap/tsup-configs
2
+
2
3
  Workleap's recommended [tsup](https://tsup.egoist.dev/) configs.
3
4
 
4
5
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](../../LICENSE)
@@ -9,10 +10,23 @@ Workleap's recommended [tsup](https://tsup.egoist.dev/) configs.
9
10
  Install the package.
10
11
 
11
12
  **With pnpm**
13
+
12
14
  ```shell
13
15
  pnpm add -D @workleap/tsup-configs
14
16
  ```
15
17
 
18
+ **With yarn**
19
+
20
+ ```shell
21
+ yarn add -D @workleap/tsup-configs
22
+ ```
23
+
24
+ **With npm**
25
+
26
+ ```shell
27
+ npm install -D @workleap/tsup-configs
28
+ ```
29
+
16
30
  ## Usage
17
31
 
18
32
  To build your React or TypeScript library project, follow these steps:
@@ -23,7 +37,7 @@ To build your React or TypeScript library project, follow these steps:
23
37
 
24
38
  ```ts
25
39
  // tsup.dev.ts
26
- import { defineDevConfig } from "tsup";
40
+ import { defineDevConfig } from "@workleap/tsup-configs";
27
41
 
28
42
  export default defineDevConfig();
29
43
  ```
@@ -32,7 +46,7 @@ export default defineDevConfig();
32
46
 
33
47
  ```ts
34
48
  // tsup.build.ts
35
- import { defineBuildConfig } from "tsup";
49
+ import { defineBuildConfig } from "@workleap/tsup-configs";
36
50
 
37
51
  export default defineBuildConfig();
38
52
  ```
@@ -47,11 +61,12 @@ export default defineBuildConfig();
47
61
  Now you can use the `dev` script to run tsup in watch mode and the `build` script to build your library.
48
62
 
49
63
  ## Customization
64
+
50
65
  If you want to use additional tsup options or override the default ones, you can pass a custom tsup config to the functions exported by this packages:
51
66
 
52
67
  ```ts
53
68
  // tsup.config.ts
54
- import { defineBuildConfig } from "tsup";
69
+ import { defineBuildConfig } from "@workleap/tsup-configs";
55
70
 
56
71
  export default defineBuildConfig({
57
72
  entry: ["lib/index.ts"],
package/dist/build.js CHANGED
@@ -1,2 +1,48 @@
1
- export { a as defineBuildConfig } from './chunk-VN7SD7ZN.js';
2
- import './chunk-KJNVYY35.js';
1
+ import { defineConfig } from 'tsup';
2
+
3
+ // src/mergeConfigs.ts
4
+ function mergeConfigs(config, baseConfig) {
5
+ if (config === void 0 || Array.isArray(config) && config.length === 0) {
6
+ return defineConfig(baseConfig);
7
+ }
8
+ if (typeof config === "function") {
9
+ return defineConfig((cliFlags) => {
10
+ return {
11
+ ...baseConfig,
12
+ ...config(cliFlags)
13
+ };
14
+ });
15
+ } else if (Array.isArray(config)) {
16
+ return defineConfig(
17
+ config.map((configItem) => {
18
+ return {
19
+ ...baseConfig,
20
+ ...configItem
21
+ };
22
+ })
23
+ );
24
+ } else {
25
+ return defineConfig({
26
+ ...baseConfig,
27
+ ...config
28
+ });
29
+ }
30
+ }
31
+
32
+ // src/build.ts
33
+ function defineBuildConfig(config) {
34
+ return mergeConfigs(config, {
35
+ clean: true,
36
+ dts: true,
37
+ minify: true,
38
+ splitting: false,
39
+ treeshake: true,
40
+ entry: ["./src"],
41
+ outDir: "./dist",
42
+ format: ["esm"],
43
+ target: "esnext",
44
+ platform: "browser"
45
+ });
46
+ }
47
+
48
+ export { defineBuildConfig };
package/dist/dev.js CHANGED
@@ -1,2 +1,47 @@
1
- export { a as defineDevConfig } from './chunk-Q2XGPH6E.js';
2
- import './chunk-KJNVYY35.js';
1
+ import { defineConfig } from 'tsup';
2
+
3
+ // src/mergeConfigs.ts
4
+ function mergeConfigs(config, baseConfig) {
5
+ if (config === void 0 || Array.isArray(config) && config.length === 0) {
6
+ return defineConfig(baseConfig);
7
+ }
8
+ if (typeof config === "function") {
9
+ return defineConfig((cliFlags) => {
10
+ return {
11
+ ...baseConfig,
12
+ ...config(cliFlags)
13
+ };
14
+ });
15
+ } else if (Array.isArray(config)) {
16
+ return defineConfig(
17
+ config.map((configItem) => {
18
+ return {
19
+ ...baseConfig,
20
+ ...configItem
21
+ };
22
+ })
23
+ );
24
+ } else {
25
+ return defineConfig({
26
+ ...baseConfig,
27
+ ...config
28
+ });
29
+ }
30
+ }
31
+
32
+ // src/dev.ts
33
+ function defineDevConfig(config) {
34
+ return mergeConfigs(config, {
35
+ dts: true,
36
+ splitting: false,
37
+ watch: true,
38
+ entry: ["./src"],
39
+ outDir: "./dist",
40
+ format: ["esm"],
41
+ target: "esnext",
42
+ platform: "browser",
43
+ sourcemap: "inline"
44
+ });
45
+ }
46
+
47
+ export { defineDevConfig };
package/dist/index.js CHANGED
@@ -1,3 +1,63 @@
1
- export { a as defineBuildConfig } from './chunk-VN7SD7ZN.js';
2
- export { a as defineDevConfig } from './chunk-Q2XGPH6E.js';
3
- import './chunk-KJNVYY35.js';
1
+ import { defineConfig } from 'tsup';
2
+
3
+ // src/mergeConfigs.ts
4
+ function mergeConfigs(config, baseConfig) {
5
+ if (config === void 0 || Array.isArray(config) && config.length === 0) {
6
+ return defineConfig(baseConfig);
7
+ }
8
+ if (typeof config === "function") {
9
+ return defineConfig((cliFlags) => {
10
+ return {
11
+ ...baseConfig,
12
+ ...config(cliFlags)
13
+ };
14
+ });
15
+ } else if (Array.isArray(config)) {
16
+ return defineConfig(
17
+ config.map((configItem) => {
18
+ return {
19
+ ...baseConfig,
20
+ ...configItem
21
+ };
22
+ })
23
+ );
24
+ } else {
25
+ return defineConfig({
26
+ ...baseConfig,
27
+ ...config
28
+ });
29
+ }
30
+ }
31
+
32
+ // src/build.ts
33
+ function defineBuildConfig(config) {
34
+ return mergeConfigs(config, {
35
+ clean: true,
36
+ dts: true,
37
+ minify: true,
38
+ splitting: false,
39
+ treeshake: true,
40
+ entry: ["./src"],
41
+ outDir: "./dist",
42
+ format: ["esm"],
43
+ target: "esnext",
44
+ platform: "browser"
45
+ });
46
+ }
47
+
48
+ // src/dev.ts
49
+ function defineDevConfig(config) {
50
+ return mergeConfigs(config, {
51
+ dts: true,
52
+ splitting: false,
53
+ watch: true,
54
+ entry: ["./src"],
55
+ outDir: "./dist",
56
+ format: ["esm"],
57
+ target: "esnext",
58
+ platform: "browser",
59
+ sourcemap: "inline"
60
+ });
61
+ }
62
+
63
+ export { defineBuildConfig, defineDevConfig };
@@ -1 +1,32 @@
1
- export { a as mergeConfigs } from './chunk-KJNVYY35.js';
1
+ import { defineConfig } from 'tsup';
2
+
3
+ // src/mergeConfigs.ts
4
+ function mergeConfigs(config, baseConfig) {
5
+ if (config === void 0 || Array.isArray(config) && config.length === 0) {
6
+ return defineConfig(baseConfig);
7
+ }
8
+ if (typeof config === "function") {
9
+ return defineConfig((cliFlags) => {
10
+ return {
11
+ ...baseConfig,
12
+ ...config(cliFlags)
13
+ };
14
+ });
15
+ } else if (Array.isArray(config)) {
16
+ return defineConfig(
17
+ config.map((configItem) => {
18
+ return {
19
+ ...baseConfig,
20
+ ...configItem
21
+ };
22
+ })
23
+ );
24
+ } else {
25
+ return defineConfig({
26
+ ...baseConfig,
27
+ ...config
28
+ });
29
+ }
30
+ }
31
+
32
+ export { mergeConfigs };
package/package.json CHANGED
@@ -2,10 +2,8 @@
2
2
  "name": "@workleap/tsup-configs",
3
3
  "author": "Workleap",
4
4
  "description": "Workleap's recommended tsup configs.",
5
- "version": "1.0.0",
5
+ "version": "1.0.1",
6
6
  "license": "Apache-2.0",
7
- "type": "module",
8
- "sideEffects": false,
9
7
  "keywords": [
10
8
  "workleap",
11
9
  "tsup",
@@ -16,8 +14,13 @@
16
14
  "url": "git+https://github.com/workleap/wl-web-configs.git",
17
15
  "directory": "packages/tsup-configs"
18
16
  },
19
- "exports": "./dist/index.js",
20
- "types": "./dist/index.d.ts",
17
+ "type": "module",
18
+ "exports": {
19
+ ".": {
20
+ "import": "./dist/index.js",
21
+ "types": "./dist/index.d.ts"
22
+ }
23
+ },
21
24
  "files": [
22
25
  "dist",
23
26
  "CHANGELOG.md",
@@ -25,7 +28,9 @@
25
28
  ],
26
29
  "devDependencies": {
27
30
  "tsup": "6.7.0",
28
- "@workleap/typescript-configs": "2.3.0"
31
+ "typescript": "5.0.4",
32
+ "@workleap/eslint-plugin": "1.8.1",
33
+ "@workleap/typescript-configs": "2.3.1"
29
34
  },
30
35
  "peerDependencies": {
31
36
  "tsup": "*"
@@ -1,5 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- function p(e,r){return e===void 0||Array.isArray(e)&&e.length===0?defineConfig(r):typeof e=="function"?defineConfig(n=>({...r,...e(n)})):Array.isArray(e)?defineConfig(e.map(n=>({...r,...n}))):defineConfig({...r,...e})}
4
-
5
- export { p as a };
@@ -1,5 +0,0 @@
1
- import { a } from './chunk-KJNVYY35.js';
2
-
3
- function n(t){return a(t,{watch:!0,dts:!0,entry:["./src"],outDir:"./dist",format:["esm"],target:"esnext",platform:"browser",sourcemap:"inline"})}
4
-
5
- export { n as a };
@@ -1,5 +0,0 @@
1
- import { a } from './chunk-KJNVYY35.js';
2
-
3
- function i(t){return a(t,{clean:!0,treeshake:!0,minify:!0,dts:!0,entry:["./src"],outDir:"./dist",format:["esm"],target:"esnext",platform:"browser"})}
4
-
5
- export { i as a };