Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dev-deps): update dev dependencies #74

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions bin/lando.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,45 +48,45 @@ if (!hconf[binPath] || (landoConfig.version !== hconf[binPath].version)) {
];

const plugins = pluginDirs
.filter(dir => dir.type === 'core')
.map(dir => ([dir.dir, fs.readdirSync(path.resolve(__dirname, '..', dir.dir))]))
.map(dir => dir[1].map(plugin => path.join(dir[0], plugin)))
.flat(Number.POSITIVE_INFINITY)
.map(dir => ({
location: `lando://${dir}`,
manifest: path.join(__dirname, '..', dir, 'plugin.yml'),
pjson: path.join(__dirname, '..', dir, 'package.json'),
}))
.filter(plugin => fs.existsSync(plugin.manifest))
.filter(dir => dir.type === 'core')
.map(dir => ([dir.dir, fs.readdirSync(path.resolve(__dirname, '..', dir.dir))]))
.map(dir => dir[1].map(plugin => path.join(dir[0], plugin)))
.flat(Number.POSITIVE_INFINITY)
.map(dir => ({
location: `lando://${dir}`,
manifest: path.join(__dirname, '..', dir, 'plugin.yml'),
pjson: path.join(__dirname, '..', dir, 'package.json'),
}))
.filter(plugin => fs.existsSync(plugin.manifest))
.map(plugin => Object.assign(plugin, { // eslint-disable-line
manifest: yaml.load(fs.readFileSync(plugin.manifest)),
pjson: fs.existsSync(plugin.pjson) ? require(plugin.pjson) : {},
}))
.map(plugin => ({
name: plugin.manifest.name || plugin.pjson.name,
package: plugin.manifest.name || plugin.pjson.name,
deprecated: plugin.deprecated === true,
hidden: plugin.hidden === true,
location: plugin.location,
type: 'core',
version: plugin.manifest.version || plugin.pjson.version || version,
isValid: true,
isInstalled: true,
}));
manifest: yaml.load(fs.readFileSync(plugin.manifest)),
pjson: fs.existsSync(plugin.pjson) ? require(plugin.pjson) : {},
}))
.map(plugin => ({
name: plugin.manifest.name || plugin.pjson.name,
package: plugin.manifest.name || plugin.pjson.name,
deprecated: plugin.deprecated === true,
hidden: plugin.hidden === true,
location: plugin.location,
type: 'core',
version: plugin.manifest.version || plugin.pjson.version || version,
isValid: true,
isInstalled: true,
}));

// get app config
const extension = `.${landoFile.split('.')[landoFile.split('.').length -1]}`;
const namespace = path.basename(landoFile, extension);
const landofiles = preLandoFiles.concat([namespace]).concat(postLandoFiles)
.map(file => file.replace(namespace, ''))
.map(file => file.replace(extension, ''))
.map(file => file.replace('.', ''));
.map(file => file.replace(namespace, ''))
.map(file => file.replace(extension, ''))
.map(file => file.replace('.', ''));

