@faststore/cli 1.12.19 → 1.12.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/commands/dev.js +46 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/utils/contentFromPath.d.ts +10 -0
- package/dist/utils/contentFromPath.js +17 -0
- package/dist/utils/contentFromPath.js.map +1 -0
- package/dist/utils/directory.d.ts +21 -0
- package/dist/utils/directory.js +31 -0
- package/dist/utils/directory.js.map +1 -0
- package/dist/utils/generate.d.ts +5 -0
- package/dist/utils/generate.js +123 -0
- package/dist/utils/generate.js.map +1 -0
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.12.25](https://github.com/vtex/faststore/compare/v1.12.24...v1.12.25) (2022-11-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @faststore/cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.12.20 (2022-10-26)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Add watch capability to cli dev command ([#1483](https://github.com/vtex/faststore/issues/1483)) ([ac34aad](https://github.com/vtex/faststore/commit/ac34aad74411118b73a53329978810083856fcaa))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Chores
|
|
23
|
+
|
|
24
|
+
* git blame ignore modification by data-fs ([#1494](https://github.com/vtex/faststore/issues/1494)) ([783079e](https://github.com/vtex/faststore/commit/783079e7095b39270bbb60e79063b774056dc5d4))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## 1.12.19 (2022-10-25)
|
|
7
29
|
|
|
8
30
|
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const core_1 = require("@oclif/core");
|
|
5
|
+
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
6
|
+
const generate_1 = require("../utils/generate");
|
|
7
|
+
const directory_1 = require("../utils/directory");
|
|
8
|
+
/**
|
|
9
|
+
* Taken from toolbelt
|
|
10
|
+
*
|
|
11
|
+
* https://github.com/vtex/toolbelt/pull/442
|
|
12
|
+
*/
|
|
13
|
+
const stabilityThreshold = process.platform === 'darwin' ? 100 : 200;
|
|
14
|
+
const defaultPatterns = ['*/**', '**'];
|
|
15
|
+
const defaultIgnored = [
|
|
16
|
+
'.DS_Store',
|
|
17
|
+
'README.md',
|
|
18
|
+
'.gitignore',
|
|
19
|
+
'package.json',
|
|
20
|
+
'node_modules/**',
|
|
21
|
+
'**/node_modules/**',
|
|
22
|
+
'.git/**',
|
|
23
|
+
'.faststore/**',
|
|
24
|
+
'**/.faststore/**',
|
|
25
|
+
];
|
|
4
26
|
class Dev extends core_1.Command {
|
|
5
27
|
async run() {
|
|
6
|
-
|
|
28
|
+
const queueChange = ( /* path: string, remove: boolean */) => {
|
|
29
|
+
// getContentFromPath(path, remove)
|
|
30
|
+
(0, generate_1.generate)();
|
|
31
|
+
};
|
|
32
|
+
const watcher = chokidar_1.default.watch([...defaultPatterns], {
|
|
33
|
+
atomic: stabilityThreshold,
|
|
34
|
+
awaitWriteFinish: {
|
|
35
|
+
stabilityThreshold,
|
|
36
|
+
},
|
|
37
|
+
cwd: (0, directory_1.getRoot)(),
|
|
38
|
+
ignoreInitial: true,
|
|
39
|
+
ignored: defaultIgnored,
|
|
40
|
+
persistent: true,
|
|
41
|
+
usePolling: process.platform === 'win32',
|
|
42
|
+
});
|
|
43
|
+
await (0, generate_1.generate)({ setup: true });
|
|
44
|
+
await new Promise((resolve, reject) => {
|
|
45
|
+
watcher
|
|
46
|
+
.on('add', ( /*file*/) => queueChange( /*file, false*/))
|
|
47
|
+
.on('change', ( /*file*/) => queueChange( /*file, false*/))
|
|
48
|
+
.on('unlink', ( /*file*/) => queueChange( /*file, true*/))
|
|
49
|
+
.on('error', reject)
|
|
50
|
+
.on('ready', resolve);
|
|
51
|
+
});
|
|
7
52
|
}
|
|
8
53
|
}
|
|
9
54
|
exports.default = Dev;
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":";;;AAAA,sCAAqC;AACrC,gEAA+B;AAE/B,gDAA4C;AAC5C,kDAA4C;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,MAAqB,GAAI,SAAQ,cAAO;IACtC,KAAK,CAAC,GAAG;QACP,MAAM,WAAW,GAAG,EAAC,mCAAmC,EAAE,EAAE;YAC1D,mCAAmC;YAEnC,IAAA,mBAAQ,GAAE,CAAA;QACZ,CAAC,CAAA;QAED,MAAM,OAAO,GAAG,kBAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,eAAe,CAAC,EAAE;YACnD,MAAM,EAAE,kBAAkB;YAC1B,gBAAgB,EAAE;gBAChB,kBAAkB;aACnB;YACD,GAAG,EAAE,IAAA,mBAAO,GAAE;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE,cAAc;YACvB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;SACzC,CAAC,CAAA;QAEF,MAAM,IAAA,mBAAQ,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAE/B,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,OAAO;iBACJ,EAAE,CAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAC,eAAe,CAAC,CAAC;iBACrD,EAAE,CAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAC,eAAe,CAAC,CAAC;iBACxD,EAAE,CAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAC,cAAc,CAAC,CAAC;iBACvD,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;iBACnB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AA/BD,sBA+BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { Readable } from 'stream';
|
|
5
|
+
export interface ContentFromPath {
|
|
6
|
+
path: string | null;
|
|
7
|
+
content: string | Readable | Buffer | NodeJS.ReadableStream;
|
|
8
|
+
}
|
|
9
|
+
declare const getContentFromPath: (path: string, remove?: boolean) => ContentFromPath;
|
|
10
|
+
export { getContentFromPath };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContentFromPath = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const directory_1 = require("./directory");
|
|
7
|
+
const getContentFromPath = (path, remove) => {
|
|
8
|
+
const content = remove
|
|
9
|
+
? ''
|
|
10
|
+
: (0, fs_extra_1.readFileSync)((0, path_1.resolve)((0, directory_1.getRoot)(), path)).toString('base64');
|
|
11
|
+
return {
|
|
12
|
+
content,
|
|
13
|
+
path: path.split(path_1.sep).join('/'),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.getContentFromPath = getContentFromPath;
|
|
17
|
+
//# sourceMappingURL=contentFromPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentFromPath.js","sourceRoot":"","sources":["../../src/utils/contentFromPath.ts"],"names":[],"mappings":";;;AAAA,+BAAkD;AAElD,uCAAuC;AACvC,2CAAqC;AAOrC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,MAAgB,EAAmB,EAAE;IAC7E,MAAM,OAAO,GAAG,MAAM;QACpB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,IAAA,uBAAY,EAAC,IAAA,cAAW,EAAC,IAAA,mBAAO,GAAE,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAEjE,OAAO;QACL,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;KAChC,CAAA;AACH,CAAC,CAAA;AAEQ,gDAAkB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const getRoot: () => string;
|
|
2
|
+
export declare const userDir: string;
|
|
3
|
+
export declare const faststoreDir: string;
|
|
4
|
+
export declare const tmpFolderName = ".faststore";
|
|
5
|
+
export declare const tmpDir: string;
|
|
6
|
+
export declare const coreFolderName = "core";
|
|
7
|
+
export declare const coreDir: string;
|
|
8
|
+
export declare const srcFolderName = "src";
|
|
9
|
+
export declare const userSrcDir: string;
|
|
10
|
+
export declare const customizationsFolderName = "customizations";
|
|
11
|
+
export declare const tmpCustomizationsDir: string;
|
|
12
|
+
export declare const userThemesFileDir: string;
|
|
13
|
+
export declare const tmpThemesCustomizationsFileDir: string;
|
|
14
|
+
export declare const cmsFolderName = "cms";
|
|
15
|
+
export declare const tmpCMSDir: string;
|
|
16
|
+
export declare const coreCMSDir: string;
|
|
17
|
+
export declare const userCMSDir: string;
|
|
18
|
+
export declare const storeConfigFileName = "store.config.js";
|
|
19
|
+
export declare const userStoreConfigFileDir: string;
|
|
20
|
+
export declare const coreStoreConfigFileDir: string;
|
|
21
|
+
export declare const tmpStoreConfigFileDir: string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tmpStoreConfigFileDir = exports.coreStoreConfigFileDir = exports.userStoreConfigFileDir = exports.storeConfigFileName = exports.userCMSDir = exports.coreCMSDir = exports.tmpCMSDir = exports.cmsFolderName = exports.tmpThemesCustomizationsFileDir = exports.userThemesFileDir = exports.tmpCustomizationsDir = exports.customizationsFolderName = exports.userSrcDir = exports.srcFolderName = exports.coreDir = exports.coreFolderName = exports.tmpDir = exports.tmpFolderName = exports.faststoreDir = exports.userDir = exports.getRoot = void 0;
|
|
4
|
+
const getRoot = () => {
|
|
5
|
+
if (process.env.OCLIF_COMPILATION) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
return process.cwd();
|
|
9
|
+
};
|
|
10
|
+
exports.getRoot = getRoot;
|
|
11
|
+
exports.userDir = (0, exports.getRoot)();
|
|
12
|
+
exports.faststoreDir = `${exports.userDir}/node_modules/@faststore`;
|
|
13
|
+
exports.tmpFolderName = '.faststore';
|
|
14
|
+
exports.tmpDir = `${exports.userDir}/${exports.tmpFolderName}`;
|
|
15
|
+
exports.coreFolderName = 'core';
|
|
16
|
+
exports.coreDir = `${exports.faststoreDir}/${exports.coreFolderName}`;
|
|
17
|
+
exports.srcFolderName = 'src';
|
|
18
|
+
exports.userSrcDir = `${exports.userDir}/${exports.srcFolderName}`;
|
|
19
|
+
exports.customizationsFolderName = 'customizations';
|
|
20
|
+
exports.tmpCustomizationsDir = `${exports.tmpDir}/src/${exports.customizationsFolderName}`;
|
|
21
|
+
exports.userThemesFileDir = `${exports.userSrcDir}/themes`;
|
|
22
|
+
exports.tmpThemesCustomizationsFileDir = `${exports.tmpCustomizationsDir}/themes/index.scss`;
|
|
23
|
+
exports.cmsFolderName = 'cms';
|
|
24
|
+
exports.tmpCMSDir = `${exports.tmpDir}/${exports.cmsFolderName}`;
|
|
25
|
+
exports.coreCMSDir = `${exports.coreDir}/${exports.cmsFolderName}`;
|
|
26
|
+
exports.userCMSDir = `${exports.userDir}/${exports.cmsFolderName}`;
|
|
27
|
+
exports.storeConfigFileName = 'store.config.js';
|
|
28
|
+
exports.userStoreConfigFileDir = `${exports.userDir}/${exports.storeConfigFileName}`;
|
|
29
|
+
exports.coreStoreConfigFileDir = `${exports.coreDir}/${exports.storeConfigFileName}`;
|
|
30
|
+
exports.tmpStoreConfigFileDir = `${exports.tmpDir}/${exports.storeConfigFileName}`;
|
|
31
|
+
//# sourceMappingURL=directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,GAAG,EAAE;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;QACjC,OAAO,EAAE,CAAA;KACV;IAED,OAAO,OAAO,CAAC,GAAG,EAAE,CAAA;AACtB,CAAC,CAAA;AANY,QAAA,OAAO,WAMnB;AAEY,QAAA,OAAO,GAAG,IAAA,eAAO,GAAE,CAAA;AACnB,QAAA,YAAY,GAAG,GAAG,eAAO,0BAA0B,CAAA;AAEnD,QAAA,aAAa,GAAG,YAAY,CAAA;AAC5B,QAAA,MAAM,GAAG,GAAG,eAAO,IAAI,qBAAa,EAAE,CAAA;AAEtC,QAAA,cAAc,GAAG,MAAM,CAAA;AACvB,QAAA,OAAO,GAAG,GAAG,oBAAY,IAAI,sBAAc,EAAE,CAAA;AAE7C,QAAA,aAAa,GAAG,KAAK,CAAA;AACrB,QAAA,UAAU,GAAG,GAAG,eAAO,IAAI,qBAAa,EAAE,CAAA;AAE1C,QAAA,wBAAwB,GAAG,gBAAgB,CAAA;AAC3C,QAAA,oBAAoB,GAAG,GAAG,cAAM,QAAQ,gCAAwB,EAAE,CAAA;AAElE,QAAA,iBAAiB,GAAG,GAAG,kBAAU,SAAS,CAAA;AAC1C,QAAA,8BAA8B,GAAG,GAAG,4BAAoB,oBAAoB,CAAA;AAE5E,QAAA,aAAa,GAAG,KAAK,CAAA;AACrB,QAAA,SAAS,GAAG,GAAG,cAAM,IAAI,qBAAa,EAAE,CAAA;AACxC,QAAA,UAAU,GAAG,GAAG,eAAO,IAAI,qBAAa,EAAE,CAAA;AAC1C,QAAA,UAAU,GAAG,GAAG,eAAO,IAAI,qBAAa,EAAE,CAAA;AAE1C,QAAA,mBAAmB,GAAG,iBAAiB,CAAA;AACvC,QAAA,sBAAsB,GAAG,GAAG,eAAO,IAAI,2BAAmB,EAAE,CAAA;AAC5D,QAAA,sBAAsB,GAAG,GAAG,eAAO,IAAI,2BAAmB,EAAE,CAAA;AAC5D,QAAA,qBAAqB,GAAG,GAAG,cAAM,IAAI,2BAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
|
|
7
|
+
const directory_1 = require("./directory");
|
|
8
|
+
const ignorePaths = ['node_modules'];
|
|
9
|
+
function createTmpFolder() {
|
|
10
|
+
try {
|
|
11
|
+
(0, fs_extra_1.mkdirsSync)(directory_1.tmpDir);
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
console.error(err);
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
console.log(`Temporary folder ${directory_1.tmpFolderName} created`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function copyCoreFiles() {
|
|
21
|
+
try {
|
|
22
|
+
(0, fs_extra_1.copySync)(directory_1.coreDir, directory_1.tmpDir, {
|
|
23
|
+
filter(src) {
|
|
24
|
+
const fileOrDirName = src.split('/').pop();
|
|
25
|
+
const shouldCopy = fileOrDirName
|
|
26
|
+
? !ignorePaths.includes(fileOrDirName)
|
|
27
|
+
: true;
|
|
28
|
+
return shouldCopy;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.error(e);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
console.log(`Core files copied`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function copyUserSrcToCustomizations() {
|
|
40
|
+
try {
|
|
41
|
+
(0, fs_extra_1.copySync)(directory_1.userSrcDir, directory_1.tmpCustomizationsDir);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
console.error(err);
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
console.log('Copied custom files');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function copyTheme() {
|
|
51
|
+
const storeConfig = await Promise.resolve().then(() => tslib_1.__importStar(require(directory_1.userStoreConfigFileDir)));
|
|
52
|
+
try {
|
|
53
|
+
(0, fs_extra_1.copyFileSync)(`${directory_1.userThemesFileDir}/${storeConfig.theme}.scss`, directory_1.tmpThemesCustomizationsFileDir);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
console.error(err);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
console.log('Copied custom styles');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function mergeCMSFile(fileName) {
|
|
63
|
+
const coreContentTypes = (0, fs_extra_1.readFileSync)(`${directory_1.coreCMSDir}/${fileName}`, 'utf8');
|
|
64
|
+
const customContentTypes = (0, fs_extra_1.readFileSync)(`${directory_1.userCMSDir}/${fileName}`, 'utf8');
|
|
65
|
+
const coreContentTypesJSON = JSON.parse(coreContentTypes);
|
|
66
|
+
const customContentTypesJSON = JSON.parse(customContentTypes);
|
|
67
|
+
const mergeContentTypes = [...coreContentTypesJSON, ...customContentTypesJSON];
|
|
68
|
+
try {
|
|
69
|
+
(0, fs_extra_1.writeFileSync)(`${directory_1.tmpCMSDir}/${fileName}`, JSON.stringify(mergeContentTypes));
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
console.error(err);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
console.log(`CMS file ${fileName} created`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function generateStoreConfigFile(content) {
|
|
79
|
+
return `module.exports = ${JSON.stringify(content, null, 2)}\n`;
|
|
80
|
+
}
|
|
81
|
+
async function copyStoreConfig() {
|
|
82
|
+
try {
|
|
83
|
+
const storeConfigFromStore = await Promise.resolve().then(() => tslib_1.__importStar(require(directory_1.userStoreConfigFileDir)));
|
|
84
|
+
const storeConfigFromCore = await Promise.resolve().then(() => tslib_1.__importStar(require(directory_1.coreStoreConfigFileDir)));
|
|
85
|
+
const mergedStoreConfig = (0, deepmerge_1.default)(storeConfigFromCore, storeConfigFromStore);
|
|
86
|
+
(0, fs_extra_1.writeFileSync)(directory_1.tmpStoreConfigFileDir, generateStoreConfigFile(mergedStoreConfig));
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
console.error(err);
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
console.log(`File store.config.js copied`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function mergeCMSFiles() {
|
|
96
|
+
try {
|
|
97
|
+
(0, fs_extra_1.mkdirsSync)(`${directory_1.tmpDir}/cms`);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.error(err);
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
console.log(`CMS file created`);
|
|
104
|
+
}
|
|
105
|
+
mergeCMSFile('content-types.json');
|
|
106
|
+
mergeCMSFile('sections.json');
|
|
107
|
+
}
|
|
108
|
+
async function generate(options) {
|
|
109
|
+
const { setup = false } = options ?? {};
|
|
110
|
+
let setupPromise = null;
|
|
111
|
+
if (setup) {
|
|
112
|
+
setupPromise = Promise.all([createTmpFolder(), copyCoreFiles()]);
|
|
113
|
+
}
|
|
114
|
+
await Promise.all([
|
|
115
|
+
setupPromise,
|
|
116
|
+
copyUserSrcToCustomizations(),
|
|
117
|
+
copyTheme(),
|
|
118
|
+
mergeCMSFiles(),
|
|
119
|
+
copyStoreConfig(),
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
exports.generate = generate;
|
|
123
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/utils/generate.ts"],"names":[],"mappings":";;;;AAAA,uCAMiB;AACjB,kEAAiC;AAEjC,2CAcoB;AAMpB,MAAM,WAAW,GAAG,CAAC,cAAc,CAAC,CAAA;AAEpC,SAAS,eAAe;IACtB,IAAI;QACF,IAAA,qBAAU,EAAC,kBAAM,CAAC,CAAA;KACnB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;KACnB;YAAS;QACR,OAAO,CAAC,GAAG,CAAC,oBAAoB,yBAAa,UAAU,CAAC,CAAA;KACzD;AACH,CAAC;AAED,SAAS,aAAa;IACpB,IAAI;QACF,IAAA,mBAAQ,EAAC,mBAAO,EAAE,kBAAM,EAAE;YACxB,MAAM,CAAC,GAAG;gBACR,MAAM,aAAa,GAAG,GAAG,C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,CAAC,GAAG,CAAC,CAAA;KACnB;YAAS;QACR,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;KAChC;IAED,YAAY,CAAC,oBAAoB,CAAC,CAAA;IAClC,YAAY,CAAC,eAAe,CAAC,CAAA;AAC/B,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,OAAyB;IACtD,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;IAEvC,IAAI,YAAY,GAA4B,IAAI,CAAA;IAEhD,IAAI,KAAK,EAAE;QACT,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,CAAA;KACjE;IAED,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,YAAY;QACZ,2BAA2B,EAAE;QAC7B,SAAS,EAAE;QACX,aAAa,EAAE;QACf,eAAe,EAAE;KAClB,CAAC,CAAA;AACJ,CAAC;AAhBD,4BAgBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/cli",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.25",
|
|
4
4
|
"description": "FastStore CLI",
|
|
5
5
|
"author": "Emerson Laurentino @emersonlaurentino",
|
|
6
6
|
"bin": {
|
|
@@ -19,11 +19,16 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@oclif/core": "^1.16.4",
|
|
21
21
|
"@oclif/plugin-help": "^5",
|
|
22
|
-
"@oclif/plugin-not-found": "^2.3.3"
|
|
22
|
+
"@oclif/plugin-not-found": "^2.3.3",
|
|
23
|
+
"chokidar": "^3.5.3",
|
|
24
|
+
"deepmerge": "^4.2.2",
|
|
25
|
+
"fs-extra": "^10.1.0",
|
|
26
|
+
"path": "^0.12.7"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@faststore/shared": "^1.12.
|
|
29
|
+
"@faststore/shared": "^1.12.20",
|
|
26
30
|
"@types/chai": "^4",
|
|
31
|
+
"@types/fs-extra": "^9.0.13",
|
|
27
32
|
"@types/node": "^16.11.63",
|
|
28
33
|
"chai": "^4",
|
|
29
34
|
"oclif": "^3",
|
|
@@ -51,12 +56,12 @@
|
|
|
51
56
|
"version": "oclif readme && git add README.md"
|
|
52
57
|
},
|
|
53
58
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
59
|
+
"node": ">=16.0.0"
|
|
55
60
|
},
|
|
56
61
|
"bugs": "https://github.com/vtex/faststore/issues",
|
|
57
62
|
"keywords": [
|
|
58
63
|
"oclif"
|
|
59
64
|
],
|
|
60
65
|
"types": "dist/index.d.ts",
|
|
61
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "4c42036e9c87bd6c1266bdfe54325b6096811b4b"
|
|
62
67
|
}
|