@automattic/vip 2.30.0-dev1 → 2.31.0-dev1

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/assets/dev-env.lando.template.yml.ejs +7 -2
  3. package/dist/bin/vip-dev-env-create.js +4 -1
  4. package/dist/bin/vip-dev-env-sync-sql.js +11 -18
  5. package/dist/bin/vip-export-sql.js +12 -11
  6. package/dist/bin/vip-import-sql.js +2 -2
  7. package/dist/bin/vip-import-validate-sql.js +2 -2
  8. package/dist/bin/vip-whoami.js +7 -10
  9. package/dist/bin/vip-wp.js +7 -5
  10. package/dist/bin/vip.js +9 -6
  11. package/dist/commands/dev-env-sync-sql.js +29 -15
  12. package/dist/commands/export-sql.js +1 -1
  13. package/dist/lib/analytics/clients/pendo.js +11 -20
  14. package/dist/lib/analytics/clients/tracks.js +12 -12
  15. package/dist/lib/analytics/index.js +9 -12
  16. package/dist/lib/api/app.js +10 -13
  17. package/dist/lib/api/cache-purge.js +3 -10
  18. package/dist/lib/api/feature-flags.js +6 -3
  19. package/dist/lib/api/http.js +10 -18
  20. package/dist/lib/api/user.js +3 -8
  21. package/dist/lib/api.js +13 -16
  22. package/dist/lib/app-logs/app-logs.js +3 -6
  23. package/dist/lib/app.js +2 -0
  24. package/dist/lib/cli/apiConfig.js +10 -7
  25. package/dist/lib/cli/config.js +2 -3
  26. package/dist/lib/cli/envAlias.js +11 -9
  27. package/dist/lib/cli/exit.js +4 -7
  28. package/dist/lib/cli/format.js +25 -26
  29. package/dist/lib/cli/progress.js +7 -3
  30. package/dist/lib/cli/prompt.js +3 -2
  31. package/dist/lib/client-file-uploader.js +86 -87
  32. package/dist/lib/config/software.js +18 -12
  33. package/dist/lib/dev-environment/dev-environment-cli.js +47 -3
  34. package/dist/lib/dev-environment/dev-environment-lando.js +2 -2
  35. package/dist/lib/env.js +16 -13
  36. package/dist/lib/envvar/api-delete.js +2 -0
  37. package/dist/lib/envvar/api-get-all.js +4 -1
  38. package/dist/lib/envvar/api-get.js +3 -1
  39. package/dist/lib/envvar/api-list.js +8 -3
  40. package/dist/lib/envvar/api-set.js +2 -0
  41. package/dist/lib/envvar/api.js +2 -5
  42. package/dist/lib/envvar/input.js +7 -8
  43. package/dist/lib/envvar/read-file.js +4 -7
  44. package/dist/lib/http/proxy-agent.js +5 -4
  45. package/dist/lib/keychain/insecure.js +25 -26
  46. package/dist/lib/keychain/secure.js +5 -2
  47. package/dist/lib/keychain.js +11 -18
  48. package/dist/lib/media-import/status.js +2 -2
  49. package/dist/lib/read-file.js +13 -14
  50. package/dist/lib/search-and-replace.js +17 -26
  51. package/dist/lib/site-import/status.js +4 -3
  52. package/dist/lib/token.js +17 -6
  53. package/dist/lib/tracker.js +13 -14
  54. package/dist/lib/user-error.js +6 -5
  55. package/dist/lib/utils.js +18 -22
  56. package/dist/lib/validations/sql.js +3 -3
  57. package/dist/lib/vip-import-validate-files.js +23 -22
  58. package/npm-shrinkwrap.json +1041 -1230
  59. package/package.json +30 -8
  60. package/tsconfig.json +37 -0
  61. package/dist/lib/analytics/clients/stub.js +0 -16
  62. package/dist/lib/cli/repo.js +0 -61
  63. package/dist/lib/keychain/browser.js +0 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "2.30.0-dev1",
3
+ "version": "2.31.0-dev1",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -54,13 +54,14 @@
54
54
  "vip-wp": "dist/bin/vip-wp.js"
55
55
  },