// assemble
hconf[binPath] = {
lando: {globalDir, plugins, pluginDirs, version, envPrefix, product},
app: {landofile: namespace, landofiles,
}};
}};
// dump
fs.mkdirSync(path.dirname(landoConfig.hconf), {recursive: true});
fs.writeFileSync(landoConfig.hconf, JSON.stringify(hconf, null, 2));
Expand Down
126 changes: 63 additions & 63 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ const initAndReport = (app, method = 'start') => {
* Helper to load in all app plugins
*/
const loadPlugins = (app, lando) => Promise.resolve(app.plugins.registry)
// Filter out
.filter(plugin => _.has(plugin, 'app'))
// LOADEM!
.map(plugin => app.plugins.load(plugin, plugin.app, app, lando))
// Remove any naughty shit
.map(plugin => _.pick(plugin.data, ['config', 'composeData', 'env', 'labels']))
// Merge minotaur
.each(result => _.merge(app, result));
// Filter out
.filter(plugin => _.has(plugin, 'app'))
// LOADEM!
.map(plugin => app.plugins.load(plugin, plugin.app, app, lando))
// Remove any naughty shit
.map(plugin => _.pick(plugin.data, ['config', 'composeData', 'env', 'labels']))
// Merge minotaur
.each(result => _.merge(app, result));

/**
* The class to instantiate a new App
Expand Down Expand Up @@ -92,12 +92,12 @@ module.exports = class App {
this.log = new Log(_.merge({}, lando.config, {logName: this.name}));
this.shell = new Shell(this.log);
this.engine = bootstrap.setupEngine(
lando.config,
lando.cache,
lando.events,
this.log,
this.shell,
lando.config.instance,
lando.config,
lando.cache,
lando.events,
this.log,
this.shell,
lando.config.instance,
);
this.Promise = lando.Promise;
this.events = new AsyncEvents(this.log);
Expand Down Expand Up @@ -205,12 +205,12 @@ module.exports = class App {
* @alias app.events:pre-destroy
* @event pre_destroy
*/
.then(() => this.events.emit('pre-destroy'))
.then(() => this.events.emit('pre-destroy'))

// Make sure app is stopped.
.then(() => this.stop())
.then(() => this.stop())
// Uninstall app.
.then(() => this.uninstall(true))
.then(() => this.uninstall(true))

/**
* Event that runs after an app is destroyed.
Expand All @@ -219,8 +219,8 @@ module.exports = class App {
* @alias app.events:post-destroy
* @event post_destroy
*/
.then(() => this.events.emit('post-destroy'))
.then(() => this.log.info('destroyed app.'));
.then(() => this.events.emit('post-destroy'))
.then(() => this.log.info('destroyed app.'));
};

/**
Expand Down Expand Up @@ -263,12 +263,12 @@ module.exports = class App {
return loadPlugins(this, this._lando).then(() => this.events.emit('pre-init', this))

// Actually assemble this thing so its ready for that engine
.then(() => {
// Get all the services
this.services = utils.getServices(this.composeData);
// Merge whatever we have thus far together
this.info = utils.getInfoDefaults(this);
})
.then(() => {
// Get all the services
this.services = utils.getServices(this.composeData);
// Merge whatever we have thus far together
this.info = utils.getInfoDefaults(this);
})
/**
* Event that allows altering of the app object right after it has been
* full initialized and all its plugins have been loaded.
Expand All @@ -278,21 +278,21 @@ module.exports = class App {
* @event post_init
* @property {App} app The app instance.
*/
.then(() => this.events.emit('post-init', this))
.then(() => this.events.emit('post-init', this))
// Finish up
.then(() => {
// Front load our app mounts
this.add(new this.ComposeService('mounts', {}, {services: utils.getAppMounts(this)}), true);
// Then front load our globals
this.add(new this.ComposeService('globals', {}, {services: utils.getGlobals(this)}), true);
// Take the big dump of all our compose stuff
this.compose = utils.dumpComposeData(this.composeData, this._dir);
// Log
this.initialized = true;
this.log.verbose('app is ready!');
this.log.silly('app has compose files', this.compose);
this.log.silly('app has config', this.config);
})
.then(() => {
// Front load our app mounts
this.add(new this.ComposeService('mounts', {}, {services: utils.getAppMounts(this)}), true);
// Then front load our globals
this.add(new this.ComposeService('globals', {}, {services: utils.getGlobals(this)}), true);
// Take the big dump of all our compose stuff
this.compose = utils.dumpComposeData(this.composeData, this._dir);
// Log
this.initialized = true;
this.log.verbose('app is ready!');
this.log.silly('app has compose files', this.compose);
this.log.silly('app has config', this.config);
})
/**
* Event that runs when the app is ready for action
*
Expand All @@ -301,7 +301,7 @@ module.exports = class App {
* @event ready
* @property {App} app The app instance.
*/
.then(() => this.events.emit('ready', this));
.then(() => this.events.emit('ready', this));
};

