@florianpat/lando-core 3.23.27-2florianPat.0 → 3.23.27-4florianPat.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
2
2
 
3
- ## v3.23.27-2florianPat.0 - [February 19, 2025](https://github.com/florianPat/lando-core/releases/tag/v3.23.27-2florianPat.0)
3
+ ## v3.23.27-4florianPat.1 - [March 5, 2025](https://github.com/florianPat/lando-core/releases/tag/v3.23.27-4florianPat.1)
4
4
 
5
5
  ## v3.23.26 - [January 24, 2025](https://github.com/lando/core/releases/tag/v3.23.26)
6
6
 
package/app.js CHANGED
@@ -131,7 +131,7 @@ module.exports = async (app, lando) => {
131
131
  app.events.on('ready', 1, async () => await require('./hooks/app-override-tooling-defaults')(app, lando));
132
132
 
133
133
  // set tooling compose cache
134
- app.events.on('ready', async () => await require('./hooks/app-set-compose-cache')(app, lando));
134
+ app.events.on('ready-engine', async () => await require('./hooks/app-set-compose-cache')(app, lando));
135
135
 
136
136
  // v4 parts of the app are ready
137
137
  app.events.on('ready', 6, async () => await require('./hooks/app-v4-ready')(app, lando));
@@ -144,7 +144,7 @@ module.exports = async (app, lando) => {
144
144
 
145
145
  // Save a compose cache every time the app is ready, we have to duplicate this for v4 because we modify the
146
146
  // composeData after the v3 app.ready event
147
- app.events.on('ready-v4', async () => await require('./hooks/app-set-v4-compose-cache')(app, lando));
147
+ app.events.on('ready-engine', async () => await require('./hooks/app-set-v4-compose-cache')(app, lando));
148
148
 
149
149
  // Otherwise set on rebuilds
150
150
  // NOTE: We set this pre-rebuild because post-rebuild runs after post-start because you would need to
package/lib/app.js CHANGED
@@ -283,6 +283,8 @@ module.exports = class App {
283
283
  console.log(require('yargonaut').chalk().cyan('Looks like this is the first time to start the app. Lets bootstrap it...'));
284
284
  }
285
285
 
286
+ const composeEnvFiles = require('../utils/normalize-files')(_.get(this, 'config.compose_env_file', []), this.root);
287
+
286
288
  return loadPlugins(this, this._lando)
287
289
  /**
288
290
  * Event that only gets triggered if the app never started before (or was destroyed)
@@ -299,7 +301,7 @@ module.exports = class App {
299
301
  this.root,
300
302
  this._dir,
301
303
  (composeFiles, outputFilePath) =>
302
- this.engine.getComposeConfig({compose: composeFiles, project: this.project, outputFilePath}),
304
+ this.engine.getComposeConfig({compose: composeFiles, project: this.project, outputFilePath, opts: {envFiles: composeEnvFiles}}),
303
305
  ))
304
306
  .then(composeFileData => {
305
307
  this.composeData = [new this.ComposeService('compose', {}, ...composeFileData)];
package/lib/cli.js CHANGED
@@ -317,6 +317,7 @@ module.exports = class Cli {
317
317
  .option('help', globalOptions.help)
318
318
  .option('verbose', globalOptions.verbose)
319
319
  .version(false)
320
+ .env('lando_cli_')
320
321
  .middleware([(argv => {
321
322
  argv._app = config;
322
323
  argv._yargs = yargs;
package/lib/compose.js CHANGED
@@ -77,21 +77,22 @@ const parseOptions = (opts = {}) => {
77
77
  /*
78
78
  * Helper to standardize construction of docker commands
79
79
  */
80
- const buildCmd = (run, name, compose, {services, cmd}, opts = {}) => {
80
+ const buildCmd = (run, name, compose, {services, cmd, envFiles}, opts = {}) => {
81
81
  if (!name) throw new Error('Need to give this composition a project name!');
82
82
  // @TODO: we need to strip out opts.user on start/stop because we often get it as part of run
83
83
  const project = ['--project-name', name];
84
84
  const files = _.flatten(_.map(compose, unit => ['--file', unit]));
85
+ const envFile = _.flatten(_.map(envFiles, unit => ['--env-file', unit]));
85
86
  const options = parseOptions(opts);
86
87
  const argz = _.flatten(_.compact([services, cmd]));
87
- return _.flatten([project, files, run, options, argz]);
88
+ return _.flatten([project, files, envFile, run, options, argz]);
88
89
  };
89
90
 
90
91
  /*
91
92
  * Helper to build build object needed by lando.shell.sh
92
93
  */
93
94
  const buildShell = (run, name, compose, opts = {}) => ({
94
- cmd: buildCmd(run, name, compose, {services: opts.services, cmd: opts.cmd}, mergeOpts(run, opts)),
95
+ cmd: buildCmd(run, name, compose, {services: opts.services, cmd: opts.cmd, envFiles: opts.envFiles ?? []}, mergeOpts(run, opts)),
95
96
  opts: {mode: 'spawn', cstdio: opts.cstdio, silent: opts.silent},
96
97
  });
97
98
 
package/lib/engine.js CHANGED
@@ -506,6 +506,7 @@ module.exports = class Engine {
506
506
  * @param {String} data.project A String of the project name (Usually this is the same as the app name)
507
507
  * @param {String} [data.outputFilePath='/path/to/file.yml'] String to output path
508
508
  * @param {Object} [data.opts] Options
509
+ * @param {Array} [data.opts.envFiles] An Array of paths to env files
509
510
  * @return {Promise} A Promise.
510
511
  * @example
511
512
  * return lando.engine.stop(app);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@florianpat/lando-core",
3
3
  "description": "The libraries that power all of Lando. Fork by flo for compose integration",
4
- "version": "3.23.27-2florianPat.0",
4
+ "version": "3.23.27-4florianPat.1",
5
5
  "author": "Florian Patruck @florianPat",
6
6
  "license": "GPL-3.0",
7
7
  "repository": "florianPat/lando-core",
@@ -247,9 +247,9 @@
247
247
  "yargs-parser"
248
248
  ],
249
249
  "dist": {
250
- "integrity": "sha512-nJ+omUdEgvWWSzY820agmarvTKCfYXYkslyaSNxCZOtyctgzRioHpx4qXRvYnoaHS6q6zjCwSShslZAGwPyyyw==",
251
- "shasum": "864b2749e3dd4bf4691b29fd9aeb45046c61f402",
252
- "filename": "florianpat-lando-core-3.23.27-2florianPat.0.tgz",
253
- "unpackedSize": 60967423
250
+ "integrity": "sha512-ZWcPay0jFJhJHu87HM67Mz4zzHfA2LI3CoZxxcwvPNO3jOEi39k6bibn5eja59IKli2zkf+7XT0otfKaDE1PfQ==",
251
+ "shasum": "365b707641df970d3b6b7a5253f02c81b89d8b02",
252
+ "filename": "florianpat-lando-core-3.23.27-4florianPat.1.tgz",
253
+ "unpackedSize": 60967664
254
254
  }
255
255
  }
package/tasks/exec.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  // Modules
4
- const fs = require('fs');
5
- const path = require('path');
6
4
  const _ = require('lodash');
7
5
 
8
6
  const {color} = require('listr2');
7
+ const fs = require('fs');
8
+ const path = require('path');
9
9
 
10
10
  // @TODO: when we have a file for recipes/compose we can set choices on service
11
11
 
@@ -14,7 +14,7 @@ module.exports = (lando, config = lando.appConfig) => ({
14
14
  describe: 'Runs command(s) on a service',
15
15
  usage: '$0 exec <service> [--user <user>] -- <command>',
16
16
  override: true,
17
- level: 'engine',
17
+ level: 'app',
18
18
  examples: [
19
19
  '$0 exec appserver -- lash bash',
20
20
  '$0 exec nginx --user root -- whoami',
@@ -40,7 +40,8 @@ module.exports = (lando, config = lando.appConfig) => ({
40
40
 
41
41
  // if no app then we need to throw
42
42
  if (!fs.existsSync(minapp.composeCache)) {
43
- throw new Error('Could not detect a built app. Rebuild or move into the correct location!');
43
+ const app = lando.getApp(options._app.root);
44
+ await app.init();
44
45
  }
45
46
 
46
47
  // Build a minimal app
@@ -59,7 +60,7 @@ module.exports = (lando, config = lando.appConfig) => ({
59
60
  }
60
61
 
61
62
  // nice things
62
- const aservices = app?.config?.allServices ?? app?.allServices ?? [];
63
+ const aservices = app.allServices;
63
64
  const choices = `[${color.green('choices:')} ${aservices.map(service => `"${service}"`).join(', ')}]`;
64
65
 
65
66
  // gather our options
@@ -127,8 +128,8 @@ module.exports = (lando, config = lando.appConfig) => ({
127
128
  ropts.push(sconf?.overrides?.working_dir ?? sconf?.working_dir);
128
129
  // mix in mount if applicable
129
130
  ropts.push(app?.mounts[options.service]);
130
- ropts.push(!options.deps ?? true);
131
- ropts.push(options.autoRemove ?? false);
131
+ ropts.push(!options.deps ?? false);
132
+ ropts.push(options.autoRemove ?? true);
132
133
 
133
134
  // emit pre-exec
134
135
  await app.events.emit('pre-exec', config);
@@ -5,8 +5,6 @@ const path = require('path');
5
5
 
6
6
  module.exports = (platform = process.landoPlatform ?? process.platform) => {
7
7
  switch (platform) {
8
- case 'darwin':
9
- return '/Applications/Docker.app/Contents/Resources/bin';
10
8
  case 'linux':
11
9
  return '/usr/share/lando/bin';
12
10
  case 'win32':