@florianpat/lando-core 3.23.3-compose → 3.23.22-test1

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 (107) hide show
  1. package/CHANGELOG.md +117 -1
  2. package/_redirects +1 -0
  3. package/bin/lando +2 -0
  4. package/bin/lando.cmd +3 -0
  5. package/builders/_lando.js +2 -1
  6. package/checksums.txt +0 -0
  7. package/components/l337-v4.js +2 -2
  8. package/components/plugin.js +1 -1
  9. package/config.yml +3 -2
  10. package/hooks/app-run-events.js +22 -0
  11. package/hooks/lando-autostart-engine.js +4 -25
  12. package/hooks/lando-run-setup.js +58 -0
  13. package/hooks/lando-setup-build-engine-darwin.js +13 -12
  14. package/hooks/lando-setup-build-engine-linux.js +14 -4
  15. package/hooks/lando-setup-build-engine-win32.js +27 -20
  16. package/hooks/lando-setup-build-engine-wsl.js +210 -0
  17. package/hooks/lando-setup-check.js +19 -0
  18. package/hooks/lando-setup-create-ca-wsl.js +34 -0
  19. package/hooks/lando-setup-create-ca.js +22 -23
  20. package/hooks/lando-setup-install-ca-darwin.js +5 -1
  21. package/hooks/lando-setup-install-ca-linux.js +4 -1
  22. package/hooks/lando-setup-install-ca-win32.js +5 -1
  23. package/hooks/lando-setup-install-ca-wsl.js +145 -0
  24. package/hooks/lando-setup-orchestrator.js +4 -4
  25. package/index.js +18 -12
  26. package/lib/app.js +2 -2
  27. package/lib/art.js +20 -8
  28. package/lib/compose.js +0 -3
  29. package/lib/daemon.js +79 -76
  30. package/lib/docker.js +2 -2
  31. package/lib/engine.js +10 -3
  32. package/lib/lando.js +2 -2
  33. package/lib/metrics.js +5 -3
  34. package/lib/router.js +1 -1
  35. package/lib/updates.js +18 -3
  36. package/netlify.toml +1 -6
  37. package/node_modules/cross-spawn/README.md +3 -10
  38. package/node_modules/cross-spawn/lib/enoent.js +1 -1
  39. package/node_modules/cross-spawn/lib/util/escape.js +4 -2
  40. package/node_modules/cross-spawn/package.json +1 -1
  41. package/node_modules/nanoid/.devcontainer.json +23 -0
  42. package/node_modules/nanoid/README.md +517 -2
  43. package/node_modules/nanoid/async/index.browser.cjs +37 -2
  44. package/node_modules/nanoid/async/index.browser.js +37 -2
  45. package/node_modules/nanoid/async/index.cjs +38 -2
  46. package/node_modules/nanoid/async/index.js +38 -2
  47. package/node_modules/nanoid/async/index.native.js +33 -2
  48. package/node_modules/nanoid/index.browser.cjs +39 -1
  49. package/node_modules/nanoid/index.browser.js +39 -1
  50. package/node_modules/nanoid/index.cjs +42 -2
  51. package/node_modules/nanoid/index.js +42 -2
  52. package/node_modules/nanoid/non-secure/index.cjs +15 -2
  53. package/node_modules/nanoid/non-secure/index.js +15 -2
  54. package/node_modules/nanoid/package.json +1 -1
  55. package/node_modules/nanoid/url-alphabet/index.cjs +4 -0
  56. package/node_modules/nanoid/url-alphabet/index.js +4 -0
  57. package/package.json +9 -8
  58. package/plugins/networking/app.js +4 -2
  59. package/plugins/networking/index.js +19 -6
  60. package/plugins/proxy/builders/_proxy.js +1 -2
  61. package/release-aliases/3-EDGE +1 -1
  62. package/release-aliases/3-STABLE +1 -1
  63. package/renderers/dc2.js +2 -1
  64. package/scripts/add-to-group.sh +72 -0
  65. package/scripts/docker-engine-start.sh +15 -1
  66. package/scripts/generate-checksums.sh +2 -2
  67. package/scripts/install-docker-desktop.ps1 +11 -12
  68. package/scripts/install-system-ca-win32.ps1 +14 -14
  69. package/scripts/lando-entrypoint.sh +4 -0
  70. package/scripts/run-elevated.ps1 +2 -2
  71. package/scripts/semcompare.sh +142 -0
  72. package/scripts/wait-for-user.sh +1 -2
  73. package/tasks/destroy.js +3 -0
  74. package/tasks/info.js +2 -1
  75. package/tasks/init.js +35 -30
  76. package/tasks/rebuild.js +2 -8
  77. package/tasks/restart.js +2 -8
  78. package/tasks/setup.js +2 -2
  79. package/tasks/shellenv.js +2 -2
  80. package/tasks/start.js +2 -8
  81. package/tasks/stop.js +3 -0
  82. package/utils/build-config.js +2 -0
  83. package/utils/build-tooling-runner.js +2 -1
  84. package/utils/get-app.js +1 -1
  85. package/utils/get-bin-paths.js +2 -2
  86. package/utils/get-compose-x.js +1 -1
  87. package/utils/get-config-defaults.js +12 -7
  88. package/utils/get-docker-bin-path.js +6 -2
  89. package/utils/get-docker-desktop-x.js +21 -0
  90. package/utils/get-docker-x.js +3 -2
  91. package/utils/get-shellenv.js +1 -2
  92. package/utils/get-system-cas.js +25 -6
  93. package/utils/get-win32-envvar-from-wsl.js +7 -0
  94. package/utils/is-admin-user.js +9 -8
  95. package/utils/is-group-member.js +14 -7
  96. package/utils/is-wsl-interop.js +17 -4
  97. package/utils/run-elevated.js +9 -0
  98. package/utils/run-powershell-script.js +31 -5
  99. package/utils/run-tasks.js +3 -2
  100. package/utils/setup-metrics.js +10 -1
  101. package/utils/shutdown-os.js +8 -3
  102. package/utils/spawn-sync-stringer.js +1 -0
  103. package/utils/update-shell-profile.js +8 -7
  104. package/utils/validate-ca.js +31 -0
  105. package/utils/winpath-2-wslpath.js +6 -0
  106. package/utils/wslpath-2-winpath.js +6 -0
  107. package/hooks/lando-dep-check.js +0 -26
