Skip to content

Commit

Permalink
Merge pull request #13450 from storybookjs/tech/migrate-rax-to-ts
Browse files Browse the repository at this point in the history
Rax: Migrate to TS
  • Loading branch information
gaetanmaisse authored Jan 13, 2021
2 parents a3e4426 + fa273e7 commit ef55773
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ executors:
docker:
- image: circleci/node:10
environment:
NODE_OPTIONS: --max_old_space_size=4096
NODE_OPTIONS: --max_old_space_size=3076
resource_class: <<parameters.class>>
sb_node_10_browsers:
parameters:
Expand All @@ -25,7 +25,7 @@ executors:
docker:
- image: circleci/node:10-browsers
environment:
NODE_OPTIONS: --max_old_space_size=4096
NODE_OPTIONS: --max_old_space_size=3076
resource_class: <<parameters.class>>
sb_node_12_browsers:
parameters:
Expand All @@ -38,7 +38,7 @@ executors:
docker:
- image: circleci/node:12-browsers
environment:
NODE_OPTIONS: --max_old_space_size=4096
NODE_OPTIONS: --max_old_space_size=3076
resource_class: <<parameters.class>>

orbs:
Expand Down Expand Up @@ -76,7 +76,7 @@ commands:
jobs:
build:
executor:
class: medium
class: large
name: sb_node_10_classic
steps:
- git-shallow-clone/checkout_advanced:
Expand Down
1 change: 1 addition & 0 deletions app/rax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@types/rax": "^1.0.2",
"rax": "^1.1.0"
},
"peerDependencies": {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const {
} = clientApi;

const framework = 'rax';
export const storiesOf = (...args) => clientApi.storiesOf(...args).addParameters({ framework });
export const configure = (...args) => coreConfigure(framework, ...args);
export const storiesOf = (...args: any) =>
clientApi.storiesOf(...args).addParameters({ framework });
export const configure = (...args: any) => coreConfigure(framework, ...args);

export { forceReRender };
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export default function renderMain({
name,
showMain,
showError,
// forceRender,
}: {
storyFn: Function;
kind: string;
name: string;
showMain: () => any;
showError: (input: { title: string; description: string }) => void;
}) {
const Element = storyFn;

Expand All @@ -29,6 +34,11 @@ export default function renderMain({

showMain();

// There is something miscellaneous here, for now, more precisely on L23,
// as we are using the storyFn directly and not calling it, so `Element` is a
// function but according to `createElement` types, there is no signature
// taking a function as input.
// @ts-expect-error
render(createElement(Element), rootElement, {
driver: DriverDOM,
});
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function babelDefault(config) {
import { TransformOptions } from '@babel/core';

export function babelDefault(config: TransformOptions) {
return {
...config,
presets: [
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions app/rax/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '@storybook/core/*';
declare module 'global';
7 changes: 7 additions & 0 deletions app/rax/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"types": ["webpack-env", "node"]
}
}
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5123,6 +5123,14 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c"
integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==

"@types/rax@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/rax/-/rax-1.0.2.tgz#1a6121244a0ad31deecdcede2651efa4ec9ead2a"
integrity sha512-oB3tpuFhFc4osp2brErugGbInNQs15GSmE21PXh7LVMPwUaemBTMjzGxXrzgvoW/marD9sRxPJTkf53UJpjnnA==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/reach__router@^1.3.5":
version "1.3.6"
resolved "https://registry.yarnpkg.com/@types/reach__router/-/reach__router-1.3.6.tgz#413417ce74caab331c70ce6a03a4c825188e4709"
Expand Down

0 comments on commit ef55773

Please sign in to comment.