diff --git a/apps/vr-tests-web-components/.storybook/main.cjs b/apps/vr-tests-web-components/.storybook/main.cjs index 55909bffd20b01..87666047a40aaa 100644 --- a/apps/vr-tests-web-components/.storybook/main.cjs +++ b/apps/vr-tests-web-components/.storybook/main.cjs @@ -9,7 +9,12 @@ const tsPaths = new TsconfigPathsPlugin({ configFile: tsConfigPath, }); -module.exports = /** @type {import('../../../.storybook/main').StorybookBaseConfig} */ ({ +// TODO - these types are copied from root ./storybook/main.js as if we would like to use those as is, it will force us to add our custom storybook plugins as devDeps to WC +// - refactor this to be shared + +/** @typedef {import('@storybook/core-common').StorybookConfig} StorybookBaseConfig */ + +module.exports = /** @type {StorybookBaseConfig} */ ({ addons: [ { name: '@storybook/addon-docs', diff --git a/apps/vr-tests-web-components/package.json b/apps/vr-tests-web-components/package.json index e4241601c2b862..713de1d2fdf400 100644 --- a/apps/vr-tests-web-components/package.json +++ b/apps/vr-tests-web-components/package.json @@ -9,7 +9,7 @@ "format": "prettier . -w --ignore-path ../../.prettierignore", "lint": "eslint src --ext .ts,.tsx", "start": "start-storybook", - "type-check": "tsc", + "type-check": "tsc --baseUrl . --noEmit", "vr:build": "yarn build", "vr:test": "storywright --browsers chromium --url dist/storybook --destpath dist/screenshots --waitTimeScreenshot 500 --concurrency 4 --headless true" }, diff --git a/apps/vr-tests-web-components/tsconfig.json b/apps/vr-tests-web-components/tsconfig.json index 8dc6c2742b749a..952413d9104a88 100644 --- a/apps/vr-tests-web-components/tsconfig.json +++ b/apps/vr-tests-web-components/tsconfig.json @@ -7,8 +7,7 @@ "experimentalDecorators": true, "resolveJsonModule": true, "allowJs": true, - "jsx": "react", - "moduleResolution": "Node16" + "jsx": "react" }, "include": ["./src", "./.storybook/*"] } diff --git a/packages/web-components/.storybook/main.cjs b/packages/web-components/.storybook/main.cjs index a6c4d1ab928b16..64a2437390d081 100644 --- a/packages/web-components/.storybook/main.cjs +++ b/packages/web-components/.storybook/main.cjs @@ -9,7 +9,24 @@ const tsPaths = new TsconfigPathsPlugin({ configFile: tsConfigPath, }); -module.exports = /** @type {Omit} */ ({ +// TODO - these types are copied from root ./storybook/main.js as if we would like to use those as is, it will force us to add our custom storybook plugins as devDeps to WC +// - refactor this to be shared + +/** + * @typedef {import('@storybook/core-common').StorybookConfig} StorybookBaseConfig + * + * @typedef {{ + * babel: (options: Record) => Promise>; + * previewHead: (head: string) => string; + * }} StorybookExtraConfig + * + * @typedef {StorybookBaseConfig & + * Required> & + * StorybookExtraConfig + * } StorybookConfig + */ + +module.exports = /** @type {Omit} */ ({ stories: ['../src/**/*.stories.@(ts|mdx)'], staticDirs: ['../public'], core: { diff --git a/packages/web-components/package.json b/packages/web-components/package.json index f296234ce5726a..b8290b6ac297ac 100644 --- a/packages/web-components/package.json +++ b/packages/web-components/package.json @@ -176,8 +176,7 @@ "./dist/esm/toggle-button/define.js" ], "scripts": { - "tsc": "tsc", - "api-extractor": "api-extractor", + "type-check": "echo 'TODO'", "benchmark": "yarn clean && yarn compile:benchmark && yarn compile && node ./scripts/run-benchmarks", "compile": "node ./scripts/compile", "compile:benchmark": "rollup -c rollup.bench.js", @@ -199,8 +198,7 @@ "devDependencies": { "@types/web": "^0.0.142", "@storybook/html": "6.5.15", - "@tensile-perf/web-components": "~0.1.13", - "rimraf": "^3.0.2" + "@tensile-perf/web-components": "~0.1.13" }, "dependencies": { "@microsoft/fast-element": "2.0.0-beta.26", diff --git a/packages/web-components/scripts/clean.js b/packages/web-components/scripts/clean.js index 2adbc830f9e12f..c7df6e70a1602a 100644 --- a/packages/web-components/scripts/clean.js +++ b/packages/web-components/scripts/clean.js @@ -4,29 +4,47 @@ * Usage: node build/clean.js %path% */ import * as path from 'path'; -import rimraf from 'rimraf'; +import * as fsPromises from 'node:fs/promises'; import yargs from 'yargs'; -const argv = yargs.argv; - -/** - * All paths passed to the clean script - */ -const paths = argv._; +main(); /** * Function to remove a given path */ function cleanPath(cleanPath) { const removePath = path.resolve(process.cwd(), cleanPath); - rimraf(removePath, () => { + + const result = fsPromises.rm(removePath, { recursive: true }).then(() => { console.log(removePath, 'cleaned'); }); + + return result; } -/** - * Clean all paths - */ -if (Array.isArray(paths)) { - paths.forEach(cleanPath); +function main() { + const argv = yargs.argv; + + /** + * All paths passed to the clean script + */ + const paths = argv._; + + /** + * Clean all paths + */ + if (!Array.isArray(paths)) { + throw new Error('"paths" must be an array'); + } + + const result = paths.map(cleanPath); + + Promise.all(result) + .then(() => { + console.log('All paths cleaned'); + }) + .catch(error => { + console.error(error); + process.exit(1); + }); }