Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript-Migration: @storybook/addons #5018

Merged
merged 34 commits into from
Dec 27, 2018
Merged

Typescript-Migration: @storybook/addons #5018

merged 34 commits into from
Dec 27, 2018

Conversation

kroeder
Copy link
Member

@kroeder kroeder commented Dec 17, 2018

Issue: N/A

What I did

Working on the TS-Migration with @ndelangen and @igor-dv

@kroeder kroeder self-assigned this Dec 17, 2018
@kroeder kroeder changed the title Ts migration/addons Typescript-Migration: @storybook/addons Dec 17, 2018
@codecov
Copy link

codecov bot commented Dec 22, 2018

Codecov Report

Merging #5018 into next will increase coverage by 0.03%.
The diff coverage is 27.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #5018      +/-   ##
==========================================
+ Coverage   35.05%   35.09%   +0.03%     
==========================================
  Files         593      594       +1     
  Lines        7348     7358      +10     
  Branches     1000     1002       +2     
==========================================
+ Hits         2576     2582       +6     
- Misses       4259     4265       +6     
+ Partials      513      511       -2
Impacted Files Coverage Δ
lib/addons/src/public_api.ts 0% <0%> (ø)
lib/addons/src/storybook-channel-mock.ts 0% <0%> (ø)
addons/notes/src/register.tsx 0% <0%> (ø) ⬆️
lib/addons/src/index.ts 0% <0%> (ø)
lib/addons/src/make-decorator.ts 95.83% <100%> (ø)
addons/notes/src/index.ts 84.61% <88.88%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b359bb2...a903991. Read the comment docs.

@@ -9,13 +9,15 @@
"noImplicitAny": true,
"jsx": "react",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsx allows react or react-native
Should there be a check for special react native build steps?

like if(buildReactNative) { tsconfig.jsx = 'react-native'; } ?

See https://www.typescriptlang.org/docs/handbook/jsx.html

babelify({ errorCallback: () => logError('js', packageJson) });
removeTsFromDist();
tscfy({ errorCallback: () => logError('ts', packageJson) });
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pure ts projects may cause unexpected behavior when it runs through babelify as well
In my case babelify copied tsx files into dist

@@ -18,7 +18,7 @@
"bootstrap": "node ./scripts/bootstrap.js",
"bootstrap:crna-kitchen-sink": "npm --prefix examples-native/crna-kitchen-sink install",
"bootstrap:docs": "yarn install --cwd docs",
"build-packs": "lerna exec --scope '@storybook/*' --parallel -- \\$LERNA_ROOT_PATH/scripts/build-pack.sh \\$LERNA_ROOT_PATH/packs",
"build-packs": "lerna exec --scope '@storybook/*' -- \\$LERNA_ROOT_PATH/scripts/build-pack.sh \\$LERNA_ROOT_PATH/packs",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to remove --parallel in order to fix native-smoke-test
The ts build of addons always failed because it seemed that channels wasn't build but addons relied on channels so it could not build as well

I found this lerna/lerna#1681 and thought "give it a shot", though I'm not sure if this is okay? I spent a lot of time on fixing this, if this is not the right fix I definitely need help for another way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

@@ -18,7 +18,7 @@
"bootstrap": "node ./scripts/bootstrap.js",
"bootstrap:crna-kitchen-sink": "npm --prefix examples-native/crna-kitchen-sink install",
"bootstrap:docs": "yarn install --cwd docs",
"build-packs": "lerna exec --scope '@storybook/*' --parallel -- \\$LERNA_ROOT_PATH/scripts/build-pack.sh \\$LERNA_ROOT_PATH/packs",
"build-packs": "lerna exec --scope '@storybook/*' -- \\$LERNA_ROOT_PATH/scripts/build-pack.sh \\$LERNA_ROOT_PATH/packs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

@ndelangen ndelangen merged commit 87c6d93 into next Dec 27, 2018
@ndelangen ndelangen deleted the ts-migration/addons branch December 27, 2018 11:38
@ndelangen ndelangen added this to the next milestone Dec 27, 2018
settings: WrapperSettings
) => any;

type MakeDecoratorResult = (...args: any) => any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this line wasn't correctly typed actually... It's not simply saying there is no type (any) but TSLint should point out an error saying args must be an array, so it should be any[].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: addons maintenance User-facing maintenance tasks typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants