Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Oct 11, 2023
1 parent 746914e commit 51edf4a
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/lib/core-server/src/utils/StoryIndexGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export class StoryIndexGenerator {
input.rawComponentPath && this.resolveComponentPath(input.rawComponentPath, absolutePath);
const title = input.title ?? defaultMakeTitle();

// eslint-disable-next-line no-underscore-dangle
const id = input.__id ?? toId(input.metaId ?? title, storyNameFromExport(input.exportName));
const tags = (input.tags || []).concat('story');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-unresolved
import component from 'component-package';

export default {
Expand Down
13 changes: 13 additions & 0 deletions code/lib/core-server/src/utils/__tests__/index-extraction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe('story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": "a",
Expand All @@ -80,6 +81,7 @@ describe('story extraction', () => {
"type": "story",
},
Object {
"componentPath": undefined,
"id": "some-fully-custom-id",
"importPath": "./src/A.stories.js",
"metaId": "custom-id",
Expand Down Expand Up @@ -124,6 +126,7 @@ describe('story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "f--story-one",
"importPath": "./src/first-nested/deeply/F.stories.js",
"metaId": undefined,
Expand Down Expand Up @@ -171,6 +174,7 @@ describe('story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/first-nested/deeply/F.stories.js",
"metaId": "a",
Expand Down Expand Up @@ -219,6 +223,7 @@ describe('story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": "a",
Expand Down Expand Up @@ -285,6 +290,7 @@ describe('story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand All @@ -297,6 +303,7 @@ describe('story extraction', () => {
"type": "story",
},
Object {
"componentPath": undefined,
"id": "custom-title--story-two",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand All @@ -309,6 +316,7 @@ describe('story extraction', () => {
"type": "story",
},
Object {
"componentPath": undefined,
"id": "custom-meta-id--story-three",
"importPath": "./src/A.stories.js",
"metaId": "custom-meta-id",
Expand Down Expand Up @@ -354,6 +362,7 @@ describe('story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand Down Expand Up @@ -417,6 +426,7 @@ describe('docs entries from story extraction', () => {
"type": "docs",
},
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand Down Expand Up @@ -478,6 +488,7 @@ describe('docs entries from story extraction', () => {
"type": "docs",
},
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand Down Expand Up @@ -527,6 +538,7 @@ describe('docs entries from story extraction', () => {
"dependents": Array [],
"entries": Array [
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand Down Expand Up @@ -589,6 +601,7 @@ describe('docs entries from story extraction', () => {
"type": "docs",
},
Object {
"componentPath": undefined,
"id": "a--story-one",
"importPath": "./src/A.stories.js",
"metaId": undefined,
Expand Down
186 changes: 186 additions & 0 deletions code/lib/core-server/src/utils/stories-json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,39 @@ describe('useStoriesJson', () => {
"title": "B",
"type": "story",
},
"componentpath-extension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-extension--story-one",
"importPath": "./src/componentPath/extension.stories.js",
"name": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/extension",
"type": "story",
},
"componentpath-noextension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-noextension--story-one",
"importPath": "./src/componentPath/noExtension.stories.js",
"name": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/noExtension",
"type": "story",
},
"componentpath-package--story-one": Object {
"componentPath": "component-package",
"id": "componentpath-package--story-one",
"importPath": "./src/componentPath/package.stories.js",
"name": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/package",
"type": "story",
},
"d--story-one": Object {
"id": "d--story-one",
"importPath": "./src/D.stories.jsx",
Expand Down Expand Up @@ -370,6 +403,57 @@ describe('useStoriesJson', () => {
],
"title": "B",
},
"componentpath-extension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-extension--story-one",
"importPath": "./src/componentPath/extension.stories.js",
"kind": "componentPath/extension",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-extension--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/extension.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/extension",
},
"componentpath-noextension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-noextension--story-one",
"importPath": "./src/componentPath/noExtension.stories.js",
"kind": "componentPath/noExtension",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-noextension--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/noExtension.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/noExtension",
},
"componentpath-package--story-one": Object {
"componentPath": "component-package",
"id": "componentpath-package--story-one",
"importPath": "./src/componentPath/package.stories.js",
"kind": "componentPath/package",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-package--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/package.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/package",
},
"d--story-one": Object {
"id": "d--story-one",
"importPath": "./src/D.stories.jsx",
Expand Down Expand Up @@ -604,6 +688,57 @@ describe('useStoriesJson', () => {
],
"title": "B",
},
"componentpath-extension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-extension--story-one",
"importPath": "./src/componentPath/extension.stories.js",
"kind": "componentPath/extension",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-extension--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/extension.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/extension",
},
"componentpath-noextension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-noextension--story-one",
"importPath": "./src/componentPath/noExtension.stories.js",
"kind": "componentPath/noExtension",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-noextension--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/noExtension.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/noExtension",
},
"componentpath-package--story-one": Object {
"componentPath": "component-package",
"id": "componentpath-package--story-one",
"importPath": "./src/componentPath/package.stories.js",
"kind": "componentPath/package",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-package--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/package.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/package",
},
"d--story-one": Object {
"id": "d--story-one",
"importPath": "./src/D.stories.jsx",
Expand Down Expand Up @@ -796,6 +931,57 @@ describe('useStoriesJson', () => {
],
"title": "B",
},
"componentpath-extension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-extension--story-one",
"importPath": "./src/componentPath/extension.stories.js",
"kind": "componentPath/extension",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-extension--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/extension.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/extension",
},
"componentpath-noextension--story-one": Object {
"componentPath": "./src/componentPath/component.js",
"id": "componentpath-noextension--story-one",
"importPath": "./src/componentPath/noExtension.stories.js",
"kind": "componentPath/noExtension",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-noextension--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/noExtension.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/noExtension",
},
"componentpath-package--story-one": Object {
"componentPath": "component-package",
"id": "componentpath-package--story-one",
"importPath": "./src/componentPath/package.stories.js",
"kind": "componentPath/package",
"name": "Story One",
"parameters": Object {
"__id": "componentpath-package--story-one",
"docsOnly": false,
"fileName": "./src/componentPath/package.stories.js",
},
"story": "Story One",
"tags": Array [
"story",
],
"title": "componentPath/package",
},
"d--story-one": Object {
"id": "d--story-one",
"importPath": "./src/D.stories.jsx",
Expand Down

0 comments on commit 51edf4a

Please sign in to comment.