Skip to content

Commit

Permalink
remove debugging code
Browse files Browse the repository at this point in the history
  • Loading branch information
bashmish committed Sep 23, 2024
1 parent 414dc64 commit 0d9601f
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 15 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on: pull_request

env:
FORCE_COLOR: true

jobs:
linux:
timeout-minutes: 30
name: Linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node 20
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: 20
cache: npm

- name: Install Dependencies
run: npm ci

- name: Lint
run: npm run lint
36 changes: 36 additions & 0 deletions .github/workflows/verify-browser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Browser tests

on: pull_request

env:
FORCE_COLOR: true

jobs:
verify-linux:
timeout-minutes: 30
name: Linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node 20
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: 20
cache: npm

- name: Install Dependencies
run: npm ci

- name: Build packages
run: npm run build

# build for production in CI to make sure tests can run with production build
- name: Build specific packages for production
run: npm run build:production

- name: Test
run: npm run test:browser
90 changes: 90 additions & 0 deletions .github/workflows/verify-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Node tests

on: pull_request

env:
FORCE_COLOR: true

jobs:
verify-linux:
timeout-minutes: 30
name: Linux
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- '18'
- '20'
- 'latest'

steps:
- uses: actions/checkout@v4

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install Playwright dependencies
run: npx playwright install --with-deps

# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v1

- name: Install Dependencies
run: npm ci

- name: Build packages
run: npm run build

- name: Build types for js packages
run: npm run types

# build for production in CI to make sure tests can run with production build
- name: Build specific packages for production
run: npm run build:production

- name: Test
run: npm run test:node

verify-windows:
timeout-minutes: 30
name: Windows
runs-on: windows-2022
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4

- name: Setup Node '20'
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: '20'
cache: 'npm'

- name: Install Playwright dependencies
run: npx playwright install --with-deps

# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v1

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build

# build for production in CI to make sure tests can run with production build
- name: Build specific packages for production
run: npm run build:production

- name: Test
run: npm run test:node
4 changes: 2 additions & 2 deletions .github/workflows/verify-storybook-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node 20
uses: actions/setup-node@v4
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
name: Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Node 20
uses: actions/setup-node@v4
Expand Down
7 changes: 1 addition & 6 deletions packages/storybook-builder/src/generate-stories-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { normalizePath } from '@rollup/pluginutils';
import { logger } from '@storybook/node-logger';
import type { Options } from '@storybook/types';
import * as path from 'path';
import { pathToFileURL } from 'url';
import { listStories } from './list-stories.js';

/**
Expand All @@ -16,11 +15,7 @@ export async function generateStoriesScript(options: Options) {
const stories = await listStories(options);

// We can then call toImportFn to create a function that can be used to load each story dynamically.
const code = (await toImportFn(stories)).trim();

console.log('generateStoriesScript', code);

return code;
return (await toImportFn(stories)).trim();
}

/**
Expand Down
5 changes: 0 additions & 5 deletions packages/storybook-builder/src/rollup-plugin-mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@ export function rollupPluginMdx(storybookOptions: Options): Plugin {
async resolveId(id) {
if (id.endsWith('.mdx.js')) {
return id;
console.log('resolveId > id', id);
}
},

async load(id) {
if (!id.endsWith('.mdx.js')) return;

const mdxPath = id.replace(/\.js$/, '');

console.log('load > mdxPath', mdxPath);
console.log('load > mdxPath.split(/).join(sep)', mdxPath.split('/').join(sep));

const mdxCode = await readFile(mdxPath.split('/').join(sep), 'utf8');

const mdxLoaderOptions = await storybookOptions.presets.apply('mdxLoaderOptions', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { esbuildPluginCommonjsNamedExports } from './esbuild-plugin-commonjs-nam
import { getNodeModuleDir } from './get-node-module-dir.js';

export const PREBUNDLED_MODULES_DIR = normalize('node_modules/.prebundled_modules');
console.log('PREBUNDLED_MODULES_DIR', PREBUNDLED_MODULES_DIR);

export function rollupPluginPrebundleModules(env: Record<string, string>): Plugin {
const modulePaths: Record<string, string> = {};
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook-framework-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"scripts": {
"build": "tsc",
"test": "npm run test:build",
"test": "npm run test:build && npm run test:ui:build && npm run test:ui:runtime",
"test:build": "storybook build -c ./tests/fixtures/all-in-one/.storybook -o ./tests/fixtures/all-in-one/storybook-build",
"test:start:build": "wds -r ./tests/fixtures/all-in-one/storybook-build -p 3000",
"test:start:runtime": "storybook dev -c ./tests/fixtures/all-in-one/.storybook -p 3000 --no-open",
Expand Down

0 comments on commit 0d9601f

Please sign in to comment.