cob-cli 2.27.1 → 2.28.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/lib/commands/customize.js +15 -4
- package/package.json +1 -1
|
@@ -115,7 +115,7 @@ async function applyCustomization(repo) {
|
|
|
115
115
|
|
|
116
116
|
let customization = (await import(customizationFile)).default;
|
|
117
117
|
|
|
118
|
-
// Asks
|
|
118
|
+
// Asks questions, if configuration exists
|
|
119
119
|
let answers = {};
|
|
120
120
|
if (customization.questions) {
|
|
121
121
|
answers = await inquirer.prompt(customization.questions);
|
|
@@ -123,10 +123,10 @@ async function applyCustomization(repo) {
|
|
|
123
123
|
|
|
124
124
|
// Apply specific customization, if it exists, otherwise use default actions
|
|
125
125
|
if (customization.actions) {
|
|
126
|
-
customization.actions(repo.name,
|
|
126
|
+
customization.actions(repo.name, answers, copy, mergeFiles);
|
|
127
127
|
} else {
|
|
128
128
|
// Default actions
|
|
129
|
-
await copy(
|
|
129
|
+
await copy(repo.name, process.cwd(), answers);
|
|
130
130
|
await mergeFiles(repo.name);
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -135,11 +135,21 @@ async function applyCustomization(repo) {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/* ************************************************************************ */
|
|
138
|
-
async function copy(
|
|
138
|
+
async function copy(repoName, target, substitutions = {}) {
|
|
139
139
|
// https://www.npmtrends.com/copyfiles-vs-cpx-vs-ncp-vs-npm-build-tools
|
|
140
140
|
// https://www.npmjs.com/package/ncp
|
|
141
141
|
// https://www.npmjs.com/package/copyfiles
|
|
142
142
|
|
|
143
|
+
let source
|
|
144
|
+
if(repoName.indexOf("/") == 0) {
|
|
145
|
+
// Based of repoName starting with "/" we assume this is already a fullpath
|
|
146
|
+
source = repoName;
|
|
147
|
+
} else {
|
|
148
|
+
// Otherwise assume repoName on standard cob-cli xdgData path
|
|
149
|
+
const { xdgData } = await import("xdg-basedir");
|
|
150
|
+
source = path.resolve( xdgData, "cob-cli", repoName);
|
|
151
|
+
}
|
|
152
|
+
|
|
143
153
|
console.log(" Copying template files ...");
|
|
144
154
|
|
|
145
155
|
let excludedFiles = RegExp(
|
|
@@ -198,6 +208,7 @@ async function mergeFiles(block) {
|
|
|
198
208
|
}
|
|
199
209
|
let prodFileContent = fs.readFileSync(prodFile).toString();
|
|
200
210
|
let mergeFileContent = fs.readFileSync(mergeFile).toString();
|
|
211
|
+
// With comments we support JS, CSS, GROOVY
|
|
201
212
|
let startStr = "/* COB-CLI START " + blockMark + " */\n";
|
|
202
213
|
let endStr = "\n/* COB-CLI END " + blockMark + " */\n";
|
|
203
214
|
|
package/package.json
CHANGED