@automattic/vip 2.28.0 → 2.28.2
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
CHANGED
|
@@ -31,7 +31,7 @@ const examples = [{
|
|
|
31
31
|
usage: `${_devEnvironment.DEV_ENVIRONMENT_FULL_COMMAND} start`,
|
|
32
32
|
description: 'Starts a local dev environment'
|
|
33
33
|
}];
|
|
34
|
-
(0, _command.default)().option('slug', 'Custom name of the dev environment').option('skip-rebuild', 'Only start stopped services').option(['w', 'skip-wp-versions-check'], 'Skip
|
|
34
|
+
(0, _command.default)().option('slug', 'Custom name of the dev environment').option('skip-rebuild', 'Only start stopped services').option(['w', 'skip-wp-versions-check'], 'Skip propting for wordpress update if non latest').option('vscode', 'Open environment workspace in VSCode').examples(examples).argv(process.argv, async (arg, opt) => {
|
|
35
35
|
const slug = await (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
36
36
|
const lando = await (0, _devEnvironmentLando.bootstrapLando)();
|
|
37
37
|
await (0, _devEnvironmentCli.validateDependencies)(lando, slug);
|
|
@@ -69,4 +69,7 @@ const examples = [{
|
|
|
69
69
|
await (0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_start_command_error', trackingInfo);
|
|
70
70
|
process.exitCode = 1;
|
|
71
71
|
}
|
|
72
|
+
await (0, _devEnvironmentCli.postStart)(slug, {
|
|
73
|
+
openVSCode: !!opt.vscode
|
|
74
|
+
});
|
|
72
75
|
});
|
|
@@ -12,6 +12,7 @@ exports.getOptionsFromAppInfo = getOptionsFromAppInfo;
|
|
|
12
12
|
exports.getTagChoices = getTagChoices;
|
|
13
13
|
exports.handleCLIException = handleCLIException;
|
|
14
14
|
exports.handleDeprecatedOptions = handleDeprecatedOptions;
|
|
15
|
+
exports.postStart = postStart;
|
|
15
16
|
exports.printTable = printTable;
|
|
16
17
|
exports.processBooleanOption = processBooleanOption;
|
|
17
18
|
exports.processComponentOptionInput = processComponentOptionInput;
|
|
@@ -32,6 +33,8 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
|
32
33
|
var _path = _interopRequireDefault(require("path"));
|
|
33
34
|
var _os = _interopRequireDefault(require("os"));
|
|
34
35
|
var _dns = _interopRequireDefault(require("dns"));
|
|
36
|
+
var _child_process = require("child_process");
|
|
37
|
+
var _shelljs = require("shelljs");
|
|
35
38
|
var _progress = require("../../lib/cli/progress");
|
|
36
39
|
var _tracker = require("../tracker");
|
|
37
40
|
var _devEnvironment = require("../constants/dev-environment");
|
|
@@ -638,6 +641,40 @@ function getEnvTrackingInfo(slug) {
|
|
|
638
641
|
};
|
|
639
642
|
}
|
|
640
643
|
}
|
|
644
|
+
async function postStart(slug, options) {
|
|
645
|
+
if (options.openVSCode) {
|
|
646
|
+
launchVSCode(slug);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const launchVSCode = slug => {
|
|
650
|
+
const workspacePath = (0, _devEnvironmentCore.getVSCodeWorkspacePath)(slug);
|
|
651
|
+
if (_fs.default.existsSync(workspacePath)) {
|
|
652
|
+
console.log('VSCode workspace already exists, skipping creation.');
|
|
653
|
+
} else {
|
|
654
|
+
(0, _devEnvironmentCore.generateVSCodeWorkspace)(slug);
|
|
655
|
+
console.log('VSCode workspace generated');
|
|
656
|
+
}
|
|
657
|
+
const vsCodeExecutable = getVSCodeExecutable();
|
|
658
|
+
if (vsCodeExecutable) {
|
|
659
|
+
(0, _child_process.spawn)(vsCodeExecutable, [workspacePath], {
|
|
660
|
+
shell: process.platform === 'win32'
|
|
661
|
+
});
|
|
662
|
+
} else {
|
|
663
|
+
console.log(`VSCode not detected in path, please open ${workspacePath} with VSCode`);
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
const getVSCodeExecutable = () => {
|
|
667
|
+
const candidates = ['code', 'code-insiders', 'codium'];
|
|
668
|
+
for (const candidate of candidates) {
|
|
669
|
+
const result = (0, _shelljs.which)(candidate);
|
|
670
|
+
if (result) {
|
|
671
|
+
debug(`Found ${candidate} in path`);
|
|
672
|
+
return candidate;
|
|
673
|
+
}
|
|
674
|
+
debug(`Could not find ${candidate} in path`);
|
|
675
|
+
}
|
|
676
|
+
return null;
|
|
677
|
+
};
|
|
641
678
|
function handleDeprecatedOptions(opts) {
|
|
642
679
|
if (opts.mailhog) {
|
|
643
680
|
console.warn(_chalk.default.yellow('Warning: --mailhog is deprecated and will be removed in a future release. Please use --mailpit instead.'));
|
|
@@ -8,9 +8,11 @@ exports.destroyEnvironment = destroyEnvironment;
|
|
|
8
8
|
exports.doesEnvironmentExist = doesEnvironmentExist;
|
|
9
9
|
exports.exec = exec;
|
|
10
10
|
exports.fetchVersionList = fetchVersionList;
|
|
11
|
+
exports.generateVSCodeWorkspace = generateVSCodeWorkspace;
|
|
11
12
|
exports.getAllEnvironmentNames = getAllEnvironmentNames;
|
|
12
13
|
exports.getApplicationInformation = getApplicationInformation;
|
|
13
14
|
exports.getEnvironmentPath = getEnvironmentPath;
|
|
15
|
+
exports.getVSCodeWorkspacePath = getVSCodeWorkspacePath;
|
|
14
16
|
exports.getVersionList = getVersionList;
|
|
15
17
|
exports.importMediaPath = importMediaPath;
|
|
16
18
|
exports.printAllEnvironmentsInfo = printAllEnvironmentsInfo;
|
|
@@ -629,4 +631,70 @@ async function getVersionList() {
|
|
|
629
631
|
prerelease: true
|
|
630
632
|
}];
|
|
631
633
|
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Functions generates workspace config including the launch config
|
|
638
|
+
*
|
|
639
|
+
* @param {string} slug - The slug of the environment to generate workspace config for
|
|
640
|
+
* @return {string} Workspace path
|
|
641
|
+
*/
|
|
642
|
+
function generateVSCodeWorkspace(slug) {
|
|
643
|
+
var _instanceData$muPlugi, _instanceData$appCode;
|
|
644
|
+
debug('Generating VSCode Workspace');
|
|
645
|
+
const location = getEnvironmentPath(slug);
|
|
646
|
+
const workspacePath = getVSCodeWorkspacePath(slug);
|
|
647
|
+
const instanceData = readEnvironmentData(slug);
|
|
648
|
+
const pathMappings = generatePathMappings(location, instanceData);
|
|
649
|
+
const folders = [{
|
|
650
|
+
path: location
|
|
651
|
+
}];
|
|
652
|
+
if ((_instanceData$muPlugi = instanceData.muPlugins) !== null && _instanceData$muPlugi !== void 0 && _instanceData$muPlugi.dir) {
|
|
653
|
+
folders.push({
|
|
654
|
+
path: instanceData.muPlugins.dir
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
if ((_instanceData$appCode = instanceData.appCode) !== null && _instanceData$appCode !== void 0 && _instanceData$appCode.dir) {
|
|
658
|
+
folders.push({
|
|
659
|
+
path: instanceData.appCode.dir
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
const workspace = {
|
|
663
|
+
folders,
|
|
664
|
+
launch: {
|
|
665
|
+
version: '0.2.0',
|
|
666
|
+
configurations: [{
|
|
667
|
+
name: `Debug ${slug}`,
|
|
668
|
+
type: 'php',
|
|
669
|
+
request: 'launch',
|
|
670
|
+
port: 9003,
|
|
671
|
+
pathMappings
|
|
672
|
+
}]
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
_fs.default.writeFileSync(workspacePath, JSON.stringify(workspace, null, 2));
|
|
676
|
+
return workspacePath;
|
|
677
|
+
}
|
|
678
|
+
const generatePathMappings = (location, instanceData) => {
|
|
679
|
+
var _instanceData$muPlugi2, _instanceData$appCode2;
|
|
680
|
+
const pathMappings = {};
|
|
681
|
+
if ((_instanceData$muPlugi2 = instanceData.muPlugins) !== null && _instanceData$muPlugi2 !== void 0 && _instanceData$muPlugi2.dir) {
|
|
682
|
+
pathMappings['/wp/wp-content/mu-plugins'] = instanceData.muPlugins.dir;
|
|
683
|
+
}
|
|
684
|
+
if ((_instanceData$appCode2 = instanceData.appCode) !== null && _instanceData$appCode2 !== void 0 && _instanceData$appCode2.dir) {
|
|
685
|
+
pathMappings['/wp/wp-content/client-mu-plugins'] = _path.default.resolve(instanceData.appCode.dir, 'client-mu-plugins');
|
|
686
|
+
pathMappings['/wp/wp-content/images'] = _path.default.resolve(instanceData.appCode.dir, 'images');
|
|
687
|
+
pathMappings['/wp/wp-content/languages'] = _path.default.resolve(instanceData.appCode.dir, 'languages');
|
|
688
|
+
pathMappings['/wp/wp-content/plugins'] = _path.default.resolve(instanceData.appCode.dir, 'plugins');
|
|
689
|
+
pathMappings['/wp/wp-content/private'] = _path.default.resolve(instanceData.appCode.dir, 'private');
|
|
690
|
+
pathMappings['/wp/wp-content/themes'] = _path.default.resolve(instanceData.appCode.dir, 'themes');
|
|
691
|
+
pathMappings['/wp/wp-content/vip-config'] = _path.default.resolve(instanceData.appCode.dir, 'vip-config');
|
|
692
|
+
}
|
|
693
|
+
pathMappings['/wp'] = _path.default.resolve(location, 'wordpress');
|
|
694
|
+
return pathMappings;
|
|
695
|
+
};
|
|
696
|
+
function getVSCodeWorkspacePath(slug) {
|
|
697
|
+
const location = getEnvironmentPath(slug);
|
|
698
|
+
const workspacePath = _path.default.join(location, `${slug}.code-workspace`);
|
|
699
|
+
return workspacePath;
|
|
632
700
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.2",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@automattic/vip",
|
|
9
|
-
"version": "2.28.
|
|
9
|
+
"version": "2.28.2",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"proxy-from-env": "^1.1.0",
|
|
36
36
|
"rollbar": "2.22.0",
|
|
37
37
|
"semver": "7.3.8",
|
|
38
|
+
"shelljs": "^0.8.5",
|
|
38
39
|
"single-line-log": "1.1.2",
|
|
39
40
|
"socket.io-client": "^4.5.3",
|
|
40
41
|
"socket.io-stream": "npm:@wearemothership/socket.io-stream@^0.9.1",
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
"update-notifier": "5.1.0",
|
|
43
44
|
"uuid": "9.0.0",
|
|
44
45
|
"xdg-basedir": "^4.0.0",
|
|
45
|
-
"xml2js": "^0.
|
|
46
|
+
"xml2js": "^0.5.0"
|
|
46
47
|
},
|
|
47
48
|
"bin": {
|
|
48
49
|
"vip": "dist/bin/vip.js",
|
|
@@ -15234,9 +15235,9 @@
|
|
|
15234
15235
|
}
|
|
15235
15236
|
},
|
|
15236
15237
|
"node_modules/xml2js": {
|
|
15237
|
-
"version": "0.
|
|
15238
|
-
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.
|
|
15239
|
-
"integrity": "sha512-
|
|
15238
|
+
"version": "0.5.0",
|
|
15239
|
+
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
|
|
15240
|
+
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
|
|
15240
15241
|
"dependencies": {
|
|
15241
15242
|
"sax": ">=0.6.0",
|
|
15242
15243
|
"xmlbuilder": "~11.0.0"
|
|
@@ -26793,9 +26794,9 @@
|
|
|
26793
26794
|
"dev": true
|
|
26794
26795
|
},
|
|
26795
26796
|
"xml2js": {
|
|
26796
|
-
"version": "0.
|
|
26797
|
-
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.
|
|
26798
|
-
"integrity": "sha512-
|
|
26797
|
+
"version": "0.5.0",
|
|
26798
|
+
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
|
|
26799
|
+
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
|
|
26799
26800
|
"requires": {
|
|
26800
26801
|
"sax": ">=0.6.0",
|
|
26801
26802
|
"xmlbuilder": "~11.0.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.2",
|
|
4
4
|
"description": "The VIP Javascript library & CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -136,6 +136,7 @@
|
|
|
136
136
|
"proxy-from-env": "^1.1.0",
|
|
137
137
|
"rollbar": "2.22.0",
|
|
138
138
|
"semver": "7.3.8",
|
|
139
|
+
"shelljs": "^0.8.5",
|
|
139
140
|
"single-line-log": "1.1.2",
|
|
140
141
|
"socket.io-client": "^4.5.3",
|
|
141
142
|
"socket.io-stream": "npm:@wearemothership/socket.io-stream@^0.9.1",
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
"update-notifier": "5.1.0",
|
|
144
145
|
"uuid": "9.0.0",
|
|
145
146
|
"xdg-basedir": "^4.0.0",
|
|
146
|
-
"xml2js": "^0.
|
|
147
|
+
"xml2js": "^0.5.0"
|
|
147
148
|
},
|
|
148
149
|
"optionalDependencies": {
|
|
149
150
|
"keytar": "7.7.0"
|