@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.
- package/README.md +48 -39
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +5 -0
- package/bin/run.js +5 -0
- package/dist/index.js +2252 -19
- package/dist/index.js.map +1 -1
- package/package.json +46 -27
- package/bin/dev +0 -17
- package/bin/run +0 -5
- package/dist/__mocks__/hcms.d.ts +0 -62
- package/dist/__mocks__/hcms.d.ts.map +0 -1
- package/dist/__mocks__/hcms.js +0 -184
- package/dist/__mocks__/hcms.js.map +0 -1
- package/dist/commands/build.d.ts +0 -12
- package/dist/commands/build.d.ts.map +0 -1
- package/dist/commands/build.js +0 -118
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/cms-sync.d.ts +0 -13
- package/dist/commands/cms-sync.d.ts.map +0 -1
- package/dist/commands/cms-sync.js +0 -39
- package/dist/commands/cms-sync.js.map +0 -1
- package/dist/commands/create.d.ts +0 -11
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -38
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -12
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -164
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/generate-graphql.d.ts +0 -12
- package/dist/commands/generate-graphql.d.ts.map +0 -1
- package/dist/commands/generate-graphql.js +0 -60
- package/dist/commands/generate-graphql.js.map +0 -1
- package/dist/commands/start.d.ts +0 -10
- package/dist/commands/start.d.ts.map +0 -1
- package/dist/commands/start.js +0 -40
- package/dist/commands/start.js.map +0 -1
- package/dist/commands/test.d.ts +0 -9
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -79
- package/dist/commands/test.js.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/utils/commands.d.ts +0 -2
- package/dist/utils/commands.d.ts.map +0 -1
- package/dist/utils/commands.js +0 -16
- package/dist/utils/commands.js.map +0 -1
- package/dist/utils/createNextjsPages.d.ts +0 -2
- package/dist/utils/createNextjsPages.d.ts.map +0 -1
- package/dist/utils/createNextjsPages.js +0 -83
- package/dist/utils/createNextjsPages.js.map +0 -1
- package/dist/utils/dependencies.d.ts +0 -8
- package/dist/utils/dependencies.d.ts.map +0 -1
- package/dist/utils/dependencies.js +0 -17
- package/dist/utils/dependencies.js.map +0 -1
- package/dist/utils/deprecations.d.ts +0 -7
- package/dist/utils/deprecations.d.ts.map +0 -1
- package/dist/utils/deprecations.js +0 -32
- package/dist/utils/deprecations.js.map +0 -1
- package/dist/utils/directory.d.ts +0 -26
- package/dist/utils/directory.d.ts.map +0 -1
- package/dist/utils/directory.js +0 -68
- package/dist/utils/directory.js.map +0 -1
- package/dist/utils/directory.test.d.ts +0 -2
- package/dist/utils/directory.test.d.ts.map +0 -1
- package/dist/utils/directory.test.js +0 -175
- package/dist/utils/directory.test.js.map +0 -1
- package/dist/utils/generate.d.ts +0 -7
- package/dist/utils/generate.d.ts.map +0 -1
- package/dist/utils/generate.js +0 -387
- package/dist/utils/generate.js.map +0 -1
- package/dist/utils/hcms.d.ts +0 -25
- package/dist/utils/hcms.d.ts.map +0 -1
- package/dist/utils/hcms.js +0 -118
- package/dist/utils/hcms.js.map +0 -1
- package/dist/utils/hcms.test.d.ts +0 -2
- package/dist/utils/hcms.test.d.ts.map +0 -1
- package/dist/utils/hcms.test.js +0 -189
- package/dist/utils/hcms.test.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -2
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -16
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/plugins.d.ts +0 -25
- package/dist/utils/plugins.d.ts.map +0 -1
- package/dist/utils/plugins.js +0 -235
- package/dist/utils/plugins.js.map +0 -1
- package/dist/utils/runCommandSync.d.ts +0 -7
- package/dist/utils/runCommandSync.d.ts.map +0 -1
- package/dist/utils/runCommandSync.js +0 -45
- package/dist/utils/runCommandSync.js.map +0 -1
- package/dist/utils/templates/myAccountPage.d.ts +0 -2
- package/dist/utils/templates/myAccountPage.d.ts.map +0 -1
- package/dist/utils/templates/myAccountPage.js +0 -49
- package/dist/utils/templates/myAccountPage.js.map +0 -1
- package/oclif.manifest.json +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class GenerateGraphql extends Command {
|
|
3
|
-
static flags: {
|
|
4
|
-
core: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
5
|
-
};
|
|
6
|
-
static args: {
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
}[];
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=generate-graphql.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-graphql.d.ts","sourceRoot":"","sources":["../../src/commands/generate-graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAS5C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAC,KAAK;;MAEX;IAED,MAAM,CAAC,IAAI;;;QAMV;IAEK,GAAG;CAwDV"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
-
const fs_extra_1 = require("fs-extra");
|
|
7
|
-
const commands_1 = require("../utils/commands");
|
|
8
|
-
const directory_1 = require("../utils/directory");
|
|
9
|
-
const logger_1 = require("../utils/logger");
|
|
10
|
-
const runCommandSync_1 = require("../utils/runCommandSync");
|
|
11
|
-
class GenerateGraphql extends core_1.Command {
|
|
12
|
-
static flags = {
|
|
13
|
-
core: core_1.Flags.boolean({ char: 'c', hidden: true }),
|
|
14
|
-
};
|
|
15
|
-
static args = [
|
|
16
|
-
{
|
|
17
|
-
name: 'path',
|
|
18
|
-
description: 'The path where the FastStore GraphQL customization is. Defaults to cwd.',
|
|
19
|
-
},
|
|
20
|
-
];
|
|
21
|
-
async run() {
|
|
22
|
-
const { flags, args } = await this.parse(GenerateGraphql);
|
|
23
|
-
const basePath = (0, directory_1.getBasePath)(args.path);
|
|
24
|
-
const { tmpDir, coreDir } = (0, directory_1.withBasePath)(basePath);
|
|
25
|
-
const isCore = flags.core ?? false;
|
|
26
|
-
const packageManager = (0, commands_1.getPreferredPackageManager)();
|
|
27
|
-
if (!isCore && !(0, fs_extra_1.existsSync)(tmpDir)) {
|
|
28
|
-
logger_1.logger.log(`${chalk_1.default.red('error')} - The ".faststore" directory could not be found. When running faststore dev or faststore build, the generate-graphql command is automatically executed.`);
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
(0, runCommandSync_1.runCommandSync)({
|
|
32
|
-
cmd: `${packageManager} run generate:schema`,
|
|
33
|
-
errorMessage: `Failed to run '${packageManager} generate:schema'. Please check your setup.`,
|
|
34
|
-
throws: 'error',
|
|
35
|
-
cwd: isCore ? undefined : tmpDir,
|
|
36
|
-
});
|
|
37
|
-
(0, runCommandSync_1.runCommandSync)({
|
|
38
|
-
cmd: `${packageManager} run generate:codegen`,
|
|
39
|
-
errorMessage: 'GraphQL was not optimized and TS files were not updated. Changes in the GraphQL layer did not take effect',
|
|
40
|
-
throws: 'error',
|
|
41
|
-
cwd: isCore ? undefined : tmpDir,
|
|
42
|
-
});
|
|
43
|
-
(0, runCommandSync_1.runCommandSync)({
|
|
44
|
-
cmd: `${packageManager} run format:generated`,
|
|
45
|
-
errorMessage: `Failed to format generated files. '${packageManager} format:generated' thrown errors`,
|
|
46
|
-
throws: 'warning',
|
|
47
|
-
cwd: isCore ? undefined : tmpDir,
|
|
48
|
-
});
|
|
49
|
-
// The command generate:copy-back expects the DESTINATION var to be present so it can copy the files to the correct directory
|
|
50
|
-
(0, runCommandSync_1.runCommandSync)({
|
|
51
|
-
cmd: `DESTINATION=${coreDir} ${packageManager} run generate:copy-back`,
|
|
52
|
-
errorMessage: `Failed to copy back typings files. '${packageManager} generate:copy-back' thrown errors`,
|
|
53
|
-
throws: 'warning',
|
|
54
|
-
cwd: isCore ? undefined : tmpDir,
|
|
55
|
-
});
|
|
56
|
-
logger_1.logger.log(`${chalk_1.default.green('success')} - GraphQL schema, types, and optimizations successfully generated 🎉`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.default = GenerateGraphql;
|
|
60
|
-
//# sourceMappingURL=generate-graphql.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-graphql.js","sourceRoot":"","sources":["../../src/commands/generate-graphql.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,0DAAyB;AACzB,uCAAqC;AAErC,gDAA8D;AAC9D,kDAA8D;AAC9D,4CAAwC;AACxC,4DAAwD;AAExD,MAAqB,eAAgB,SAAQ,cAAO;IAClD,MAAM,CAAC,KAAK,GAAG;QACb,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KACjD,CAAA;IAED,MAAM,CAAC,IAAI,GAAG;QACZ;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EACT,yEAAyE;SAC5E;KACF,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAEzD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,wBAAY,EAAC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C,CAAC,CAAA;QAEF,eAAM,CAAC,GAAG,CACR,GAAG,eAAK,CAAC,KAAK,CACZ,SAAS,CACV,uEAAuE,CACzE,CAAA;IACH,CAAC;;AApEH,kCAqEC"}
|
package/dist/commands/start.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Command } from '@oclif/core';
|
|
3
|
-
export default class Start extends Command {
|
|
4
|
-
static args: {
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
}[];
|
|
8
|
-
run(): Promise<import("child_process").ChildProcess>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=start.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAMrC,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACxC,MAAM,CAAC,IAAI;;;QAeV;IAEK,GAAG;CAmBV"}
|
package/dist/commands/start.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const fs_extra_1 = require("fs-extra");
|
|
6
|
-
const commands_1 = require("../utils/commands");
|
|
7
|
-
const directory_1 = require("../utils/directory");
|
|
8
|
-
class Start extends core_1.Command {
|
|
9
|
-
static args = [
|
|
10
|
-
{
|
|
11
|
-
name: 'account',
|
|
12
|
-
description: 'The account for which the Discovery is running. Currently noop.',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'path',
|
|
16
|
-
description: 'The path where the FastStore being run is. Defaults to cwd.',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'port',
|
|
20
|
-
description: 'The port where FastStore should run. Defaults to 3000.',
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
async run() {
|
|
24
|
-
const { args } = await this.parse(Start);
|
|
25
|
-
const basePath = (0, directory_1.getBasePath)(args.path);
|
|
26
|
-
const port = args.port ?? 3000;
|
|
27
|
-
const { tmpDir } = (0, directory_1.withBasePath)(basePath);
|
|
28
|
-
const packageManager = (0, commands_1.getPreferredPackageManager)();
|
|
29
|
-
if (!(0, fs_extra_1.existsSync)(tmpDir)) {
|
|
30
|
-
throw Error('The ".faststore" directory could not be found. If you are trying to serve your store, run "faststore build" first.');
|
|
31
|
-
}
|
|
32
|
-
return (0, child_process_1.spawn)(`${packageManager} run serve -p ${port}`, {
|
|
33
|
-
shell: true,
|
|
34
|
-
cwd: tmpDir,
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.default = Start;
|
|
40
|
-
//# sourceMappingURL=start.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AACrC,iDAAqC;AACrC,uCAAqC;AACrC,gDAA8D;AAC9D,kDAA8D;AAE9D,MAAqB,KAAM,SAAQ,cAAO;IACxC,MAAM,CAAC,IAAI,GAAG;QACZ;YACE,IAAI,EAAE,SAAS;YACf,WAAW,EACT,iEAAiE;SACpE;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EACT,6DAA6D;SAChE;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,wDAAwD;SACtE;KACF,CAAA;IAED,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAA;QAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAA;QACzC,MAAM,cAAc,GAAG,IAAA,qCAA0B,GAAE,CAAA;QAEnD,IAAI,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,EAAE,CAAC;YACxB,MAAM,KAAK,CACT,oHAAoH,CACrH,CAAA;QACH,CAAC;QAED,OAAO,IAAA,qBAAK,EAAC,GAAG,cAAc,iBAAiB,IAAI,EAAE,EAAE;YACrD,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,SAAS;SACjB,CAAC,CAAA;IACJ,CAAC;;AApCH,wBAqCC"}
|
package/dist/commands/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AA8CrC,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,IAAI;;;QAMV;IAEK,GAAG;CAkCV"}
|
package/dist/commands/test.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const child_process_1 = require("child_process");
|
|
6
|
-
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
7
|
-
const commands_1 = require("../utils/commands");
|
|
8
|
-
const directory_1 = require("../utils/directory");
|
|
9
|
-
const generate_1 = require("../utils/generate");
|
|
10
|
-
/**
|
|
11
|
-
* Taken from toolbelt
|
|
12
|
-
*
|
|
13
|
-
* https://github.com/vtex/toolbelt/pull/442
|
|
14
|
-
*/
|
|
15
|
-
const stabilityThreshold = process.platform === 'darwin' ? 100 : 200;
|
|
16
|
-
const defaultPatterns = ['*/**', '**'];
|
|
17
|
-
const defaultIgnored = [
|
|
18
|
-
'.DS_Store',
|
|
19
|
-
'README.md',
|
|
20
|
-
'.gitignore',
|
|
21
|
-
'package.json',
|
|
22
|
-
'node_modules/**',
|
|
23
|
-
'**/node_modules/**',
|
|
24
|
-
'.git/**',
|
|
25
|
-
'.faststore/**',
|
|
26
|
-
'**/.faststore/**',
|
|
27
|
-
];
|
|
28
|
-
const testAbortController = new AbortController();
|
|
29
|
-
async function storeTest(tmpDir) {
|
|
30
|
-
const packageManager = (0, commands_1.getPreferredPackageManager)();
|
|
31
|
-
const testProcess = (0, child_process_1.spawn)(`${packageManager} run test:e2e`, {
|
|
32
|
-
shell: true,
|
|
33
|
-
cwd: tmpDir,
|
|
34
|
-
signal: testAbortController.signal,
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
});
|
|
37
|
-
testProcess.on('close', () => {
|
|
38
|
-
testAbortController.abort();
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
class Test extends core_1.Command {
|
|
42
|
-
static args = [
|
|
43
|
-
{
|
|
44
|
-
name: 'path',
|
|
45
|
-
description: 'The path where the FastStore being tested is. Defaults to cwd.',
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
async run() {
|
|
49
|
-
const { args } = await this.parse(Test);
|
|
50
|
-
const basePath = (0, directory_1.getBasePath)(args.path);
|
|
51
|
-
const { getRoot, tmpDir } = (0, directory_1.withBasePath)(basePath);
|
|
52
|
-
const watcher = chokidar_1.default.watch([...defaultPatterns], {
|
|
53
|
-
atomic: stabilityThreshold,
|
|
54
|
-
awaitWriteFinish: {
|
|
55
|
-
stabilityThreshold,
|
|
56
|
-
},
|
|
57
|
-
cwd: getRoot(),
|
|
58
|
-
ignoreInitial: true,
|
|
59
|
-
ignored: defaultIgnored,
|
|
60
|
-
persistent: true,
|
|
61
|
-
usePolling: process.platform === 'win32',
|
|
62
|
-
});
|
|
63
|
-
testAbortController.signal.addEventListener('abort', () => {
|
|
64
|
-
watcher.close();
|
|
65
|
-
});
|
|
66
|
-
await (0, generate_1.generate)({ setup: true, basePath });
|
|
67
|
-
storeTest(tmpDir);
|
|
68
|
-
return await new Promise((resolve, reject) => {
|
|
69
|
-
watcher
|
|
70
|
-
.on('error', () => {
|
|
71
|
-
testAbortController.abort();
|
|
72
|
-
reject();
|
|
73
|
-
})
|
|
74
|
-
.on('ready', resolve);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.default = Test;
|
|
79
|
-
//# sourceMappingURL=test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,iDAAqC;AACrC,gEAA+B;AAE/B,gDAA8D;AAC9D,kDAA8D;AAC9D,gDAA4C;AAE5C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;AAEpE,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAEtC,MAAM,cAAc,GAAG;IACrB,WAAW;IACX,WAAW;IACX,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,SAAS;IACT,eAAe;IACf,kBAAkB;CACnB,CAAA;AAED,MAAM,mBAAmB,GAAG,IAAI,eAAe,EAAE,CAAA;AAEjD,KAAK,UAAU,SAAS,CAAC,MAAc;IACrC,MAAM,cAAc,GAAG,IAAA,qCAA0B,GAAE,CAAA;IAEnD,MAAM,WAAW,GAAG,IAAA,qBAAK,EAAC,GAAG,cAAc,eAAe,EAAE;QAC1D,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,mBAAmB,CAAC,MAAM;QAClC,KAAK,EAAE,SAAS;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O,EAAE,GAAG,EAAE;gBAChB,mBAAmB,CAAC,KAAK,EAAE,CAAA;gBAC3B,MAAM,EAAE,CAAA;YACV,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;;AA1CH,uBA2CC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { run } from '@oclif/core';
|
|
2
|
-
import { default as Create } from './commands/create';
|
|
3
|
-
import { default as Dev } from './commands/dev';
|
|
4
|
-
import { default as Build } from './commands/build';
|
|
5
|
-
import { default as Serve } from './commands/start';
|
|
6
|
-
import { default as CmsSync } from './commands/cms-sync';
|
|
7
|
-
import { default as Test } from './commands/test';
|
|
8
|
-
export declare const commands: {
|
|
9
|
-
create: typeof Create;
|
|
10
|
-
dev: typeof Dev;
|
|
11
|
-
build: typeof Build;
|
|
12
|
-
serve: typeof Serve;
|
|
13
|
-
'cms-sync': typeof CmsSync;
|
|
14
|
-
test: typeof Test;
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEjD,eAAO,MAAM,QAAQ;;;;;;;CAOpB,CAAA"}
|
package/dist/utils/commands.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"AAGA,wBAAgB,0BAA0B,WASzC"}
|
package/dist/utils/commands.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPreferredPackageManager = void 0;
|
|
4
|
-
const node_child_process_1 = require("node:child_process");
|
|
5
|
-
// Retrieves the package manager based on the developer lockfile, using `ni`.
|
|
6
|
-
function getPreferredPackageManager() {
|
|
7
|
-
const agent = (0, node_child_process_1.spawnSync)('na', ['?'], {
|
|
8
|
-
encoding: 'utf8',
|
|
9
|
-
shell: true,
|
|
10
|
-
}).stdout.trim();
|
|
11
|
-
if (agent === '')
|
|
12
|
-
return 'yarn'; // Default to Yarn
|
|
13
|
-
return agent;
|
|
14
|
-
}
|
|
15
|
-
exports.getPreferredPackageManager = getPreferredPackageManager;
|
|
16
|
-
//# sourceMappingURL=commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":";;;AAAA,2DAA8C;AAE9C,6EAA6E;AAC7E,SAAgB,0BAA0B;IACxC,MAAM,KAAK,GAAG,IAAA,8BAAS,EAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;QACnC,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IAEhB,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,MAAM,CAAA,CAAC,kBAAkB;IAElD,OAAO,KAAK,CAAA;AACd,CAAC;AATD,gEASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNextjsPages.d.ts","sourceRoot":"","sources":["../../src/utils/createNextjsPages.ts"],"names":[],"mappings":"AAwDA,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,QA8DjD"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNextJsPages = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const directory_1 = require("./directory");
|
|
8
|
-
const myAccountPage_1 = require("./templates/myAccountPage");
|
|
9
|
-
const ALLOWED_PREFIX_PAGES = ['/pvt/account'];
|
|
10
|
-
const createExternalPages = ({ customizationPagesDir, corePagesDir, baseCustomizationPagesDir, }) => {
|
|
11
|
-
fs_1.default.readdirSync(customizationPagesDir).forEach((file) => {
|
|
12
|
-
const filePath = path_1.default.join(customizationPagesDir, file);
|
|
13
|
-
const destinationPath = path_1.default.join(corePagesDir, file);
|
|
14
|
-
if (fs_1.default.statSync(filePath).isDirectory()) {
|
|
15
|
-
if (!fs_1.default.existsSync(destinationPath)) {
|
|
16
|
-
fs_1.default.mkdirSync(destinationPath, { recursive: true });
|
|
17
|
-
}
|
|
18
|
-
return createExternalPages({
|
|
19
|
-
customizationPagesDir: filePath,
|
|
20
|
-
corePagesDir: destinationPath,
|
|
21
|
-
baseCustomizationPagesDir,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const isReactFile = filePath.endsWith('.tsx');
|
|
25
|
-
/* Checks if the destination path does not exist as a file or as a folder containing an "index.tsx" file.
|
|
26
|
-
* This ensures that the path is available before proceeding with file creation or other operations.
|
|
27
|
-
*/
|
|
28
|
-
const isDestinationAvailable = !fs_1.default.existsSync(destinationPath) &&
|
|
29
|
-
!fs_1.default.existsSync(path_1.default.join(destinationPath.replace('.tsx', ''), 'index.tsx'));
|
|
30
|
-
if (isReactFile && isDestinationAvailable) {
|
|
31
|
-
const externalPagePath = `src/customizations/src/pages${filePath.replace(baseCustomizationPagesDir, '').replace('.tsx', '')}`;
|
|
32
|
-
const content = (0, myAccountPage_1.myAccountPageTemplate)(externalPagePath);
|
|
33
|
-
fs_1.default.writeFileSync(destinationPath, content);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
function isAllowedPrefixPage(file) {
|
|
38
|
-
return ALLOWED_PREFIX_PAGES.some((prefix) => file.startsWith(prefix));
|
|
39
|
-
}
|
|
40
|
-
function createNextJsPages(basePath) {
|
|
41
|
-
const { tmpDir } = (0, directory_1.withBasePath)(basePath);
|
|
42
|
-
const corePagesDir = path_1.default.join(tmpDir, 'src/pages');
|
|
43
|
-
const customizationPagesDir = path_1.default.join(tmpDir, 'src/customizations/src/pages');
|
|
44
|
-
if (!fs_1.default.existsSync(customizationPagesDir)) {
|
|
45
|
-
// If the customization pages directory doesn't exist, we don't need to create any pages
|
|
46
|
-
// and we can return early.
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const allPagesAreAllowed = ({ basePath, dirPath, }) => {
|
|
50
|
-
const items = fs_1.default.readdirSync(dirPath, { withFileTypes: true });
|
|
51
|
-
return items.every((item) => {
|
|
52
|
-
const itemPath = path_1.default.join(dirPath, item.name);
|
|
53
|
-
if (item.isDirectory()) {
|
|
54
|
-
return allPagesAreAllowed({ basePath, dirPath: itemPath });
|
|
55
|
-
}
|
|
56
|
-
if (!item.isFile()) {
|
|
57
|
-
return false; // Reject anything that is not a file (symlinks, sockets, etc.)
|
|
58
|
-
}
|
|
59
|
-
const isNextPage = /\.(js|jsx|ts|tsx)$/.test(item.name);
|
|
60
|
-
if (!isNextPage) {
|
|
61
|
-
return false; // Reject files that are not Next.js pages
|
|
62
|
-
}
|
|
63
|
-
// For Next.js page files, check if they match allowed prefixes
|
|
64
|
-
const relativePath = path_1.default.relative(basePath, itemPath);
|
|
65
|
-
const normalizedPath = '/' + relativePath.replace(/\\/g, '/').replace(/\.(js|jsx|ts|tsx)$/, '');
|
|
66
|
-
return isAllowedPrefixPage(normalizedPath);
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
const pagesAreAllowed = allPagesAreAllowed({
|
|
70
|
-
basePath: customizationPagesDir,
|
|
71
|
-
dirPath: customizationPagesDir,
|
|
72
|
-
});
|
|
73
|
-
if (!pagesAreAllowed) {
|
|
74
|
-
throw new Error(`Only these prefix pages: (${ALLOWED_PREFIX_PAGES.join(', ')}) are allowed`);
|
|
75
|
-
}
|
|
76
|
-
createExternalPages({
|
|
77
|
-
customizationPagesDir,
|
|
78
|
-
corePagesDir,
|
|
79
|
-
baseCustomizationPagesDir: customizationPagesDir,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
exports.createNextJsPages = createNextJsPages;
|
|
83
|
-
//# sourceMappingURL=createNextjsPages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createNextjsPages.js","sourceRoot":"","sources":["../../src/utils/createNextjsPages.ts"],"names":[],"mappings":";;;;AAAA,oDAAmB;AACnB,wDAAuB;AAEvB,2CAA0C;AAC1C,6DAAiE;AAEjE,MAAM,oBAAoB,GAAG,CAAC,cAAc,CAAC,CAAA;AAQ7C,MAAM,mBAAmB,GAAG,CAAC,EAC3B,qBAAqB,EACrB,YAAY,EACZ,yBAAyB,GACD,EAAE,EAAE;IAC5B,YAAE,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrD,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAA;QACvD,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;QACrD,IAAI,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,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,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;YAE1E,OAAO,mBAAmB,CAAC,cAAc,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,MAAM,eAAe,GAAG,kBAAkB,CAAC;QACzC,QAAQ,EAAE,qBAAqB;QAC/B,OAAO,EAAE,qBAAqB;KAC/B,CAAC,CAAA;IAEF,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,6BAA6B,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAC5E,CAAA;IACH,CAAC;IAED,mBAAmB,CAAC;QAClB,qBAAqB;QACrB,YAAY;QACZ,yBAAyB,EAAE,qBAAqB;KACjD,CAAC,CAAA;AACJ,CAAC;AA9DD,8CA8DC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type InstallDependenciesOptions = {
|
|
2
|
-
dependencies: string[];
|
|
3
|
-
cwd: string;
|
|
4
|
-
errorMessage: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function installDependencies({ dependencies, cwd, errorMessage, }: InstallDependenciesOptions): void;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/utils/dependencies.ts"],"names":[],"mappings":"AAGA,KAAK,0BAA0B,GAAG;IAChC,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,GAAG,EACH,YAAY,GACb,EAAE,0BAA0B,QAU5B"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.installDependencies = void 0;
|
|
4
|
-
const commands_1 = require("./commands");
|
|
5
|
-
const runCommandSync_1 = require("./runCommandSync");
|
|
6
|
-
function installDependencies({ dependencies, cwd, errorMessage, }) {
|
|
7
|
-
const packageManager = (0, commands_1.getPreferredPackageManager)();
|
|
8
|
-
const installCommand = packageManager === 'npm' ? 'install' : 'add';
|
|
9
|
-
(0, runCommandSync_1.runCommandSync)({
|
|
10
|
-
cmd: `${packageManager} ${installCommand} ${dependencies.join(' ')}`,
|
|
11
|
-
errorMessage,
|
|
12
|
-
throws: 'error',
|
|
13
|
-
cwd,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
exports.installDependencies = installDependencies;
|
|
17
|
-
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/utils/dependencies.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AACvD,qDAAiD;AAQjD,SAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,GAAG,EACH,YAAY,GACe;IAC3B,MAAM,cAAc,GAAG,IAAA,qCAA0B,GAAE,CAAA;IACnD,MAAM,cAAc,GAAG,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;IAEnE,IAAA,+BAAc,EAAC;QACb,GAAG,EAAE,GAAG,cAAc,IAAI,cAAc,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACpE,YAAY;QACZ,MAAM,EAAE,OAAO;QACf,GAAG;KACJ,CAAC,CAAA;AACJ,CAAC;AAdD,kDAcC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks for the presence of deprecated secret files and logs a warning if found.
|
|
3
|
-
*
|
|
4
|
-
* @param basePath The base path where to look for the secret files
|
|
5
|
-
*/
|
|
6
|
-
export declare function checkDeprecatedSecretFiles(basePath: string): void;
|
|
7
|
-
//# sourceMappingURL=deprecations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecations.d.ts","sourceRoot":"","sources":["../../src/utils/deprecations.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,QAsB1D"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkDeprecatedSecretFiles = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const logger_1 = require("./logger");
|
|
8
|
-
/**
|
|
9
|
-
* Checks for the presence of deprecated secret files and logs a warning if found.
|
|
10
|
-
*
|
|
11
|
-
* @param basePath The base path where to look for the secret files
|
|
12
|
-
*/
|
|
13
|
-
function checkDeprecatedSecretFiles(basePath) {
|
|
14
|
-
const secretsFilePath = `${basePath}/secrets.hidden.json`;
|
|
15
|
-
const vtexEnvFilePath = `${basePath}/vtex.env`;
|
|
16
|
-
const secretsFileExists = (0, fs_1.existsSync)(secretsFilePath);
|
|
17
|
-
const vtexEnvFileExists = (0, fs_1.existsSync)(vtexEnvFilePath);
|
|
18
|
-
if (secretsFileExists || vtexEnvFileExists) {
|
|
19
|
-
const filesFound = [
|
|
20
|
-
secretsFileExists ? 'secrets.hidden.json' : null,
|
|
21
|
-
vtexEnvFileExists ? 'vtex.env' : null,
|
|
22
|
-
]
|
|
23
|
-
.filter(Boolean)
|
|
24
|
-
.join(' and ');
|
|
25
|
-
logger_1.logger.warn(`${chalk_1.default.yellow('warning')} - Deprecated secret files detected: ${chalk_1.default.bold(filesFound)}\n` +
|
|
26
|
-
`Note: 'vtex.env' should only be used for local development and not in production.\n` +
|
|
27
|
-
`For production environments, please configure your secrets directly in the FastStore WebOps Settings page.`);
|
|
28
|
-
logger_1.logger.log(''); // Add empty line for better readability
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.checkDeprecatedSecretFiles = checkDeprecatedSecretFiles;
|
|
32
|
-
//# sourceMappingURL=deprecations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecations.js","sourceRoot":"","sources":["../../src/utils/deprecations.ts"],"names":[],"mappings":";;;;AAAA,2BAA+B;AAC/B,0DAAyB;AACzB,qCAAiC;AAEjC;;;;GAIG;AACH,SAAgB,0BAA0B,CAAC,QAAgB;IACzD,MAAM,eAAe,GAAG,GAAG,QAAQ,sBAAsB,CAAA;IACzD,MAAM,eAAe,GAAG,GAAG,QAAQ,WAAW,CAAA;IAE9C,MAAM,iBAAiB,GAAG,IAAA,eAAU,EAAC,eAAe,CAAC,CAAA;IACrD,MAAM,iBAAiB,GAAG,IAAA,eAAU,EAAC,eAAe,CAAC,CAAA;IAErD,IAAI,iBAAiB,IAAI,iBAAiB,EAAE,CAAC;QAC3C,MAAM,UAAU,GAAG;YACjB,iBAAiB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI;YAChD,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;SACtC;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,OAAO,CAAC,CAAA;QAEhB,eAAM,CAAC,IAAI,CACT,GAAG,eAAK,CAAC,MAAM,CAAC,SAAS,CAAC,wCAAwC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI;YAC1F,qFAAqF;YACrF,4GAA4G,CAC/G,CAAA;QACD,eAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA,CAAC,wCAAwC;IACzD,CAAC;AACH,CAAC;AAtBD,gEAsBC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export declare const getBasePath: (basePath?: string) => string;
|
|
2
|
-
export declare const withBasePath: (basepath: string) => {
|
|
3
|
-
getRoot: () => string;
|
|
4
|
-
getPackagePath: (...packagePath: string[]) => string;
|
|
5
|
-
userDir: string;
|
|
6
|
-
userSrcDir: string;
|
|
7
|
-
userThemesFileDir: string;
|
|
8
|
-
userCMSDir: string;
|
|
9
|
-
userLegacyStoreConfigFile: string;
|
|
10
|
-
userStoreConfigFile: string;
|
|
11
|
-
tmpSeoConfig: string;
|
|
12
|
-
tmpFolderName: string;
|
|
13
|
-
tmpDir: string;
|
|
14
|
-
tmpCustomizationsSrcDir: string;
|
|
15
|
-
tmpThemesCustomizationsFile: string;
|
|
16
|
-
tmpThemesPluginsFile: string;
|
|
17
|
-
tmpCMSDir: (projectName?: string) => string;
|
|
18
|
-
tmpCMSWebhookUrlsFile: string;
|
|
19
|
-
tmpPagesDir: string;
|
|
20
|
-
tmpApiDir: string;
|
|
21
|
-
tmpPluginsDir: string;
|
|
22
|
-
tmpStoreConfigFile: string;
|
|
23
|
-
coreDir: string;
|
|
24
|
-
coreCMSDir: string;
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=directory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,cAAe,MAAM,WAM5C,CAAA;AAED,eAAO,MAAM,YAAY,aAAc,MAAM;;qCA8CH,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;CA6CjD,CAAA"}
|
package/dist/utils/directory.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withBasePath = exports.getBasePath = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
-
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
|
-
const getBasePath = (basePath) => {
|
|
8
|
-
if (basePath) {
|
|
9
|
-
return node_path_1.default.resolve(basePath);
|
|
10
|
-
}
|
|
11
|
-
return process.cwd();
|
|
12
|
-
};
|
|
13
|
-
exports.getBasePath = getBasePath;
|
|
14
|
-
const withBasePath = (basepath) => {
|
|
15
|
-
const tmpFolderName = '.faststore';
|
|
16
|
-
// The basepath is where the discovery code is. It's either . or the path configured on faststore.json
|
|
17
|
-
const getRoot = () => basepath;
|
|
18
|
-
/*
|
|
19
|
-
* This will loop from the basepath until the process.cwd() looking for node_modules/@faststore/core
|
|
20
|
-
*
|
|
21
|
-
* If it reaches process.cwd() (or /, as a safeguard), without finding it, it will throw an exception
|
|
22
|
-
*/
|
|
23
|
-
const getCorePackagePath = () => {
|
|
24
|
-
const packageFromNodeModules = node_path_1.default.join('node_modules', '@faststore', 'core');
|
|
25
|
-
const resolvedCwd = node_path_1.default.resolve(process.cwd());
|
|
26
|
-
const parents = [];
|
|
27
|
-
let attemptedPath;
|
|
28
|
-
do {
|
|
29
|
-
attemptedPath = node_path_1.default.join(resolvedCwd, basepath, ...parents, packageFromNodeModules);
|
|
30
|
-
if (node_fs_1.default.existsSync(attemptedPath)) {
|
|
31
|
-
return attemptedPath;
|
|
32
|
-
}
|
|
33
|
-
parents.push('..');
|
|
34
|
-
} while (node_path_1.default.resolve(attemptedPath) !== resolvedCwd ||
|
|
35
|
-
node_path_1.default.resolve(attemptedPath) !== '/');
|
|
36
|
-
throw `Could not find @node_modules on ${basepath} or any of its parents until ${attemptedPath}`;
|
|
37
|
-
};
|
|
38
|
-
const customizationsDir = getRoot();
|
|
39
|
-
const tmpDir = node_path_1.default.join(process.cwd(), tmpFolderName);
|
|
40
|
-
const userSrcDir = node_path_1.default.join(customizationsDir, 'src');
|
|
41
|
-
const getPackagePath = (...packagePath) => node_path_1.default.join(customizationsDir, 'node_modules', ...packagePath);
|
|
42
|
-
return {
|
|
43
|
-
getRoot,
|
|
44
|
-
getPackagePath,
|
|
45
|
-
userDir: customizationsDir,
|
|
46
|
-
userSrcDir,
|
|
47
|
-
userThemesFileDir: node_path_1.default.join(userSrcDir, 'themes'),
|
|
48
|
-
userCMSDir: node_path_1.default.join(customizationsDir, 'cms', 'faststore'),
|
|
49
|
-
userLegacyStoreConfigFile: node_path_1.default.join(customizationsDir, 'faststore.config.js'),
|
|
50
|
-
userStoreConfigFile: node_path_1.default.join(customizationsDir, 'discovery.config.js'),
|
|
51
|
-
tmpSeoConfig: node_path_1.default.join(tmpDir, 'next-seo.config.ts'),
|
|
52
|
-
tmpFolderName,
|
|
53
|
-
tmpDir,
|
|
54
|
-
tmpCustomizationsSrcDir: node_path_1.default.join(tmpDir, 'src', 'customizations', 'src'),
|
|
55
|
-
tmpThemesCustomizationsFile: node_path_1.default.join(tmpDir, 'src', 'customizations', 'src', 'themes', 'index.scss'),
|
|
56
|
-
tmpThemesPluginsFile: node_path_1.default.join(tmpDir, 'src', 'plugins', 'index.scss'),
|
|
57
|
-
tmpCMSDir: (projectName = 'faststore') => node_path_1.default.join(tmpDir, 'cms', projectName),
|
|
58
|
-
tmpCMSWebhookUrlsFile: node_path_1.default.join(tmpDir, 'cms-webhook-urls.json'),
|
|
59
|
-
tmpPagesDir: node_path_1.default.join(tmpDir, 'src', 'pages'),
|
|
60
|
-
tmpApiDir: node_path_1.default.join(tmpDir, 'src', 'pages', 'api'),
|
|
61
|
-
tmpPluginsDir: node_path_1.default.join(tmpDir, 'src', 'plugins'),
|
|
62
|
-
tmpStoreConfigFile: node_path_1.default.join(tmpDir, 'src', 'customizations', 'discovery.config.js'),
|
|
63
|
-
coreDir: getCorePackagePath(),
|
|
64
|
-
coreCMSDir: node_path_1.default.join(getCorePackagePath(), 'cms', 'faststore'),
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
exports.withBasePath = withBasePath;
|
|
68
|
-
//# sourceMappingURL=directory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":";;;;AAAA,8DAAwB;AACxB,kEAA4B;AAErB,M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