Skip to content

Commit

Permalink
Merge pull request #19206 from darenbt/build/lib-docs-tools+lib-instr…
Browse files Browse the repository at this point in the history
…umenter-tsup

Build: Bundle lib/docs-tools & lib/instrumenter with ts-up
  • Loading branch information
ndelangen authored Oct 17, 2022
2 parents 1228ccc + fa51a4b commit 23e2e27
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 15 deletions.
6 changes: 3 additions & 3 deletions code/addons/highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
"@types/webpack-env": "^1.16.0",
"typescript": "~4.6.3"
},
"publishConfig": {
"access": "public"
},
"bundler": {
"entries": [
"./src/index.ts",
"./src/highlight.ts"
]
},
"publishConfig": {
"access": "public"
},
"gitHead": "438114fcf62a763f0e8c07e2c34890dd987ca431",
"sbmodern": "dist/modern/index.js",
"storybook": {
Expand Down
22 changes: 18 additions & 4 deletions code/lib/docs-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@
},
"license": "MIT",
"sideEffects": false,
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"README.md",
Expand All @@ -31,10 +39,11 @@
],
"scripts": {
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
"prep": "node ../../../scripts/prepare.js"
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@babel/core": "^7.12.10",
"@storybook/core-common": "7.0.0-alpha.38",
"@storybook/csf": "0.0.2--canary.49.258942b.0",
"@storybook/store": "7.0.0-alpha.38",
"doctrine": "^3.0.0",
Expand All @@ -48,5 +57,10 @@
"publishConfig": {
"access": "public"
},
"bundler": {
"entries": [
"./src/index.ts"
]
},
"gitHead": "438114fcf62a763f0e8c07e2c34890dd987ca431"
}
2 changes: 1 addition & 1 deletion code/lib/docs-tools/src/argTypes/enhanceArgTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const enhanceArgTypes = <TFramework extends AnyFramework>(

const extractedArgTypes = extractArgTypes && component ? extractArgTypes(component) : {};
const withExtractedTypes = extractedArgTypes
? combineParameters(extractedArgTypes, userArgTypes)
? (combineParameters(extractedArgTypes, userArgTypes) as typeof userArgTypes)
: userArgTypes;

return withExtractedTypes;
Expand Down
4 changes: 2 additions & 2 deletions code/lib/docs-tools/src/hasDocsOrControls.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { StorybookConfigOptions } from '@storybook/core-common';
import type { Options } from '@storybook/core-common';

// `addons/x` is for the monorepo, `addon-x` is for normal usage
const packageRe = /(addons\/|addon-)(docs|controls)/;

export const hasDocsOrControls = (options: StorybookConfigOptions) =>
export const hasDocsOrControls = (options: Options) =>
options.presetsList?.some((preset) => packageRe.test(preset.name));
2 changes: 1 addition & 1 deletion code/lib/docs-tools/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './argTypes';
export * from './argTypes/index';
export * from './shared';
export * from './hasDocsOrControls';
21 changes: 17 additions & 4 deletions code/lib/instrumenter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@
},
"license": "MIT",
"sideEffects": false,
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"./package.json": "./package.json"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"README.md",
Expand All @@ -31,7 +39,7 @@
],
"scripts": {
"check": "../../../scripts/node_modules/.bin/tsc --noEmit",
"prep": "node ../../../scripts/prepare.js"
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@storybook/addons": "7.0.0-alpha.38",
Expand All @@ -46,5 +54,10 @@
"publishConfig": {
"access": "public"
},
"bundler": {
"entries": [
"./src/index.ts"
]
},
"gitHead": "438114fcf62a763f0e8c07e2c34890dd987ca431"
}
1 change: 1 addition & 0 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7636,6 +7636,7 @@ __metadata:
resolution: "@storybook/docs-tools@workspace:lib/docs-tools"
dependencies:
"@babel/core": ^7.12.10
"@storybook/core-common": 7.0.0-alpha.38
"@storybook/csf": 0.0.2--canary.49.258942b.0
"@storybook/store": 7.0.0-alpha.38
doctrine: ^3.0.0
Expand Down

0 comments on commit 23e2e27

Please sign in to comment.