@automattic/vip 2.0.12 → 2.2.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/CONTRIBUTING.md +34 -1
- package/README.md +95 -0
- package/assets/{dev-environment.lando.template.yml.ejs → dev-env.lando.template.yml.ejs} +61 -50
- package/assets/dev-env.nginx.template.conf.ejs +13 -0
- package/dist/bin/vip-app.js +9 -9
- package/dist/bin/vip-config-envvar-delete.js +93 -0
- package/dist/bin/vip-config-envvar-get-all.js +94 -0
- package/dist/bin/vip-config-envvar-get.js +79 -0
- package/dist/bin/vip-config-envvar-list.js +91 -0
- package/dist/bin/vip-config-envvar-set.js +112 -0
- package/dist/bin/vip-config-envvar.js +23 -0
- package/dist/bin/vip-config.js +20 -0
- package/dist/bin/vip-dev-env-create.js +27 -12
- package/dist/bin/vip-dev-env-destroy.js +6 -7
- package/dist/bin/vip-dev-env-exec.js +9 -10
- package/dist/bin/vip-dev-env-import-media.js +45 -0
- package/dist/bin/vip-dev-env-import-sql.js +70 -0
- package/dist/bin/vip-dev-env-import.js +32 -0
- package/dist/bin/vip-dev-env-info.js +5 -6
- package/dist/bin/vip-dev-env-start.js +24 -4
- package/dist/bin/vip-dev-env-stop.js +4 -5
- package/dist/bin/vip-dev-env.js +2 -2
- package/dist/bin/vip-import-media-abort.js +4 -4
- package/dist/bin/vip-import-media.js +6 -6
- package/dist/bin/vip-import-sql.js +8 -3
- package/dist/bin/vip-search-replace.js +1 -1
- package/dist/bin/vip-sync.js +11 -11
- package/dist/bin/vip-wp.js +14 -14
- package/dist/bin/vip.js +15 -16
- package/dist/lib/api.js +3 -1
- package/dist/lib/cli/apiConfig.js +3 -17
- package/dist/lib/cli/command.js +45 -31
- package/dist/lib/cli/format.js +19 -15
- package/dist/lib/cli/prompt.js +2 -2
- package/dist/lib/client-file-uploader.js +7 -7
- package/dist/lib/constants/dev-environment.js +2 -1
- package/dist/lib/dev-environment/dev-environment-cli.js +57 -26
- package/dist/lib/dev-environment/dev-environment-core.js +113 -29
- package/dist/lib/dev-environment/dev-environment-lando.js +90 -15
- package/dist/lib/envvar/api-delete.js +56 -0
- package/dist/lib/envvar/api-get-all.js +59 -0
- package/dist/lib/envvar/api-get.js +24 -0
- package/dist/lib/envvar/api-list.js +60 -0
- package/dist/lib/envvar/api-set.js +58 -0
- package/dist/lib/envvar/api.js +104 -0
- package/dist/lib/envvar/input.js +55 -0
- package/dist/lib/envvar/logging.js +33 -0
- package/dist/lib/envvar/read-file.js +43 -0
- package/dist/lib/keychain/insecure.js +6 -6
- package/dist/lib/keychain.js +5 -5
- package/dist/lib/media-import/progress.js +0 -5
- package/dist/lib/media-import/status.js +8 -3
- package/dist/lib/search-and-replace.js +1 -1
- package/dist/lib/site-import/status.js +6 -5
- package/dist/lib/token.js +7 -7
- package/dist/lib/tracker.js +4 -4
- package/dist/lib/validations/is-multi-site-sql-dump.js +3 -3
- package/dist/lib/validations/line-by-line.js +1 -1
- package/dist/lib/validations/sql.js +0 -18
- package/helpers/check-version.js +5 -1
- package/jest.setupMocks.js +1 -0
- package/package.json +35 -25
- package/assets/dev-environment.wp-config-defaults.php +0 -109
- package/dist/bin/vip-dev-environment-create.js +0 -58
- package/dist/bin/vip-dev-environment-destroy.js +0 -48
- package/dist/bin/vip-dev-environment-info.js +0 -58
- package/dist/bin/vip-dev-environment-start.js +0 -54
- package/dist/bin/vip-dev-environment-stop.js +0 -56
- package/dist/bin/vip-dev-environment.js +0 -23
- package/dist/lib/dev-environment.js +0 -335
|
@@ -134,24 +134,6 @@ function checkTablePrefixes(tables, errors, infos) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
const checks = {
|
|
137
|
-
useDB: {
|
|
138
|
-
matcher: /^use\s/i,
|
|
139
|
-
matchHandler: lineNumber => lineNumber,
|
|
140
|
-
outputFormatter: errorCheckFormatter,
|
|
141
|
-
results: [],
|
|
142
|
-
message: 'USE statement',
|
|
143
|
-
excerpt: "'USE' statement should not be present (case-insensitive, at beginning of line)",
|
|
144
|
-
recommendation: 'Remove these lines'
|
|
145
|
-
},
|
|
146
|
-
createDB: {
|
|
147
|
-
matcher: /^CREATE DATABASE/i,
|
|
148
|
-
matchHandler: lineNumber => lineNumber,
|
|
149
|
-
outputFormatter: errorCheckFormatter,
|
|
150
|
-
results: [],
|
|
151
|
-
message: 'CREATE DATABASE statement',
|
|
152
|
-
excerpt: "'CREATE DATABASE' statement should not be present (case-insensitive)",
|
|
153
|
-
recommendation: 'Remove these lines'
|
|
154
|
-
},
|
|
155
137
|
binaryLogging: {
|
|
156
138
|
matcher: /SET @@SESSION.sql_log_bin/i,
|
|
157
139
|
matchHandler: lineNumber => lineNumber,
|
package/helpers/check-version.js
CHANGED
|
@@ -4,6 +4,10 @@ const { name, engines } = require( '../package.json' );
|
|
|
4
4
|
const version = engines.node;
|
|
5
5
|
|
|
6
6
|
if ( ! semver.satisfies( process.version, version ) ) {
|
|
7
|
-
console.log(
|
|
7
|
+
console.log( [
|
|
8
|
+
`The current version of Node (${ process.version }) does not meet the minimum requirements;`,
|
|
9
|
+
`${ name } requires Node version ${ version }.`,
|
|
10
|
+
'Please follow the installation instructions at https://nodejs.org/en/download/ to upgrade before continuing.`',
|
|
11
|
+
].join( ' ' ) );
|
|
8
12
|
process.exit( 1 );
|
|
9
13
|
}
|
package/jest.setupMocks.js
CHANGED
package/package.json
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "The VIP Javascript library & CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"vip": "dist/bin/vip.js",
|
|
8
8
|
"vip-app": "dist/bin/vip-app.js",
|
|
9
9
|
"vip-app-list": "dist/bin/vip-app-list.js",
|
|
10
|
+
"vip-config": "dist/bin/vip-config.js",
|
|
11
|
+
"vip-config-envvar": "dist/bin/vip-config-envvar.js",
|
|
12
|
+
"vip-config-envvar-delete": "dist/bin/vip-config-envvar-delete.js",
|
|
13
|
+
"vip-config-envvar-get": "dist/bin/vip-config-envvar-get.js",
|
|
14
|
+
"vip-config-envvar-get-all": "dist/bin/vip-config-envvar-get-all.js",
|
|
15
|
+
"vip-config-envvar-list": "dist/bin/vip-config-envvar-list.js",
|
|
16
|
+
"vip-config-envvar-set": "dist/bin/vip-config-envvar-set.js",
|
|
17
|
+
"vip-dev-env": "dist/bin/vip-dev-env.js",
|
|
18
|
+
"vip-dev-env-create": "dist/bin/vip-dev-env-create.js",
|
|
19
|
+
"vip-dev-env-destroy": "dist/bin/vip-dev-env-destroy.js",
|
|
20
|
+
"vip-dev-env-exec": "dist/bin/vip-dev-env-exec.js",
|
|
21
|
+
"vip-dev-env-import": "dist/bin/vip-dev-env-import.js",
|
|
22
|
+
"vip-dev-env-import-media": "dist/bin/vip-dev-env-import-media.js",
|
|
23
|
+
"vip-dev-env-import-sql": "dist/bin/vip-dev-env-import-sql.js",
|
|
24
|
+
"vip-dev-env-info": "dist/bin/vip-dev-env-info.js",
|
|
25
|
+
"vip-dev-env-start": "dist/bin/vip-dev-env-start.js",
|
|
26
|
+
"vip-dev-env-stop": "dist/bin/vip-dev-env-stop.js",
|
|
10
27
|
"vip-import": "dist/bin/vip-import.js",
|
|
11
|
-
"vip-import-sql": "dist/bin/vip-import-sql.js",
|
|
12
|
-
"vip-import-sql-status": "dist/bin/vip-import-sql-status.js",
|
|
13
28
|
"vip-import-media": "dist/bin/vip-import-media.js",
|
|
14
|
-
"vip-import-media-status": "dist/bin/vip-import-media-status.js",
|
|
15
29
|
"vip-import-media-abort": "dist/bin/vip-import-media-abort.js",
|
|
30
|
+
"vip-import-media-status": "dist/bin/vip-import-media-status.js",
|
|
31
|
+
"vip-import-sql": "dist/bin/vip-import-sql.js",
|
|
32
|
+
"vip-import-sql-status": "dist/bin/vip-import-sql-status.js",
|
|
16
33
|
"vip-import-validate-files": "dist/bin/vip-import-validate-files.js",
|
|
17
34
|
"vip-import-validate-sql": "dist/bin/vip-import-validate-sql.js",
|
|
18
35
|
"vip-search-replace": "dist/bin/vip-search-replace.js",
|
|
19
36
|
"vip-sync": "dist/bin/vip-sync.js",
|
|
20
|
-
"vip-wp": "dist/bin/vip-wp.js"
|
|
21
|
-
"vip-dev-env": "dist/bin/vip-dev-env.js",
|
|
22
|
-
"vip-dev-env-start": "dist/bin/vip-dev-env-start.js",
|
|
23
|
-
"vip-dev-env-stop": "dist/bin/vip-dev-env-stop.js",
|
|
24
|
-
"vip-dev-env-create": "dist/bin/vip-dev-env-create.js",
|
|
25
|
-
"vip-dev-env-destroy": "dist/bin/vip-dev-env-destroy.js",
|
|
26
|
-
"vip-dev-env-info": "dist/bin/vip-dev-env-info.js",
|
|
27
|
-
"vip-dev-env-exec": "dist/bin/vip-dev-env-exec.js"
|
|
37
|
+
"vip-wp": "dist/bin/vip-wp.js"
|
|
28
38
|
},
|
|
29
39
|
"scripts": {
|
|
30
40
|
"test": "npm run lint && npm run flow && jest --coverage",
|
|
@@ -63,7 +73,7 @@
|
|
|
63
73
|
},
|
|
64
74
|
"homepage": "https://github.com/Automattic/vip#readme",
|
|
65
75
|
"devDependencies": {
|
|
66
|
-
"@babel/cli": "7.
|
|
76
|
+
"@babel/cli": "7.15.7",
|
|
67
77
|
"@babel/core": "7.14.0",
|
|
68
78
|
"@babel/eslint-parser": "^7.13.14",
|
|
69
79
|
"@babel/plugin-transform-modules-commonjs": "7.14.0",
|
|
@@ -73,18 +83,18 @@
|
|
|
73
83
|
"babel-jest": "26.6.3",
|
|
74
84
|
"babel-plugin-module-resolver": "4.1.0",
|
|
75
85
|
"core-js": "3.12.0",
|
|
76
|
-
"eslint": "7.
|
|
77
|
-
"eslint-config-wpvip": "github:automattic/eslint-config-wpvip#
|
|
86
|
+
"eslint": "7.32.0",
|
|
87
|
+
"eslint-config-wpvip": "github:automattic/eslint-config-wpvip#d0aa883",
|
|
78
88
|
"eslint-plugin-flowtype": "5.7.2",
|
|
79
89
|
"eslint-plugin-import": "2.22.1",
|
|
80
90
|
"eslint-plugin-jest": "24.3.6",
|
|
81
91
|
"eslint-plugin-json": "3.0.0",
|
|
82
92
|
"eslint-plugin-jsx-a11y": "6.4.1",
|
|
83
93
|
"eslint-plugin-no-async-foreach": "0.1.1",
|
|
84
|
-
"eslint-plugin-react": "7.
|
|
94
|
+
"eslint-plugin-react": "^7.26.0",
|
|
85
95
|
"eslint-plugin-wpcalypso": "5.0.0",
|
|
86
96
|
"flow-bin": "0.150.0",
|
|
87
|
-
"jest": "
|
|
97
|
+
"jest": "27.2.1",
|
|
88
98
|
"nock": "13.0.11",
|
|
89
99
|
"prettier": "npm:wp-prettier@2.0.5",
|
|
90
100
|
"publish-please": "5.5.2"
|
|
@@ -93,19 +103,19 @@
|
|
|
93
103
|
"@apollo/client": "^3.3.6",
|
|
94
104
|
"@automattic/vip-search-replace": "^1.0.15",
|
|
95
105
|
"args": "5.0.1",
|
|
96
|
-
"chalk": "4.1.
|
|
97
|
-
"cli-columns": "^
|
|
106
|
+
"chalk": "4.1.2",
|
|
107
|
+
"cli-columns": "^4.0.0",
|
|
98
108
|
"cli-table": "github:automattic/cli-table#7b14232",
|
|
99
109
|
"configstore": "5.0.1",
|
|
100
|
-
"debug": "4.3.
|
|
110
|
+
"debug": "4.3.2",
|
|
101
111
|
"ejs": "^3.1.6",
|
|
102
112
|
"enquirer": "2.3.6",
|
|
103
|
-
"graphql": "15.5.
|
|
104
|
-
"graphql-tag": "2.12.
|
|
105
|
-
"ini": "
|
|
113
|
+
"graphql": "15.5.1",
|
|
114
|
+
"graphql-tag": "2.12.5",
|
|
115
|
+
"ini": "2.0.0",
|
|
106
116
|
"json2csv": "5.0.6",
|
|
107
117
|
"jwt-decode": "2.2.0",
|
|
108
|
-
"lando": "git+https://github.com/lando/
|
|
118
|
+
"lando": "git+https://github.com/lando/cli.git#v3.4.3",
|
|
109
119
|
"node-fetch": "^2.6.1",
|
|
110
120
|
"opn": "5.5.0",
|
|
111
121
|
"rollbar": "2.22.0",
|
|
@@ -120,6 +130,6 @@
|
|
|
120
130
|
"xml2js": "^0.4.23"
|
|
121
131
|
},
|
|
122
132
|
"optionalDependencies": {
|
|
123
|
-
"keytar": "
|
|
133
|
+
"keytar": "7.7.0"
|
|
124
134
|
}
|
|
125
135
|
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* These are baseline configs that are identical across all Go environments.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Read-only filesystem
|
|
9
|
-
*/
|
|
10
|
-
if ( ! defined( 'DISALLOW_FILE_EDIT' ) ) {
|
|
11
|
-
define( 'DISALLOW_FILE_EDIT', true );
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if ( ! defined( 'DISALLOW_FILE_MODS' ) ) {
|
|
15
|
-
define( 'DISALLOW_FILE_MODS', true );
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if ( ! defined( 'AUTOMATIC_UPDATER_DISABLED' ) ) {
|
|
19
|
-
define( 'AUTOMATIC_UPDATER_DISABLED', true );
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Server limits
|
|
23
|
-
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
|
|
24
|
-
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Error Handler
|
|
29
|
-
*
|
|
30
|
-
* Load custom error logging functions, if available.
|
|
31
|
-
*/
|
|
32
|
-
if ( file_exists( ABSPATH . '/wp-content/mu-plugins/lib/wpcom-error-handler/wpcom-error-handler.php' ) ) {
|
|
33
|
-
require_once ABSPATH . '/wp-content/mu-plugins/lib/wpcom-error-handler/wpcom-error-handler.php';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Cron Control
|
|
38
|
-
*/
|
|
39
|
-
if ( ! defined( 'WPCOM_VIP_LOAD_CRON_CONTROL_LOCALLY' ) ) {
|
|
40
|
-
define( 'WPCOM_VIP_LOAD_CRON_CONTROL_LOCALLY', true );
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if ( ! defined( 'WP_CRON_CONTROL_SECRET' ) ) {
|
|
44
|
-
define( 'WP_CRON_CONTROL_SECRET', 'this-is-a-secret' );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* VIP Env variables
|
|
49
|
-
*/
|
|
50
|
-
if ( ! defined( 'WPCOM_IS_VIP_ENV' ) ) {
|
|
51
|
-
define( 'WPCOM_IS_VIP_ENV', false );
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if ( ! defined( 'A8C_PROXIED_REQUEST' ) ) {
|
|
55
|
-
define( 'A8C_PROXIED_REQUEST', true );
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if ( ! defined( 'FILES_CLIENT_SITE_ID' ) ) {
|
|
59
|
-
define( 'FILES_CLIENT_SITE_ID', 200508 );
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if ( ! defined( 'VIP_GO_APP_ENVIRONMENT' ) ) {
|
|
63
|
-
define( 'VIP_GO_APP_ENVIRONMENT', 'local' );
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* VIP Config
|
|
68
|
-
*/
|
|
69
|
-
if ( file_exists( ABSPATH . '/wp-content/vip-config/vip-config.php' ) ) {
|
|
70
|
-
require_once( ABSPATH . '/wp-content/vip-config/vip-config.php' );
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Enterprise Search
|
|
75
|
-
*/
|
|
76
|
-
/*
|
|
77
|
-
// Uncomment following code in order to enable Enterprise Search
|
|
78
|
-
if ( ! defined( 'VIP_ENABLE_VIP_SEARCH' ) ) {
|
|
79
|
-
define( 'VIP_ENABLE_VIP_SEARCH', true );
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if ( ! defined( 'VIP_ENABLE_ELASTICSEARCH_QUERY_INTEGRATION' ) ) {
|
|
83
|
-
define( 'VIP_ENABLE_ELASTICSEARCH_QUERY_INTEGRATION', true );
|
|
84
|
-
}
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
if ( ! defined( 'VIP_ELASTICSEARCH_ENDPOINTS' ) ) {
|
|
88
|
-
define( 'VIP_ELASTICSEARCH_ENDPOINTS', [
|
|
89
|
-
'http://vip-search:9200',
|
|
90
|
-
] );
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if ( ! defined( 'VIP_ELASTICSEARCH_USERNAME' ) ) {
|
|
94
|
-
define( 'VIP_ELASTICSEARCH_USERNAME', 'test_user' );
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if ( ! defined( 'VIP_ELASTICSEARCH_PASSWORD' ) ) {
|
|
98
|
-
define( 'VIP_ELASTICSEARCH_PASSWORD', 'test_password' );
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* StatsD
|
|
103
|
-
*/
|
|
104
|
-
if ( ! defined( 'VIP_STATSD_HOST' ) ) {
|
|
105
|
-
define( 'VIP_STATSD_HOST', 'statsd' );
|
|
106
|
-
}
|
|
107
|
-
if ( ! defined( 'VIP_STATSD_PORT' ) ) {
|
|
108
|
-
define( 'VIP_STATSD_PORT', 8126 );
|
|
109
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @fomat
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
"use strict";
|
|
12
|
-
|
|
13
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
14
|
-
|
|
15
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
-
|
|
17
|
-
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
|
-
|
|
19
|
-
var _devEnvironment = require("../lib/dev-environment");
|
|
20
|
-
|
|
21
|
-
var _devEnvironment2 = require("../lib/constants/dev-environment");
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment'); // Command examples
|
|
29
|
-
|
|
30
|
-
const examples = [{
|
|
31
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} create`,
|
|
32
|
-
description: 'Creates a local dev environment'
|
|
33
|
-
}, {
|
|
34
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} create --slug test`,
|
|
35
|
-
description: 'Creates a local dev environment named "test", this enables to create multiple independend environments'
|
|
36
|
-
}];
|
|
37
|
-
(0, _command.default)().option('slug', `Custom name of the dev environment (default: "${_devEnvironment.defaults.environmentSlug}")`).option('title', 'Title for the WordPress site (default: "VIP Dev")').option('multisite', 'Enable multisite install').option('php', 'Use a specific PHP version').option('wordpress', 'Use a specific WordPress version or local directory (default: last stable)').option('mu-plugins', 'Use a specific mu-plugins changeset or local directory (default: "auto": last commit in master)').option('jetpack', 'Use a specific Jetpack from a local directory (default: "mu": use the version in mu-plugins)').option('client-code', 'Use the client code from a local directory or VIP skeleton (default: use the VIP skeleton)').examples(examples).argv(process.argv, async (arg, opt) => {
|
|
38
|
-
const slug = opt.slug || _devEnvironment.defaults.environmentSlug;
|
|
39
|
-
debug('Args: ', arg, 'Options: ', opt);
|
|
40
|
-
const extraCommandParmas = opt.slug ? ` --slug ${opt.slug}` : '';
|
|
41
|
-
|
|
42
|
-
const startCommand = _chalk.default.bold(_devEnvironment2.DEV_ENVIRONMENT_COMMAND + ' start' + extraCommandParmas);
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
await (0, _devEnvironment.createEnvironment)(slug, opt);
|
|
46
|
-
const message = _chalk.default.green('✓') + ` environment created.\n\n\nTo start it please run:\n\n${startCommand}\n`;
|
|
47
|
-
console.log(message);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
let messageToShow = _chalk.default.red('Error:');
|
|
50
|
-
|
|
51
|
-
if ('Environment already exists.' === e.message) {
|
|
52
|
-
messageToShow += `Environment already exists\n\n\nTo start the environment run:\n\n${startCommand}\n\n` + `To create another environment use ${_chalk.default.bold('--slug')} option with a unique name.\n`;
|
|
53
|
-
console.log(messageToShow);
|
|
54
|
-
} else {
|
|
55
|
-
console.log(messageToShow, e.message);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @fomat
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
"use strict";
|
|
12
|
-
|
|
13
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
14
|
-
|
|
15
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
-
|
|
17
|
-
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
|
-
|
|
19
|
-
var _devEnvironment = require("../lib/dev-environment");
|
|
20
|
-
|
|
21
|
-
var _devEnvironment2 = require("../lib/constants/dev-environment");
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment'); // Command examples
|
|
29
|
-
|
|
30
|
-
const examples = [{
|
|
31
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} destroy`,
|
|
32
|
-
description: 'Destroys a default local dev environment'
|
|
33
|
-
}, {
|
|
34
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} destroy --slug foo`,
|
|
35
|
-
description: 'Destroys a local dev environment named foo'
|
|
36
|
-
}];
|
|
37
|
-
(0, _command.default)().option('slug', `Custom name of the dev environment (default: "${_devEnvironment.defaults.environmentSlug}")`).examples(examples).argv(process.argv, async (arg, opt) => {
|
|
38
|
-
const slug = opt.slug || _devEnvironment.defaults.environmentSlug;
|
|
39
|
-
debug('Args: ', arg, 'Options: ', opt);
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
await (0, _devEnvironment.destroyEnvironment)(slug);
|
|
43
|
-
const message = _chalk.default.green('✓') + ' environment destroyed.\n';
|
|
44
|
-
console.log(message);
|
|
45
|
-
} catch (e) {
|
|
46
|
-
console.log(_chalk.default.red('Error:'), e.message);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @fomat
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
"use strict";
|
|
12
|
-
|
|
13
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
14
|
-
|
|
15
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
-
|
|
17
|
-
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
|
-
|
|
19
|
-
var _devEnvironment = require("../lib/dev-environment");
|
|
20
|
-
|
|
21
|
-
var _devEnvironment2 = require("../lib/constants/dev-environment");
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment'); // Command examples
|
|
29
|
-
|
|
30
|
-
const examples = [{
|
|
31
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} info`,
|
|
32
|
-
description: 'Return information about a local dev environment'
|
|
33
|
-
}];
|
|
34
|
-
(0, _command.default)().option('slug', `Custom name of the dev environment (default: "${_devEnvironment.defaults.environmentSlug}")`).option('all', 'Show Info for all local dev environemnts').examples(examples).argv(process.argv, async (arg, opt) => {
|
|
35
|
-
const slug = opt.slug || _devEnvironment.defaults.environmentSlug;
|
|
36
|
-
debug('Args: ', arg, 'Options: ', opt);
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
if (opt.all) {
|
|
40
|
-
await (0, _devEnvironment.printAllEnvironmentsInfo)();
|
|
41
|
-
} else {
|
|
42
|
-
await (0, _devEnvironment.printEnvironmentInfo)(slug);
|
|
43
|
-
}
|
|
44
|
-
} catch (e) {
|
|
45
|
-
let messageToShow = _chalk.default.red('Error:');
|
|
46
|
-
|
|
47
|
-
if ('Environment not found.' === e.message) {
|
|
48
|
-
const extraCommandParmas = opt.slug ? ` --slug ${opt.slug}` : '';
|
|
49
|
-
|
|
50
|
-
const createCommand = _chalk.default.bold(_devEnvironment2.DEV_ENVIRONMENT_COMMAND + ' create' + extraCommandParmas);
|
|
51
|
-
|
|
52
|
-
messageToShow += `Environment doesnt exists\n\n\nTo create new environment run:\n\n${createCommand}\n`;
|
|
53
|
-
console.log(messageToShow);
|
|
54
|
-
} else {
|
|
55
|
-
console.log(messageToShow, e.message);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @fomat
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
"use strict";
|
|
12
|
-
|
|
13
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
14
|
-
|
|
15
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
-
|
|
17
|
-
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
|
-
|
|
19
|
-
var _devEnvironment = require("../lib/dev-environment");
|
|
20
|
-
|
|
21
|
-
var _devEnvironment2 = require("../lib/constants/dev-environment");
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment'); // Command examples
|
|
29
|
-
|
|
30
|
-
const examples = [{
|
|
31
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} start`,
|
|
32
|
-
description: 'Starts a local dev environment'
|
|
33
|
-
}];
|
|
34
|
-
(0, _command.default)().option('slug', `Custom name of the dev environment (default: "${_devEnvironment.defaults.environmentSlug}")`).examples(examples).argv(process.argv, async (arg, opt) => {
|
|
35
|
-
const slug = opt.slug || _devEnvironment.defaults.environmentSlug;
|
|
36
|
-
debug('Args: ', arg, 'Options: ', opt);
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
await (0, _devEnvironment.startEnvironment)(slug);
|
|
40
|
-
} catch (e) {
|
|
41
|
-
let messageToShow = _chalk.default.red('Error:');
|
|
42
|
-
|
|
43
|
-
if ('Environment not found.' === e.message) {
|
|
44
|
-
const extraCommandParmas = opt.slug ? ` --slug ${opt.slug}` : '';
|
|
45
|
-
|
|
46
|
-
const createCommand = _chalk.default.bold(_devEnvironment2.DEV_ENVIRONMENT_COMMAND + ' create' + extraCommandParmas);
|
|
47
|
-
|
|
48
|
-
messageToShow += `Environment doesnt exists\n\n\nTo create new environment run:\n\n${createCommand}\n`;
|
|
49
|
-
console.log(messageToShow);
|
|
50
|
-
} else {
|
|
51
|
-
console.log(messageToShow, e.message);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @fomat
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
"use strict";
|
|
12
|
-
|
|
13
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
14
|
-
|
|
15
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
-
|
|
17
|
-
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
|
-
|
|
19
|
-
var _devEnvironment = require("../lib/dev-environment");
|
|
20
|
-
|
|
21
|
-
var _devEnvironment2 = require("../lib/constants/dev-environment");
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
const debug = (0, _debug.default)('@automattic/vip:bin:dev-environment'); // Command examples
|
|
29
|
-
|
|
30
|
-
const examples = [{
|
|
31
|
-
usage: `${_devEnvironment2.DEV_ENVIRONMENT_COMMAND} stop`,
|
|
32
|
-
description: 'Stops a local dev environment'
|
|
33
|
-
}];
|
|
34
|
-
(0, _command.default)().option('slug', `Custom name of the dev environment (default: "${_devEnvironment.defaults.environmentSlug}")`).examples(examples).argv(process.argv, async (arg, opt) => {
|
|
35
|
-
const slug = opt.slug || _devEnvironment.defaults.environmentSlug;
|
|
36
|
-
debug('Args: ', arg, 'Options: ', opt);
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
await (0, _devEnvironment.stopEnvironment)(slug);
|
|
40
|
-
const message = _chalk.default.green('✓') + ' environment stopped.\n';
|
|
41
|
-
console.log(message);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
let messageToShow = _chalk.default.red('Error:');
|
|
44
|
-
|
|
45
|
-
if ('Environment not found.' === e.message) {
|
|
46
|
-
const extraCommandParmas = opt.slug ? ` --slug ${opt.slug}` : '';
|
|
47
|
-
|
|
48
|
-
const createCommand = _chalk.default.bold(_devEnvironment2.DEV_ENVIRONMENT_COMMAND + ' create' + extraCommandParmas);
|
|
49
|
-
|
|
50
|
-
messageToShow += `Environment doesnt exists\n\n\nTo create new environment run:\n\n${createCommand}\n`;
|
|
51
|
-
console.log(messageToShow);
|
|
52
|
-
} else {
|
|
53
|
-
console.log(messageToShow, e.message);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @fomat
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* External dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
"use strict";
|
|
16
|
-
|
|
17
|
-
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
18
|
-
|
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
-
|
|
21
|
-
(0, _command.default)({
|
|
22
|
-
requiredArgs: 1
|
|
23
|
-
}).command('create', 'Create a local dev environment').command('start', 'Start a local dev environment').command('stop', 'Stop a local dev environment').command('destroy', 'Destroy a local dev environment').command('info', 'Provides basic info about a local dev environment').argv(process.argv);
|