@pega/custom-dx-components 26.1.12-alpha.0.3 → 26.1.12-alpha.0.5
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/package.json +2 -3
- package/src/tasks/build-all/helper.js +3 -2
- package/src/tasks/build-comp/helper.js +3 -2
- package/src/tasks/bundle/builder/index.js +8 -25
- package/src/tasks/bundle/builder/webpack.config.js +0 -11
- package/src/tasks/create/index.js +2 -0
- package/src/tasks/export-rc/helper.js +4 -3
- package/src/tasks/init/index.js +2 -5
- package/src/tasks/init/template/eslint.config.mjs +4 -0
- package/src/tasks/init/template/package-lock.json +52 -1052
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/promote-webpack/webpack.config.js +0 -11
- package/src/tasks/publish/helper.js +3 -2
- package/src/tasks/publish-all/helper.js +3 -2
- package/src/tasks/publish-lib/index.js +3 -2
- package/src/util.js +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/custom-dx-components",
|
|
3
|
-
"version": "26.1.12-alpha.0.
|
|
3
|
+
"version": "26.1.12-alpha.0.5",
|
|
4
4
|
"description": "Utility for building custom UI components",
|
|
5
5
|
"bin": {
|
|
6
6
|
"custom-dx-components": "./bin/index.js"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@pega/constellation-dx-components-build-utils": "^2.0.18",
|
|
38
38
|
"@pega/inquirer-fuzzy-path": "^4.0.0",
|
|
39
39
|
"ajv": "^8.20.0",
|
|
40
|
-
"archiver": "^
|
|
40
|
+
"archiver": "^8.0.0",
|
|
41
41
|
"arg": "^5.0.2",
|
|
42
42
|
"chalk": "^6.0.1",
|
|
43
43
|
"compression-webpack-plugin": "^12.0.0",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"postcss": "^8.5.32",
|
|
58
58
|
"postcss-loader": "8.2.1",
|
|
59
59
|
"postcss-preset-env": "11.6.2",
|
|
60
|
-
"react-dev-utils": "^12.0.1",
|
|
61
60
|
"resolve-url-loader": "^5.0.0",
|
|
62
61
|
"sass-loader": "^17.1.0",
|
|
63
62
|
"terser-webpack-plugin": "5.6.1",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// archiver v8 has no default export; ZipArchive replaces the archiver('zip') factory.
|
|
5
|
+
import { ZipArchive } from 'archiver';
|
|
5
6
|
import chalk from 'chalk';
|
|
6
7
|
|
|
7
8
|
import { getComponentDirectoryPath, getComponents, getPegaServerConfig, addDebugLog } from '../../util.js';
|
|
@@ -35,7 +36,7 @@ export const zipComponent = async (componentKey) => {
|
|
|
35
36
|
const configJson = `${srcDirectory}/config.json`;
|
|
36
37
|
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
37
38
|
|
|
38
|
-
const archive =
|
|
39
|
+
const archive = new ZipArchive({ zlib: { level: 9 } });
|
|
39
40
|
const zipChunks = [];
|
|
40
41
|
archive.on('data', (chunk) => zipChunks.push(chunk));
|
|
41
42
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// archiver v8 has no default export; ZipArchive replaces the archiver('zip') factory.
|
|
5
|
+
import { ZipArchive } from 'archiver';
|
|
5
6
|
import chalk from 'chalk';
|
|
6
7
|
|
|
7
8
|
import { constructCompleteUrl, getComponentDirectoryPath, getComponents, getPegaServerConfig, getFetchAgent, getLibraryBased } from '../../util.js';
|
|
@@ -55,7 +56,7 @@ export const zipComponent = async (componentKey) => {
|
|
|
55
56
|
|
|
56
57
|
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
57
58
|
|
|
58
|
-
const archive =
|
|
59
|
+
const archive = new ZipArchive({ zlib: { level: 9 } });
|
|
59
60
|
const zipChunks = [];
|
|
60
61
|
archive.on('data', (chunk) => zipChunks.push(chunk));
|
|
61
62
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import webpack from 'webpack';
|
|
3
|
-
import FileSizeReporter from 'react-dev-utils/FileSizeReporter.js';
|
|
4
|
-
import printBuildError from 'react-dev-utils/printBuildError.js';
|
|
5
3
|
import { getUseWebPackPromotion, addDebugLog, emptyDirSync } from '../../../util.js';
|
|
6
4
|
|
|
7
5
|
import paths from './paths.js';
|
|
@@ -27,22 +25,11 @@ process.on('unhandledRejection', (err) => {
|
|
|
27
25
|
// process.exit(1);
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
const measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild;
|
|
31
|
-
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
|
|
32
|
-
|
|
33
|
-
// These sizes are pretty large. We'll warn for bundles exceeding them.
|
|
34
|
-
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
|
35
|
-
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
36
|
-
|
|
37
28
|
let compilationErrors = null;
|
|
38
29
|
|
|
39
30
|
// Create the build and print the deployment instructions.
|
|
40
|
-
function build(config,
|
|
41
|
-
addDebugLog(
|
|
42
|
-
'bundle build',
|
|
43
|
-
`config: ${JSON.stringify(config)}, \npreviousFileSizes: ${JSON.stringify(previousFileSizes)}, showStats: ${showStats}`,
|
|
44
|
-
'',
|
|
45
|
-
);
|
|
31
|
+
function build(config, showStats = true) {
|
|
32
|
+
addDebugLog('bundle build', `config: ${JSON.stringify(config)}, showStats: ${showStats}`, '');
|
|
46
33
|
|
|
47
34
|
if (showStats) {
|
|
48
35
|
console.log(`Creating a ${Env} build...`);
|
|
@@ -108,7 +95,6 @@ function build(config, previousFileSizes, showStats = true) {
|
|
|
108
95
|
|
|
109
96
|
const resolveArgs = {
|
|
110
97
|
stats,
|
|
111
|
-
previousFileSizes,
|
|
112
98
|
warnings: messages.warnings,
|
|
113
99
|
};
|
|
114
100
|
return resolve(resolveArgs);
|
|
@@ -137,16 +123,16 @@ export default async ({ inputFile, outputFile, componentKey, externals, globals,
|
|
|
137
123
|
}
|
|
138
124
|
|
|
139
125
|
return new Promise((resolve, reject) => {
|
|
140
|
-
|
|
141
|
-
.then((
|
|
126
|
+
Promise.resolve()
|
|
127
|
+
.then(() => {
|
|
142
128
|
// Remove all content but keep the directory so that
|
|
143
129
|
// if you're in it, you don't end up in Trash
|
|
144
130
|
emptyDirSync(paths.appBuild);
|
|
145
131
|
// Start the webpack build
|
|
146
|
-
return build(config,
|
|
132
|
+
return build(config, showStats);
|
|
147
133
|
})
|
|
148
134
|
.then(
|
|
149
|
-
({
|
|
135
|
+
({ warnings }) => {
|
|
150
136
|
if (showStats) {
|
|
151
137
|
if (warnings.length) {
|
|
152
138
|
// console.log(chalk.yellow('Compiled with warnings.\n'), warnings[0].message);
|
|
@@ -157,9 +143,6 @@ export default async ({ inputFile, outputFile, componentKey, externals, globals,
|
|
|
157
143
|
} else {
|
|
158
144
|
console.log(chalk.green('Compiled successfully.\n'));
|
|
159
145
|
}
|
|
160
|
-
|
|
161
|
-
console.log('File sizes after gzip:\n');
|
|
162
|
-
printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild, WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_CHUNK_GZIP_SIZE);
|
|
163
146
|
}
|
|
164
147
|
|
|
165
148
|
resolve('done emitting');
|
|
@@ -169,7 +152,7 @@ export default async ({ inputFile, outputFile, componentKey, externals, globals,
|
|
|
169
152
|
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
|
|
170
153
|
if (tscCompileOnError) {
|
|
171
154
|
console.log(chalk.yellow('Compiled with the following type errors (you may want to check these before deploying your app):\n'));
|
|
172
|
-
|
|
155
|
+
console.log(err);
|
|
173
156
|
} else if (compilationErrors != null) {
|
|
174
157
|
if (compilationErrors.length == undefined) {
|
|
175
158
|
console.log(chalk.red('Error...'), compilationErrors.message);
|
|
@@ -182,7 +165,7 @@ export default async ({ inputFile, outputFile, componentKey, externals, globals,
|
|
|
182
165
|
// process.exit(1);
|
|
183
166
|
} else {
|
|
184
167
|
console.log(chalk.red('Failed to compile.\n'));
|
|
185
|
-
|
|
168
|
+
console.log(JSON.stringify(err));
|
|
186
169
|
}
|
|
187
170
|
},
|
|
188
171
|
)
|
|
@@ -4,8 +4,6 @@ import webpack from 'webpack';
|
|
|
4
4
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
5
5
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
6
6
|
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
7
|
-
import getCSSModuleLocalIdent from 'react-dev-utils/getCSSModuleLocalIdent.js';
|
|
8
|
-
import ModuleNotFoundPlugin from 'react-dev-utils/ModuleNotFoundPlugin.js';
|
|
9
7
|
import CompressionPlugin from 'compression-webpack-plugin';
|
|
10
8
|
|
|
11
9
|
import paths from './paths.js';
|
|
@@ -200,9 +198,6 @@ export default (
|
|
|
200
198
|
use: getStyleLoaders({
|
|
201
199
|
importLoaders: 1,
|
|
202
200
|
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
203
|
-
modules: {
|
|
204
|
-
getLocalIdent: getCSSModuleLocalIdent,
|
|
205
|
-
},
|
|
206
201
|
}),
|
|
207
202
|
},
|
|
208
203
|
// Opt-in support for SASS (using .scss or .sass extensions).
|
|
@@ -232,9 +227,6 @@ export default (
|
|
|
232
227
|
{
|
|
233
228
|
importLoaders: 3,
|
|
234
229
|
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
|
|
235
|
-
modules: {
|
|
236
|
-
getLocalIdent: getCSSModuleLocalIdent,
|
|
237
|
-
},
|
|
238
230
|
},
|
|
239
231
|
'sass-loader',
|
|
240
232
|
),
|
|
@@ -262,9 +254,6 @@ export default (
|
|
|
262
254
|
],
|
|
263
255
|
},
|
|
264
256
|
plugins: [
|
|
265
|
-
// This gives some necessary context to module not found errors, such as
|
|
266
|
-
// the requesting resource.
|
|
267
|
-
new ModuleNotFoundPlugin(paths.appPath),
|
|
268
257
|
// Makes some environment variables available to the JS code, for example:
|
|
269
258
|
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
|
|
270
259
|
// It is absolutely essential that NODE_ENV is set to production
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
getStandaloneMaxLibraryCount,
|
|
28
28
|
getStandaloneMaxComponentNameCount,
|
|
29
29
|
getStandaloneMaxLibraryFromPrefixCount,
|
|
30
|
+
normalizeOrganization,
|
|
30
31
|
} from '../../util.js';
|
|
31
32
|
import { COMPONENT_SCHEMA, SHARED_FILE_NAMES } from '../../constants.js';
|
|
32
33
|
|
|
@@ -203,6 +204,7 @@ const validateCompile = async ({ componentName, componentLabel, library, version
|
|
|
203
204
|
if (organization == null) {
|
|
204
205
|
({ organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8')));
|
|
205
206
|
}
|
|
207
|
+
organization = normalizeOrganization(organization);
|
|
206
208
|
|
|
207
209
|
const componentKey = `${organization}_${library}_${componentName}`;
|
|
208
210
|
const targetDirectory = await getComponentDirectoryPath(componentKey);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
-
|
|
4
|
+
// archiver v8 has no default export; ZipArchive replaces the archiver('zip') factory.
|
|
5
|
+
import { ZipArchive } from 'archiver';
|
|
5
6
|
import fs from 'fs';
|
|
6
7
|
import {
|
|
7
8
|
addDebugLog,
|
|
@@ -200,7 +201,7 @@ export const zipComponent = async (componentKey) => {
|
|
|
200
201
|
const configJson = `${srcDirectory}/config.json`;
|
|
201
202
|
const localizationJson = `${srcDirectory}/localizations.json`;
|
|
202
203
|
|
|
203
|
-
const archive =
|
|
204
|
+
const archive = new ZipArchive({ zlib: { level: 9 } });
|
|
204
205
|
const zipChunks = [];
|
|
205
206
|
archive.on('data', (chunk) => zipChunks.push(chunk));
|
|
206
207
|
|
|
@@ -263,7 +264,7 @@ export const zipRC = async (content, archiveDirectory, archiveFileName) => {
|
|
|
263
264
|
const archiveFile = join(archiveDirectory, archiveFileName);
|
|
264
265
|
|
|
265
266
|
const output = fs.createWriteStream(archiveFile);
|
|
266
|
-
const archive =
|
|
267
|
+
const archive = new ZipArchive({
|
|
267
268
|
zlib: { level: 9 }, // Sets the compression level.
|
|
268
269
|
});
|
|
269
270
|
|
package/src/tasks/init/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import chalk from 'chalk';
|
|
|
5
5
|
import { execa } from 'execa';
|
|
6
6
|
import { Listr, PRESET_TIMER } from 'listr2';
|
|
7
7
|
import inquirer from 'inquirer';
|
|
8
|
-
import { compileMustacheTemplate,
|
|
8
|
+
import { compileMustacheTemplate, normalizeOrganization, sanitize } from '../../util.js';
|
|
9
9
|
import { getInitProjectQuestions } from './helper.js';
|
|
10
10
|
import { enableAgentFiles } from '../../ai/index.js';
|
|
11
11
|
|
|
@@ -37,10 +37,7 @@ const copyProjectTemplate = async (options) => {
|
|
|
37
37
|
|
|
38
38
|
let { organization, projectName } = options;
|
|
39
39
|
projectName = sanitize(projectName).toLowerCase();
|
|
40
|
-
organization =
|
|
41
|
-
if (!isPascalCase(organization)) {
|
|
42
|
-
organization = convertIntoPascalCase(organization);
|
|
43
|
-
}
|
|
40
|
+
organization = normalizeOrganization(organization);
|
|
44
41
|
options = { ...options, organization, projectName };
|
|
45
42
|
|
|
46
43
|
// Compile and write package.json in one go
|
|
@@ -10,6 +10,10 @@ export default defineConfig([
|
|
|
10
10
|
eslintReact.configs['recommended-typescript'],
|
|
11
11
|
globalIgnores([
|
|
12
12
|
'**/node_modules',
|
|
13
|
+
// generated by jest --coverage, not source
|
|
14
|
+
'**/coverage/**',
|
|
15
|
+
// buildAllComponents writes bundles to <org>_<library>/ at the project root
|
|
16
|
+
'*_*/**',
|
|
13
17
|
// agent skills ship sample assets that are not part of the TypeScript project
|
|
14
18
|
'.claude/**',
|
|
15
19
|
'packages/*/lib',
|