56
56
  "scripts": {
57
- "test": "npm run lint && npm run flow && jest --coverage --testPathIgnorePatterns __tests__/devenv-e2e/",
57
+ "test": "npm run lint && npm run flow && npm run check-types && jest --testPathIgnorePatterns __tests__/devenv-e2e/",
58
58
  "test:e2e:dev-env": "jest -c __tests__/devenv-e2e/jest/jest.config.js",
59
59
  "clean": "rimraf dist",
60
60
  "prepare": "npm run clean && npm run build",
61
+ "check-types": "tsc",
61
62
  "postinstall": "node ./helpers/check-version.js",
62
- "build": "babel src -d dist",
63
- "build:watch": "babel src -d dist --watch --source-maps",
63
+ "build": "babel src -d dist --extensions=\".js,.ts\"",
64
+ "build:watch": "babel src -d dist --watch --source-maps --extensions=\".js,.ts\"",
64
65
  "flow": "flow",
65
66
  "jest": "jest --testPathIgnorePatterns __tests__/devenv-e2e/",
66
67
  "lint": "eslint index.js src __tests__",
@@ -98,9 +99,30 @@
98
99
  "@babel/plugin-transform-modules-commonjs": "7.21.5",
99
100
  "@babel/preset-env": "7.21.5",
100
101
  "@babel/preset-flow": "7.21.4",
102
+ "@babel/preset-typescript": "7.21.4",
101
103
  "@jest/globals": "^29.5.0",
102
104
  "@jest/test-sequencer": "^29.5.0",
105
+ "@tsconfig/node16": "^1.0.4",
106
+ "@types/args": "5.0.0",
107
+ "@types/cli-table": "0.3.1",
108
+ "@types/configstore": "5.0.1",
109
+ "@types/debug": "4.1.8",
110
+ "@types/dockerode": "^3.3.18",
111
+ "@types/ejs": "^3.1.2",
112
+ "@types/js-yaml": "^4.0.5",
113
+ "@types/json2csv": "5.0.3",
114
+ "@types/node-fetch": "^2.6.4",
115
+ "@types/opn": "5.5.0",
116
+ "@types/proxy-from-env": "^1.0.1",
117
+ "@types/semver": "7.5.0",
118
+ "@types/shelljs": "^0.8.12",
119
+ "@types/single-line-log": "1.1.0",
120
+ "@types/update-notifier": "5.1.0",
121
+ "@types/uuid": "9.0.0",
122
+ "@types/xdg-basedir": "^4.0.2",
123
+ "@types/xml2js": "^0.4.11",
103
124
  "babel-jest": "^29.5.0",
125
+ "babel-plugin-explicit-exports-references": "^1.0.2",
104
126
  "babel-plugin-module-resolver": "5.0.0",
105
127
  "check-node-version": "^4.2.1",
106
128
  "dockerode": "^3.3.4",
@@ -108,16 +130,16 @@
108
130
  "eslint-plugin-flowtype": "^8.0.3",
109
131
  "flow-bin": "^0.206.0",
110
132
  "jest": "^29.5.0",
111
- "jest-environment-jsdom": "^29.5.0",
112
133
  "nock": "13.3.1",
113
134
  "prettier": "^2.0.5",
114
135
  "publish-please": "5.5.2",
115
- "rimraf": "3.0.2"
136
+ "rimraf": "3.0.2",
137
+ "typescript": "5.0.4"
116
138
  },
