diff --git a/.circleci/config.yml b/.circleci/config.yml index 25a3d59a9846..66b369a7e80f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: <> sb_node_10_browsers: parameters: @@ -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: <> sb_node_12_browsers: parameters: @@ -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: <> orbs: @@ -76,7 +76,7 @@ commands: jobs: build: executor: - class: medium + class: large name: sb_node_10_classic steps: - git-shallow-clone/checkout_advanced: diff --git a/app/rax/package.json b/app/rax/package.json index ed81414bb6cb..3b7e149b2e4e 100644 --- a/app/rax/package.json +++ b/app/rax/package.json @@ -54,6 +54,7 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { + "@types/rax": "^1.0.2", "rax": "^1.1.0" }, "peerDependencies": { diff --git a/app/rax/src/client/index.js b/app/rax/src/client/index.ts similarity index 100% rename from app/rax/src/client/index.js rename to app/rax/src/client/index.ts diff --git a/app/rax/src/client/preview/globals.js b/app/rax/src/client/preview/globals.ts similarity index 100% rename from app/rax/src/client/preview/globals.js rename to app/rax/src/client/preview/globals.ts diff --git a/app/rax/src/client/preview/index.js b/app/rax/src/client/preview/index.ts similarity index 65% rename from app/rax/src/client/preview/index.js rename to app/rax/src/client/preview/index.ts index 109004a46b5f..488026ef4ff8 100644 --- a/app/rax/src/client/preview/index.js +++ b/app/rax/src/client/preview/index.ts @@ -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 }; diff --git a/app/rax/src/client/preview/render.js b/app/rax/src/client/preview/render.ts similarity index 63% rename from app/rax/src/client/preview/render.js rename to app/rax/src/client/preview/render.ts index fc1b4c93f8f7..f791ccfff75b 100644 --- a/app/rax/src/client/preview/render.js +++ b/app/rax/src/client/preview/render.ts @@ -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; @@ -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, }); diff --git a/app/rax/src/server/build.js b/app/rax/src/server/build.ts similarity index 100% rename from app/rax/src/server/build.js rename to app/rax/src/server/build.ts diff --git a/app/rax/src/server/framework-preset-rax.js b/app/rax/src/server/framework-preset-rax.ts similarity index 66% rename from app/rax/src/server/framework-preset-rax.js rename to app/rax/src/server/framework-preset-rax.ts index 038cd57824b4..73fb93058e10 100644 --- a/app/rax/src/server/framework-preset-rax.js +++ b/app/rax/src/server/framework-preset-rax.ts @@ -1,4 +1,6 @@ -export function babelDefault(config) { +import { TransformOptions } from '@babel/core'; + +export function babelDefault(config: TransformOptions) { return { ...config, presets: [ diff --git a/app/rax/src/server/index.js b/app/rax/src/server/index.ts similarity index 100% rename from app/rax/src/server/index.js rename to app/rax/src/server/index.ts diff --git a/app/rax/src/server/options.js b/app/rax/src/server/options.ts similarity index 100% rename from app/rax/src/server/options.js rename to app/rax/src/server/options.ts diff --git a/app/rax/src/typings.d.ts b/app/rax/src/typings.d.ts new file mode 100644 index 000000000000..6288cba4b09a --- /dev/null +++ b/app/rax/src/typings.d.ts @@ -0,0 +1,2 @@ +declare module '@storybook/core/*'; +declare module 'global'; diff --git a/app/rax/tsconfig.json b/app/rax/tsconfig.json new file mode 100644 index 000000000000..f1429a324345 --- /dev/null +++ b/app/rax/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "types": ["webpack-env", "node"] + } +} diff --git a/yarn.lock b/yarn.lock index 4088e971f55f..c184cbf271db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"