@faststore/cli 2.0.3-alpha.0 → 2.0.20-alpha.0
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 +18 -0
- package/dist/utils/generate.js +34 -33
- package/dist/utils/generate.js.map +1 -1
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
## [2.0.20-alpha.0](https://github.com/vtex/faststore/compare/v2.0.19-alpha.0...v2.0.20-alpha.0) (2022-12-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* cli copy theme ([#1560](https://github.com/vtex/faststore/issues/1560)) ([9f16796](https://github.com/vtex/faststore/commit/9f167967a9a48adb7912a74a131fda22dd9715e8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [2.0.12-alpha.0](https://github.com/vtex/faststore/compare/v2.0.11-alpha.0...v2.0.12-alpha.0) (2022-12-13)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* Beautify CLI messages with chalk ([#1550](https://github.com/vtex/faststore/issues/1550)) ([6c4c32c](https://github.com/vtex/faststore/commit/6c4c32c3ac0a97b55364b7251f2d90dc70f08952))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## 2.0.3-alpha.0 (2022-11-30)
|
|
7
25
|
|
|
8
26
|
|
package/dist/utils/generate.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generate = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_extra_1 = require("fs-extra");
|
|
6
5
|
const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
|
|
6
|
+
const fs_extra_1 = require("fs-extra");
|
|
7
7
|
const directory_1 = require("./directory");
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
9
|
const ignorePaths = ['node_modules'];
|
|
9
10
|
function createTmpFolder() {
|
|
10
11
|
try {
|
|
@@ -12,12 +13,10 @@ function createTmpFolder() {
|
|
|
12
13
|
(0, fs_extra_1.removeSync)(directory_1.tmpDir);
|
|
13
14
|
}
|
|
14
15
|
(0, fs_extra_1.mkdirsSync)(directory_1.tmpDir);
|
|
16
|
+
console.log(`${chalk_1.default.green('success')} - Temporary folder ${chalk_1.default.dim(directory_1.tmpFolderName)} created`);
|
|
15
17
|
}
|
|
16
18
|
catch (err) {
|
|
17
|
-
console.error(err);
|
|
18
|
-
}
|
|
19
|
-
finally {
|
|
20
|
-
console.log(`Temporary folder ${directory_1.tmpFolderName} created`);
|
|
19
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
function copyCoreFiles() {
|
|
@@ -31,35 +30,43 @@ function copyCoreFiles() {
|
|
|
31
30
|
return shouldCopy;
|
|
32
31
|
},
|
|
33
32
|
});
|
|
33
|
+
console.log(`${chalk_1.default.green('success')} - Core files copied`);
|
|
34
34
|
}
|
|
35
35
|
catch (e) {
|
|
36
36
|
console.error(e);
|
|
37
37
|
}
|
|
38
|
-
finally {
|
|
39
|
-
console.log(`Core files copied`);
|
|
40
|
-
}
|
|
41
38
|
}
|
|
42
39
|
function copyUserSrcToCustomizations() {
|
|
43
40
|
try {
|
|
44
41
|
(0, fs_extra_1.copySync)(directory_1.userSrcDir, directory_1.tmpCustomizationsDir);
|
|
42
|
+
console.log(`${chalk_1.default.green('success')} - Custom files copied`);
|
|
45
43
|
}
|
|
46
44
|
catch (err) {
|
|
47
|
-
console.error(err);
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
console.log('Copied custom files');
|
|
45
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
51
46
|
}
|
|
52
47
|
}
|
|
53
48
|
async function copyTheme() {
|
|
54
49
|
const storeConfig = await Promise.resolve().then(() => tslib_1.__importStar(require(directory_1.userStoreConfigFileDir)));
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
if (storeConfig.theme) {
|
|
51
|
+
const customTheme = `${directory_1.userThemesFileDir}/${storeConfig.theme}.scss`;
|
|
52
|
+
if ((0, fs_extra_1.existsSync)(customTheme)) {
|
|
53
|
+
try {
|
|
54
|
+
(0, fs_extra_1.copyFileSync)(customTheme, directory_1.tmpThemesCustomizationsFileDir);
|
|
55
|
+
console.log(`${chalk_1.default.green('success')} - ${storeConfig.theme} theme has been applied`);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// TODO: add link to our doc about creating a custom theme on faststore evergreen
|
|
63
|
+
console.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`);
|
|
64
|
+
}
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
else if ((0, fs_extra_1.existsSync)(directory_1.userThemesFileDir) &&
|
|
67
|
+
(0, fs_extra_1.readdirSync)(directory_1.userThemesFileDir).length > 0) {
|
|
68
|
+
// TODO: add link to our doc about creating a custom theme on faststore evergreen
|
|
69
|
+
console.info(`${chalk_1.default.blue('info')} - The theme needs to be added to the config file to be applied`);
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
function mergeCMSFile(fileName) {
|
|
@@ -70,12 +77,10 @@ function mergeCMSFile(fileName) {
|
|
|
70
77
|
const mergeContentTypes = [...coreContentTypesJSON, ...customContentTypesJSON];
|
|
71
78
|
try {
|
|
72
79
|
(0, fs_extra_1.writeFileSync)(`${directory_1.tmpCMSDir}/${fileName}`, JSON.stringify(mergeContentTypes));
|
|
80
|
+
console.log(`${chalk_1.default.green('success')} - CMS file ${chalk_1.default.dim(fileName)} created`);
|
|
73
81
|
}
|
|
74
82
|
catch (err) {
|
|
75
|
-
console.error(err);
|
|
76
|
-
}
|
|
77
|
-
finally {
|
|
78
|
-
console.log(`CMS file ${fileName} created`);
|
|
83
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
79
84
|
}
|
|
80
85
|
}
|
|
81
86
|
function generateStoreConfigFile(content) {
|
|
@@ -87,23 +92,19 @@ async function copyStoreConfig() {
|
|
|
87
92
|
const storeConfigFromCore = await Promise.resolve().then(() => tslib_1.__importStar(require(directory_1.coreStoreConfigFileDir)));
|
|
88
93
|
const mergedStoreConfig = (0, deepmerge_1.default)(storeConfigFromCore, storeConfigFromStore);
|
|
89
94
|
(0, fs_extra_1.writeFileSync)(directory_1.tmpStoreConfigFileDir, generateStoreConfigFile(mergedStoreConfig));
|
|
95
|
+
console.log(`${chalk_1.default.green('success')} - File ${chalk_1.default.dim('store.config.js')} copied`);
|
|
90
96
|
}
|
|
91
97
|
catch (err) {
|
|
92
|
-
console.error(err);
|
|
93
|
-
}
|
|
94
|
-
finally {
|
|
95
|
-
console.log(`File store.config.js copied`);
|
|
98
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
function mergeCMSFiles() {
|
|
99
102
|
try {
|
|
100
103
|
(0, fs_extra_1.mkdirsSync)(`${directory_1.tmpDir}/cms`);
|
|
104
|
+
console.log(`${chalk_1.default.green('success')} - CMS folder created`);
|
|
101
105
|
}
|
|
102
106
|
catch (err) {
|
|
103
|
-
console.error(err);
|
|
104
|
-
}
|
|
105
|
-
finally {
|
|
106
|
-
console.log(`CMS file created`);
|
|
107
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
107
108
|
}
|
|
108
109
|
mergeCMSFile('content-types.json');
|
|
109
110
|
mergeCMSFile('sections.json');
|
|
@@ -111,11 +112,11 @@ function mergeCMSFiles() {
|
|
|
111
112
|
function createNodeModulesSymbolicLink() {
|
|
112
113
|
try {
|
|
113
114
|
(0, fs_extra_1.symlinkSync)(directory_1.userNodeModulesDir, directory_1.tmpNodeModulesDir);
|
|
115
|
+
console.log(`${chalk_1.default.green('success')} - Symbolic ${chalk_1.default.dim('node_modules')} link created from ${chalk_1.default.dim(directory_1.userNodeModulesDir)} to ${chalk_1.default.dim(directory_1.tmpNodeModulesDir)}`);
|
|
114
116
|
}
|
|
115
117
|
catch (err) {
|
|
116
|
-
console.error(err);
|
|
118
|
+
console.error(`${chalk_1.default.red('error')} - ${err}`);
|
|
117
119
|
}
|
|
118
|
-
console.log(`node_modules symbolic link created from ${directory_1.userNodeModulesDir} to ${directory_1.tmpNodeModulesDir}`);
|
|
119
120
|
}
|
|
120
121
|
async function generate(options) {
|
|
121
122
|
const { setup = false } = options ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/utils/generate.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/utils/generate.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AACjC,uCAUiB;AAEjB,2CAgBoB;AAEpB,0DAAyB;AAMzB,MAAM,WAAW,GAAG,CAAC,cAAc,CAAC,CAAA;AAEpC,SAAS,eAAe;IACtB,IAAI;QACF,IAAI,IAAA,qBAAU,EAAC,kBAAM,CAAC,EAAE;YACtB,IAAA,qBAAU,EAAC,kBAAM,CAAC,CAAA;SACnB;QAED,IAAA,qBAAU,EAAC,kBAAM,CAAC,CAAA;QAClB,OAAO,CAAC,GAAG,CACT,GAAG,eAAK,CAAC,KAAK,CAAC,SAAS,CAAC,uBAAuB,eAAK,CAAC,GAAG,CACvD,yBAAa,CACd,UAAU,CACZ,CAAA;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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20-alpha.0",
|
|
4
4
|
"description": "FastStore CLI",
|
|
5
5
|
"author": "Emerson Laurentino @emersonlaurentino",
|
|
6
6
|
"bin": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@oclif/core": "^1.16.4",
|
|
21
21
|
"@oclif/plugin-help": "^5",
|
|
22
22
|
"@oclif/plugin-not-found": "^2.3.3",
|
|
23
|
+
"chalk": "~4.1.2",
|
|
23
24
|
"chokidar": "^3.5.3",
|
|
24
25
|
"deepmerge": "^4.2.2",
|
|
25
26
|
"fs-extra": "^10.1.0",
|
|
@@ -37,6 +38,10 @@
|
|
|
37
38
|
"tslib": "^2.3.1",
|
|
38
39
|
"typescript": "^4.8.4"
|
|
39
40
|
},
|
|
41
|
+
"volta": {
|
|
42
|
+
"node": "16.18.0",
|
|
43
|
+
"yarn": "1.19.1"
|
|
44
|
+
},
|
|
40
45
|
"oclif": {
|
|
41
46
|
"bin": "faststore",
|
|
42
47
|
"dirname": "faststore",
|
|
@@ -63,5 +68,5 @@
|
|
|
63
68
|
"oclif"
|
|
64
69
|
],
|
|
65
70
|
"types": "dist/index.d.ts",
|
|
66
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "7d86ce0afcdfdf61519989279a352b464a5215d7"
|
|
67
72
|
}
|