@gravity-ui/app-builder 0.2.0 → 0.2.2

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.2](https://github.com/gravity-ui/app-builder/compare/v0.2.1...v0.2.2) (2023-05-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * allow upload of additional files to CDN ([#15](https://github.com/gravity-ui/app-builder/issues/15)) ([dcdf8e0](https://github.com/gravity-ui/app-builder/commit/dcdf8e06d4d19a50fce3f6bbc48f4cf9ac2c7926))
9
+
10
+ ## [0.2.1](https://github.com/gravity-ui/app-builder/compare/v0.2.0...v0.2.1) (2023-04-24)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **cli:** correctly consider --inspect/--inspect-brk options without value ([#11](https://github.com/gravity-ui/app-builder/issues/11)) ([a5c74c3](https://github.com/gravity-ui/app-builder/commit/a5c74c39e64d6fc57bf10eb3e49596d96a9e8dcb))
16
+ * sove fixes ([#13](https://github.com/gravity-ui/app-builder/issues/13)) ([e4f9e1a](https://github.com/gravity-ui/app-builder/commit/e4f9e1a14c9e71197e91586a9c254db880f8ac11))
17
+
3
18
  ## [0.2.0](https://github.com/gravity-ui/app-builder/compare/v0.1.1...v0.2.0) (2023-03-10)
4
19
 
5
20
 
@@ -41,6 +41,7 @@ async function buildWebpackServer(config) {
41
41
  }, liveReload: false, hot: true, client: {
42
42
  webSocketURL: { pathname: webSocketPath },
43
43
  overlay: {
44
+ runtimeErrors: config.verbose,
44
45
  warnings: config.verbose,
45
46
  },
46
47
  }, webSocketServer: {
@@ -146,6 +146,10 @@ interface CdnUploadConfig {
146
146
  region?: string;
147
147
  endpoint?: string;
148
148
  compress?: boolean;
149
+ /**
150
+ * pattern for additional files in build that need to be loaded to CDN
151
+ */
152
+ additionalPattern?: string | string[];
149
153
  }
150
154
  export interface ServerConfig {
151
155
  port?: number | true;
@@ -7,6 +7,7 @@ interface S3UploadPluginOptions {
7
7
  compress?: boolean;
8
8
  s3ClientOptions: S3ClientOptions;
9
9
  s3UploadOptions: Pick<UploadOptions, 'bucket' | 'targetPath' | 'existsBehavior'>;
10
+ additionalPattern?: string | string[];
10
11
  }
11
12
  export declare class S3UploadPlugin {
12
13
  private options;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.S3UploadPlugin = void 0;
4
7
  const webpack_1 = require("webpack");
8
+ const fast_glob_1 = __importDefault(require("fast-glob"));
5
9
  const upload_js_1 = require("./upload.js");
6
10
  class S3UploadPlugin {
7
11
  constructor(options) {
@@ -10,7 +14,14 @@ class S3UploadPlugin {
10
14
  apply(compiler) {
11
15
  compiler.hooks.done.tapPromise('S3UploadPlugin', async ({ compilation }) => {
12
16
  var _a;
13
- const fileNames = Object.keys(compilation.assets).filter((name) => {
17
+ let fileNames = Object.keys(compilation.assets);
18
+ if (this.options.additionalPattern) {
19
+ const additionallFiles = fast_glob_1.default.sync(this.options.additionalPattern, {
20
+ cwd: compilation.outputOptions.path,
21
+ });
22
+ fileNames = fileNames.concat(additionallFiles);
23
+ }
24
+ fileNames = fileNames.filter((name) => {
14
25
  const fullPath = compilation.outputOptions.path + '/' + name;
15
26
  return this.isIncludeAndNotExclude(fullPath);
16
27
  });
@@ -14,7 +14,7 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
14
14
  getCurrentDirectory: ts.sys.getCurrentDirectory,
15
15
  getNewLine: () => ts.sys.newLine,
16
16
  };
17
- const host = ts.createWatchCompilerHost(configPath, { noEmitOnError: false, inlineSourceMap: enableSourceMap, inlineSources: enableSourceMap }, ts.sys, createProgram, reportDiagnostic, reportWatchStatusChanged);
17
+ const host = ts.createWatchCompilerHost(configPath, Object.assign({ noEmitOnError: false, inlineSourceMap: enableSourceMap, inlineSources: enableSourceMap }, (enableSourceMap ? { sourceMap: false } : undefined)), ts.sys, createProgram, reportDiagnostic, reportWatchStatusChanged);
18
18
  host.readFile = (0, utils_1.displayFilename)(host.readFile, 'Reading', logger);
19
19
  (0, utils_1.onHostEvent)(host, 'createProgram', () => {
20
20
  logger.verbose("We're about to create the program");
@@ -524,7 +524,8 @@ function configurePlugins(options) {
524
524
  publicPath: path_1.default.normalize(config.publicPathPrefix + '/build/') })));
525
525
  }
526
526
  if (isEnvDevelopment && !config.disableReactRefresh) {
527
- plugins.push(new react_refresh_webpack_plugin_1.default());
527
+ const { webSocketPath = path_1.default.normalize(`/${config.publicPathPrefix}/build/sockjs-node`) } = config.devServer || {};
528
+ plugins.push(new react_refresh_webpack_plugin_1.default({ overlay: { sockPath: webSocketPath } }));
528
529
  }
529
530
  if (config.detectCircularDependencies) {
530
531
  let circularPluginOptions = {
@@ -631,6 +632,7 @@ function configurePlugins(options) {
631
632
  bucket: cdn.bucket,
632
633
  targetPath: cdn.prefix,
633
634
  },
635
+ additionalPattern: cdn.additionalPattern,
634
636
  }));
635
637
  }
636
638
  }
@@ -45,7 +45,7 @@ function resolveTsconfigPathsToAlias(tsConfigPath) {
45
45
  }
46
46
  const basePath = path_1.default.resolve(path_1.default.dirname(tsConfigPath), baseUrl);
47
47
  const aliases = {};
48
- const modules = [];
48
+ const modules = [basePath];
49
49
  for (const [key, value] of Object.entries(paths)) {
50
50
  if (!Array.isArray(value) || value.length === 0) {
51
51
  continue;
@@ -86,11 +86,13 @@ function createCli(argv) {
86
86
  group: 'Server',
87
87
  type: 'number',
88
88
  describe: 'Opens a port for debugging',
89
+ coerce: (arg) => (arg === undefined ? null : arg),
89
90
  })
90
91
  .option('inspect-brk', {
91
92
  group: 'Server',
92
93
  type: 'number',
93
94
  describe: 'Opens a port for debugging. Will block until debugger is attached',
95
+ coerce: (arg) => (arg === undefined ? null : arg),
94
96
  })
95
97
  .option('entry-filter', {
96
98
  group: 'Client',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -101,7 +101,7 @@
101
101
  "webpack": "^5.75.0",
102
102
  "webpack-assets-manifest": "^5.1.0",
103
103
  "webpack-bundle-analyzer": "^4.8.0",
104
- "webpack-dev-server": "^4.11.1",
104
+ "webpack-dev-server": "^4.13.2",
105
105
  "webpack-manifest-plugin": "^5.0.0",
106
106
  "worker-loader": "^3.0.8",
107
107
  "yargs": "^17.7.1"