@pega/custom-dx-components 0.25.23 → 0.25.25
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/create/index.js +5 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/CASE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/config.json.mustache +1 -0
- package/src/tasks/create-all/index.js +5 -1
- package/src/tasks/init/template/package.json.mustache +8 -3
- package/src/tasks/init/template/scripts/components.json +3 -0
- package/src/tasks/init/template/scripts/esbuild.dev.js +34 -0
- package/src/tasks/init/template/scripts/index.mustache +26 -0
- package/src/tasks/init/template/scripts/index.ts +1 -0
- package/src/tasks/init/template/scripts/main.js +75 -0
- package/src/tasks/publish-archive/index.js +4 -2
- package/src/tasks/validator/index.js +10 -5
- package/src/util.js +28 -5
- package/tests/assets/library/components/create/Pega_DXIL_MyTestText/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +1 -0
- package/tests/assets/original/components/create/Pega_DXIL_MyTestText/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/config.json +1 -0
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +3 -3
package/package.json
CHANGED
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
getLibraryBased,
|
|
23
23
|
addDebugLog,
|
|
24
24
|
checkLibraryAndArchives,
|
|
25
|
-
getConfigDefaults
|
|
25
|
+
getConfigDefaults,
|
|
26
|
+
getSubTypeLabel
|
|
26
27
|
} from '../../util.js';
|
|
27
28
|
import { COMPONENT_SCHEMA, SHARED_FILE_NAMES } from '../../constants.js';
|
|
28
29
|
|
|
@@ -103,6 +104,8 @@ const compileMustacheTemplates = async (
|
|
|
103
104
|
files.forEach(file => {
|
|
104
105
|
const filePath = path.join(componentDirectory, file);
|
|
105
106
|
|
|
107
|
+
const subTypeLabel = getSubTypeLabel(type, subtype);
|
|
108
|
+
|
|
106
109
|
const output = compileMustacheTemplate(filePath, {
|
|
107
110
|
COMPONENT_KEY: componentKey,
|
|
108
111
|
COMPONENT_NAME: componentName,
|
|
@@ -114,6 +117,7 @@ const compileMustacheTemplates = async (
|
|
|
114
117
|
ALLOWEDAPPS: JSON.stringify(allowedApplications),
|
|
115
118
|
TYPE: type,
|
|
116
119
|
SUB_TYPE: JSON.stringify(mustacheSubType),
|
|
120
|
+
SUB_TYPE_LABEL: subTypeLabel,
|
|
117
121
|
DESCRIPTION: description,
|
|
118
122
|
IS_TEMPLATE: isTemplate,
|
|
119
123
|
IS_PICKLIST: isPicklist,
|
|
@@ -23,7 +23,8 @@ import { checkPathAccess, showVersion ,
|
|
|
23
23
|
getLibraryBased,
|
|
24
24
|
addDebugLog,
|
|
25
25
|
checkLibraryAndArchives,
|
|
26
|
-
getConfigDefaults
|
|
26
|
+
getConfigDefaults,
|
|
27
|
+
getSubTypeLabel
|
|
27
28
|
} from '../../util.js';
|
|
28
29
|
|
|
29
30
|
import { COMPONENT_SCHEMA, COMPONENTS_DIRECTORY_PATH, TASKS_CONFIG_JSON_FILENAME, COMPONENTS_PATH, CATEGORY_CONSTELLATION, SHARED_FILE_NAMES } from '../../constants.js';
|
|
@@ -113,6 +114,8 @@ export const compileMustacheTemplates = async (
|
|
|
113
114
|
files.forEach((file) => {
|
|
114
115
|
const filePath = path.join(componentDirectory, file);
|
|
115
116
|
|
|
117
|
+
const subTypeLabel = getSubTypeLabel(type, subtype).toString();
|
|
118
|
+
|
|
116
119
|
const output = compileMustacheTemplate(filePath, {
|
|
117
120
|
COMPONENT_KEY: componentKey,
|
|
118
121
|
COMPONENT_NAME: componentName,
|
|
@@ -124,6 +127,7 @@ export const compileMustacheTemplates = async (
|
|
|
124
127
|
ALLOWEDAPPS: JSON.stringify(allowedApplications),
|
|
125
128
|
TYPE: type,
|
|
126
129
|
SUB_TYPE: JSON.stringify(mustacheSubType),
|
|
130
|
+
SUB_TYPE_LABEL: subTypeLabel,
|
|
127
131
|
DESCRIPTION: description,
|
|
128
132
|
IS_TEMPLATE: isTemplate,
|
|
129
133
|
IS_PICKLIST: isPicklist,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"publishAll": "custom-dx-components publishAll",
|
|
30
30
|
"promoteWebPack": "custom-dx-components promoteWebPack",
|
|
31
31
|
"revertWebPack": "custom-dx-components revertWebPack",
|
|
32
|
-
"_***Library_mode_only***": "Library mode only commands
|
|
32
|
+
"_***Library_mode_only***": "Library CL mode only commands",
|
|
33
33
|
"createLib": "custom-dx-components createLibrary",
|
|
34
34
|
"switchLib": "custom-dx-components switchLibrary",
|
|
35
35
|
"createLibVersion": "custom-dx-components createVersion",
|
|
@@ -49,6 +49,10 @@
|
|
|
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",
|
|
52
56
|
"_***Internal_only***": "Internal usage only",
|
|
53
57
|
"_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",
|
|
54
58
|
"_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 ",
|
|
@@ -107,7 +111,7 @@
|
|
|
107
111
|
"@babel/preset-react": "^7.26.3",
|
|
108
112
|
"@babel/preset-typescript": "^7.26.0",
|
|
109
113
|
"@pega/configs": "^0.16.2",
|
|
110
|
-
"@pega/custom-dx-components": "~0.25.
|
|
114
|
+
"@pega/custom-dx-components": "~0.25.25",
|
|
111
115
|
"@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
|
|
112
116
|
"@storybook/addon-actions": "^7.6.19",
|
|
113
117
|
"@storybook/addon-essentials": "^7.6.19",
|
|
@@ -153,6 +157,7 @@
|
|
|
153
157
|
"storybook": "^7.6.19",
|
|
154
158
|
"stylelint": "^16.10.0",
|
|
155
159
|
"ts-jest": "^29.2.5",
|
|
156
|
-
"typescript": "~5.5.4"
|
|
160
|
+
"typescript": "~5.5.4",
|
|
161
|
+
"esbuild": "^0.25.0"
|
|
157
162
|
}
|
|
158
163
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* entry point for component map */
|
|
@@ -0,0 +1,75 @@
|
|
|
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();
|
|
@@ -138,6 +138,7 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
138
138
|
const rulesetQuestions = await getPublishComponentQuestions();
|
|
139
139
|
const rulesetAnswers = await inquirer.prompt(rulesetQuestions);
|
|
140
140
|
const { rulesetName, rulesetVersion} = rulesetAnswers;
|
|
141
|
+
const mainDirectory = process.cwd();
|
|
141
142
|
|
|
142
143
|
let content = {
|
|
143
144
|
libraryName : orgLibName,
|
|
@@ -150,9 +151,10 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
150
151
|
|
|
151
152
|
archiveBeforeStore = true;
|
|
152
153
|
|
|
154
|
+
|
|
153
155
|
if (archiveBeforeStore) {
|
|
154
156
|
|
|
155
|
-
|
|
157
|
+
|
|
156
158
|
const archiveFileName = `${orgLibName}_${selectedVersion}.arch.zip`;
|
|
157
159
|
const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
|
|
158
160
|
if (fs.existsSync(archiveDirectory)) {
|
|
@@ -207,7 +209,7 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
207
209
|
content = { ...content, zipContent: zipBuffer.zipContent};
|
|
208
210
|
|
|
209
211
|
try {
|
|
210
|
-
publishComponentLibraryArchiveToServer(content, true )
|
|
212
|
+
publishComponentLibraryArchiveToServer(content, zipBuffer.zipContent, true )
|
|
211
213
|
.then( () => {
|
|
212
214
|
console.log(chalk.green.bold(`Success: Published Archive ${content.libraryName}/${content.version} to server.`));
|
|
213
215
|
})
|
|
@@ -318,8 +318,10 @@ export default async (option) => {
|
|
|
318
318
|
// addDebugLog("validate","", "");
|
|
319
319
|
|
|
320
320
|
let componentToValidate = null;
|
|
321
|
+
let throwTheError = false;
|
|
321
322
|
if (option.params && option.params[3]) {
|
|
322
323
|
componentToValidate = option.params[3];
|
|
324
|
+
throwTheError = true;
|
|
323
325
|
} else if (option && option.task === 'validateSchema') {
|
|
324
326
|
const localComponents = await getComponents();
|
|
325
327
|
const answer = await inquirer.prompt({
|
|
@@ -332,8 +334,10 @@ export default async (option) => {
|
|
|
332
334
|
componentToValidate = answer.component;
|
|
333
335
|
} else if (option.name) {
|
|
334
336
|
componentToValidate = option.value;
|
|
337
|
+
throwTheError = true;
|
|
335
338
|
} else {
|
|
336
339
|
componentToValidate = option;
|
|
340
|
+
throwTheError = true;
|
|
337
341
|
}
|
|
338
342
|
|
|
339
343
|
const componentDirectory = await getComponentDirectoryPath(componentToValidate);
|
|
@@ -369,13 +373,14 @@ export default async (option) => {
|
|
|
369
373
|
componentToValidate &&
|
|
370
374
|
!/^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$/.test(componentToValidate)
|
|
371
375
|
) {
|
|
372
|
-
const ootbComponents = await getOOTBComponents();
|
|
373
|
-
if (ootbComponents.includes(componentToValidate)) {
|
|
374
|
-
throw new Error(`Invalid: Error occurred in validating ${componentToValidate}`);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
376
|
|
|
377
|
+
if (throwTheError) {
|
|
378
|
+
throw new Error (`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
|
|
378
379
|
|
|
380
|
+
}
|
|
381
|
+
console.log(`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
|
|
382
|
+
process.exit(1);
|
|
383
|
+
}
|
|
379
384
|
|
|
380
385
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
381
386
|
} else {
|