@gravity-ui/app-builder 0.2.1 → 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,12 @@
|
|
|
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
|
+
|
|
3
10
|
## [0.2.1](https://github.com/gravity-ui/app-builder/compare/v0.2.0...v0.2.1) (2023-04-24)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -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
|
-
|
|
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
|
});
|