create-react-starter-kit 1.0.3 → 1.0.4

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.
@@ -1,3 +1,11 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ <% if (buildTool === 'vite' || buildTool === 'esbuild') { -%>
4
+ import { mergeConfig } from 'vite';
5
+ <% } -%>
6
+
7
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
8
+
1
9
  /** @type { import('@storybook/<%= buildTool === 'vite' || buildTool === 'esbuild' ? 'react-vite' : 'react-webpack5' %>').StorybookConfig } */
2
10
  const config = {
3
11
  stories: ['../src/**/*.stories.@(<%= isTypeScript ? 'ts|tsx' : 'js|jsx' %>)'],
@@ -9,6 +17,26 @@ const config = {
9
17
  docs: {
10
18
  autodocs: 'tag',
11
19
  },
20
+ <% if (buildTool === 'vite' || buildTool === 'esbuild') { -%>
21
+ async viteFinal(config) {
22
+ return mergeConfig(config, {
23
+ resolve: {
24
+ alias: {
25
+ '@': path.resolve(dirname, '../src'),
26
+ },
27
+ },
28
+ });
29
+ },
30
+ <% } else { -%>
31
+ async webpackFinal(config) {
32
+ config.resolve = config.resolve ?? {};
33
+ config.resolve.alias = {
34
+ ...(config.resolve.alias ?? {}),
35
+ '@': path.resolve(dirname, '../src'),
36
+ };
37
+ return config;
38
+ },
39
+ <% } -%>
12
40
  };
13
41
 
14
42
  export default config;
@@ -1,11 +1,13 @@
1
+ <% if (isTypeScript) { -%>
2
+ import type { Preview } from '@storybook/react';
3
+ <% } -%>
1
4
  import { AppProviders } from '../src/providers';
2
5
  <% if (router === 'react-router') { -%>
3
6
  import { MemoryRouter } from 'react-router-dom';
4
7
  <% } -%>
5
8
  import '../src/styles/global.<%= styling === 'sass' && uiLibrary !== 'shadcn' ? 'scss' : 'css' %>';
6
9
 
7
- /** @type { import('@storybook/react').Preview } */
8
- const preview = {
10
+ const preview<% if (isTypeScript) { %>: Preview<% } %> = {
9
11
  parameters: {
10
12
  layout: 'padded',
11
13
  controls: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-react-starter-kit",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Interactive CLI to scaffold a production-ready React app with your preferred stack",
5
5
  "keywords": [
6
6
  "react",
@@ -1,3 +1,11 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ <% if (buildTool === 'vite' || buildTool === 'esbuild') { -%>
4
+ import { mergeConfig } from 'vite';
5
+ <% } -%>
6
+
7
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
8
+
1
9
  /** @type { import('@storybook/<%= buildTool === 'vite' || buildTool === 'esbuild' ? 'react-vite' : 'react-webpack5' %>').StorybookConfig } */
2
10
  const config = {
3
11
  stories: ['../src/**/*.stories.@(<%= isTypeScript ? 'ts|tsx' : 'js|jsx' %>)'],
@@ -9,6 +17,26 @@ const config = {
9
17
  docs: {
10
18
  autodocs: 'tag',
11
19
  },
20
+ <% if (buildTool === 'vite' || buildTool === 'esbuild') { -%>
21
+ async viteFinal(config) {
22
+ return mergeConfig(config, {
23
+ resolve: {
24
+ alias: {
25
+ '@': path.resolve(dirname, '../src'),
26
+ },
27
+ },
28
+ });
29
+ },
30
+ <% } else { -%>
31
+ async webpackFinal(config) {
32
+ config.resolve = config.resolve ?? {};
33
+ config.resolve.alias = {
34
+ ...(config.resolve.alias ?? {}),
35
+ '@': path.resolve(dirname, '../src'),
36
+ };
37
+ return config;
38
+ },
39
+ <% } -%>
12
40
  };
13
41
 
14
42
  export default config;
@@ -1,11 +1,13 @@
1
+ <% if (isTypeScript) { -%>
2
+ import type { Preview } from '@storybook/react';
3
+ <% } -%>
1
4
  import { AppProviders } from '../src/providers';
2
5
  <% if (router === 'react-router') { -%>
3
6
  import { MemoryRouter } from 'react-router-dom';
4
7
  <% } -%>
5
8
  import '../src/styles/global.<%= styling === 'sass' && uiLibrary !== 'shadcn' ? 'scss' : 'css' %>';
6
9
 
7
- /** @type { import('@storybook/react').Preview } */
8
- const preview = {
10
+ const preview<% if (isTypeScript) { %>: Preview<% } %> = {
9
11
  parameters: {
10
12
  layout: 'padded',
11
13
  controls: {
@@ -1,40 +0,0 @@
1
- import { AppProviders } from '../src/providers';
2
- <% if (router === 'react-router') { -%>
3
- import { MemoryRouter } from 'react-router-dom';
4
- <% } -%>
5
- import '../src/styles/global.<%= styling === 'sass' && uiLibrary !== 'shadcn' ? 'scss' : 'css' %>';
6
-
7
- /** @type { import('@storybook/react').Preview } */
8
- const preview = {
9
- parameters: {
10
- layout: 'padded',
11
- controls: {
12
- matchers: {
13
- color: /(background|color)$/i,
14
- date: /Date$/i,
15
- },
16
- },
17
- docs: {
18
- toc: true,
19
- },
20
- },
21
- decorators: [
22
- (Story) => (
23
- <AppProviders>
24
- <% if (router === 'react-router') { -%>
25
- <MemoryRouter>
26
- <div style={{ maxWidth: 960, margin: '0 auto' }}>
27
- <Story />
28
- </div>
29
- </MemoryRouter>
30
- <% } else { -%>
31
- <div style={{ maxWidth: 960, margin: '0 auto' }}>
32
- <Story />
33
- </div>
34
- <% } -%>
35
- </AppProviders>
36
- ),
37
- ],
38
- };
39
-
40
- export default preview;
@@ -1,40 +0,0 @@
1
- import { AppProviders } from '../src/providers';
2
- <% if (router === 'react-router') { -%>
3
- import { MemoryRouter } from 'react-router-dom';
4
- <% } -%>
5
- import '../src/styles/global.<%= styling === 'sass' && uiLibrary !== 'shadcn' ? 'scss' : 'css' %>';
6
-
7
- /** @type { import('@storybook/react').Preview } */
8
- const preview = {
9
- parameters: {
10
- layout: 'padded',
11
- controls: {
12
- matchers: {
13
- color: /(background|color)$/i,
14
- date: /Date$/i,
15
- },
16
- },
17
- docs: {
18
- toc: true,
19
- },
20
- },
21
- decorators: [
22
- (Story) => (
23
- <AppProviders>
24
- <% if (router === 'react-router') { -%>
25
- <MemoryRouter>
26
- <div style={{ maxWidth: 960, margin: '0 auto' }}>
27
- <Story />
28
- </div>
29
- </MemoryRouter>
30
- <% } else { -%>
31
- <div style={{ maxWidth: 960, margin: '0 auto' }}>
32
- <Story />
33
- </div>
34
- <% } -%>
35
- </AppProviders>
36
- ),
37
- ],
38
- };
39
-
40
- export default preview;