@nx/react-native 17.0.4 → 17.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -7
- package/LICENSE +1 -1
- package/README.md +4 -9
- package/executors.json +0 -5
- package/generators.json +11 -12
- package/migrations.json +0 -126
- package/package.json +15 -11
- package/plugins/metro-resolver.js +1 -4
- package/plugins/with-nx-metro.js +2 -6
- package/src/executors/build-android/build-android.impl.js +6 -2
- package/src/executors/build-android/build-android.impl.ts +6 -2
- package/src/executors/build-android/schema.json +1 -1
- package/src/executors/build-ios/schema.json +1 -1
- package/src/executors/bundle/schema.d.ts +1 -1
- package/src/executors/bundle/schema.json +1 -1
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +0 -4
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +0 -4
- package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -4
- package/src/executors/ensure-symlink/schema.json +1 -1
- package/src/executors/pod-install/schema.json +1 -1
- package/src/executors/run-android/run-android.impl.js +17 -5
- package/src/executors/run-android/run-android.impl.ts +18 -9
- package/src/executors/run-android/schema.json +1 -1
- package/src/executors/run-ios/run-ios.impl.js +16 -4
- package/src/executors/run-ios/run-ios.impl.ts +18 -9
- package/src/executors/run-ios/schema.json +1 -1
- package/src/executors/start/schema.d.ts +1 -1
- package/src/executors/start/schema.json +1 -1
- package/src/executors/start/start.impl.js +26 -11
- package/src/executors/start/start.impl.ts +28 -14
- package/src/executors/storybook/storybook.impl.d.ts +0 -4
- package/src/executors/storybook/storybook.impl.js +2 -15
- package/src/executors/storybook/storybook.impl.ts +7 -26
- package/src/executors/sync-deps/schema.d.ts +0 -1
- package/src/executors/sync-deps/schema.json +1 -6
- package/src/executors/sync-deps/sync-deps.impl.d.ts +1 -2
- package/src/executors/sync-deps/sync-deps.impl.js +11 -33
- package/src/executors/sync-deps/sync-deps.impl.ts +18 -57
- package/src/generators/application/application.js +8 -52
- package/src/generators/application/application.spec.ts +2 -29
- package/src/generators/application/files/app/Gemfile.template +1 -2
- package/src/generators/application/files/app/android/app/build.gradle.template +28 -12
- package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +6 -2
- package/src/generators/application/files/app/android/app/src/debug/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +75 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +32 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +62 -0
- package/src/generators/application/files/app/android/app/src/release/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +20 -0
- package/src/generators/application/files/app/android/build.gradle.template +20 -7
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/src/generators/application/files/app/android/gradle.properties +3 -0
- package/src/generators/application/files/app/android/gradlew.template +7 -12
- package/src/generators/application/files/app/android/settings.gradle.template +2 -2
- package/src/generators/application/files/app/babel.config.json.template +3 -0
- package/src/generators/application/files/app/ios/Podfile.template +7 -0
- package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +0 -5
- package/src/generators/application/files/app/ios/__className__/Info.plist.template +8 -5
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +33 -11
- package/src/generators/application/files/app/metro.config.js.template +5 -1
- package/src/generators/application/files/app/src/app/App.tsx.template +13 -50
- package/src/generators/application/lib/add-detox.d.ts +3 -0
- package/src/generators/application/lib/add-detox.js +23 -0
- package/src/generators/application/lib/add-project.js +18 -18
- package/src/generators/application/lib/normalize-options.d.ts +0 -7
- package/src/generators/application/lib/normalize-options.js +3 -35
- package/src/generators/application/lib/normalize-options.spec.ts +7 -70
- package/src/generators/application/schema.d.ts +3 -5
- package/src/generators/application/schema.json +6 -14
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +1 -1
- package/src/generators/component/schema.d.ts +3 -3
- package/src/generators/component/schema.json +4 -4
- package/src/generators/component-story/component-story.d.ts +8 -5
- package/src/generators/component-story/component-story.js +69 -8
- package/src/generators/component-story/component-story.spec.ts +428 -0
- package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
- package/src/generators/component-story/schema.d.ts +0 -1
- package/src/generators/component-story/schema.json +3 -11
- package/src/generators/init/init.d.ts +1 -2
- package/src/generators/init/init.js +56 -55
- package/src/generators/init/init.spec.ts +6 -7
- package/src/generators/init/schema.d.ts +3 -3
- package/src/generators/init/schema.json +18 -13
- package/src/generators/library/files/lib/babel.config.json.template +17 -0
- package/src/generators/library/lib/normalize-options.js +0 -5
- package/src/generators/library/library.js +38 -48
- package/src/generators/library/library.spec.ts +60 -12
- package/src/generators/library/schema.d.ts +0 -1
- package/src/generators/library/schema.json +2 -2
- package/src/generators/stories/schema.d.ts +0 -2
- package/src/generators/stories/schema.json +2 -15
- package/src/generators/stories/stories-app.spec.ts +128 -0
- package/src/generators/stories/stories-lib.spec.ts +105 -0
- package/src/generators/stories/stories.d.ts +2 -5
- package/src/generators/stories/stories.js +50 -7
- package/src/generators/storybook-configuration/configuration.d.ts +2 -7
- package/src/generators/storybook-configuration/configuration.js +48 -18
- package/src/generators/storybook-configuration/configuration.spec.ts +135 -0
- package/src/generators/storybook-configuration/files/app/storybook.ts.template +9 -0
- package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +74 -0
- package/src/generators/storybook-configuration/files/root/story-loader.ts.template +5 -0
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.d.ts +6 -0
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js +25 -0
- package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +161 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +6 -0
- package/src/generators/storybook-configuration/lib/create-storybook-files.js +42 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +7 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +29 -0
- package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +65 -0
- package/src/generators/storybook-configuration/schema.d.ts +2 -4
- package/src/generators/storybook-configuration/schema.json +12 -22
- package/src/generators/upgrade-native/lib/normalize-options.d.ts +1 -1
- package/src/generators/upgrade-native/schema.d.ts +1 -1
- package/src/generators/upgrade-native/schema.json +3 -3
- package/src/generators/upgrade-native/upgrade-native.d.ts +0 -2
- package/src/generators/upgrade-native/upgrade-native.js +0 -3
- package/src/migrations/update-16-6-0/update-metro-config.js +5 -1
- package/src/migrations/update-16-9-0/remove-types-react-native.js +9 -2
- package/src/utils/add-jest.d.ts +1 -1
- package/src/utils/add-jest.js +1 -13
- package/src/utils/add-linting.d.ts +0 -1
- package/src/utils/add-linting.js +1 -1
- package/src/utils/add-linting.spec.ts +6 -4
- package/src/utils/chmod-android-gradle-files.js +2 -6
- package/src/utils/find-all-npm-dependencies.js +3 -5
- package/src/utils/find-all-npm-dependencies.spec.ts +9 -17
- package/src/utils/symlink-task.d.ts +2 -0
- package/src/utils/symlink-task.js +18 -0
- package/src/utils/testing-generators.js +0 -1
- package/src/utils/versions.d.ts +13 -10
- package/src/utils/versions.js +14 -11
- package/plugin.d.ts +0 -1
- package/plugin.js +0 -6
- package/plugins/plugin.d.ts +0 -14
- package/plugins/plugin.js +0 -162
- package/src/executors/upgrade/schema.d.ts +0 -1
- package/src/executors/upgrade/schema.json +0 -11
- package/src/executors/upgrade/upgrade.impl.d.ts +0 -13
- package/src/executors/upgrade/upgrade.impl.js +0 -47
- package/src/executors/upgrade/upgrade.impl.ts +0 -64
- package/src/generators/application/files/app/.babelrc.js.template +0 -23
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +0 -22
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +0 -45
- package/src/generators/application/lib/add-e2e.d.ts +0 -3
- package/src/generators/application/lib/add-e2e.js +0 -46
- package/src/generators/library/files/lib/.babelrc.js.template +0 -21
- package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +0 -23
- package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +0 -15
- package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
- package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
- package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +0 -9
- package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +0 -82
- package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +0 -23
- package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +0 -14
- package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +0 -9
- package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +0 -77
- package/src/generators/web-configuration/lib/normalize-schema.d.ts +0 -17
- package/src/generators/web-configuration/lib/normalize-schema.js +0 -16
- package/src/generators/web-configuration/lib/webpack-targets.d.ts +0 -7
- package/src/generators/web-configuration/lib/webpack-targets.js +0 -75
- package/src/generators/web-configuration/schema.d.ts +0 -6
- package/src/generators/web-configuration/schema.json +0 -42
- package/src/generators/web-configuration/web-configuration.d.ts +0 -12
- package/src/generators/web-configuration/web-configuration.js +0 -87
- package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +0 -6
- package/src/migrations/update-18-0-0/add-upgrade-target.js +0 -33
- package/src/migrations/update-18-0-0/add-web-configuration.d.ts +0 -8
- package/src/migrations/update-18-0-0/add-web-configuration.js +0 -33
- package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +0 -39
- package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +0 -5
- package/src/migrations/update-18-0-0/change-storybook-targets.js +0 -57
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
- package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
- package/src/migrations/update-18-0-0/remove-block-list.spec.ts +0 -68
- package/src/migrations/update-18-0-0/remove-metro.d.ts +0 -14
- package/src/migrations/update-18-0-0/remove-metro.js +0 -29
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
- package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -30
- package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +0 -40
- package/src/utils/ensure-dependencies.d.ts +0 -2
- package/src/utils/ensure-dependencies.js +0 -30
|
@@ -1,13 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storiesGenerator = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
exports.storiesGenerator = exports.createAllStories = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const component_story_1 = require("../component-story/component-story");
|
|
7
|
+
const stories_1 = require("@nx/react/src/generators/stories/stories");
|
|
8
|
+
const minimatch = require("minimatch");
|
|
9
|
+
const versions_1 = require("../../utils/versions");
|
|
10
|
+
async function createAllStories(tree, projectName, ignorePaths) {
|
|
11
|
+
(0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
|
12
|
+
const { isTheFileAStory } = await Promise.resolve().then(() => require('@nx/storybook/src/utils/utilities'));
|
|
13
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
14
|
+
const projectConfiguration = projects.get(projectName);
|
|
15
|
+
const { sourceRoot } = projectConfiguration;
|
|
16
|
+
const projectPath = await (0, stories_1.projectRootPath)(tree, projectConfiguration);
|
|
17
|
+
let componentPaths = [];
|
|
18
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (path) => {
|
|
19
|
+
if (ignorePaths?.some((pattern) => minimatch(path, pattern)))
|
|
20
|
+
return;
|
|
21
|
+
if ((path.endsWith('.tsx') && !path.endsWith('.spec.tsx')) ||
|
|
22
|
+
(path.endsWith('.js') && !path.endsWith('.spec.js')) ||
|
|
23
|
+
(path.endsWith('.jsx') && !path.endsWith('.spec.jsx'))) {
|
|
24
|
+
// Check if file is NOT a story (either ts/tsx or js/jsx)
|
|
25
|
+
if (!isTheFileAStory(tree, path)) {
|
|
26
|
+
// Since the file is not a story
|
|
27
|
+
// Let's see if the .stories.* file exists
|
|
28
|
+
const ext = path.slice(path.lastIndexOf('.'));
|
|
29
|
+
const storyPath = `${path.split(ext)[0]}.stories${ext}`;
|
|
30
|
+
if (!tree.exists(storyPath)) {
|
|
31
|
+
componentPaths.push(path);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
await Promise.all(componentPaths.map(async (componentPath) => {
|
|
37
|
+
const relativeCmpDir = componentPath.replace((0, path_1.join)(sourceRoot, '/'), '');
|
|
38
|
+
if (!(0, stories_1.containsComponentDeclaration)(tree, componentPath)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
await (0, component_story_1.default)(tree, {
|
|
42
|
+
componentPath: relativeCmpDir,
|
|
43
|
+
project: projectName,
|
|
44
|
+
skipFormat: true,
|
|
45
|
+
});
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
exports.createAllStories = createAllStories;
|
|
9
49
|
async function storiesGenerator(host, schema) {
|
|
10
|
-
|
|
50
|
+
await createAllStories(host, schema.project, schema.ignorePaths);
|
|
51
|
+
if (!schema.skipFormat) {
|
|
52
|
+
await (0, devkit_1.formatFiles)(host);
|
|
53
|
+
}
|
|
11
54
|
}
|
|
12
55
|
exports.storiesGenerator = storiesGenerator;
|
|
13
56
|
exports.default = storiesGenerator;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { StorybookConfigureSchema } from './schema';
|
|
3
|
-
export declare function storybookConfigurationGenerator(
|
|
4
|
-
/**
|
|
5
|
-
* This would be a direct pass through to @nx/react:storybook-configuration generator.
|
|
6
|
-
* @TODO (@xiongemi): remove this generator for v19
|
|
7
|
-
*/
|
|
8
|
-
export declare function storybookConfigurationGeneratorInternal(host: Tree, schema: StorybookConfigureSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
3
|
+
export declare function storybookConfigurationGenerator(host: Tree, schema: StorybookConfigureSchema): Promise<GeneratorCallback>;
|
|
9
4
|
export default storybookConfigurationGenerator;
|
|
@@ -1,26 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.storybookConfigurationGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const versions_1 = require("../../utils/versions");
|
|
6
|
+
const stories_1 = require("../stories/stories");
|
|
7
|
+
const add_resolver_main_fields_to_metro_config_1 = require("./lib/add-resolver-main-fields-to-metro-config");
|
|
8
|
+
const create_storybook_files_1 = require("./lib/create-storybook-files");
|
|
9
|
+
const replace_app_import_with_storybook_toggle_1 = require("./lib/replace-app-import-with-storybook-toggle");
|
|
10
|
+
async function generateStories(host, schema) {
|
|
11
|
+
await (0, stories_1.default)(host, {
|
|
12
|
+
project: schema.name,
|
|
13
|
+
ignorePaths: schema.ignorePaths,
|
|
14
|
+
skipFormat: true,
|
|
10
15
|
});
|
|
11
16
|
}
|
|
17
|
+
async function storybookConfigurationGenerator(host, schema) {
|
|
18
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
|
19
|
+
const installTask = await configurationGenerator(host, {
|
|
20
|
+
name: schema.name,
|
|
21
|
+
uiFramework: '@storybook/react-native',
|
|
22
|
+
configureCypress: false,
|
|
23
|
+
js: false,
|
|
24
|
+
linter: schema.linter,
|
|
25
|
+
standaloneConfig: schema.standaloneConfig,
|
|
26
|
+
tsConfiguration: schema.tsConfiguration,
|
|
27
|
+
skipFormat: true,
|
|
28
|
+
});
|
|
29
|
+
const installRequiredPackagesTask = await (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
30
|
+
'@react-native-async-storage/async-storage': versions_1.reactNativeAsyncStorageVersion,
|
|
31
|
+
'react-native-safe-area-context': versions_1.reactNativeSafeAreaContextVersion,
|
|
32
|
+
});
|
|
33
|
+
addStorybookTask(host, schema.name);
|
|
34
|
+
(0, create_storybook_files_1.createStorybookFiles)(host, schema);
|
|
35
|
+
(0, replace_app_import_with_storybook_toggle_1.replaceAppImportWithStorybookToggle)(host, schema);
|
|
36
|
+
(0, add_resolver_main_fields_to_metro_config_1.addResolverMainFieldsToMetroConfig)(host, schema);
|
|
37
|
+
if (schema.generateStories) {
|
|
38
|
+
await generateStories(host, schema);
|
|
39
|
+
}
|
|
40
|
+
await (0, devkit_1.formatFiles)(host);
|
|
41
|
+
return (0, devkit_1.runTasksInSerial)(installTask, installRequiredPackagesTask);
|
|
42
|
+
}
|
|
12
43
|
exports.storybookConfigurationGenerator = storybookConfigurationGenerator;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
44
|
+
function addStorybookTask(host, projectName) {
|
|
45
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(host, projectName);
|
|
46
|
+
projectConfig.targets['storybook'] = {
|
|
47
|
+
executor: '@nx/react-native:storybook',
|
|
48
|
+
options: {
|
|
49
|
+
searchDir: [projectConfig.sourceRoot],
|
|
50
|
+
outputFile: './.storybook/story-loader.js',
|
|
51
|
+
pattern: '**/*.stories.@(js|jsx|ts|tsx|md)',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
(0, devkit_1.updateProjectConfiguration)(host, projectName, projectConfig);
|
|
24
55
|
}
|
|
25
|
-
exports.storybookConfigurationGeneratorInternal = storybookConfigurationGeneratorInternal;
|
|
26
56
|
exports.default = storybookConfigurationGenerator;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
+
import { Linter } from '@nx/eslint';
|
|
4
|
+
import { logger } from '@nx/devkit';
|
|
5
|
+
|
|
6
|
+
import libraryGenerator from '../library/library';
|
|
7
|
+
import applicationGenerator from '../application/application';
|
|
8
|
+
import componentGenerator from '../component/component';
|
|
9
|
+
import storybookConfigurationGenerator from './configuration';
|
|
10
|
+
|
|
11
|
+
// nested code imports graph from the repo, which might have innacurate graph version
|
|
12
|
+
jest.mock('nx/src/project-graph/project-graph', () => ({
|
|
13
|
+
...jest.requireActual<any>('nx/src/project-graph/project-graph'),
|
|
14
|
+
createProjectGraphAsync: jest
|
|
15
|
+
.fn()
|
|
16
|
+
.mockImplementation(async () => ({ nodes: {}, dependencies: {} })),
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
describe('react-native:storybook-configuration', () => {
|
|
20
|
+
let appTree;
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
jest.spyOn(logger, 'warn').mockImplementation(() => {});
|
|
24
|
+
jest.spyOn(logger, 'debug').mockImplementation(() => {});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
jest.restoreAllMocks();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('should generate files for an app', () => {
|
|
32
|
+
it('should configure everything at once', async () => {
|
|
33
|
+
appTree = await createTestUILib('test-ui-lib');
|
|
34
|
+
appTree.write('.gitignore', '');
|
|
35
|
+
await storybookConfigurationGenerator(appTree, {
|
|
36
|
+
name: 'test-ui-lib',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
expect(appTree.exists('test-ui-lib/.storybook/main.js')).toBeTruthy();
|
|
40
|
+
expect(
|
|
41
|
+
appTree.exists('test-ui-lib/tsconfig.storybook.json')
|
|
42
|
+
).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should generate stories for components', async () => {
|
|
46
|
+
appTree = await createTestUILib('test-ui-lib');
|
|
47
|
+
await componentGenerator(appTree, {
|
|
48
|
+
name: 'test-ui-lib',
|
|
49
|
+
project: 'test-ui-lib',
|
|
50
|
+
});
|
|
51
|
+
await storybookConfigurationGenerator(appTree, {
|
|
52
|
+
name: 'test-ui-lib',
|
|
53
|
+
generateStories: true,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(
|
|
57
|
+
appTree.exists(
|
|
58
|
+
'test-ui-lib/src/lib/test-ui-lib/test-ui-lib.stories.tsx'
|
|
59
|
+
)
|
|
60
|
+
).toBeTruthy();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('should generate files for lib', () => {
|
|
65
|
+
it('should configure everything at once', async () => {
|
|
66
|
+
appTree = await createTestAppLib('test-ui-app');
|
|
67
|
+
await storybookConfigurationGenerator(appTree, {
|
|
68
|
+
name: 'test-ui-app',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
expect(appTree.exists('test-ui-app/.storybook/main.js')).toBeTruthy();
|
|
72
|
+
expect(
|
|
73
|
+
appTree.exists('test-ui-app/tsconfig.storybook.json')
|
|
74
|
+
).toBeTruthy();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should generate stories for components', async () => {
|
|
78
|
+
appTree = await createTestAppLib('test-ui-app');
|
|
79
|
+
await storybookConfigurationGenerator(appTree, {
|
|
80
|
+
name: 'test-ui-app',
|
|
81
|
+
generateStories: true,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Currently the auto-generate stories feature only picks up components under the 'lib' directory.
|
|
85
|
+
// In our 'createTestAppLib' function, we call @nx/react-native:component to generate a component
|
|
86
|
+
// under the specified 'lib' directory
|
|
87
|
+
expect(
|
|
88
|
+
appTree.exists(
|
|
89
|
+
'test-ui-app/src/app/my-component/my-component.stories.tsx'
|
|
90
|
+
)
|
|
91
|
+
).toBeTruthy();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export async function createTestUILib(libName: string): Promise<Tree> {
|
|
97
|
+
let appTree = createTreeWithEmptyWorkspace();
|
|
98
|
+
|
|
99
|
+
await libraryGenerator(appTree, {
|
|
100
|
+
linter: Linter.EsLint,
|
|
101
|
+
skipFormat: true,
|
|
102
|
+
skipTsConfig: false,
|
|
103
|
+
unitTestRunner: 'none',
|
|
104
|
+
name: libName,
|
|
105
|
+
projectNameAndRootFormat: 'as-provided',
|
|
106
|
+
});
|
|
107
|
+
return appTree;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function createTestAppLib(
|
|
111
|
+
libName: string,
|
|
112
|
+
plainJS = false
|
|
113
|
+
): Promise<Tree> {
|
|
114
|
+
let appTree = createTreeWithEmptyWorkspace();
|
|
115
|
+
|
|
116
|
+
await applicationGenerator(appTree, {
|
|
117
|
+
e2eTestRunner: 'none',
|
|
118
|
+
linter: Linter.EsLint,
|
|
119
|
+
skipFormat: false,
|
|
120
|
+
style: 'css',
|
|
121
|
+
unitTestRunner: 'none',
|
|
122
|
+
name: libName,
|
|
123
|
+
js: plainJS,
|
|
124
|
+
install: false,
|
|
125
|
+
projectNameAndRootFormat: 'as-provided',
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
await componentGenerator(appTree, {
|
|
129
|
+
name: 'my-component',
|
|
130
|
+
project: libName,
|
|
131
|
+
directory: 'app',
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return appTree;
|
|
135
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { configure, getStorybookUI } from '@storybook/react-native';
|
|
2
|
+
|
|
3
|
+
import { loadStories } from '<%= offsetFromRoot %>../.storybook/story-loader';
|
|
4
|
+
|
|
5
|
+
configure(() => loadStories(), module);
|
|
6
|
+
|
|
7
|
+
const StorybookUIRoot = getStorybookUI({});
|
|
8
|
+
|
|
9
|
+
export default StorybookUIRoot;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggle inspired from https://github.com/infinitered/ignite/blob/master/boilerplate/storybook/toggle-storybook.tsx
|
|
3
|
+
*/
|
|
4
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
5
|
+
import { DevSettings } from 'react-native';
|
|
6
|
+
|
|
7
|
+
import AppRoot from '../app/App';
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_REACTOTRON_WS_URI = 'ws://localhost:9090';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Toggle Storybook mode, in __DEV__ mode only.
|
|
13
|
+
*
|
|
14
|
+
* In non-__DEV__ mode, or when Storybook isn't toggled on,
|
|
15
|
+
* renders its children.
|
|
16
|
+
*
|
|
17
|
+
* The mode flag is persisted in async storage, which means it
|
|
18
|
+
* persists across reloads/restarts - this is handy when developing
|
|
19
|
+
* new components in Storybook.
|
|
20
|
+
*/
|
|
21
|
+
function ToggleStorybook(props) {
|
|
22
|
+
const [showStorybook, setShowStorybook] = useState(false);
|
|
23
|
+
const [StorybookUIRoot, setStorybookUIRoot] = useState(null);
|
|
24
|
+
const ws = useRef(new WebSocket(DEFAULT_REACTOTRON_WS_URI));
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!__DEV__) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (DevSettings) {
|
|
32
|
+
// Add our toggle command to the menu
|
|
33
|
+
DevSettings.addMenuItem('Toggle Storybook', () => {
|
|
34
|
+
setShowStorybook((show) => {
|
|
35
|
+
// On toggle, flip the current value
|
|
36
|
+
show = !show;
|
|
37
|
+
|
|
38
|
+
// Return it to change the local state
|
|
39
|
+
return show;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Load the storybook UI once
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
46
|
+
setStorybookUIRoot(() => require('./storybook.ts').default);
|
|
47
|
+
|
|
48
|
+
// Behave as Reactotron.storybookSwitcher(), not a HOC way.
|
|
49
|
+
ws.current.onmessage = (e) => {
|
|
50
|
+
const data = JSON.parse(e.data);
|
|
51
|
+
|
|
52
|
+
if (data.type === 'storybook') {
|
|
53
|
+
setShowStorybook(data.payload);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
ws.current.onerror = (e) => {
|
|
57
|
+
setShowStorybook(false);
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (showStorybook) {
|
|
62
|
+
return StorybookUIRoot ? <StorybookUIRoot /> : null;
|
|
63
|
+
} else {
|
|
64
|
+
return props.children;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default () => {
|
|
69
|
+
return (
|
|
70
|
+
<ToggleStorybook>
|
|
71
|
+
<AppRoot />
|
|
72
|
+
</ToggleStorybook>
|
|
73
|
+
);
|
|
74
|
+
};
|
package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addResolverMainFieldsToMetroConfig = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Add resolverMainFields in metro.config.js
|
|
8
|
+
*/
|
|
9
|
+
function addResolverMainFieldsToMetroConfig(host, schema) {
|
|
10
|
+
const { root } = (0, devkit_1.readProjectConfiguration)(host, schema.name);
|
|
11
|
+
const metroConfigPath = (0, path_1.join)(root, 'metro.config.js');
|
|
12
|
+
try {
|
|
13
|
+
devkit_1.logger.debug(`Updating resolverMainFields for ${metroConfigPath}`);
|
|
14
|
+
const metroConfigContent = host.read(metroConfigPath, 'utf-8');
|
|
15
|
+
if (metroConfigContent.includes('resolverMainFields:')) {
|
|
16
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `${metroConfigPath} is already udpated.`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
host.write(metroConfigPath, metroConfigContent.replace(/},\s+resolver: {/, `},resolver: { resolverMainFields: ['sbmodern', 'browser', 'main'],`));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
devkit_1.logger.error((0, devkit_1.stripIndents) `Unable to update ${metroConfigPath} for project ${root}.`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.addResolverMainFieldsToMetroConfig = addResolverMainFieldsToMetroConfig;
|
package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { addProjectConfiguration, Tree } from '@nx/devkit';
|
|
2
|
+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
3
|
+
|
|
4
|
+
import { formatFile } from '../../../utils/format-file';
|
|
5
|
+
|
|
6
|
+
import { addResolverMainFieldsToMetroConfig } from './add-resolver-main-fields-to-metro-config';
|
|
7
|
+
|
|
8
|
+
describe('addResolverMainFieldsToMetroConfig', () => {
|
|
9
|
+
let tree: Tree;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
tree = createTreeWithEmptyWorkspace();
|
|
13
|
+
|
|
14
|
+
addProjectConfiguration(tree, 'products', {
|
|
15
|
+
root: 'products',
|
|
16
|
+
sourceRoot: 'products/src',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it(`should update metro.config.js and add key projectRoot`, async () => {
|
|
21
|
+
tree.write(
|
|
22
|
+
'products/metro.config.js',
|
|
23
|
+
formatFile`
|
|
24
|
+
const { withNxMetro } = require('@nx/react-native');
|
|
25
|
+
const { getDefaultConfig } = require('metro-config');
|
|
26
|
+
const exclusionList = require('metro-config/src/defaults/exclusionList');
|
|
27
|
+
|
|
28
|
+
module.exports = (async () => {
|
|
29
|
+
const {
|
|
30
|
+
resolver: { sourceExts, assetExts },
|
|
31
|
+
} = await getDefaultConfig();
|
|
32
|
+
return withNxMetro(
|
|
33
|
+
{
|
|
34
|
+
transformer: {
|
|
35
|
+
getTransformOptions: async () => ({
|
|
36
|
+
transform: {
|
|
37
|
+
experimentalImportSupport: false,
|
|
38
|
+
inlineRequires: true,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
42
|
+
},
|
|
43
|
+
resolver: {
|
|
44
|
+
|
|
45
|
+
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
46
|
+
sourceExts: [...sourceExts, 'svg'],
|
|
47
|
+
blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
})();`
|
|
52
|
+
);
|
|
53
|
+
addResolverMainFieldsToMetroConfig(tree, {
|
|
54
|
+
name: 'products',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
expect(
|
|
58
|
+
formatFile`${tree.read('products/metro.config.js', 'utf-8')}`
|
|
59
|
+
).toEqual(
|
|
60
|
+
formatFile`
|
|
61
|
+
const { withNxMetro } = require('@nx/react-native');
|
|
62
|
+
const { getDefaultConfig } = require('metro-config');
|
|
63
|
+
const exclusionList = require('metro-config/src/defaults/exclusionList');
|
|
64
|
+
|
|
65
|
+
module.exports = (async () => {
|
|
66
|
+
const {
|
|
67
|
+
resolver: { sourceExts, assetExts },
|
|
68
|
+
} = await getDefaultConfig();
|
|
69
|
+
return withNxMetro(
|
|
70
|
+
{
|
|
71
|
+
transformer: {
|
|
72
|
+
getTransformOptions: async () => ({
|
|
73
|
+
transform: {
|
|
74
|
+
experimentalImportSupport: false,
|
|
75
|
+
inlineRequires: true,
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
79
|
+
},
|
|
80
|
+
resolver: {
|
|
81
|
+
resolverMainFields: ['sbmodern', 'browser', 'main'],
|
|
82
|
+
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
83
|
+
sourceExts: [...sourceExts, 'svg'],
|
|
84
|
+
blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
})();`
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it(`should not udpate metro.config.js if projectRoot already exists`, async () => {
|
|
93
|
+
tree.write(
|
|
94
|
+
'products/metro.config.js',
|
|
95
|
+
`
|
|
96
|
+
const { withNxMetro } = require('@nx/react-native');
|
|
97
|
+
const { getDefaultConfig } = require('metro-config');
|
|
98
|
+
|
|
99
|
+
module.exports = (async () => {
|
|
100
|
+
const {
|
|
101
|
+
resolver: { sourceExts, assetExts },
|
|
102
|
+
} = await getDefaultConfig();
|
|
103
|
+
// console.log(getModulesRunBeforeMainModule);
|
|
104
|
+
return withNxMetro(
|
|
105
|
+
{
|
|
106
|
+
transformer: {
|
|
107
|
+
getTransformOptions: async () => ({
|
|
108
|
+
transform: {
|
|
109
|
+
experimentalImportSupport: false,
|
|
110
|
+
inlineRequires: true,
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
114
|
+
},
|
|
115
|
+
resolver: {
|
|
116
|
+
resolverMainFields: ['main'],
|
|
117
|
+
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
118
|
+
sourceExts: [...sourceExts, 'svg'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
);
|
|
122
|
+
})();
|
|
123
|
+
`
|
|
124
|
+
);
|
|
125
|
+
addResolverMainFieldsToMetroConfig(tree, {
|
|
126
|
+
name: 'products',
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
expect(tree.read('products/metro.config.js', 'utf-8')).toEqual(
|
|
130
|
+
`
|
|
131
|
+
const { withNxMetro } = require('@nx/react-native');
|
|
132
|
+
const { getDefaultConfig } = require('metro-config');
|
|
133
|
+
|
|
134
|
+
module.exports = (async () => {
|
|
135
|
+
const {
|
|
136
|
+
resolver: { sourceExts, assetExts },
|
|
137
|
+
} = await getDefaultConfig();
|
|
138
|
+
// console.log(getModulesRunBeforeMainModule);
|
|
139
|
+
return withNxMetro(
|
|
140
|
+
{
|
|
141
|
+
transformer: {
|
|
142
|
+
getTransformOptions: async () => ({
|
|
143
|
+
transform: {
|
|
144
|
+
experimentalImportSupport: false,
|
|
145
|
+
inlineRequires: true,
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
babelTransformerPath: require.resolve('react-native-svg-transformer'),
|
|
149
|
+
},
|
|
150
|
+
resolver: {
|
|
151
|
+
resolverMainFields: ['main'],
|
|
152
|
+
assetExts: assetExts.filter((ext) => ext !== 'svg'),
|
|
153
|
+
sourceExts: [...sourceExts, 'svg'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
})();
|
|
158
|
+
`
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStorybookFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const chalk = require("chalk");
|
|
7
|
+
/**
|
|
8
|
+
* This function generate ./storybook under project root.
|
|
9
|
+
*/
|
|
10
|
+
async function createStorybookFiles(host, schema) {
|
|
11
|
+
const { root, projectType, targets, sourceRoot } = (0, devkit_1.readProjectConfiguration)(host, schema.name);
|
|
12
|
+
// do not proceed if not a react native project
|
|
13
|
+
if (targets?.start?.executor !== '@nx/react-native:start' &&
|
|
14
|
+
targets?.start?.executor !== '@nx/expo:start' &&
|
|
15
|
+
targets?.start?.executor !== '@nrwl/react-native:start' &&
|
|
16
|
+
targets?.start?.executor !== '@nrwl/expo:start') {
|
|
17
|
+
devkit_1.logger.error(`Unable to add storybook to ${schema.name}. It is not a Nx React Native / Expo project.`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const storybookUIFileName = schema.js ? 'storybook.js' : 'storybook.ts';
|
|
21
|
+
const storybookUIFilePath = (0, path_1.join)(root, `./${storybookUIFileName}`);
|
|
22
|
+
if (host.exists(storybookUIFilePath)) {
|
|
23
|
+
devkit_1.logger.warn(`${storybookUIFileName} file already exists for ${projectType} ${schema.name}! Skipping generating this file.`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (projectType !== 'application') {
|
|
27
|
+
devkit_1.logger.info(`${chalk.bold.cyan('info')} To see your Storybook stories on the device, you should start your mobile app for the <platform> of your choice (typically ios or android).`);
|
|
28
|
+
}
|
|
29
|
+
// copy files to app's .storybook folder
|
|
30
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), (0, path_1.join)(root, 'src', 'storybook'), {
|
|
31
|
+
tmpl: '',
|
|
32
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(sourceRoot),
|
|
33
|
+
});
|
|
34
|
+
// copy files to workspace root's .storybook folder
|
|
35
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/root'), (0, path_1.join)(root, (0, devkit_1.offsetFromRoot)(root), '.storybook'), {
|
|
36
|
+
tmpl: '',
|
|
37
|
+
});
|
|
38
|
+
if (schema.js) {
|
|
39
|
+
(0, devkit_1.toJS)(host);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.createStorybookFiles = createStorybookFiles;
|
package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { StorybookConfigureSchema } from '../schema';
|
|
3
|
+
/**
|
|
4
|
+
* To replace the import statement for storybook.
|
|
5
|
+
* Need to import app with storybook toggle from .storybook/toggle-storybook
|
|
6
|
+
*/
|
|
7
|
+
export declare function replaceAppImportWithStorybookToggle(host: Tree, schema: StorybookConfigureSchema): void;
|
package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceAppImportWithStorybookToggle = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* To replace the import statement for storybook.
|
|
8
|
+
* Need to import app with storybook toggle from .storybook/toggle-storybook
|
|
9
|
+
*/
|
|
10
|
+
function replaceAppImportWithStorybookToggle(host, schema) {
|
|
11
|
+
const { root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(host, schema.name);
|
|
12
|
+
const mainFilePath = (0, path_1.join)(sourceRoot, schema.js ? 'main.js' : 'main.tsx');
|
|
13
|
+
const appImportImport = `import App from './app/App';`;
|
|
14
|
+
const storybookeToggleImport = `import App from './storybook/toggle-storybook';`;
|
|
15
|
+
try {
|
|
16
|
+
devkit_1.logger.debug(`Updating import for ${mainFilePath}`);
|
|
17
|
+
const contents = host.read(mainFilePath, 'utf-8');
|
|
18
|
+
if (!contents.includes(appImportImport) ||
|
|
19
|
+
contents.includes(storybookeToggleImport)) {
|
|
20
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `${mainFilePath} is already udpated.`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
host.write(mainFilePath, contents.replace(appImportImport, storybookeToggleImport));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `Unable to update import in ${mainFilePath} for project ${root}.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.replaceAppImportWithStorybookToggle = replaceAppImportWithStorybookToggle;
|