Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react-native): storybook relative paths #22031

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/generated/devkit/CreateDependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

Ƭ **CreateDependencies**\<`T`\>: (`options`: `T` \| `undefined`, `context`: [`CreateDependenciesContext`](../../devkit/documents/CreateDependenciesContext)) => [`RawProjectGraphDependency`](../../devkit/documents/RawProjectGraphDependency)[] \| `Promise`\<[`RawProjectGraphDependency`](../../devkit/documents/RawProjectGraphDependency)[]\>

A function which parses files in the workspace to create dependencies in the [ProjectGraph](../../devkit/documents/ProjectGraph)
Use [validateDependency](../../devkit/documents/validateDependency) to validate dependencies

#### Type parameters

| Name | Type |
Expand All @@ -15,6 +12,9 @@ Use [validateDependency](../../devkit/documents/validateDependency) to validate

▸ (`options`, `context`): [`RawProjectGraphDependency`](../../devkit/documents/RawProjectGraphDependency)[] \| `Promise`\<[`RawProjectGraphDependency`](../../devkit/documents/RawProjectGraphDependency)[]\>

A function which parses files in the workspace to create dependencies in the [ProjectGraph](../../devkit/documents/ProjectGraph)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the docs should not be changed. could you run pnpm documentation and make sure no docs got updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you said, no docs updated after pnpm documentation. Should I revert those file or you have a better idea?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you revert the doc changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiongemi done

Use [validateDependency](../../devkit/documents/validateDependency) to validate dependencies

##### Parameters

| Name | Type |
Expand Down
6 changes: 3 additions & 3 deletions docs/generated/devkit/CreateNodesFunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

Ƭ **CreateNodesFunction**\<`T`\>: (`projectConfigurationFile`: `string`, `options`: `T` \| `undefined`, `context`: [`CreateNodesContext`](../../devkit/documents/CreateNodesContext)) => [`CreateNodesResult`](../../devkit/documents/CreateNodesResult) \| `Promise`\<[`CreateNodesResult`](../../devkit/documents/CreateNodesResult)\>

A function which parses a configuration file into a set of nodes.
Used for creating nodes for the [ProjectGraph](../../devkit/documents/ProjectGraph)

#### Type parameters

| Name | Type |
Expand All @@ -15,6 +12,9 @@ Used for creating nodes for the [ProjectGraph](../../devkit/documents/ProjectGra

▸ (`projectConfigurationFile`, `options`, `context`): [`CreateNodesResult`](../../devkit/documents/CreateNodesResult) \| `Promise`\<[`CreateNodesResult`](../../devkit/documents/CreateNodesResult)\>

A function which parses a configuration file into a set of nodes.
Used for creating nodes for the [ProjectGraph](../../devkit/documents/ProjectGraph)

##### Parameters

| Name | Type |
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/devkit/Executor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Ƭ **Executor**\<`T`\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/ExecutorContext)) => `Promise`\<\{ `success`: `boolean` }\> \| `AsyncIterableIterator`\<\{ `success`: `boolean` }\>

Implementation of a target of a project

#### Type parameters

| Name | Type |
Expand All @@ -14,6 +12,8 @@ Implementation of a target of a project

▸ (`options`, `context`): `Promise`\<\{ `success`: `boolean` }\> \| `AsyncIterableIterator`\<\{ `success`: `boolean` }\>

Implementation of a target of a project

##### Parameters

| Name | Type |
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/devkit/Generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Ƭ **Generator**\<`T`\>: (`tree`: `any`, `schema`: `T`) => `void` \| [`GeneratorCallback`](../../devkit/documents/GeneratorCallback) \| `Promise`\<`void` \| [`GeneratorCallback`](../../devkit/documents/GeneratorCallback)\>

A function that schedules updates to the filesystem to be done atomically

#### Type parameters

| Name | Type |
Expand All @@ -14,6 +12,8 @@ A function that schedules updates to the filesystem to be done atomically

