@pega/custom-dx-components 0.25.25 → 0.25.26
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 +1 -1
- package/src/tasks/init/template/package.json.mustache +2 -7
- package/src/util.js +2 -1
- package/src/tasks/init/template/scripts/components.json +0 -3
- package/src/tasks/init/template/scripts/esbuild.dev.js +0 -34
- package/src/tasks/init/template/scripts/index.mustache +0 -26
- package/src/tasks/init/template/scripts/index.ts +0 -1
- package/src/tasks/init/template/scripts/main.js +0 -75
package/package.json
CHANGED
|
@@ -49,10 +49,6 @@
|
|
|
49
49
|
"exportLibVersion": "custom-dx-components exportArchive",
|
|
50
50
|
"validate": "custom-dx-components buildComponent",
|
|
51
51
|
"validateAll": "custom-dx-components buildAllComponents",
|
|
52
|
-
"_***Local component server***": "Commands to lauch local component server for debugging of run time",
|
|
53
|
-
"localDev": "node scripts/esbuild.dev.js",
|
|
54
|
-
"localGenerate": "node scripts/main.js",
|
|
55
|
-
"localStart": "npm run localGenerate && npm run localDev",
|
|
56
52
|
"_***Internal_only***": "Internal usage only",
|
|
57
53
|
"_internal-test-coverage": "node --input-type=module --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand node_modules/@pega/custom-dx-component --ci --testResultsProcessor='jest-junit' --coverage",
|
|
58
54
|
"_internal-test": "echo 'Running functional and unit tests will DELETE existing local components, proceed (y/n)?' && read proceed && if test \"$proceed\" = \"y\"; then npm run _internal-test-full; fi ",
|
|
@@ -111,7 +107,7 @@
|
|
|
111
107
|
"@babel/preset-react": "^7.26.3",
|
|
112
108
|
"@babel/preset-typescript": "^7.26.0",
|
|
113
109
|
"@pega/configs": "^0.16.2",
|
|
114
|
-
"@pega/custom-dx-components": "~0.25.
|
|
110
|
+
"@pega/custom-dx-components": "~0.25.26",
|
|
115
111
|
"@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
|
|
116
112
|
"@storybook/addon-actions": "^7.6.19",
|
|
117
113
|
"@storybook/addon-essentials": "^7.6.19",
|
|
@@ -157,7 +153,6 @@
|
|
|
157
153
|
"storybook": "^7.6.19",
|
|
158
154
|
"stylelint": "^16.10.0",
|
|
159
155
|
"ts-jest": "^29.2.5",
|
|
160
|
-
"typescript": "~5.5.4"
|
|
161
|
-
"esbuild": "^0.25.0"
|
|
156
|
+
"typescript": "~5.5.4"
|
|
162
157
|
}
|
|
163
158
|
}
|
package/src/util.js
CHANGED
|
@@ -1572,7 +1572,8 @@ if (showDebug) addDebugLog("updateC11NB2SForInfinity", "", "");
|
|
|
1572
1572
|
|
|
1573
1573
|
const objOauthData = JSON.parse(OAuthData);
|
|
1574
1574
|
objOauthData["C11NB2S"] = bootstrap.tokens.C11NB2S;
|
|
1575
|
-
objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
|
|
1575
|
+
// objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
|
|
1576
|
+
objOauthData["appStaticContentServer"] = (bootstrap.serviceConfig.appStaticContentServer != "no-cdn" && bootstrap.serviceConfig.appStaticContentServer != "") ? bootstrap.serviceConfig.appStaticContentServer : bootstrap.serviceConfig.staticContentServer;
|
|
1576
1577
|
|
|
1577
1578
|
// write out file
|
|
1578
1579
|
fs.writeFileSync(TOKEN_PATH, JSON.stringify(objOauthData), { encoding: 'utf8',flag:'w' });
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import esbuild from 'esbuild';
|
|
2
|
-
|
|
3
|
-
async function startDevServer() {
|
|
4
|
-
const ctx = await esbuild.context({
|
|
5
|
-
entryPoints: ['scripts/index.ts'],
|
|
6
|
-
bundle: true,
|
|
7
|
-
outdir: 'dist',
|
|
8
|
-
sourcemap: true,
|
|
9
|
-
loader: { '.js': 'jsx' },
|
|
10
|
-
platform: 'browser',
|
|
11
|
-
logLevel: 'info',
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Initial build
|
|
15
|
-
await ctx.rebuild();
|
|
16
|
-
console.log('✨ Initial build complete');
|
|
17
|
-
|
|
18
|
-
// Watch for changes
|
|
19
|
-
await ctx.watch();
|
|
20
|
-
console.log('👀 Watching for changes...');
|
|
21
|
-
|
|
22
|
-
let { host, port } = await ctx.serve({
|
|
23
|
-
servedir: 'dist',
|
|
24
|
-
port: 3030,
|
|
25
|
-
host: 'localhost'
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
console.log(`🚀 Development server running at http://${host}:${port}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
startDevServer().catch((err) => {
|
|
32
|
-
console.error('Error:', err);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const loadable = (importFn: () => Promise<any>, componentName: string) => {
|
|
2
|
-
return async () => {
|
|
3
|
-
if (!PCore.getComponentsRegistry().lazyMap[componentName]) {
|
|
4
|
-
const component = await importFn();
|
|
5
|
-
PCore.getComponentsRegistry().lazyMap[componentName] = component.default;
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const reactComponentsMap = {
|
|
11
|
-
{{#components}}
|
|
12
|
-
{{name}}: {
|
|
13
|
-
modules: [
|
|
14
|
-
loadable(
|
|
15
|
-
() =>
|
|
16
|
-
import(
|
|
17
|
-
/* webpackChunkName: "{{name}}" */ "../src/components/{{name}}/index"
|
|
18
|
-
),
|
|
19
|
-
"{{name}}"
|
|
20
|
-
),
|
|
21
|
-
],
|
|
22
|
-
scripts: [],
|
|
23
|
-
},
|
|
24
|
-
{{/components}}
|
|
25
|
-
};
|
|
26
|
-
PCore.getComponentsRegistry().mergeComponentsMap(reactComponentsMap);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* entry point for component map */
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import Mustache from 'mustache';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
|
|
9
|
-
const componentsDir = path.join(__dirname, '../src/components');
|
|
10
|
-
const componentsJsonPath = path.join(__dirname, './components.json');
|
|
11
|
-
|
|
12
|
-
async function populateComponents() {
|
|
13
|
-
try {
|
|
14
|
-
if (!fs.existsSync(componentsDir)) {
|
|
15
|
-
throw new Error(`Components directory not found: ${componentsDir}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const componentNames = fs.readdirSync(componentsDir)
|
|
19
|
-
.filter(file => {
|
|
20
|
-
const componentPath = path.join(componentsDir, file);
|
|
21
|
-
const configPath = path.join(componentPath, 'config.json');
|
|
22
|
-
return fs.statSync(componentPath).isDirectory() && fs.existsSync(configPath);
|
|
23
|
-
})
|
|
24
|
-
.map(dir => {
|
|
25
|
-
const configPath = path.join(componentsDir, dir, 'config.json');
|
|
26
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
27
|
-
return config.componentKey || dir;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const data = { components: componentNames };
|
|
31
|
-
fs.writeFileSync(componentsJsonPath, JSON.stringify(data, null, 2));
|
|
32
|
-
console.log('Components list updated:', componentNames);
|
|
33
|
-
return componentNames;
|
|
34
|
-
} catch (err) {
|
|
35
|
-
console.error('Error populating components:', err.message);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function generateIndex(components) {
|
|
41
|
-
try {
|
|
42
|
-
const templatePath = path.join(__dirname, './index.mustache');
|
|
43
|
-
const outputPath = path.join(__dirname, './index.ts');
|
|
44
|
-
|
|
45
|
-
if (!fs.existsSync(templatePath)) {
|
|
46
|
-
throw new Error('Template file missing: index.mustache');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const template = fs.readFileSync(templatePath, 'utf-8');
|
|
50
|
-
const templateData = {
|
|
51
|
-
components: components.map(name => ({ name }))
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const output = Mustache.render(template, templateData);
|
|
55
|
-
|
|
56
|
-
// Ensure src directory exists
|
|
57
|
-
const srcDir = path.dirname(outputPath);
|
|
58
|
-
if (!fs.existsSync(srcDir)) {
|
|
59
|
-
fs.mkdirSync(srcDir, { recursive: true });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
fs.writeFileSync(outputPath, output, 'utf-8');
|
|
63
|
-
console.log('Generated exports for components:', components);
|
|
64
|
-
} catch (err) {
|
|
65
|
-
console.error('Error generating index:', err.message);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async function main() {
|
|
71
|
-
const components = await populateComponents();
|
|
72
|
-
await generateIndex(components);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
main();
|