@gravity-ui/app-builder 0.5.2 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.4](https://github.com/gravity-ui/app-builder/compare/v0.5.3...v0.5.4) (2023-07-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * **ForkTSCheckerWebpackPlugin:** allow overwrite config ([#40](https://github.com/gravity-ui/app-builder/issues/40)) ([7490647](https://github.com/gravity-ui/app-builder/commit/74906477d707973dc885b0050ecc018ad6e43a00))
9
+
10
+ ## [0.5.3](https://github.com/gravity-ui/app-builder/compare/v0.5.2...v0.5.3) (2023-06-30)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **storybook:** support storybook 7 ([#38](https://github.com/gravity-ui/app-builder/issues/38)) ([1e51ac3](https://github.com/gravity-ui/app-builder/commit/1e51ac3dca99acd9b5a2a53a2525bcd90224e861))
16
+
3
17
  ## [0.5.2](https://github.com/gravity-ui/app-builder/compare/v0.5.1...v0.5.2) (2023-06-28)
4
18
 
5
19
 
package/README.md CHANGED
@@ -187,7 +187,7 @@ With this `{rootDir}/src/ui/tsconfig.json`:
187
187
  - `svgr` (`SvgrConfig`) — svgr plugin options. [more](https://react-svgr.com/docs/options/)
188
188
  - `entryFilter` (`string[]`) — filter used entrypoints.
189
189
  - `excludeFromClean` (`string[]`) — do not clean provided paths before build.
190
- - `disableForkTsChecker` (`boolean`) - do not use `ForkTsChecker`.
190
+ - `forkTsCheker` (`false | ForkTsCheckerWebpackPluginOptions`) - config for ForkTsCheckerWebpackPlugin [more](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#options). If `false`, ForkTsCheckerWebpackPlugin will be disabled.
191
191
 
192
192
  ##### Dev build
193
193
 
@@ -1,5 +1,7 @@
1
1
  import type { NormalizedServiceConfig, ServiceConfig, LibraryConfig } from './models';
2
2
  import type { CliArgs } from '../create-cli';
3
- export declare function getProjectConfig(command: string, { env, ...argv }: Partial<CliArgs>): Promise<LibraryConfig | NormalizedServiceConfig>;
3
+ export declare function getProjectConfig(command: string, { env, storybook, ...argv }: Partial<CliArgs> & {
4
+ storybook?: boolean;
5
+ }): Promise<LibraryConfig | NormalizedServiceConfig>;
4
6
  export declare function normalizeConfig(userConfig: ServiceConfig, mode?: 'dev' | 'build' | string): Promise<NormalizedServiceConfig>;
5
7
  export declare function normalizeConfig(userConfig: LibraryConfig, mode?: 'dev' | 'build' | string): Promise<LibraryConfig>;
@@ -19,7 +19,26 @@ function remapPaths(paths) {
19
19
  function omitUndefined(obj) {
20
20
  return lodash_1.default.omitBy(obj, lodash_1.default.isUndefined);
21
21
  }
22
- async function getProjectConfig(command, { env, ...argv }) {
22
+ function getModuleLoader({ storybook } = {}) {
23
+ if (!storybook) {
24
+ return (0, cosmiconfig_typescript_loader_1.TypeScriptLoader)();
25
+ }
26
+ // storybook 7 uses esbuild-register to compile ts to cjs
27
+ // https://github.com/storybookjs/storybook/blob/c1ec290b3a74ce05b23f74250539ae571bffaa66/code/lib/core-common/src/utils/interpret-require.ts#L11
28
+ // esbuild-register uses pirates.addHook which adds _extensions[ext] to Module
29
+ const hasEsbuildRegistered = Boolean(require('module')._extensions['.ts']);
30
+ if (hasEsbuildRegistered) {
31
+ return (pathname) => {
32
+ // eslint-disable-next-line security/detect-non-literal-require
33
+ const result = require(pathname);
34
+ return result.default || result;
35
+ };
36
+ }
37
+ else {
38
+ return (0, cosmiconfig_typescript_loader_1.TypeScriptLoader)();
39
+ }
40
+ }
41
+ async function getProjectConfig(command, { env, storybook, ...argv }) {
23
42
  function getLoader(loader) {
24
43
  return async (pathname, content) => {
25
44
  const config = loader(pathname, content);
@@ -29,7 +48,7 @@ async function getProjectConfig(command, { env, ...argv }) {
29
48
  return config;
30
49
  };
31
50
  }
32
- const tsLoader = getLoader((0, cosmiconfig_typescript_loader_1.TypeScriptLoader)());
51
+ const tsLoader = getLoader(getModuleLoader({ storybook }));
33
52
  const moduleName = 'app-builder';
34
53
  const explorer = (0, cosmiconfig_1.cosmiconfigSync)(moduleName, {
35
54
  cache: false,
@@ -6,6 +6,7 @@ import type { Configuration, ResolveOptions, DefinePlugin } from 'webpack';
6
6
  import type { ServerConfiguration } from 'webpack-dev-server';
7
7
  import type { Options as CircularDependenciesOptions } from 'circular-dependency-plugin';
8
8
  import type { Config as SvgrConfig } from '@svgr/core';
9
+ import type { ForkTsCheckerWebpackPluginOptions } from 'fork-ts-checker-webpack-plugin/lib/plugin-options';
9
10
  export interface Entities<T> {
10
11
  data: Record<string, T>;
11
12
  keys: string[];
@@ -137,7 +138,11 @@ export interface ClientConfig {
137
138
  * use new JSX Transform
138
139
  */
139
140
  newJsxTransform?: boolean;
141
+ /**
142
+ * @deprecated
143
+ * */
140
144
  disableForkTsChecker?: boolean;
145
+ forkTsChecker?: false | ForkTsCheckerWebpackPluginOptions;
141
146
  disableSourceMapGeneration?: boolean;
142
147
  lazyCompilation?: boolean | LazyCompilationConfig;
143
148
  polyfill?: {
@@ -585,8 +585,9 @@ function configurePlugins(options) {
585
585
  }
586
586
  plugins.push(new circular_dependency_plugin_1.default(circularPluginOptions));
587
587
  }
588
- if (!config.disableForkTsChecker) {
588
+ if (!config.disableForkTsChecker && config.forkTsChecker !== false) {
589
589
  plugins.push(new fork_ts_checker_webpack_plugin_1.default({
590
+ ...config.forkTsChecker,
590
591
  typescript: {
591
592
  typescriptPath: require.resolve((0, path_1.resolve)(paths_1.default.appNodeModules, 'typescript')),
592
593
  configFile: (0, path_1.resolve)(paths_1.default.app, 'src/ui/tsconfig.json'),
@@ -594,6 +595,7 @@ function configurePlugins(options) {
594
595
  syntactic: true,
595
596
  },
596
597
  mode: 'write-references',
598
+ ...config.forkTsChecker?.typescript,
597
599
  },
598
600
  }));
599
601
  }
@@ -12,7 +12,9 @@ const config_1 = require("./config");
12
12
  const config_2 = require("../config");
13
13
  const models_1 = require("../models");
14
14
  async function configureServiceWebpackConfig(mode, storybookConfig) {
15
- const serviceConfig = await (0, config_2.getProjectConfig)(mode === "production" /* WebpackMode.Prod */ ? 'build' : 'dev', {});
15
+ const serviceConfig = await (0, config_2.getProjectConfig)(mode === "production" /* WebpackMode.Prod */ ? 'build' : 'dev', {
16
+ storybook: true,
17
+ });
16
18
  let options = {};
17
19
  if ((0, models_1.isLibraryConfig)(serviceConfig)) {
18
20
  options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "prepublishOnly": "npm run build"
57
57
  },
58
58
  "dependencies": {
59
- "@aws-sdk/client-s3": "^3.293.0",
59
+ "@aws-sdk/client-s3": "^3.353.0",
60
60
  "@babel/core": "^7.21.4",
61
61
  "@babel/plugin-proposal-decorators": "^7.21.0",
62
62
  "@babel/plugin-proposal-dynamic-import": "^7.18.6",
@@ -108,7 +108,7 @@
108
108
  "rimraf": "^5.0.0",
109
109
  "sass": "^1.62.1",
110
110
  "sass-loader": "^13.3.1",
111
- "semver": "^7.5.0",
111
+ "semver": "^7.5.2",
112
112
  "signal-exit": "^3.0.7",
113
113
  "source-map-loader": "^4.0.1",
114
114
  "strip-ansi": "^6.0.1",
@@ -126,8 +126,8 @@
126
126
  "yargs": "^17.7.2"
127
127
  },
128
128
  "devDependencies": {
129
- "@commitlint/cli": "^17.6.5",
130
- "@commitlint/config-conventional": "^17.6.5",
129
+ "@commitlint/cli": "^17.6.6",
130
+ "@commitlint/config-conventional": "^17.6.6",
131
131
  "@gravity-ui/eslint-config": "^1.0.2",
132
132
  "@gravity-ui/prettier-config": "^1.0.1",
133
133
  "@gravity-ui/tsconfig": "^1.0.0",