@emulsify/cli 1.4.0 → 1.4.1
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/dist/handlers/init.js
CHANGED
|
@@ -21,14 +21,14 @@ const git = (0, simple_git_1.default)();
|
|
|
21
21
|
function init(progress) {
|
|
22
22
|
return async (name, targetDirectory, options) => {
|
|
23
23
|
const { name: autoPlatformName, emulsifyParentDirectory } = (await (0, getPlatformInfo_1.default)()) || {};
|
|
24
|
-
const platformName = (options === null || options === void 0 ? void 0 : options.platform) || autoPlatformName;
|
|
24
|
+
const platformName = ((options === null || options === void 0 ? void 0 : options.platform) || autoPlatformName);
|
|
25
25
|
if (!platformName) {
|
|
26
26
|
return (0, log_1.default)('error', 'Unable to determine which platform you are installing Emulsify within. Please specify a platform (such as "drupal" or "wordpress") by passing a -p or --platform flag with your init command.', constants_2.EXIT_ERROR);
|
|
27
27
|
}
|
|
28
28
|
progress.tick(10, {
|
|
29
29
|
message: `using starter for ${platformName}, validating config`,
|
|
30
30
|
});
|
|
31
|
-
const machineName = (options === null || options === void 0 ? void 0 : options.machineName) || (0, strToMachineName_1.default)(name);
|
|
31
|
+
const machineName = (options === null || options === void 0 ? void 0 : options.machineName) || (0, strToMachineName_1.default)(name, platformName);
|
|
32
32
|
const starters = (0, getAvailableStarters_1.default)();
|
|
33
33
|
const starter = starters.find(ramda_1.default.propEq('platform')(platformName));
|
|
34
34
|
const targetParent = targetDirectory || emulsifyParentDirectory;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.getMachineNameSpaceReplacement = void 0;
|
|
4
|
+
const getMachineNameSpaceReplacement = (platform) => (platform === 'drupal' ? '_' : '-');
|
|
5
|
+
exports.getMachineNameSpaceReplacement = getMachineNameSpaceReplacement;
|
|
6
|
+
function strToMachineName(str, platform) {
|
|
4
7
|
return (str
|
|
5
8
|
.replace(/[^A-Za-z0-9 ]/g, '')
|
|
6
9
|
.replace(/\s{2,}/g, ' ')
|
|
7
|
-
.replace(/\s/g,
|
|
10
|
+
.replace(/\s/g, (0, exports.getMachineNameSpaceReplacement)(platform))
|
|
8
11
|
.toLowerCase());
|
|
9
12
|
}
|
|
10
13
|
exports.default = strToMachineName;
|
package/package.json
CHANGED