@gravity-ui/app-builder 0.1.0 → 0.2.0

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.0](https://github.com/gravity-ui/app-builder/compare/v0.1.1...v0.2.0) (2023-03-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * allow upload to many s3 destinations ([#7](https://github.com/gravity-ui/app-builder/issues/7)) ([406c4b2](https://github.com/gravity-ui/app-builder/commit/406c4b2362793528f85384ec3247f49ce8cbda16))
9
+ * enable verbose mode in `CleanWebpackPlugin` ([#5](https://github.com/gravity-ui/app-builder/issues/5)) ([945f28a](https://github.com/gravity-ui/app-builder/commit/945f28a0875312256af143ca5e98c42fe414691f))
10
+
11
+ ## [0.1.1](https://github.com/gravity-ui/app-builder/compare/v0.1.0...v0.1.1) (2023-03-10)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * correctly load dayjs locales ([#6](https://github.com/gravity-ui/app-builder/issues/6)) ([412dfd6](https://github.com/gravity-ui/app-builder/commit/412dfd6d89dccbda9652a96baa36491db2e6b4dc))
17
+
3
18
  ## [0.1.0](https://github.com/gravity-ui/app-builder/compare/v0.0.2...v0.1.0) (2023-02-07)
4
19
 
5
20
 
@@ -76,7 +76,10 @@ function compileToCjs(code, file, inputSourceMap, sourceDir = paths_1.default.sr
76
76
  fs_1.default.mkdirSync(compiledCjsDir, { recursive: true });
77
77
  babel.transform(finalCode, {
78
78
  filename: sourceFile,
79
- plugins: ['@babel/plugin-transform-modules-commonjs', 'dynamic-import-node'],
79
+ plugins: [
80
+ '@babel/plugin-transform-modules-commonjs',
81
+ '@babel/plugin-proposal-dynamic-import',
82
+ ],
80
83
  sourceMaps: true,
81
84
  inputSourceMap,
82
85
  }, (err, transformedCjs) => {
@@ -138,13 +138,14 @@ export interface ClientConfig {
138
138
  };
139
139
  definitions?: DefinePlugin['definitions'];
140
140
  watchOptions?: Configuration['watchOptions'];
141
- cdn?: {
142
- bucket: string;
143
- prefix?: string;
144
- region?: string;
145
- endpoint?: string;
146
- compress?: boolean;
147
- };
141
+ cdn?: CdnUploadConfig | CdnUploadConfig[];
142
+ }
143
+ interface CdnUploadConfig {
144
+ bucket: string;
145
+ prefix?: string;
146
+ region?: string;
147
+ endpoint?: string;
148
+ compress?: boolean;
148
149
  }
149
150
  export interface ServerConfig {
150
151
  port?: number | true;
@@ -484,6 +484,7 @@ function configurePlugins(options) {
484
484
  const excludeFromClean = config.excludeFromClean || [];
485
485
  const plugins = [
486
486
  new clean_webpack_plugin_1.CleanWebpackPlugin({
487
+ verbose: config.verbose,
487
488
  cleanOnceBeforeBuildPatterns: [
488
489
  '**/*',
489
490
  ...(isEnvDevelopment ? ['!manifest.json'] : []),
@@ -509,7 +510,7 @@ function configurePlugins(options) {
509
510
  new RegExp(`^\\./(${(contextReplacement.locale || ['ru']).join('|')})$`)));
510
511
  plugins.push(new webpack.ContextReplacementPlugin(/dayjs[\\/]locale$/,
511
512
  // eslint-disable-next-line security/detect-non-literal-regexp
512
- new RegExp(`^\\./(${(contextReplacement.locale || ['ru']).join('|')})$`)));
513
+ new RegExp(`^\\./(${(contextReplacement.locale || ['ru']).join('|')})\\.js$`)));
513
514
  if (contextReplacement['highlight.js']) {
514
515
  plugins.push(new webpack.ContextReplacementPlugin(/highlight\.js[\\/]lib[\\/]languages$/,
515
516
  // eslint-disable-next-line security/detect-non-literal-regexp
@@ -596,26 +597,42 @@ function configurePlugins(options) {
596
597
  output: path_1.default.resolve(paths_1.default.appBuild, manifestFile),
597
598
  }));
598
599
  if (config.cdn) {
599
- let credentials;
600
+ let credentialsGlobal;
600
601
  if (process.env.FRONTEND_S3_ACCESS_KEY_ID && process.env.FRONTEND_S3_SECRET_ACCESS_KEY) {
601
- credentials = {
602
+ credentialsGlobal = {
602
603
  accessKeyId: process.env.FRONTEND_S3_ACCESS_KEY_ID,
603
604
  secretAccessKey: process.env.FRONTEND_S3_SECRET_ACCESS_KEY,
604
605
  };
605
606
  }
606
- plugins.push(new s3_upload_1.S3UploadPlugin({
607
- exclude: config.hiddenSourceMap ? /\.map$/ : undefined,
608
- compress: config.cdn.compress,
609
- s3ClientOptions: {
610
- region: config.cdn.region,
611
- endpoint: config.cdn.endpoint,
612
- credentials,
613
- },
614
- s3UploadOptions: {
615
- bucket: config.cdn.bucket,
616
- targetPath: config.cdn.prefix,
617
- },
618
- }));
607
+ const cdns = Array.isArray(config.cdn) ? config.cdn : [config.cdn];
608
+ for (let index = 0; index < cdns.length; index++) {
609
+ const cdn = cdns[index];
610
+ if (!cdn) {
611
+ continue;
612
+ }
613
+ let credentials = credentialsGlobal;
614
+ const accessKeyId = process.env[`FRONTEND_S3_ACCESS_KEY_ID_${index}`];
615
+ const secretAccessKey = process.env[`FRONTEND_S3_SECRET_ACCESS_KEY_${index}`];
616
+ if (accessKeyId && secretAccessKey) {
617
+ credentials = {
618
+ accessKeyId,
619
+ secretAccessKey,
620
+ };
621
+ }
622
+ plugins.push(new s3_upload_1.S3UploadPlugin({
623
+ exclude: config.hiddenSourceMap ? /\.map$/ : undefined,
624
+ compress: cdn.compress,
625
+ s3ClientOptions: {
626
+ region: cdn.region,
627
+ endpoint: cdn.endpoint,
628
+ credentials,
629
+ },
630
+ s3UploadOptions: {
631
+ bucket: cdn.bucket,
632
+ targetPath: cdn.prefix,
633
+ },
634
+ }));
635
+ }
619
636
  }
620
637
  return plugins;
621
638
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -37,20 +37,22 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@aws-sdk/client-s3": "^3.216.0",
40
- "@babel/core": "^7.20.2",
41
- "@babel/plugin-proposal-decorators": "^7.20.2",
42
- "@babel/plugin-transform-modules-commonjs": "^7.19.6",
43
- "@babel/plugin-transform-runtime": "^7.19.6",
40
+ "@babel/core": "^7.21.0",
41
+ "@babel/plugin-proposal-decorators": "^7.21.0",
42
+ "@babel/plugin-proposal-dynamic-import": "^7.18.6",
43
+ "@babel/plugin-transform-modules-commonjs": "^7.21.2",
44
+ "@babel/plugin-transform-runtime": "^7.21.0",
44
45
  "@babel/preset-env": "^7.20.2",
45
46
  "@babel/preset-react": "^7.18.6",
46
- "@babel/preset-typescript": "^7.18.6",
47
- "@babel/runtime": "^7.20.1",
47
+ "@babel/preset-typescript": "^7.21.0",
48
+ "@babel/runtime": "^7.21.0",
48
49
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
49
- "@statoscope/webpack-plugin": "^5.24.0",
50
+ "@statoscope/webpack-plugin": "^5.25.1",
50
51
  "@svgr/core": "^6.5.1",
51
52
  "@svgr/webpack": "^6.5.1",
52
- "babel-loader": "^9.1.0",
53
- "babel-plugin-inline-react-svg": "^2.0.1",
53
+ "babel-loader": "^9.1.2",
54
+ "babel-plugin-dynamic-import-node": "^2.3.3",
55
+ "babel-plugin-inline-react-svg": "^2.0.2",
54
56
  "babel-plugin-lodash": "^3.3.4",
55
57
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
56
58
  "chalk": "^4.1.2",
@@ -59,33 +61,33 @@
59
61
  "clear": "^0.1.0",
60
62
  "common-tags": "^1.8.2",
61
63
  "cosmiconfig": "^7.1.0",
62
- "cosmiconfig-typescript-loader": "^4.2.0",
63
- "css-loader": "^6.7.2",
64
+ "cosmiconfig-typescript-loader": "^4.3.0",
65
+ "css-loader": "^6.7.3",
64
66
  "css-minimizer-webpack-plugin": "^4.2.2",
65
67
  "dotenv": "^16.0.3",
66
68
  "execa": "^5.1.1",
67
69
  "fast-glob": "^3.2.12",
68
70
  "file-type": "^16.5.3",
69
- "fork-ts-checker-webpack-plugin": "^7.2.13",
70
- "fs-extra": "^10.1.0",
71
+ "fork-ts-checker-webpack-plugin": "^7.3.0",
72
+ "fs-extra": "^11.1.0",
71
73
  "get-port": "^5.1.1",
72
74
  "lodash": "^4.17.21",
73
75
  "mime-types": "^2.1.35",
74
- "mini-css-extract-plugin": "^2.7.0",
76
+ "mini-css-extract-plugin": "^2.7.2",
75
77
  "moment-timezone-data-webpack-plugin": "^1.5.1",
76
78
  "nodemon": "^2.0.20",
77
79
  "p-map": "^4.0.0",
78
80
  "p-queue": "^6.6.2",
79
- "pino-pretty": "^9.1.1",
80
- "postcss": "^8.4.19",
81
- "postcss-loader": "^7.0.1",
82
- "postcss-preset-env": "^7.8.3",
83
- "react": "^17.0.2",
84
- "react-dom": "^17.0.2",
81
+ "pino-pretty": "^9.4.0",
82
+ "postcss": "^8.4.21",
83
+ "postcss-loader": "^7.0.2",
84
+ "postcss-preset-env": "^8.0.1",
85
+ "react": "^18.2.0",
86
+ "react-dom": "^18.2.0",
85
87
  "react-refresh": "^0.14.0",
86
88
  "resolve-url-loader": "^5.0.0",
87
- "rimraf": "^3.0.2",
88
- "sass": "^1.56.1",
89
+ "rimraf": "^4.1.2",
90
+ "sass": "^1.58.3",
89
91
  "sass-loader": "^13.2.0",
90
92
  "semver": "^7.3.8",
91
93
  "signal-exit": "^3.0.7",
@@ -94,46 +96,45 @@
94
96
  "style-loader": "^3.3.1",
95
97
  "svgo": "^3.0.2",
96
98
  "ts-node": "10.9.1",
97
- "tslib": "^2.4.1",
98
- "typescript": "^4.9.3",
99
+ "tslib": "^2.5.0",
100
+ "typescript": "^4.9.5",
99
101
  "webpack": "^5.75.0",
100
102
  "webpack-assets-manifest": "^5.1.0",
101
- "webpack-bundle-analyzer": "^4.7.0",
103
+ "webpack-bundle-analyzer": "^4.8.0",
102
104
  "webpack-dev-server": "^4.11.1",
103
105
  "webpack-manifest-plugin": "^5.0.0",
104
106
  "worker-loader": "^3.0.8",
105
- "yargs": "^17.6.2"
107
+ "yargs": "^17.7.1"
106
108
  },
107
109
  "devDependencies": {
108
- "@commitlint/cli": "^17.3.0",
109
- "@commitlint/config-conventional": "^17.3.0",
110
+ "@commitlint/cli": "^17.4.4",
111
+ "@commitlint/config-conventional": "^17.4.4",
110
112
  "@gravity-ui/eslint-config": "^1.0.2",
111
113
  "@gravity-ui/prettier-config": "^1.0.1",
112
114
  "@gravity-ui/tsconfig": "^1.0.0",
113
115
  "@types/circular-dependency-plugin": "^5.0.5",
114
116
  "@types/common-tags": "^1.8.1",
115
- "@types/fs-extra": "^9.0.13",
116
- "@types/jest": "^29.2.4",
117
- "@types/lodash": "^4.14.190",
117
+ "@types/fs-extra": "^11.0.1",
118
+ "@types/jest": "^29.4.0",
119
+ "@types/lodash": "^4.14.191",
118
120
  "@types/mime-types": "^2.1.1",
119
- "@types/node": "^14.18.12",
121
+ "@types/node": "^14.18.37",
120
122
  "@types/nodemon": "^1.19.2",
121
- "@types/rimraf": "^3.0.2",
122
- "@types/sass": "^1.43.1",
123
+ "@types/sass": "^1.45.0",
123
124
  "@types/semver": "^7.3.13",
124
125
  "@types/signal-exit": "^3.0.1",
125
126
  "@types/terser-webpack-plugin": "^5.2.0",
126
127
  "@types/webpack-assets-manifest": "^5.1.0",
127
128
  "@types/webpack-bundle-analyzer": "^4.6.0",
128
129
  "@types/webpack-manifest-plugin": "^3.0.5",
129
- "eslint": "^8.29.0",
130
- "husky": "^8.0.2",
131
- "jest": "^29.3.1",
130
+ "eslint": "^8.35.0",
131
+ "husky": "^8.0.3",
132
+ "jest": "^29.4.3",
132
133
  "monaco-editor-webpack-plugin": "^6.0.0",
133
134
  "nano-staged": "^0.8.0",
134
135
  "npm-run-all": "^4.1.5",
135
136
  "prettier": "^2.8.0",
136
- "ts-jest": "^29.0.3"
137
+ "ts-jest": "^29.0.5"
137
138
  },
138
139
  "peerDependencies": {
139
140
  "monaco-editor-webpack-plugin": "*"