@faststore/cli 3.99.1 → 4.0.0-dev.4

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,175 +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 directory_1 = require("./directory");
6
- const pathsToMatch = (expected, desired) => {
7
- const expectedResolved = path_1.default.resolve(expected);
8
- const desiredResolved = path_1.default.resolve(desired);
9
- return expectedResolved === desiredResolved;
10
- };
11
- const originalProcessCwd = process.cwd;
12
- beforeEach(() => {
13
- process.cwd = originalProcessCwd;
14
- });
15
- describe('withBasePath as the current dir `.`', () => {
16
- const basePath = '.';
17
- describe('tmpDir', () => {
18
- it('is the basePath + .faststore', () => {
19
- const { tmpDir: tmpDirWithBase } = (0, directory_1.withBasePath)(basePath);
20
- expect(pathsToMatch(tmpDirWithBase, './.faststore')).toBe(true);
21
- });
22
- });
23
- describe('userDir', () => {
24
- it("returns the directory of the starter's package.json", () => {
25
- const { userSrcDir: userSrcDirWithBase } = (0, directory_1.withBasePath)(basePath);
26
- expect(pathsToMatch(userSrcDirWithBase, './src')).toBe(true);
27
- });
28
- });
29
- describe('tmpCustomizationsSrcDir', () => {
30
- it('returns the directory of customizations directory on the tmp dir', () => {
31
- const { tmpCustomizationsSrcDir: tmpCustomizationsSrcDirWithBase } = (0, directory_1.withBasePath)(basePath);
32
- expect(pathsToMatch(tmpCustomizationsSrcDirWithBase, './.faststore/src/customizations/src')).toBe(true);
33
- });
34
- });
35
- describe('userThemesFileDir', () => {
36
- it("returns the directory of the starter's theme directory", () => {
37
- const { userThemesFileDir: userThemesFileDirWithBase } = (0, directory_1.withBasePath)(basePath);
38
- expect(pathsToMatch(userThemesFileDirWithBase, './src/themes')).toBe(true);
39
- });
40
- });
41
- describe('tmpThemesCustomizationsFile', () => {
42
- it('returns the path of the theme file on the .faststore dir', () => {
43
- const { tmpThemesCustomizationsFile: tmpThemesCustomizationsFileWithBase, } = (0, directory_1.withBasePath)(basePath);
44
- expect(pathsToMatch(tmpThemesCustomizationsFileWithBase, './.faststore/src/customizations/src/themes/index.scss')).toBe(true);
45
- });
46
- });
47
- describe('tmpCMSDir', () => {
48
- it('returns the path of the CMS dir on the .faststore dir', () => {
49
- const { tmpCMSDir: tmpCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
50
- expect(pathsToMatch(tmpCMSDirWithBase(), './.faststore/cms/faststore')).toBe(true);
51
- });
52
- });
53
- describe('userCMSDir', () => {
54
- it('returns the path of the CMS dir on the user dir', () => {
55
- const { userCMSDir: userCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
56
- expect(pathsToMatch(userCMSDirWithBase, './cms/faststore')).toBe(true);
57
- });
58
- });
59
- describe('tmpCMSWebhookUrlsFile', () => {
60
- it('returns the path of the CMS webhooks file on the .faststore dir', () => {
61
- const { tmpCMSWebhookUrlsFile: tmpCMSWebhookUrlsFileWithBase } = (0, directory_1.withBasePath)(basePath);
62
- expect(pathsToMatch(tmpCMSWebhookUrlsFileWithBase, './.faststore/cms-webhook-urls.json')).toBe(true);
63
- });
64
- });
65
- describe('userStoreConfigFile', () => {
66
- it('returns the path of the user discovery.config file', () => {
67
- const { userStoreConfigFile: userStoreConfigFileWithBase } = (0, directory_1.withBasePath)(basePath);
68
- expect(pathsToMatch(userStoreConfigFileWithBase, './discovery.config.js')).toBe(true);
69
- });
70
- });
71
- describe('tmpStoreConfigFile', () => {
72
- it('returns the path of the discovery.config file in the customizations dir', () => {
73
- const { tmpStoreConfigFile: tmpStoreConfigFileWithBase } = (0, directory_1.withBasePath)(basePath);
74
- expect(pathsToMatch(tmpStoreConfigFileWithBase, './.faststore/src/customizations/discovery.config.js')).toBe(true);
75
- });
76
- });
77
- });
78
- describe('withBasePath as an arbitrary dir', () => {
79
- const basePath = path_1.default.join(__dirname, '..', '__mocks__', 'store');
80
- describe('coreDir', () => {
81
- it('is the faststoreDir + core', () => {
82
- const mockedCwd = jest.fn(() => {
83
- return './src/__mocks__/store';
84
- });
85
- process.cwd = mockedCwd;
86
- const { coreDir: coreDirWithBase } = (0, directory_1.withBasePath)(basePath);
87
- expect(pathsToMatch(coreDirWithBase, './src/__mocks__/store/node_modules/@faststore/core')).toBe(true);
88
- });
89
- describe('when is in a monorepo', () => {
90
- it('can look at its parent until it reaches the monorepo directory', () => {
91
- const mockedCwd = jest.fn(() => {
92
- return './src/__mocks__/monorepo';
93
- });
94
- process.cwd = mockedCwd;
95
- const { coreDir: coreDirWithBase } = (0, directory_1.withBasePath)(path_1.default.join(__dirname, '..', '__mocks__', 'monorepo', 'discovery'));
96
- expect(pathsToMatch(coreDirWithBase, './src/__mocks__/monorepo/node_modules/@faststore/core')).toBe(true);
97
- });
98
- });
99
- });
100
- describe('tmpDir', () => {
101
- it('is the basePath + .faststore', () => {
102
- const { tmpDir: tmpDirWithBase } = (0, directory_1.withBasePath)(basePath);
103
- expect(pathsToMatch(tmpDirWithBase, './.faststore')).toBe(true);
104
- });
105
- });
106
- describe('userDir', () => {
107
- it("returns the directory of the starter's package.json", () => {
108
- const { userSrcDir: userSrcDirWithBase } = (0, directory_1.withBasePath)(basePath);
109
- expect(pathsToMatch(userSrcDirWithBase, './src/__mocks__/store/src')).toBe(true);
110
- });
111
- });
112
- describe('tmpCustomizationsSrcDir', () => {
113
- it('returns the directory of customizations directory on the tmp dir', () => {
114
- const { tmpCustomizationsSrcDir: tmpCustomizationsSrcDirWithBase } = (0, directory_1.withBasePath)(basePath);
115
- expect(pathsToMatch(tmpCustomizationsSrcDirWithBase, './.faststore/src/customizations/src')).toBe(true);
116
- });
117
- });
118
- describe('userThemesFileDir', () => {
119
- it("returns the directory of the starter's theme directory", () => {
120
- const { userThemesFileDir: userThemesFileDirWithBase } = (0, directory_1.withBasePath)(basePath);
121
- expect(pathsToMatch(userThemesFileDirWithBase, './src/__mocks__/store/src/themes')).toBe(true);
122
- });
123
- });
124
- describe('tmpThemesCustomizationsFile', () => {
125
- it('returns the path of the theme file on the .faststore dir', () => {
126
- const { tmpThemesCustomizationsFile: tmpThemesCustomizationsFileWithBase, } = (0, directory_1.withBasePath)(basePath);
127
- expect(pathsToMatch(tmpThemesCustomizationsFileWithBase, './.faststore/src/customizations/src/themes/index.scss')).toBe(true);
128
- });
129
- });
130
- describe('tmpCMSDir', () => {
131
- it('returns the path of the CMS dir on the .faststore dir', () => {
132
- const { tmpCMSDir: tmpCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
133
- expect(pathsToMatch(tmpCMSDirWithBase(), './.faststore/cms/faststore')).toBe(true);
134
- });
135
- it('returns the path of the CMS dir with the builderId on the .faststore dir', () => {
136
- const { tmpCMSDir: tmpCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
137
- expect(pathsToMatch(tmpCMSDirWithBase('another-builder'), './.faststore/cms/another-builder')).toBe(true);
138
- });
139
- });
140
- describe('userCMSDir', () => {
141
- it('returns the path of the CMS dir on the user dir', () => {
142
- const { userCMSDir: userCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
143
- expect(pathsToMatch(userCMSDirWithBase, './src/__mocks__/store/cms/faststore')).toBe(true);
144
- });
145
- });
146
- describe('coreCMSDir', () => {
147
- it('returns the path of the CMS dir on @faststore/core package', () => {
148
- const mockedCwd = jest.fn(() => {
149
- return './src/__mocks__/store';
150
- });
151
- process.cwd = mockedCwd;
152
- const { coreCMSDir: coreCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
153
- expect(pathsToMatch(coreCMSDirWithBase, './src/__mocks__/store/node_modules/@faststore/core/cms/faststore')).toBe(true);
154
- });
155
- });
156
- describe('tmpCMSWebhookUrlsFile', () => {
157
- it('returns the path of the CMS webhooks file on the .faststore dir', () => {
158
- const { tmpCMSWebhookUrlsFile: tmpCMSWebhookUrlsFileWithBase } = (0, directory_1.withBasePath)(basePath);
159
- expect(pathsToMatch(tmpCMSWebhookUrlsFileWithBase, './.faststore/cms-webhook-urls.json')).toBe(true);
160
- });
161
- });
162
- describe('userStoreConfigFile', () => {
163
- it('returns the path of the user discovery.config file', () => {
164
- const { userStoreConfigFile: userStoreConfigFileWithBase } = (0, directory_1.withBasePath)(basePath);
165
- expect(pathsToMatch(userStoreConfigFileWithBase, './src/__mocks__/store/discovery.config.js')).toBe(true);
166
- });
167
- });
168
- describe('tmpStoreConfigFile', () => {
169
- it('returns the path of the discovery.config file in the customizations dir', () => {
170
- const { tmpStoreConfigFile: tmpStoreConfigFileWithBase } = (0, directory_1.withBasePath)(basePath);
171
- expect(pathsToMatch(tmpStoreConfigFileWithBase, './.faststore/src/customizations/discovery.config.js')).toBe(true);
172
- });
173
- });
174
- });
175
- //# sourceMappingURL=directory.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"directory.test.js","sourceRoot":"","sources":["../../src/utils/directory.test.ts"],"names":[],"mappings":";;;AAAA,wDAAuB;AACvB,2CAA0C;AAE1C,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,EAAE;IACzD,MAAM,gBAAgB,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/C,MAAM,eAAe,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAE7C,OAAO,gBAAgB,KAAK,eAAe,CAAA;AAC7C,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,C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qD,CACtD,CACF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACd,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,7 +0,0 @@
1
- interface GenerateOptions {
2
- setup?: boolean;
3
- basePath: string;
4
- }
5
- export declare function generate(options: GenerateOptions): Promise<void>;
6
- export {};
7
- //# sourceMappingURL=generate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/utils/generate.ts"],"names":[],"mappings":"AAsBA,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAufD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,iBA6BtD"}
@@ -1,387 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = void 0;
4
- const tslib_1 = require("tslib");
5
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const fs_extra_1 = require("fs-extra");
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const ora_1 = tslib_1.__importDefault(require("ora"));
9
- const createNextjsPages_1 = require("./createNextjsPages");
10
- const dependencies_1 = require("./dependencies");
11
- const directory_1 = require("./directory");
12
- const logger_1 = require("./logger");
13
- const plugins_1 = require("./plugins");
14
- // package.json is copied manually after filtering its content
15
- const ignorePaths = [
16
- 'package.json',
17
- 'node_modules',
18
- 'cypress.config.ts',
19
- 'base.jsonc', // CP special file, it must not be copied to the merchants' temp dir
20
- ];
21
- function createTmpFolder(basePath) {
22
- const { tmpDir, tmpFolderName } = (0, directory_1.withBasePath)(basePath);
23
- try {
24
- if ((0, fs_extra_1.existsSync)(tmpDir)) {
25
- (0, fs_extra_1.removeSync)(tmpDir);
26
- }
27
- (0, fs_extra_1.mkdirsSync)(tmpDir);
28
- logger_1.logger.log(`${chalk_1.default.green('success')} - Temporary folder ${chalk_1.default.dim(tmpFolderName)} created`);
29
- }
30
- catch (err) {
31
- logger_1.logger.error(`${chalk_1.default.red('error')} - ${err}`);
32
- }
33
- }
34
- /**
35
- * Prevents imports from @faststore/core from randomly conflicting
36
- * where sometimes the package.json from the .faststore folder
37
- * took precedence over @faststore/core's package.json.
38
- */
39
- function filterAndCopyPackageJson(basePath) {
40
- const { coreDir, tmpDir } = (0, directory_1.withBasePath)(basePath);
41
- const corePackageJsonPath = path_1.default.join(coreDir, 'package.json');
42
- const corePackageJsonFile = (0, fs_extra_1.readFileSync)(corePackageJsonPath, 'utf8');
43
- const { exports: _, ...filteredFileContent } = JSON.parse(corePackageJsonFile);
44
- filteredFileContent.name = 'dot-faststore';
45
- (0, fs_extra_1.writeJsonSync)(path_1.default.join(tmpDir, 'package.json'), filteredFileContent, {
46
- spaces: 2,
47
- });
48
- }
49
- // Temporary array of strict rules enabled so far.
50
- const TS_CONFIG_STRICT_RULES_ENABLED = ['noImplicitAny'];
51
- /**
52
- * Modify TypeScript compilation settings (tsconfig.json) to disable specific strict
53
- * type checking rules when files are moved to the .faststore folder.
54
- * TODO: The idea is to change the strict to false when all strict rules are migrated.
55
- */
56
- function disableTsConfigStrictRules(basePath) {
57
- const { coreDir, tmpDir } = (0, directory_1.withBasePath)(basePath);
58
- const coreTsConfigPath = path_1.default.join(coreDir, 'tsconfig.json');
59
- const coreTsConfigFile = (0, fs_extra_1.readFileSync)(coreTsConfigPath, 'utf8');
60
- const tsConfig = JSON.parse(coreTsConfigFile);
61
- TS_CONFIG_STRICT_RULES_ENABLED.forEach((strictRule) => {
62
- tsConfig.compilerOptions[strictRule] = false;
63
- });
64
- (0, fs_extra_1.writeJsonSync)(path_1.default.join(tmpDir, 'tsconfig.json'), tsConfig, {
65
- spaces: 2,
66
- });
67
- }
68
- function copyCoreFiles(basePath) {
69
- const { coreDir, tmpDir } = (0, directory_1.withBasePath)(basePath);
70
- try {
71
- (0, fs_extra_1.copySync)(coreDir, tmpDir, {
72
- dereference: true,
73
- filter(src) {
74
- const fileOrDirName = path_1.default.basename(src);
75
- const shouldCopy = fileOrDirName
76
- ? !ignorePaths.includes(fileOrDirName)
77
- : true;
78
- return shouldCopy;
79
- },
80
- });
81
- filterAndCopyPackageJson(basePath);
82
- disableTsConfigStrictRules(basePath);
83
- logger_1.logger.log(`${chalk_1.default.green('success')} - Core files copied`);
84
- }
85
- catch (e) {
86
- logger_1.logger.error(e);
87
- }
88
- }
89
- function copyPublicFiles(basePath) {
90
- const { userDir, tmpDir } = (0, directory_1.withBasePath)(basePath);
91
- const allowList = ['json', 'txt', 'xml', 'ico', 'public', 'svg'];
92
- try {
93
- if ((0, fs_extra_1.existsSync)(`${userDir}/public`)) {
94
- (0, fs_extra_1.copySync)(`${userDir}/public`, `${tmpDir}/public`, {
95
- dereference: true,
96
- overwrite: true,
97
- filter: (src) => {
98
- const allow = allowList.some((ext) => src.endsWith(ext));
99
- return allow;
100
- },
101
- });
102
- logger_1.logger.log(`${chalk_1.default.green('success')} - Public files copied`);
103
- }
104
- }
105
- catch (e) {
106
- logger_1.logger.error(e);
107
- }
108
- }
109
- async function copyCypressFiles(basePath) {
110
- const { userDir, userStoreConfigFile, userLegacyStoreConfigFile, tmpDir } = (0, directory_1.withBasePath)(basePath);
111
- try {
112
- // Cypress 9.x config file
113
- if ((0, fs_extra_1.existsSync)(`${userDir}/cypress.json`)) {
114
- (0, fs_extra_1.copySync)(`${userDir}/cypress.json`, `${tmpDir}/cypress.json`, {
115
- dereference: true,
116
- });
117
- }
118
- // Cypress 12.x config file
119
- if ((0, fs_extra_1.existsSync)(`${userDir}/cypress.config.ts`)) {
120
- (0, fs_extra_1.copySync)(`${userDir}/cypress.config.ts`, `${tmpDir}/cypress.config.ts`, {
121
- dereference: true,
122
- });
123
- }
124
- let userStoreConfig;
125
- if ((0, fs_extra_1.existsSync)(userStoreConfigFile)) {
126
- userStoreConfig = await Promise.resolve(`${path_1.default.resolve(userStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
127
- }
128
- else if ((0, fs_extra_1.existsSync)(userLegacyStoreConfigFile)) {
129
- userStoreConfig = await Promise.resolve(`${path_1.default.resolve(userLegacyStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
130
- }
131
- else {
132
- logger_1.logger.info(`${chalk_1.default.blue('info')} - No store config file was found in the root directory`);
133
- }
134
- // Copy custom Cypress folder and files
135
- if ((0, fs_extra_1.existsSync)(`${userDir}/cypress`) &&
136
- userStoreConfig?.experimental?.enableCypressExtension) {
137
- (0, fs_extra_1.copySync)(`${userDir}/cypress`, `${tmpDir}/cypress`, {
138
- overwrite: true,
139
- dereference: true,
140
- });
141
- logger_1.logger.log(`${chalk_1.default.green('success')} - Cypress test files copied`);
142
- }
143
- // Create default Cypress 12.x (or superior) support file
144
- if (userStoreConfig?.experimental?.cypressVersion > 9) {
145
- (0, fs_extra_1.copySync)(`${tmpDir}/cypress/support/index.js`, `${tmpDir}/cypress/support/e2e.js`, { overwrite: false });
146
- }
147
- }
148
- catch (e) {
149
- logger_1.logger.error(e);
150
- }
151
- }
152
- function copyUserStarterToCustomizations(basePath) {
153
- const { userSrcDir, tmpCustomizationsSrcDir, userLegacyStoreConfigFile, userStoreConfigFile, tmpStoreConfigFile, } = (0, directory_1.withBasePath)(basePath);
154
- try {
155
- if ((0, fs_extra_1.existsSync)(userSrcDir) && (0, fs_extra_1.readdirSync)(userSrcDir).length > 0) {
156
- (0, fs_extra_1.copySync)(userSrcDir, tmpCustomizationsSrcDir, { dereference: true });
157
- (0, createNextjsPages_1.createNextJsPages)(basePath);
158
- }
159
- if ((0, fs_extra_1.existsSync)(userStoreConfigFile)) {
160
- (0, fs_extra_1.copySync)(userStoreConfigFile, tmpStoreConfigFile, { dereference: true });
161
- }
162
- else if ((0, fs_extra_1.existsSync)(userLegacyStoreConfigFile)) {
163
- (0, fs_extra_1.copySync)(userLegacyStoreConfigFile, tmpStoreConfigFile, {
164
- dereference: true,
165
- });
166
- }
167
- else {
168
- logger_1.logger.info(`${chalk_1.default.blue('info')} - No store config file was found in the root directory`);
169
- }
170
- logger_1.logger.log(`${chalk_1.default.green('success')} - Starter files copied`);
171
- }
172
- catch (err) {
173
- logger_1.logger.error(`${chalk_1.default.red('error')} - ${err}`);
174
- }
175
- }
176
- async function createCmsWebhookUrlsJsonFile(basePath) {
177
- const { userStoreConfigFile, userLegacyStoreConfigFile, tmpCMSWebhookUrlsFile, } = (0, directory_1.withBasePath)(basePath);
178
- let userStoreConfig;
179
- if ((0, fs_extra_1.existsSync)(userStoreConfigFile)) {
180
- userStoreConfig = await Promise.resolve(`${path_1.default.resolve(userStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
181
- }
182
- else if ((0, fs_extra_1.existsSync)(userLegacyStoreConfigFile)) {
183
- userStoreConfig = await Promise.resolve(`${path_1.default.resolve(userLegacyStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
184
- }
185
- else {
186
- logger_1.logger.info(`${chalk_1.default.blue('info')} - No store config file was found in the root directory`);
187
- }
188
- if (userStoreConfig?.vtexHeadlessCms &&
189
- userStoreConfig.vtexHeadlessCms?.webhookUrls) {
190
- const { webhookUrls } = userStoreConfig?.vtexHeadlessCms;
191
- try {
192
- (0, fs_extra_1.writeJsonSync)(tmpCMSWebhookUrlsFile, { urls: webhookUrls }, { spaces: 2 });
193
- logger_1.logger.log(`${chalk_1.default.green('success')} - CMS webhook URLs file created`);
194
- }
195
- catch (err) {
196
- logger_1.logger.error(`${chalk_1.default.red('error')} - ${err}`);
197
- }
198
- }
199
- else {
200
- logger_1.logger.info(`${chalk_1.default.blue('info')} - No CMS webhook URLs were provided`);
201
- }
202
- }
203
- async function copyTheme(basePath) {
204
- const { userStoreConfigFile, userThemesFileDir, tmpThemesCustomizationsFile, userLegacyStoreConfigFile, } = (0, directory_1.withBasePath)(basePath);
205
- let storeConfig;
206
- // Because of how node caches imports, if we don't delete the cache
207
- // for the {discovery|faststore}.config.js files we will return a
208
- // cached version and not reflect the theme change until a restart
209
- // happens. Deleting before importing clears the cache
210
- if ((0, fs_extra_1.existsSync)(userStoreConfigFile)) {
211
- delete require.cache[path_1.default.resolve(userStoreConfigFile)];
212
- storeConfig = await Promise.resolve(`${path_1.default.resolve(userStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
213
- }
214
- else if ((0, fs_extra_1.existsSync)(userLegacyStoreConfigFile)) {
215
- delete require.cache[path_1.default.resolve(userLegacyStoreConfigFile)];
216
- storeConfig = await Promise.resolve(`${path_1.default.resolve(userLegacyStoreConfigFile)}`).then(s => tslib_1.__importStar(require(s)));
217
- }
218
- else {
219
- logger_1.logger.info(`${chalk_1.default.blue('info')} - No store config file was found in the root directory`);
220
- }
221
- if (storeConfig.theme) {
222
- const customTheme = path_1.default.join(userThemesFileDir, `${storeConfig.theme}.scss`);
223
- if ((0, fs_extra_1.existsSync)(customTheme)) {
224
- try {
225
- (0, fs_extra_1.copyFileSync)(customTheme, tmpThemesCustomizationsFile);
226
- logger_1.logger.log(`${chalk_1.default.green('success')} - ${storeConfig.theme} theme has been applied`);
227
- }
228
- catch (err) {
229
- logger_1.logger.error(`${chalk_1.default.red('error')} - ${err}`);
230
- }
231
- }
232
- else {
233
- logger_1.logger.info(`${chalk_1.default.blue('info')} - The ${storeConfig.theme} theme was added to the config file but the ${storeConfig.theme}.scss file does not exist in the themes folder. Read more: https://developers.vtex.com/docs/guides/faststore/themes-overview`);
234
- }
235
- }
236
- else if ((0, fs_extra_1.existsSync)(userThemesFileDir) &&
237
- (0, fs_extra_1.readdirSync)(userThemesFileDir).length > 0) {
238
- logger_1.logger.info(`${chalk_1.default.blue('info')} - The theme needs to be added to the config file to be applied. Read more: https://www.faststore.dev/docs/themes/overview`);
239
- }
240
- }
241
- function updateBuildTime(basePath) {
242
- try {
243
- const { tmpSeoConfig } = (0, directory_1.withBasePath)(basePath);
244
- let config = (0, fs_extra_1.readFileSync)(tmpSeoConfig, 'utf8');
245
- const newBuildTime = new Date().toISOString();
246
- config = config.replace(/const buildTime = .*?;/, `const buildTime = '${newBuildTime}';`);
247
- (0, fs_extra_1.writeFileSync)(tmpSeoConfig, config);
248
- logger_1.logger.log(`${chalk_1.default.green('success')} - Build time updated`, newBuildTime);
249
- }
250
- catch (error) {
251
- logger_1.logger.error(`${chalk_1.default.red('error')} - Updating build time:`, error);
252
- }
253
- }
254
- function checkDependencies(basePath, packagesToCheck) {
255
- const { coreDir, getRoot } = (0, directory_1.withBasePath)(basePath);
256
- const corePackageJsonPath = path_1.default.join(coreDir, 'package.json');
257
- const rootPackageJsonPath = path_1.default.join(getRoot(), 'package.json');
258
- const corePackageJson = require(corePackageJsonPath);
259
- const rootPackageJson = require(rootPackageJsonPath);
260
- packagesToCheck.forEach((packageName) => {
261
- const coreVersion = corePackageJson.devDependencies[packageName] ||
262
- corePackageJson.dependencies[packageName];
263
- const rootVersion = rootPackageJson.devDependencies[packageName] ||
264
- rootPackageJson.dependencies[packageName];
265
- if (!coreVersion || !rootVersion) {
266
- logger_1.logger.warn(`${chalk_1.default.yellow('warning')} - Package ${packageName} not found in both core or root dependencies.`);
267
- }
268
- else if (coreVersion !== rootVersion) {
269
- logger_1.logger.warn(`${chalk_1.default.yellow('warning')} - Version mismatch detected for ${packageName}.
270
- Core: ${coreVersion}, Customization: ${rootVersion}. Please align both versions to prevent issues`);
271
- }
272
- });
273
- }
274
- function updateNextConfig(basePath) {
275
- const { tmpDir } = (0, directory_1.withBasePath)(basePath);
276
- const nextConfigPath = path_1.default.join(tmpDir, 'next.config.js');
277
- let nextConfigData = String((0, fs_extra_1.readFileSync)(nextConfigPath));
278
- nextConfigData = nextConfigData.replace(/outputFileTracingRoot\:\s+(.*),/, `outputFileTracingRoot: '${process.cwd()}',`);
279
- (0, fs_extra_1.writeFileSync)(nextConfigPath, nextConfigData);
280
- }
281
- // returns new (discovery.config.js) or legacy (faststore.config.js) store config file
282
- function getCurrentUserStoreConfigFile(basePath) {
283
- const { userStoreConfigFile, userLegacyStoreConfigFile } = (0, directory_1.withBasePath)(basePath);
284
- if ((0, fs_extra_1.existsSync)(userStoreConfigFile)) {
285
- return userStoreConfigFile;
286
- }
287
- if ((0, fs_extra_1.existsSync)(userLegacyStoreConfigFile)) {
288
- return userLegacyStoreConfigFile;
289
- }
290
- return null;
291
- }
292
- function validateAndInstallMissingDependencies(basePath) {
293
- const { userDir } = (0, directory_1.withBasePath)(basePath);
294
- const currentUserStoreConfigFile = getCurrentUserStoreConfigFile(basePath);
295
- if (!currentUserStoreConfigFile) {
296
- return;
297
- }
298
- const userStoreConfig = require(currentUserStoreConfigFile);
299
- const userPackageJson = require(path_1.default.join(userDir, 'package.json'));
300
- const missingDependencies = [];
301
- if (userStoreConfig.experimental.preact) {
302
- missingDependencies.push({
303
- feature: 'Preact',
304
- dependencies: ['preact@10.23.1', 'preact-render-to-string@6.5.8'],
305
- });
306
- }
307
- missingDependencies.forEach(({ feature, dependencies }) => {
308
- const dependenciesToInstall = dependencies.filter((dependency) => {
309
- const dependencyName = dependency.split('@')[0];
310
- return !userPackageJson.dependencies[dependencyName];
311
- });
312
- if (dependenciesToInstall.length > 0) {
313
- const spinner = (0, ora_1.default)(`Installing ${feature} missing dependencies\n`).start();
314
- (0, dependencies_1.installDependencies)({
315
- dependencies: dependenciesToInstall,
316
- cwd: userDir,
317
- errorMessage: `failed to install ${feature} dependencies`,
318
- });
319
- spinner.stop();
320
- }
321
- });
322
- }
323
- // TODO: Read the value from an environment variable
324
- const ENABLE_REDIRECTS_MIDDLEWARE = false;
325
- // Enable redirects middleware by renaming the file from middleware__DISABLED.ts to middleware.tsß
326
- function enableRedirectsMiddleware(basePath) {
327
- if (!ENABLE_REDIRECTS_MIDDLEWARE) {
328
- return;
329
- }
330
- try {
331
- const { tmpDir } = (0, directory_1.withBasePath)(basePath);
332
- const disabledMiddlewarePath = path_1.default.join(tmpDir, 'src', 'middleware__DISABLED.ts');
333
- /* Rename the file to enable middleware functionality and then remove the disabled middleware file */
334
- if ((0, fs_extra_1.existsSync)(disabledMiddlewarePath)) {
335
- const enabledMiddlewarePath = path_1.default.join(tmpDir, 'src', 'middleware.ts');
336
- (0, fs_extra_1.copyFileSync)(disabledMiddlewarePath, enabledMiddlewarePath);
337
- (0, fs_extra_1.removeSync)(disabledMiddlewarePath);
338
- logger_1.logger.log(`${chalk_1.default.green('success')} Redirects middleware has been enabled`);
339
- }
340
- }
341
- catch (error) {
342
- logger_1.logger.error(error);
343
- throw error;
344
- }
345
- }
346
- function enableSearchSSR(basePath) {
347
- const storeConfigPath = getCurrentUserStoreConfigFile(basePath);
348
- if (!storeConfigPath) {
349
- return;
350
- }
351
- const storeConfig = require(storeConfigPath);
352
- if (!storeConfig.experimental.enableSearchSSR) {
353
- return;
354
- }
355
- const { tmpDir } = (0, directory_1.withBasePath)(basePath);
356
- const searchPagePath = path_1.default.join(tmpDir, 'src', 'pages', 's.tsx');
357
- const searchPageData = String((0, fs_extra_1.readFileSync)(searchPagePath));
358
- const searchPageWithSSR = searchPageData.replaceAll('getStaticProps', 'getServerSideProps');
359
- (0, fs_extra_1.writeFileSync)(searchPagePath, searchPageWithSSR);
360
- }
361
- async function generate(options) {
362
- const { basePath, setup = false } = options;
363
- let setupPromise = null;
364
- validateAndInstallMissingDependencies(basePath);
365
- if (setup) {
366
- setupPromise = Promise.all([
367
- createTmpFolder(basePath),
368
- copyCoreFiles(basePath),
369
- copyCypressFiles(basePath),
370
- copyPublicFiles(basePath),
371
- updateNextConfig(basePath),
372
- ]);
373
- }
374
- await Promise.all([
375
- setupPromise,
376
- checkDependencies(basePath, ['typescript']),
377
- enableSearchSSR(basePath),
378
- updateBuildTime(basePath),
379
- copyUserStarterToCustomizations(basePath),
380
- copyTheme(basePath),
381
- createCmsWebhookUrlsJsonFile(basePath),
382
- enableRedirectsMiddleware(basePath),
383
- (0, plugins_1.installPlugins)(basePath),
384
- ]);
385
- }
386
- exports.generate = generate;
387
- //# sourceMappingURL=generate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/ut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 +0,0 @@
1
- export interface ContentTypeOrSectionDefinition {
2
- id?: string;
3
- name?: string;
4
- scopes?: string[];
5
- isSingleton?: boolean;
6
- onlySettings?: boolean;
7
- requiredScopes?: string[];
8
- schema?: Record<string, unknown>;
9
- configurationSchemaSets?: ConfigurationSchemaSet[];
10
- }
11
- export interface ConfigurationSchemaSet {
12
- name?: string;
13
- configurations?: Array<{
14
- name?: string;
15
- schema?: Record<string, unknown>;
16
- }>;
17
- }
18
- export declare function splitCustomDefinitions(coreDefinitions: ContentTypeOrSectionDefinition[], customDefinitions: ContentTypeOrSectionDefinition[], primaryIdentifier: 'id' | 'name'): {
19
- duplicates: ContentTypeOrSectionDefinition[];
20
- newDefinitions: ContentTypeOrSectionDefinition[];
21
- };
22
- export declare function dedupeAndMergeDefinitions(coreDefinitions: ContentTypeOrSectionDefinition[], duplicates: ContentTypeOrSectionDefinition[], primaryIdentifier: 'id' | 'name'): ContentTypeOrSectionDefinition[];
23
- export declare function mergeCMSFile(fileName: string, basePath: string): Promise<void>;
24
- export declare function mergeCMSFiles(basePath: string): Promise<void>;
25
- //# sourceMappingURL=hcms.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hcms.d.ts","sourceRoot":"","sources":["../../src/utils/hcms.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,8BAA8B;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,uBAAuB,CAAC,EAAE,sBAAsB,EAAE,CAAA;CACnD;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KACjC,CAAC,CAAA;CACH;AAED,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,8BAA8B,EAAE,EACjD,iBAAiB,EAAE,8BAA8B,EAAE,EACnD,iBAAiB,EAAE,IAAI,GAAG,MAAM;;;EA0BjC;AAED,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,8BAA8B,EAAE,EACjD,UAAU,EAAE,8BAA8B,EAAE,EAC5C,iBAAiB,EAAE,IAAI,GAAG,MAAM,oCA+BjC;AAqBD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAyFpE;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,iBAOnD"}