@@ -35,8 +35,9 @@ module.exports = async (tasks, {
35
35
  fallbackRendererOptions = rendererOptions;
36
36
  }
37
37
 
38
- // if terminal is DUMB then force the verbose renderer
39
- if (process?.env?.TERM === 'dumb') renderer = 'verbose';
38
+ // some sitautions just need the bare minimum
39
+ if (process?.env?.TERM === 'dumb') renderer = 'simple';
40
+ if (process?.env?.CI && !require('is-interactive')()) renderer = 'simple';
40
41
 
41
42
  const defaults = {
42
43
  ctx: {data: {}, errors: [], results: [], skipped: 0, ran: 0, total: 0},
@@ -18,10 +18,19 @@ const getMetricsContext = () => {
18
18
  module.exports = (log, config) => {
19
19
  const Metrics = require('./../lib/metrics');
20
20
  const command = _.get(config, 'command._', 'unknown');
21
+
22
+ // group by endpoints and resolve multiples
23
+ const endpoints = _(_.groupBy(config.stats, 'url'))
24
+ .map((data, url) => ({
25
+ url,
26
+ report: data.map(data => data.report).every(report => report === true),
27
+ }))
28
+ .value();
29
+
21
30
  return new Metrics({
22
31
  log,
23
32
  id: config.id,
24
- endpoints: config.stats,
33
+ endpoints,
25
34
  data: {
26
35
  command: `lando ${command}`,
27
36
  context: getMetricsContext(),
@@ -6,11 +6,12 @@ module.exports = ({
6
6
  message = 'Lando wants to restart your computer',
7
7
  password = undefined,
8
8
  type = 'restart',
9
- wait = process.platform === 'win32' ? 5 : 'now',
9
+ wait = process.landoPlatform === 'win32' || process.platform === 'win32' ? 5 : 'now',
10
+ platform = process.landoPlatform ?? process.platform,
10
11
  } = {}) => {
11
12
  debug('shutdown with %o %o', type, {message, wait});
12
13
 
13
- switch (process.platform) {
14
+ switch (platform) {
14
15
  case 'darwin':
15
16
  args.push('shutdown');
16
17
  // handle the restart type
@@ -48,6 +49,10 @@ module.exports = ({
48
49
  args.push('/c');
49
50
  args.push(message);
50
51
 
51
- return require('./run-command')('shutdown', args, {debug});
52
+ return require('./run-command')('shutdown.exe', args, {debug});
53
+ case 'wsl':
54
+ args.push('-Command');
55
+ args.push(`wsl --terminate ${process.env.WSL_DISTRO_NAME}`);
56
+ return require('./run-command')('powershell.exe', args, {debug});
52
57
  }
53
58
  };
@@ -4,6 +4,7 @@ const {spawnSync} = require('child_process');
4
4
 
5
5
  module.exports = (...args) => {
6
6
  const result = spawnSync(...args);
7
+
7
8
  // stringify and trim
8
9
  result.stdout = result.stdout.toString().trim();
9
10
  result.stderr = result.stderr.toString().trim();
@@ -6,6 +6,12 @@ const os = require('os');
6
6
  const read = require('./read-file');
7
7
  const write = require('./write-file');
8
8
 
9
+ const trim = (data = []) => {
10
+ while (data.length > 0 && data[data.length - 1] === '') data.pop();
11
+ data.push('');
12
+ return data;
13
+ };
14
+
9
15
  module.exports = (file, updates = []) => {
10
16
  // create empty file if it doesnt exist first
11
17
  if (!fs.existsSync(file)) {
@@ -17,9 +23,7 @@ module.exports = (file, updates = []) => {
17
23
  // get the content
18
24
  const content = read(file);
19
25
  // split into lines
20
- const lines = content.split('\n');
21
- // if we end up with second to last line that is empty then pop
22
- if (lines[lines.length - 2].trim() === '') lines.pop();
26
+ const lines = trim(content.split('\n'));
23
27
 
24
28
  // loops through the updates and add/update as needed
25
29
  for (const [update, search] of updates) {
@@ -31,11 +35,8 @@ module.exports = (file, updates = []) => {
31
35
  }
32
36
  }
33
37
 
34
- // if the last element doesnt contain a newline
35
- if (!lines[lines.length - 1].includes(os.EOL)) lines.push(os.EOL);
36
-
37
38
  // Write the modified content back to the file
38
- write(file, lines.join(os.EOL));
39
+ write(file, `${trim(lines).join(os.EOL)}${os.EOL}`);
39
40
 
40
41
  // handle errors
41
42
  } catch (error) {
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const forge = require('node-forge');
4
+ const read = require('./read-file');
5
+
6
+ module.exports = (cert, key, {
7
+ debug = require('debug')('@lando/validate-script'),
8
+ } = {}) => {
9
+ try {
10
+ cert = forge.pki.certificateFromPem(read(cert));
11
+ key = forge.pki.privateKeyFromPem(read(key));
12
+
13
+ // verify the signature using the public key in the CA certificate
14
+ const md = forge.md.sha256.create();
15
+ md.update('taanab', 'utf8');
16
+ const signature = key.sign(md);
17
+
18
+ // if they dont match then throw
19
+ if (!cert.publicKey.verify(md.digest().bytes(), signature)) {
20
+ debug('CA and its private key do not match');
21
+ return false;
22
+ }
23
+
24
+ // otherwise we are good
25
+ return true;
26
+ } catch (error) {
27
+ debug('something is wrong with the CA %o', error.message);
28
+ debug('%o', error);
29
+ return false;
30
+ }
31
+ };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports = path => {
4
+ const {stdout} = require('./spawn-sync-stringer')('wslpath', ['-u', path], {encoding: 'utf-8'});
5
+ return stdout.trim();
6
+ };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports = path => {
4
+ const {stdout} = require('./spawn-sync-stringer')('wslpath', ['-w', path], {encoding: 'utf-8'});
5
+ return stdout.trim();
6
+ };
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = async lando => {
4
- // only run if engine bootstrap or above and if engine/orchestrator have been installed
5
- if (lando._bootstrapLevel >= 3) {
6
- lando.log.verbose('build-engine exists: %s', lando.engine.dockerInstalled);
7
- lando.log.verbose('orchestrator exists: %s', lando.engine.composeInstalled);
8
-
9
- // BUILD ENGINE
10
- if (lando.engine.dockerInstalled === false) {
11
- if (lando.cli) {
12
- const dep = process.platform === 'linux' ? 'DOCKER ENGINE' : 'DOCKER DESKTOP';
13
- console.error(lando.cli.makeArt('noDockerDep', dep));
14
- process.exit(1);
15
- } else throw Error('docker could not be located!');
16
- }
17
-
18
- // ORCHESTRATOR
19
- if (lando.engine.composeInstalled === false) {
20
- if (lando.cli) {
21
- console.error(lando.cli.makeArt('noDockerDep', 'DOCKER COMPOSE'));
22
- process.exit(1);
23
- } else throw Error('docker-compose could not be located!');
24
- }
25
- }
26
- };