117
139
  "dependencies": {
118
140
  "@apollo/client": "3.3.6",
119
141
  "@automattic/vip-go-preflight-checks": "^2.0.16",
120
- "@automattic/vip-search-replace": "^1.0.15",
142
+ "@automattic/vip-search-replace": "^1.1.1",
121
143
  "args": "5.0.3",
122
144
  "chalk": "4.1.2",
123
145
  "cli-columns": "^4.0.0",
@@ -133,7 +155,7 @@
133
155
  "ini": "2.0.0",
134
156
  "js-yaml": "^4.1.0",
135
157
  "json2csv": "5.0.7",
136
- "jwt-decode": "2.2.0",
158
+ "jwt-decode": "3.1.2",
137
159
  "lando": "github:automattic/lando-cli.git#d58d9b3",
138
160
  "node-fetch": "^2.6.1",
139
161
  "opn": "5.5.0",
package/tsconfig.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "extends": "@tsconfig/node16/tsconfig.json",
3
+ "compilerOptions": {
4
+ // Target latest version of ECMAScript.
5
+ "target": "esnext",
6
+ // Don't parse types from JS as TS doesn't play well with Flow-ish JS.
7
+ "allowJs": false,
8
+ // Don't emit; allow Babel to transform files.
9
+ "noEmit": true,
10
+ // Can't checkJs if we don't allowJs, so this remains false
11
+ "checkJs": false,
12
+ // Disallow features that require cross-file information for emit as we're using Babel
13
+ "isolatedModules": true,
14
+ "resolveJsonModule": true,
15
+ "baseUrl": ".",
16
+ "paths": {
17
+ "*": [
18
+ "./types/*",
19
+ "./node_modules/*"
20
+ ]
21
+ },
22
+ // It's worth enabling this, I promise!
23
+ "noImplicitAny": true
24
+ },
25
+ "include": [
26
+ "src",
27
+ "helpers",
28
+ "config",
29
+ "__tests__",
30
+ "__fixtures__",
31
+ "noImplictAnyImportBypass.d.ts"
32
+ ],
33
+ "exclude": [
34
+ "node_modules",
35
+ "**/*.js"
36
+ ]
37
+ }
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * Internal dependencies
9
- */
10
- class AnalyticsClientStub {
11
- // eslint-disable-next-line no-unused-vars
12
- trackEvent(name, props) {
13
- return Promise.resolve(true);
14
- }
15
- }
16
- exports.default = AnalyticsClientStub;
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getRepoFromGitConfig;
7
- var _fs = _interopRequireDefault(require("fs"));
8
- var _path = _interopRequireDefault(require("path"));
9
- var _ini = _interopRequireDefault(require("ini"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- /**
12
- * External dependencies
13
- */
14
- async function getRepoFromGitConfig() {
15
- const file = await find();
16
- if (!file.length) {
17
- return '';
18
- }
19
- const config = _ini.default.parse(_fs.default.readFileSync(file, 'utf-8'));
20
-
21
- // Find the first 'wpcomvip' remote
22
- for (const key in config) {
23
- if ('remote' !== key.substring(0, 6)) {
24
- continue;
25
- }
26
- if (!config[key].url) {
27
- continue;
28
- }
29
- if (0 > config[key].url.indexOf('wpcomvip/')) {
30
- continue;
31
- }
32
- let repo = config[key].url;
33
- repo = repo.replace(/.git$/, '');
34
- repo = repo.replace('https://github.com/', '');
35
- repo = repo.replace('git@github.com:', '');
36
- return repo;
37
- }
38
- }
39
- async function find(dir) {
40
- dir = dir || process.cwd();
41
- const test = dir + '/.git/config';
42
- if (await exists(test)) {
43
- return test;
44
- }
45
-
46
- // Bail if we went all the way and didn't find it
47
- const directory = _path.default.parse(dir);
48
- if (directory.dir === directory.root) {
49
- return '';
50
- }
51
-
52
- // cd ..
53
- const up = dir.split(_path.default.sep);
54
- up.pop();
55
- return find(up.join(_path.default.sep));
56
- }
57
- async function exists(file) {
58
- return new Promise(resolve => {
59
- _fs.default.access(file, _fs.default.constants.F_OK, err => resolve(!err));
60
- });
61
- }
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /* global window */
8
- /**
9
- * Internal dependencies
10
- */
11
- class Secure {
12
- getPassword(service) {
13
- return new Promise(resolve => {
14
- const password = window.localStorage.getItem(service);
15
- return resolve(password);
16
- });
17
- }
18
- setPassword(service, password) {
19
- return new Promise(resolve => {
20
- const set = !!window.localStorage.setItem(service, password);
21
- return resolve(set);
22
- });
23
- }
24
- deletePassword(service) {
25
- return new Promise(resolve => {
26
- const del = !!window.localStorage.removeItem(service);
27
- return resolve(del);
28
- });
29
- }
30
- }
31
- exports.default = Secure;