@faststore/cli 3.99.0 → 4.0.0-dev.1

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.
Files changed (96) hide show
  1. package/README.md +48 -39
  2. package/bin/dev.cmd +1 -1
  3. package/bin/dev.js +5 -0
  4. package/bin/run.js +5 -0
  5. package/dist/index.js +2252 -19
  6. package/dist/index.js.map +1 -1
  7. package/package.json +46 -27
  8. package/bin/dev +0 -17
  9. package/bin/run +0 -5
  10. package/dist/__mocks__/hcms.d.ts +0 -62
  11. package/dist/__mocks__/hcms.d.ts.map +0 -1
  12. package/dist/__mocks__/hcms.js +0 -184
  13. package/dist/__mocks__/hcms.js.map +0 -1
  14. package/dist/commands/build.d.ts +0 -12
  15. package/dist/commands/build.d.ts.map +0 -1
  16. package/dist/commands/build.js +0 -118
  17. package/dist/commands/build.js.map +0 -1
  18. package/dist/commands/cms-sync.d.ts +0 -13
  19. package/dist/commands/cms-sync.d.ts.map +0 -1
  20. package/dist/commands/cms-sync.js +0 -39
  21. package/dist/commands/cms-sync.js.map +0 -1
  22. package/dist/commands/create.d.ts +0 -11
  23. package/dist/commands/create.d.ts.map +0 -1
  24. package/dist/commands/create.js +0 -38
  25. package/dist/commands/create.js.map +0 -1
  26. package/dist/commands/dev.d.ts +0 -12
  27. package/dist/commands/dev.d.ts.map +0 -1
  28. package/dist/commands/dev.js +0 -164
  29. package/dist/commands/dev.js.map +0 -1
  30. package/dist/commands/generate-graphql.d.ts +0 -12
  31. package/dist/commands/generate-graphql.d.ts.map +0 -1
  32. package/dist/commands/generate-graphql.js +0 -60
  33. package/dist/commands/generate-graphql.js.map +0 -1
  34. package/dist/commands/start.d.ts +0 -10
  35. package/dist/commands/start.d.ts.map +0 -1
  36. package/dist/commands/start.js +0 -40
  37. package/dist/commands/start.js.map +0 -1
  38. package/dist/commands/test.d.ts +0 -9
  39. package/dist/commands/test.d.ts.map +0 -1
  40. package/dist/commands/test.js +0 -79
  41. package/dist/commands/test.js.map +0 -1
  42. package/dist/index.d.ts +0 -16
  43. package/dist/index.d.ts.map +0 -1
  44. package/dist/utils/commands.d.ts +0 -2
  45. package/dist/utils/commands.d.ts.map +0 -1
  46. package/dist/utils/commands.js +0 -16
  47. package/dist/utils/commands.js.map +0 -1
  48. package/dist/utils/createNextjsPages.d.ts +0 -2
  49. package/dist/utils/createNextjsPages.d.ts.map +0 -1
  50. package/dist/utils/createNextjsPages.js +0 -83
  51. package/dist/utils/createNextjsPages.js.map +0 -1
  52. package/dist/utils/dependencies.d.ts +0 -8
  53. package/dist/utils/dependencies.d.ts.map +0 -1
  54. package/dist/utils/dependencies.js +0 -17
  55. package/dist/utils/dependencies.js.map +0 -1
  56. package/dist/utils/deprecations.d.ts +0 -7
  57. package/dist/utils/deprecations.d.ts.map +0 -1
  58. package/dist/utils/deprecations.js +0 -32
  59. package/dist/utils/deprecations.js.map +0 -1
  60. package/dist/utils/directory.d.ts +0 -26
  61. package/dist/utils/directory.d.ts.map +0 -1
  62. package/dist/utils/directory.js +0 -68
  63. package/dist/utils/directory.js.map +0 -1
  64. package/dist/utils/directory.test.d.ts +0 -2
  65. package/dist/utils/directory.test.d.ts.map +0 -1
  66. package/dist/utils/directory.test.js +0 -175
  67. package/dist/utils/directory.test.js.map +0 -1
  68. package/dist/utils/generate.d.ts +0 -7
  69. package/dist/utils/generate.d.ts.map +0 -1
  70. package/dist/utils/generate.js +0 -387
  71. package/dist/utils/generate.js.map +0 -1
  72. package/dist/utils/hcms.d.ts +0 -25
  73. package/dist/utils/hcms.d.ts.map +0 -1
  74. package/dist/utils/hcms.js +0 -118
  75. package/dist/utils/hcms.js.map +0 -1
  76. package/dist/utils/hcms.test.d.ts +0 -2
  77. package/dist/utils/hcms.test.d.ts.map +0 -1
  78. package/dist/utils/hcms.test.js +0 -189
  79. package/dist/utils/hcms.test.js.map +0 -1
  80. package/dist/utils/logger.d.ts +0 -2
  81. package/dist/utils/logger.d.ts.map +0 -1
  82. package/dist/utils/logger.js +0 -16
  83. package/dist/utils/logger.js.map +0 -1
  84. package/dist/utils/plugins.d.ts +0 -25
  85. package/dist/utils/plugins.d.ts.map +0 -1
  86. package/dist/utils/plugins.js +0 -235
  87. package/dist/utils/plugins.js.map +0 -1
  88. package/dist/utils/runCommandSync.d.ts +0 -7
  89. package/dist/utils/runCommandSync.d.ts.map +0 -1
  90. package/dist/utils/runCommandSync.js +0 -45
  91. package/dist/utils/runCommandSync.js.map +0 -1
  92. package/dist/utils/templates/myAccountPage.d.ts +0 -2
  93. package/dist/utils/templates/myAccountPage.d.ts.map +0 -1
  94. package/dist/utils/templates/myAccountPage.js +0 -49
  95. package/dist/utils/templates/myAccountPage.js.map +0 -1
  96. package/oclif.manifest.json +0 -1
