@appdirect/sfb-toolkit 3.0.5 → 3.0.6
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/coverage/clover.xml +32 -32
- package/coverage/coverage-final.json +4 -4
- package/coverage/lcov-report/constants/customUserAttributesMock.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/pageUrls.js.html +1 -1
- package/coverage/lcov-report/constants/userMock.js.html +1 -1
- package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +1 -1
- package/coverage/lcov-report/controllers/controllers-utils/index.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +1 -1
- package/coverage/lcov-report/controllers/data-filters/index.html +1 -1
- package/coverage/lcov-report/controllers/index.html +1 -1
- package/coverage/lcov-report/controllers/index.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +7 -7
- package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +3 -3
- package/coverage/lcov-report/front-end-utils/src/components/base/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +11 -11
- package/coverage/lcov-report/front-end-utils/src/components/container.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/components/search.js.html +13 -13
- package/coverage/lcov-report/front-end-utils/src/constants/index.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +1 -1
- package/coverage/lcov-report/front-end-utils/src/utils/index.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/middlewares/config.js.html +1 -1
- package/coverage/lcov-report/middlewares/index.html +1 -1
- package/coverage/lcov.info +81 -81
- package/npm-shrinkwrap.json +7 -7
- package/package.json +3 -3
- package/readme.md +5 -0
- package/src/tools/toolkit-common-fun.js +87 -3
- package/src/tools/toolkit-common-vars.js +1 -1
- package/src/tools/toolkit-components.js +11 -5
- package/src/tools/toolkit-create.js +19 -2
- package/src/tools/toolkit-install.js +20 -2
- package/src/tools/toolkit-package.js +3 -1
- package/src/tools/toolkit-setup.js +41 -7
|
@@ -4,7 +4,8 @@ const colors = require("colors")
|
|
|
4
4
|
const prompt = require("./prompt-questions");
|
|
5
5
|
|
|
6
6
|
const { CURRENT_PATH, TOOLKIT_PATH, COMMAND_PARAM, BOOTSTRAP_FOLDERS, CONFIG_PATH, PAGE_OBJECTS_SUFFIX } = require("./toolkit-common-vars");
|
|
7
|
-
const { selfDestruction, filesCounter, shouldBeProjectFolder, getAvailableFolderWithPrompt,
|
|
7
|
+
const { selfDestruction, filesCounter, shouldBeProjectFolder, getAvailableFolderWithPrompt,
|
|
8
|
+
licenseAgreement, versionCheck, createCustomThemePacakgeJson, addMetadata } = require("./toolkit-common-fun");
|
|
8
9
|
const { LOCAL_CONFIG } = require("./toolkit-config");
|
|
9
10
|
const projectName = COMMAND_PARAM; // [optional] project name
|
|
10
11
|
|
|
@@ -13,6 +14,9 @@ let freshLocalConfig = {
|
|
|
13
14
|
defaultValues: {}
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
let themeName;
|
|
18
|
+
let userThemeAnswer;
|
|
19
|
+
|
|
16
20
|
(async () => {
|
|
17
21
|
try {
|
|
18
22
|
await licenseAgreement();
|
|
@@ -52,26 +56,40 @@ let freshLocalConfig = {
|
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
58
|
|
|
59
|
+
const themeCreatedBy = await prompt.ask(["WhoAreYou"]);
|
|
55
60
|
|
|
56
61
|
// copy theme folder
|
|
57
62
|
try {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
userThemeAnswer = await prompt.ask(["ThemeTemplates"]);
|
|
64
|
+
themeName = await prompt.ask(["ThemeName"], [{name:"ThemeName", default: userThemeAnswer.ThemeTemplates.name}]);
|
|
61
65
|
await copy(
|
|
62
66
|
`${TOOLKIT_PATH}/node_modules/${userThemeAnswer.ThemeTemplates.dependency}`,
|
|
63
|
-
`${projectPath}/themes/${
|
|
67
|
+
`${projectPath}/themes/${themeName.ThemeName}`
|
|
64
68
|
);
|
|
65
69
|
await remove(
|
|
66
|
-
`${projectPath}/themes/${
|
|
70
|
+
`${projectPath}/themes/${themeName.ThemeName}/package.json`
|
|
67
71
|
);
|
|
68
|
-
freshLocalConfig.defaultValues.themeName =
|
|
72
|
+
freshLocalConfig.defaultValues.themeName = themeName.ThemeName;
|
|
69
73
|
} catch (err) {
|
|
70
74
|
console.error(` Could not copy clasic theme due to: \n ${err}`.red);
|
|
71
75
|
selfDestruction(projectPath); // revert changes
|
|
72
76
|
process.exit(1);
|
|
73
77
|
}
|
|
74
78
|
|
|
79
|
+
try{
|
|
80
|
+
fs.writeFileSync(
|
|
81
|
+
`${projectPath}/themes/${themeName.ThemeName}/package.json`,
|
|
82
|
+
createCustomThemePacakgeJson(
|
|
83
|
+
themeName.ThemeName,
|
|
84
|
+
userThemeAnswer.ThemeTemplates.dependency,
|
|
85
|
+
themeCreatedBy.WhoAreYou
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
} catch(err) {
|
|
89
|
+
console.error(` ERROR: Unable to create ${themeName.ThemeName}'s package.json file due to ${err}.`.red);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
|
|
75
93
|
// copy config/index.js file
|
|
76
94
|
try {
|
|
77
95
|
await copy(
|
|
@@ -107,6 +125,22 @@ let freshLocalConfig = {
|
|
|
107
125
|
process.exit(1);
|
|
108
126
|
}
|
|
109
127
|
|
|
128
|
+
try {
|
|
129
|
+
const toolkitPackageJson = JSON.parse(fs.readFileSync(`${TOOLKIT_PATH}/package.json`));
|
|
130
|
+
const themeVersion = toolkitPackageJson.dependencies[`${userThemeAnswer.ThemeTemplates.dependency}`];
|
|
131
|
+
addMetadata({
|
|
132
|
+
themeTemplate: userThemeAnswer.ThemeTemplates.dependency,
|
|
133
|
+
themeVersion,
|
|
134
|
+
createdBy: themeCreatedBy.WhoAreYou,
|
|
135
|
+
createdAt: new Date(),
|
|
136
|
+
customComponents: false,
|
|
137
|
+
sfbThemeComponentsVersion: 'latest'
|
|
138
|
+
}, projectPath);
|
|
139
|
+
|
|
140
|
+
} catch (err) {
|
|
141
|
+
console.error(` ERROR: Unable to save metadata due to: ${err}`.red);
|
|
142
|
+
}
|
|
143
|
+
|
|
110
144
|
console.log(` Theme location: ${projectPath}/`.green)
|
|
111
145
|
console.log(` Configuration file location: ${projectPath}/config/`.green)
|
|
112
146
|
console.log(`\n All done! You can start your server by running \`sfb-toolkit start\` inside the project root folder: ${projectPath}\n`.green);
|