▸ (`tree`, `schema`): `void` \| [`GeneratorCallback`](../../devkit/documents/GeneratorCallback) \| `Promise`\<`void` \| [`GeneratorCallback`](../../devkit/documents/GeneratorCallback)\>

A function that schedules updates to the filesystem to be done atomically

##### Parameters

| Name | Type |
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/devkit/GeneratorCallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Ƭ **GeneratorCallback**: () => `void` \| `Promise`\<`void`\>

A callback function that is executed after changes are made to the file system

#### Type declaration

▸ (): `void` \| `Promise`\<`void`\>

A callback function that is executed after changes are made to the file system

##### Returns

`void` \| `Promise`\<`void`\>
8 changes: 4 additions & 4 deletions docs/generated/devkit/ProjectTargetConfigurator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Ƭ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`\<`string`, [`TargetConfiguration`](../../devkit/documents/TargetConfiguration)\>

**`Deprecated`**

Add targets to the projects in a [CreateNodes](../../devkit/documents/CreateNodes) function instead. This will be removed in Nx 19

#### Type declaration

▸ (`file`): `Record`\<`string`, [`TargetConfiguration`](../../devkit/documents/TargetConfiguration)\>
Expand All @@ -19,3 +15,7 @@ Add targets to the projects in a [CreateNodes](../../devkit/documents/CreateNode
##### Returns

`Record`\<`string`, [`TargetConfiguration`](../../devkit/documents/TargetConfiguration)\>

**`Deprecated`**

Add targets to the projects in a [CreateNodes](../../devkit/documents/CreateNodes) function instead. This will be removed in Nx 19
4 changes: 2 additions & 2 deletions docs/generated/devkit/TaskGraphExecutor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Ƭ **TaskGraphExecutor**\<`T`\>: (`taskGraph`: [`TaskGraph`](../../devkit/documents/TaskGraph), `options`: `Record`\<`string`, `T`\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/ExecutorContext)) => `Promise`\<`BatchExecutorResult` \| `AsyncIterableIterator`\<`BatchExecutorTaskResult`\>\>

Implementation of a target of a project that handles multiple projects to be batched

#### Type parameters

| Name | Type |
Expand All @@ -14,6 +12,8 @@ Implementation of a target of a project that handles multiple projects to be bat

▸ (`taskGraph`, `options`, `overrides`, `context`): `Promise`\<`BatchExecutorResult` \| `AsyncIterableIterator`\<`BatchExecutorTaskResult`\>\>

Implementation of a target of a project that handles multiple projects to be batched

##### Parameters

| Name | Type |
Expand Down
3 changes: 3 additions & 0 deletions docs/generated/devkit/defaultTasksRunner.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

▸ **defaultTasksRunner**(`tasks`, `options`, `context?`): `any`

`any | Promise<{ [id: string]: TaskStatus }>`
will change to Promise<{ [id: string]: TaskStatus }> after Nx 15 is released.

#### Parameters

| Name | Type |
Expand Down
14 changes: 10 additions & 4 deletions packages/react-native/src/executors/storybook/storybook.impl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from 'path';
import { join, relative, resolve, dirname } from 'path';
import { ExecutorContext, logger, readJsonFile } from '@nx/devkit';
import { fileExists } from '@nx/workspace/src/utilities/fileutils';
import * as chalk from 'chalk';
Expand Down Expand Up @@ -66,9 +66,15 @@ export function runCliStorybook(
workspaceRoot: string,
options: ReactNativeStorybookOptions
) {
const storiesFiles: string[] = options.searchDir.flatMap((dir) =>
globSync(join(dir, options.pattern))
);
const storiesFiles: string[] = options.searchDir.flatMap((dir) => {
const storyFilePaths: string[] = globSync(join(dir, options.pattern));

return storyFilePaths.map((storyFilePath) => {
const loaderPath: string = resolve(dirname(options.outputFile));
return relative(loaderPath, storyFilePath);
});
});

if (storiesFiles.length === 0) {
logger.warn(`${chalk.bold.yellow('warn')} No stories found.`);
}
Expand Down