@@ -1,118 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeCMSFiles = exports.mergeCMSFile = exports.dedupeAndMergeDefinitions = exports.splitCustomDefinitions = void 0;
4
- const tslib_1 = require("tslib");
5
- const path_1 = tslib_1.__importDefault(require("path"));
6
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
- const core_1 = require("@oclif/core");
8
- const fs_extra_1 = require("fs-extra");
9
- const directory_1 = require("./directory");
10
- const plugins_1 = require("./plugins");
11
- function splitCustomDefinitions(coreDefinitions, customDefinitions, primaryIdentifier) {
12
- const coreDefinitionIdentifiers = new Set(coreDefinitions.map((definition) => definition[primaryIdentifier] ?? ''));
13
- const duplicates = [];
14
- const newDefinitions = [];
15
- customDefinitions.forEach((definition) => {
16
- if (!definition[primaryIdentifier]) {
17
- console.error('Ignoring invalid definition:', definition);
18
- return;
19
- }
20
- if (coreDefinitionIdentifiers.has(definition[primaryIdentifier])) {
21
- duplicates.push(definition);
22
- return;
23
- }
24
- newDefinitions.push(definition);
25
- });
26
- return { duplicates, newDefinitions };
27
- }
28
- exports.splitCustomDefinitions = splitCustomDefinitions;
29
- function dedupeAndMergeDefinitions(coreDefinitions, duplicates, primaryIdentifier) {
30
- const sortedCoreDefs = coreDefinitions.filter((definition) => Boolean(definition[primaryIdentifier]));
31
- sortedCoreDefs.sort((a, b) => a[primaryIdentifier] < b[primaryIdentifier] ? -1 : 1);
32
- const sortedDuplicates = duplicates.filter((definition) => Boolean(definition[primaryIdentifier]));
33
- sortedDuplicates.sort((a, b) => a[primaryIdentifier] < b[primaryIdentifier] ? -1 : 1);
34
- let duplicateIdx = 0;
35
- const result = sortedCoreDefs.map((currentDefinition) => {
36
- const isDuplicateMatch = currentDefinition[primaryIdentifier] ===
37
- sortedDuplicates[duplicateIdx]?.[primaryIdentifier];
38
- if (duplicateIdx < sortedDuplicates.length && isDuplicateMatch) {
39
- return sortedDuplicates[duplicateIdx++];
40
- }
41
- return currentDefinition;
42
- });
43
- return result;
44
- }
45
- exports.dedupeAndMergeDefinitions = dedupeAndMergeDefinitions;
46
- async function confirmUserChoice(duplicates, fileName) {
47
- const goAhead = await core_1.CliUx.ux.confirm(`You are about to override default ${fileName.split('.')[0]}:\n\n${duplicates
48
- .map((definition) => definition.id || definition.name)
49
- .join('\n')}\n\nAre you sure? [yes/no]`);
50
- if (!goAhead) {
51
- throw new Error('cms-sync cancelled by user.');
52
- }
53
- return;
54
- }
55
- async function mergeCMSFile(fileName, basePath) {
56
- const { coreCMSDir, userCMSDir, tmpCMSDir, getPackagePath, userStoreConfigFile, } = (0, directory_1.withBasePath)(basePath);
57
- const userStoreConfig = await Promise.resolve(`${path_1.default.resolve(userStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
58
- const cmsProjectName = userStoreConfig.contentSource?.project ?? 'faststore';
59
- const coreFilePath = path_1.default.join(coreCMSDir, fileName);
60
- const customFilePath = path_1.default.join(userCMSDir, fileName);
61
- const coreFile = (0, fs_extra_1.readFileSync)(coreFilePath, 'utf8');
62
- const coreDefinitions = JSON.parse(coreFile);
63
- const primaryIdentifierForDefinitions = fileName === 'content-types.json' ? 'id' : 'name';
64
- let output = coreDefinitions;
65
- const plugins = await (0, plugins_1.getPluginsList)(basePath);
66
- const pluginCMSFilePaths = plugins.map((plugin) => getPackagePath((0, plugins_1.getPluginName)(plugin), 'cms', 'faststore', fileName));
67
- const customizations = [...pluginCMSFilePaths, customFilePath].filter((pluginCMSFilePath) => (0, fs_extra_1.existsSync)(pluginCMSFilePath));
68
- // TODO: create a validation when the CMS files exist but don't have a component for them
69
- for (const newFilePath of customizations) {
70
- const customFile = (0, fs_extra_1.readFileSync)(newFilePath, 'utf8');
71
- try {
72
- const customDefinitions = JSON.parse(customFile);
73
- const { duplicates, newDefinitions } = splitCustomDefinitions(output, customDefinitions, primaryIdentifierForDefinitions);
74
- if (duplicates.length) {
75
- if (newFilePath === customFilePath) {
76
- await confirmUserChoice(duplicates, fileName);
77
- }
78
- output = [
79
- ...dedupeAndMergeDefinitions(output, duplicates, primaryIdentifierForDefinitions),
80
- ...newDefinitions,
81
- ];
82
- }
83
- else {
84
- output = [...output, ...newDefinitions];
85
- }
86
- }
87
- catch (err) {
88
- if (err instanceof SyntaxError) {
89
- console.info(`${chalk_1.default.red('error')} - ${fileName} is a malformed JSON file, ignoring its contents.`);
90
- }
91
- else {
92
- throw err;
93
- }
94
- }
95
- }
96
- try {
97
- if (!(0, fs_extra_1.existsSync)(tmpCMSDir(cmsProjectName))) {
98
- (0, fs_extra_1.mkdirSync)(tmpCMSDir(cmsProjectName));
99
- }
100
- (0, fs_extra_1.writeFileSync)(path_1.default.join(tmpCMSDir(cmsProjectName), fileName), JSON.stringify(output));
101
- console.log(`${chalk_1.default.green('success')} - CMS file ${chalk_1.default.dim(fileName)} created`);
102
- }
103
- catch (err) {
104
- console.error(`${chalk_1.default.red('error')} - ${err}`);
105
- }
106
- }
107
- exports.mergeCMSFile = mergeCMSFile;
108
- async function mergeCMSFiles(basePath) {
109
- try {
110
- await mergeCMSFile('content-types.json', basePath);
111
- await mergeCMSFile('sections.json', basePath);
112
- }
113
- catch (err) {
114
- console.error(`${chalk_1.default.red('error')} - ${err}`);
115
- }
116
- }
117
- exports.mergeCMSFiles = mergeCMSFiles;
118
- //# sourceMappingURL=hcms.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hcms.js","sourceRoot":"","sources":["../../src/utils/hcms.ts"],"names":[],"mappings":";;;;AAAA,wDAAuB;AACvB,0DAAyB;AACzB,sCAAmC;AACnC,uCAA6E;AAE7E,2CAA0C;AAC1C,uCAAyD;AAqBzD,SAAgB,sBAAsB,CACpC,eAAiD,EACjD,iBAAmD,EACnD,iBAAgC;IAEhC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CACvC,eAAe,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CACzE,CAAA;IAED,MAAM,UAAU,GAAqC,EAAE,CAAA;IACvD,MAAM,cAAc,GAAqC,EAAE,CAAA;IAE3D,iBAAiB,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACvC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,UAAU,CAAC,CAAA;YACzD,OAAM;QACR,CAAC;QAED,IACE,yBAAyB,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAW,CAAC,EACtE,CAAC;YACD,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAC3B,OAAM;QACR,CAAC;QAED,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAA;AACvC,CAAC;AA7BD,wDA6BC;AAED,SAAgB,yBAAyB,CACvC,eAAiD,EACjD,UAA4C,EAC5C,iBAAgC;IAEhC,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAC3D,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CACvC,CAAA;IAC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,EAAE,CAAC;YAC3C,IAAA,oBAAS,EAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAA;QACtC,CAAC;QACD,IAAA,wBAAa,EACX,cAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,EAC9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACvB,CAAA;QACD,OAAO,CAAC,GAAG,CACT,GAAG,eAAK,CAAC,KAAK,CAAC,SAAS,CAAC,eAAe,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CACtE,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjD,CAAC;AACH,CAAC;AAzFD,oCAyFC;AAEM,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAA;QAClD,MAAM,YAAY,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACjD,CAAC;AACH,CAAC;AAPD,sCAOC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=hcms.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hcms.test.d.ts","sourceRoot":"","sources":["../../src/utils/hcms.test.ts"],"names":[],"mappings":""}
@@ -1,189 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const path_1 = tslib_1.__importDefault(require("path"));
5
- const hcms_1 = require("../__mocks__/hcms");
6
- const hcms_2 = require("./hcms");
7
- const directory_1 = require("./directory");
8
- jest.mock('fs-extra', () => ({
9
- mkdirSync: jest.fn(),
10
- readFileSync: jest.fn(),
11
- existsSync: jest.fn(),
12
- writeFileSync: jest.fn(),
13
- }));
14
- jest.mock('./plugins', () => ({
15
- getPluginsList: jest.fn(),
16
- }));
17
- describe('mergeCMSFile', () => {
18
- it("should create a resulting file that contains all core definitions if a custom definitions file doesn't exist", async () => {
19
- const { readFileSync, existsSync, writeFileSync } = require('fs-extra');
20
- const { tmpCMSDir, userStoreConfigFile } = (0, directory_1.withBasePath)('.');
21
- existsSync.mockReturnValueOnce(false);
22
- readFileSync.mockReturnValueOnce(JSON.stringify(hcms_1.coreContentTypes));
23
- jest.mock(path_1.default.resolve(userStoreConfigFile), () => ({
24
- contentSource: {
25
- project: 'faststore-3',
26
- },
27
- }), { virtual: true });
28
- const { getPluginsList } = require('./plugins');
29
- getPluginsList.mockResolvedValue([]);
30
- await (0, hcms_2.mergeCMSFile)('content-types.json', '.');
31
- expect(writeFileSync).toHaveBeenCalledWith(path_1.default.join(tmpCMSDir('faststore-3'), 'content-types.json'), JSON.stringify(hcms_1.coreContentTypes));
32
- existsSync.mockReturnValueOnce(false);
33
- readFileSync.mockReturnValueOnce(JSON.stringify(hcms_1.coreSections));
34
- await (0, hcms_2.mergeCMSFile)('sections.json', '.');
35
- expect(writeFileSync).toHaveBeenCalledWith(path_1.default.join(tmpCMSDir('faststore-3'), 'sections.json'), JSON.stringify(hcms_1.coreSections));
36
- });
37
- });
38
- describe('splitCustomDefinitions', () => {
39
- it('should return empty arrays if there are no custom definitions', () => {
40
- // content-types
41
- expect((0, hcms_2.splitCustomDefinitions)(hcms_1.coreContentTypes, [], 'id')).toEqual({
42
- duplicates: [],
43
- newDefinitions: [],
44
- });
45
- // sections
46
- expect((0, hcms_2.splitCustomDefinitions)(hcms_1.coreSections, [], 'name')).toEqual({
47
- duplicates: [],
48
- newDefinitions: [],
49
- });
50
- });
51
- it('should return empty duplicates array if all custom definitions are new', () => {
52
- // content-types
53
- expect((0, hcms_2.splitCustomDefinitions)(hcms_1.coreContentTypes, hcms_1.allNewCustomContentTypes, 'id')).toEqual({
54
- duplicates: [],
55
- newDefinitions: hcms_1.allNewCustomContentTypes,
56
- });
57
- // sections
58
- expect((0, hcms_2.splitCustomDefinitions)(hcms_1.coreSections, hcms_1.allNewCustomSections, 'name')).toEqual({
59
- duplicates: [],
60
- newDefinitions: hcms_1.allNewCustomSections,
61
- });
62
- });
63
- it('should return expected split definitions', () => {
64
- // content-types
65
- expect((0, hcms_2.splitCustomDefinitions)(hcms_1.coreContentTypes, hcms_1.customContentTypesWithDuplicates, 'id')).toEqual({
66
- duplicates: hcms_1.contentTypeDuplicates,
67
- newDefinitions: hcms_1.allNewCustomContentTypes,
68
- });
69
- // sections
70
- expect((0, hcms_2.splitCustomDefinitions)(hcms_1.coreSections, hcms_1.customSectionsWithDuplicates, 'name')).toEqual({
71
- duplicates: hcms_1.sectionDuplicates,
72
- newDefinitions: hcms_1.allNewCustomSections,
73
- });
74
- });
75
- });
76
- describe('dedupeAndMergeDefinitions', () => {
77
- it('should return the exact same core definitions if there are no duplicates', () => {
78
- expect((0, hcms_2.dedupeAndMergeDefinitions)(hcms_1.coreContentTypes, [], 'id')).toEqual(hcms_1.coreContentTypes);
79
- expect((0, hcms_2.dedupeAndMergeDefinitions)(hcms_1.coreSections, [], 'name')).toEqual(hcms_1.coreSections);
80
- });
81
- it('should return expected merged definitions, applying overrides based on duplicates', () => {
82
- expect((0, hcms_2.dedupeAndMergeDefinitions)(hcms_1.coreContentTypes, hcms_1.contentTypeDuplicates, 'id')).toEqual([
83
- {
84
- id: '404',
85
- name: 'Error 404',
86
- configurationSchemaSets: [],
87
- isSingleton: true,
88
- },
89
- {
90
- id: '500',
91
- name: 'Error 500',
92
- configurationSchemaSets: [],
93
- isSingleton: true,
94
- },
95
- {
96
- id: 'globalSections',
97
- name: 'Global Sections',
98
- configurationSchemaSets: [],
99
- isSingleton: true,
100
- },
101
- {
102
- id: 'home',
103
- name: 'Home',
104
- isSingleton: true,
105
- configurationSchemaSets: [],
106
- },
107
- {
108
- id: 'landingPage',
109
- name: 'Landing Page',
110
- configurationSchemaSets: [],
111
- },
112
- {
113
- id: 'login',
114
- name: 'Custom Login. Why not...',
115
- configurationSchemaSets: [],
116
- isSingleton: true,
117
- },
118
- {
119
- id: 'pdp',
120
- name: 'Product Page',
121
- isSingleton: true,
122
- configurationSchemaSets: [],
123
- },
124
- {
125
- id: 'plp',
126
- name: 'Product List Page',
127
- isSingleton: true,
128
- configurationSchemaSets: [],
129
- },
130
- {
131
- id: 'search',
132
- name: 'Custom Search Page',
133
- isSingleton: true,
134
- configurationSchemaSets: [],
135
- },
136
- ]);
137
- expect((0, hcms_2.dedupeAndMergeDefinitions)(hcms_1.coreSections, hcms_1.sectionDuplicates, 'name')).toEqual([
138
- {
139
- name: 'Alert',
140
- schema: {
141
- title: 'Alert',
142
- description: 'Add an alert',
143
- properties: {},
144
- },
145
- },
146
- {
147
- name: 'BannerNewsletter',
148
- schema: {
149
- title: 'Newsletter + Cool Banner',
150
- description: 'Totally not spam.',
151
- properties: {},
152
- },
153
- },
154
- {
155
- name: 'Hero',
156
- schema: {
157
- title: 'Hero',
158
- description: 'Very careful with the image you choose here... not that we have anything to hide ;)',
159
- properties: {},
160
- },
161
- },
162
- {
163
- name: 'Navbar',
164
- schema: {
165
- title: 'Navbar',
166
- description: 'Navbar configuration',
167
- properties: {},
168
- },
169
- },
170
- {
171
- name: 'ProductShelf',
172
- schema: {
173
- title: 'Product Shelf',
174
- description: 'Add custom shelves to your store',
175
- properties: {},
176
- },
177
- },
178
- {
179
- name: 'Search',
180
- schema: {
181
- title: 'Search Bar',
182
- description: 'Search Bar Configuration',
183
- properties: {},
184
- },
185
- },
186
- ]);
187
- });
188
- });
189
- //# sourceMappingURL=hcms.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hcms.test.js","sourceRoot":"","sources":["../../src/utils/hcms.test.ts"],"names":[],"mappings":";;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;oBAC3B,UAAU,EAAE,EAAE;iBACf;aACF;YACD;gBACE,IAAI,EAAE,kBAAkB;gBACxB,MAAM,EAAE;oBACN,KAAK,EAAE,0BAA0B;oBACjC,WAAW,EAAE,mBAAmB;oBAChC,UAAU,EAAE,EAAE;iBACf;aACF;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE;oBACN,KAAK,EAAE,MAAM;oBACb,WAAW,EACT,qFAAqF;oBACvF,UAAU,EAAE,EAAE;iBACf;aACF;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE;oBACN,KAAK,EAAE,QAAQ;oBACf,WAAW,EAAE,sBAAsB;oBACnC,UAAU,EAAE,EAAE;iBACf;aACF;YACD;gBACE,IAAI,EAAE,cAAc;gBACpB,MAAM,EAAE;oBACN,KAAK,EAAE,eAAe;oBACtB,WAAW,EAAE,kCAAkC;oBAC/C,UAAU,EAAE,EAAE;iBACf;aACF;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE;oBACN,KAAK,EAAE,YAAY;oBACnB,WAAW,EAAE,0BAA0B;oBACvC,UAAU,EAAE,EAAE;iBACf;aACF;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const logger: Console;
2
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,SAWjB,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logger = void 0;
4
- exports.logger = new Proxy(console, {
5
- get(target, prop) {
6
- if (prop === 'log') {
7
- return (...args) => {
8
- if (process.env.DISCOVERY_DEBUG === 'true') {
9
- target.log(...args);
10
- }
11
- };
12
- }
13
- return target[prop];
14
- },
15
- });
16
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE;IACvC,GAAG,CAAC,MAAM,EAAE,IAAmB;QAC7B,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE;gBACxB,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,EAAE,CAAC;oBAC3C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAA;gBACrB,CAAC;YACH,CAAC,CAAA;QACH,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAA;IACrB,CAAC;CACF,CAAC,CAAA"}
@@ -1,25 +0,0 @@
1
- export type PageConfig = {
2
- path: string;
3
- appLayout: boolean;
4
- name: string;
5
- };
6
- export type APIConfig = {
7
- path: string;
8
- };
9
- export type PluginConfig = {
10
- pages?: {
11
- [pageName: string]: Partial<PageConfig>;
12
- };
13
- apis?: {
14
- [pageName: string]: Partial<APIConfig>;
15
- };
16
- };
17
- export type Plugin = string | {
18
- [pluginName: string]: PluginConfig;
19
- };
20
- export declare const getPluginName: (plugin: Plugin) => string;
21
- export declare const getPluginsList: (basePath: string) => Promise<Plugin[]>;
22
- export declare function addPluginsSections(basePath: string, plugins: Plugin[]): Promise<void>;
23
- export declare function addPluginsOverrides(basePath: string, plugins: Plugin[]): Promise<void>;
24
- export declare const installPlugins: (basePath: string) => Promise<void>;
25
- //# sourceMappingURL=plugins.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/utils/plugins.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;KAAE,CAAA;IACnD,IAAI,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;KAAE,CAAA;CAClD,CAAA;AAED,MAAM,MAAM,MAAM,GACd,MAAM,GACN;IACE,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAAA;CACnC,CAAA;AAkBL,eAAO,MAAM,aAAa,WAAY,MAAM,WAM3C,CAAA;AAeD,eAAO,MAAM,cAAc,aAAoB,MAAM,KAAG,QAAQ,MAAM,EAAE,CAWvE,CAAA;AAwHD,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,iBAkC3E;AAED,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,iBAoC5E;AAwED,eAAO,MAAM,cAAc,aAAoB,MAAM,kBAUpD,CAAA"}
@@ -1,235 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.installPlugins = exports.addPluginsOverrides = exports.addPluginsSections = exports.getPluginsList = exports.getPluginName = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs_extra_1 = require("fs-extra");
6
- const directory_1 = require("./directory");
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const logger_1 = require("./logger");
9
- const PLUGIN_CONFIG_FILE = 'plugin.config.js';
10
- const sanitizePluginName = (pluginName, pascalCase = false) => {
11
- const sanitized = pluginName.split('/')[1];
12
- if (pascalCase) {
13
- return sanitized
14
- .toLowerCase()
15
- .split('-')
16
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
17
- .join('');
18
- }
19
- return sanitized;
20
- };
21
- const getPluginName = (plugin) => {
22
- if (typeof plugin === 'string') {
23
- return plugin;
24
- }
25
- return Object.keys(plugin)[0];
26
- };
27
- exports.getPluginName = getPluginName;
28
- const getPluginCustomConfig = (plugin) => {
29
- if (typeof plugin === 'string') {
30
- return {};
31
- }
32
- return plugin[(0, exports.getPluginName)(plugin)];
33
- };
34
- const getPluginSrcPath = async (basePath, pluginName) => {
35
- const { getPackagePath } = (0, directory_1.withBasePath)(basePath);
36
- return getPackagePath(pluginName, 'src');
37
- };
38
- const getPluginsList = async (basePath) => {
39
- const { tmpStoreConfigFile } = (0, directory_1.withBasePath)(basePath);
40
- try {
41
- const { plugins = [] } = await Promise.resolve(`${tmpStoreConfigFile}`).then(s => tslib_1.__importStar(require(s)));
42
- return plugins;
43
- }
44
- catch (error) {
45
- logger_1.logger.error(`Could not load plugins from store config`);
46
- }
47
- return [];
48
- };
49
- exports.getPluginsList = getPluginsList;
50
- const copyPluginsSrc = async (basePath, plugins) => {
51
- const { tmpPluginsDir } = (0, directory_1.withBasePath)(basePath);
52
- logger_1.logger.log('Copying plugins files');
53
- plugins.forEach(async (plugin) => {
54
- const pluginName = (0, exports.getPluginName)(plugin);
55
- const pluginSrcPath = await getPluginSrcPath(basePath, (0, exports.getPluginName)(pluginName));
56
- const pluginDestPath = path_1.default.join(tmpPluginsDir, sanitizePluginName(pluginName));
57
- (0, fs_extra_1.copySync)(pluginSrcPath, pluginDestPath);
58
- logger_1.logger.log(`Copied ${pluginName} files`);
59
- });
60
- };
61
- const copyPluginPublicFiles = async (basePath, plugins) => {
62
- const { tmpDir, getPackagePath } = (0, directory_1.withBasePath)(basePath);
63
- logger_1.logger.log('Copying plugin public files');
64
- plugins.forEach(async (plugin) => {
65
- const pluginName = (0, exports.getPluginName)(plugin);
66
- const pluginPath = getPackagePath((0, exports.getPluginName)(pluginName));
67
- try {
68
- if ((0, fs_extra_1.existsSync)(`${pluginPath}/public`)) {
69
- (0, fs_extra_1.copySync)(`${pluginPath}/public`, `${tmpDir}/public`, {
70
- dereference: true,
71
- overwrite: true,
72
- });
73
- logger_1.logger.log(`Plugin public files copied`);
74
- }
75
- }
76
- catch (e) {
77
- logger_1.logger.error(e);
78
- }
79
- });
80
- };
81
- const getPluginPageFileContent = (pluginName, pageName, appLayout) => `
82
- // GENERATED FILE
83
- // @ts-nocheck
84
- import * as page from 'src/plugins/${pluginName}/pages/${pageName}'
85
- ${appLayout ? `import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'` : ``}
86
- ${appLayout ? `import RenderSections from 'src/components/cms/RenderSections'` : ``}
87
-
88
- export async function getServerSideProps(${appLayout ? '{ previewData, ...otherProps }' : 'otherProps'}) {
89
- const noop = async function() {}
90
- const loaderData = await (page.loader || noop)(otherProps)
91
- ${appLayout ? `const { sections = [] } = await getGlobalSectionsData(previewData)` : ``}
92
-
93
- return {
94
- props: {
95
- data: loaderData,
96
- ${appLayout ? 'globalSections: sections' : ``}
97
- }
98
- }
99
- }
100
- export default function Page(props) {
101
- ${appLayout
102
- ? `return <RenderSections globalSections={props.globalSections}>
103
- {page.default(props.data)}
104
- </RenderSections>`
105
- : `return page.default(props.data)`}
106
- }
107
- `;
108
- const generatePluginPages = async (basePath, plugins) => {
109
- const { tmpPagesDir, getPackagePath } = (0, directory_1.withBasePath)(basePath);
110
- logger_1.logger.log('Generating plugin pages');
111
- plugins.forEach(async (plugin) => {
112
- const pluginName = (0, exports.getPluginName)(plugin);
113
- const pluginConfigPath = getPackagePath(pluginName, PLUGIN_CONFIG_FILE);
114
- const pluginConfig = await Promise.resolve(`${pluginConfigPath}`).then(s => tslib_1.__importStar(require(s)));
115
- const { pages: pagesCustom } = getPluginCustomConfig(plugin);
116
- const pagesConfig = {
117
- ...(pluginConfig.pages ?? {}),
118
- ...pagesCustom,
119
- };
120
- const pages = Object.keys(pagesConfig);
121
- pages.forEach(async (pageName) => {
122
- const paths = pagesConfig[pageName].path.split('/');
123
- const pageFile = paths.pop();
124
- const pagePaths = paths;
125
- const pagePath = path_1.default.join(tmpPagesDir, ...pagePaths, pageFile + '.tsx');
126
- const fileContent = getPluginPageFileContent(sanitizePluginName(pluginName), pageName, pagesConfig[pageName].appLayout);
127
- (0, fs_extra_1.mkdirSync)(path_1.default.dirname(pagePath), { recursive: true });
128
- (0, fs_extra_1.writeFileSync)(pagePath, fileContent);
129
- });
130
- });
131
- };
132
- async function addPluginsSections(basePath, plugins) {
133
- const { tmpPluginsDir, getPackagePath } = (0, directory_1.withBasePath)(basePath);
134
- logger_1.logger.log('Adding plugin sections');
135
- const indexPluginsOverrides = plugins
136
- .filter((plugin) => (0, fs_extra_1.existsSync)(getPackagePath((0, exports.getPluginName)(plugin), 'src', 'components', 'index.ts')))
137
- .map((plugin) => {
138
- const pluginReference = sanitizePluginName((0, exports.getPluginName)(plugin), true) + 'Components';
139
- return {
140
- import: `import { default as ${pluginReference} } from 'src/plugins/${sanitizePluginName((0, exports.getPluginName)(plugin))}/components'`,
141
- pluginReference,
142
- };
143
- });
144
- const pluginsImportFileContent = `
145
- ${indexPluginsOverrides.map((plugin) => plugin.import).join('\n')}
146
-
147
- export default {
148
- ${indexPluginsOverrides.map((plugin) => `...${plugin.pluginReference}`).join(',\n')}
149
- }
150
- `;
151
- const sectionPath = path_1.default.join(tmpPluginsDir, 'index.ts');
152
- (0, fs_extra_1.writeFileSync)(sectionPath, pluginsImportFileContent);
153
- logger_1.logger.log('Writing plugins overrides');
154
- logger_1.logger.log(sectionPath);
155
- logger_1.logger.log(pluginsImportFileContent);
156
- }
157
- exports.addPluginsSections = addPluginsSections;
158
- async function addPluginsOverrides(basePath, plugins) {
159
- const { tmpPluginsDir, getPackagePath } = (0, directory_1.withBasePath)(basePath);
160
- logger_1.logger.log('Adding plugin overrides');
161
- plugins
162
- .map((plugin) => ({
163
- pluginName: (0, exports.getPluginName)(plugin),
164
- pluginOverridesPath: getPackagePath((0, exports.getPluginName)(plugin), 'src', 'components', 'overrides'),
165
- }))
166
- .filter(({ pluginOverridesPath }) => (0, fs_extra_1.existsSync)(pluginOverridesPath))
167
- .reverse()
168
- .forEach(({ pluginName, pluginOverridesPath }) => {
169
- const overrideFilesAlreadyCopied = [];
170
- const sanitizedPluginName = sanitizePluginName(pluginName);
171
- const overrideFiles = (0, fs_extra_1.readdirSync)(pluginOverridesPath);
172
- overrideFiles
173
- .filter((file) => !overrideFilesAlreadyCopied.includes(file))
174
- .forEach((overrideFileName) => {
175
- const overrideFileContent = `export { override } from 'src/plugins/${sanitizedPluginName}/components/overrides/${overrideFileName.split('.')[0]}'`;
176
- (0, fs_extra_1.writeFileSync)(path_1.default.join(tmpPluginsDir, 'overrides', overrideFileName), overrideFileContent);
177
- overrideFilesAlreadyCopied.push(overrideFileName);
178
- });
179
- });
180
- }
181
- exports.addPluginsOverrides = addPluginsOverrides;
182
- const addPluginsTheme = async (basePath, plugins) => {
183
- const { getPackagePath, tmpThemesPluginsFile } = (0, directory_1.withBasePath)(basePath);
184
- const pluginImportsContent = plugins
185
- .filter((plugin) => (0, fs_extra_1.existsSync)(getPackagePath((0, exports.getPluginName)(plugin), 'src', 'themes', 'index.scss')))
186
- .map((plugin) => `@import "${(0, exports.getPluginName)(plugin)}/src/themes/index.scss"`)
187
- .join('\n');
188
- (0, fs_extra_1.writeFileSync)(tmpThemesPluginsFile, pluginImportsContent);
189
- };
190
- const getPluginAPIFileContent = (pluginName, apiName) => `
191
- // GENERATED FILE
192
- // @ts-nocheck
193
- import apiHandle from 'src/plugins/${pluginName}/apis/${apiName}'
194
- import { NextApiRequest, NextApiResponse } from "next/types"
195
-
196
- export default function handle(req: NextApiRequest, res: NextApiResponse) {
197
- return apiHandle(req, res)
198
- }
199
- `;
200
- const generatePluginApis = async (basePath, plugins) => {
201
- const { tmpApiDir, getPackagePath } = (0, directory_1.withBasePath)(basePath);
202
- logger_1.logger.log('Generating plugin APIs');
203
- plugins.forEach(async (plugin) => {
204
- const pluginName = (0, exports.getPluginName)(plugin);
205
- const pluginConfigPath = getPackagePath(pluginName, PLUGIN_CONFIG_FILE);
206
- const pluginConfig = await Promise.resolve(`${pluginConfigPath}`).then(s => tslib_1.__importStar(require(s)));
207
- const { apis: apisCustom } = getPluginCustomConfig(plugin);
208
- const apisConfig = {
209
- ...(pluginConfig.apis ?? {}),
210
- ...apisCustom,
211
- };
212
- const apis = Object.keys(apisConfig);
213
- apis.forEach(async (apiName) => {
214
- const paths = apisConfig[apiName].path.split('/');
215
- const apiFile = paths.pop();
216
- const apiPaths = paths;
217
- const apiPath = path_1.default.join(tmpApiDir, 'plugins', ...apiPaths, apiFile + '.ts');
218
- const fileContent = getPluginAPIFileContent(sanitizePluginName(pluginName), apiName);
219
- (0, fs_extra_1.mkdirSync)(path_1.default.dirname(apiPath), { recursive: true });
220
- (0, fs_extra_1.writeFileSync)(apiPath, fileContent);
221
- });
222
- });
223
- };
224
- const installPlugins = async (basePath) => {
225
- const plugins = await (0, exports.getPluginsList)(basePath);
226
- copyPluginsSrc(basePath, plugins);
227
- copyPluginPublicFiles(basePath, plugins);
228
- generatePluginPages(basePath, plugins);
229
- generatePluginApis(basePath, plugins);
230
- addPluginsSections(basePath, plugins);
231
- addPluginsOverrides(basePath, plugins);
232
- addPluginsTheme(basePath, plugins);
233
- };
234
- exports.installPlugins = installPlugins;
235
- //# sourceMappingURL=plugins.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/utils/plugins.ts"],"names":[],"mappings":";;;;AAAA,uCAMiB;AACjB,2CAA0C;AAC1C,wDAAuB;AACvB,qCAAiC;AAuBjC,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AAE7C,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,UAAU,GAAG,KAAK,EAAE,EAAE;IACpE,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAE1C,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,SAAS;aACb,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