/**
Expand Down Expand Up @@ -334,34 +334,34 @@ module.exports = class App {
* @alias app.events:pre-rebuild
* @event pre_rebuild
*/
.then(() => this.events.emit('pre-rebuild'))
.then(() => this.events.emit('pre-rebuild'))
// Stop app.
.then(() => this.stop())
.then(() => this.stop())
// Uninstall app
.then(() => this.uninstall())
.then(() => this.uninstall())
// Repull/build components.
.then(() => this.engine.build(this))
.then(() => this.engine.build(this))
// Install app.
.then(() => this.start())
.then(() => this.start())
/**
* Event that runs after an app is rebuilt.
*
* @since 3.0.0
* @alias app.events:post-rebuild
* @event post_rebuild
*/
.then(() => this.events.emit('post-rebuild'))
.then(() => this.log.info('rebuilt app.'));
.then(() => this.events.emit('post-rebuild'))
.then(() => this.log.info('rebuilt app.'));
};

/*
/*
* @TODO
*/
reset() {
this.initialized = false;
};

/**
/**
* Stops and then starts an app.
*
* This just runs `app.stop` and `app.start` in succession.
Expand All @@ -380,8 +380,8 @@ module.exports = class App {
this.log.info('restarting app...');
// stop/start
return this.stop()
.then(() => this.start())
.then(() => this.log.info('restarted app.'));
.then(() => this.start())
.then(() => this.log.info('restarted app.'));
};

/**
Expand Down Expand Up @@ -411,10 +411,10 @@ module.exports = class App {
* @alias app.events:pre-start
* @event pre_start
*/
.then(() => this.events.emit('pre-start'))
.then(() => this.events.emit('pre-start'))

// Start core containers
.then(() => this.engine.start(this))
.then(() => this.engine.start(this))

/**
* Event that runs after an app is started.
Expand All @@ -426,8 +426,8 @@ module.exports = class App {
* @alias app.events:post-start
* @event post_start
*/
.then(() => this.events.emit('post-start'))
.then(() => this.log.info('started app.'));
.then(() => this.events.emit('post-start'))
.then(() => this.log.info('started app.'));
};

/**
Expand All @@ -453,10 +453,10 @@ module.exports = class App {
* @alias app.events:pre-stop
* @event pre_stop
*/
.then(() => this.events.emit('pre-stop'))
.then(() => this.events.emit('pre-stop'))

// Stop components.
.then(() => this.engine.stop(this))
.then(() => this.engine.stop(this))

/**
* Event that runs after an app stop.
Expand All @@ -465,8 +465,8 @@ module.exports = class App {
* @alias app.events:post-stop
* @event post_stop
*/
.then(() => this.events.emit('post-stop'))
.then(() => this.log.info('stopped app.'));
.then(() => this.events.emit('post-stop'))
.then(() => this.log.info('stopped app.'));
};

/**
Expand Down Expand Up @@ -498,10 +498,10 @@ module.exports = class App {
* @alias app.events:pre-uninstall
* @event pre_uninstall
*/
.then(() => this.events.emit('pre-uninstall'))
.then(() => this.events.emit('pre-uninstall'))

// Kill components.
.then(() => this.engine.destroy(_.merge({}, this, {opts: {purge}})))
.then(() => this.engine.destroy(_.merge({}, this, {opts: {purge}})))

/**
* Event that runs after an app is uninstalled.
Expand All @@ -513,8 +513,8 @@ module.exports = class App {
* @alias app.events:post-uninstall
* @event post_uninstall
*/
.then(() => this.events.emit('post-uninstall'))
.then(() => this.log.info('uninstalled app.'));
.then(() => this.events.emit('post-uninstall'))
.then(() => this.log.info('uninstalled app.'));
};

getServiceContainerId(service) {
Expand Down
Loading
Loading