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

update to node18 and update oclif deps as needed #226

Merged
merged 8 commits into from
Oct 25, 2023
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
14 changes: 7 additions & 7 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- x64
- arm64
node-version:
- '16'
- '18'
os:
- linux
- macos
Expand Down Expand Up @@ -64,19 +64,19 @@ jobs:
matrix:
include:
- os: windows-2022
key: cli-node16-win-x64-${{ github.sha }}
key: cli-node18-win-x64-${{ github.sha }}
file: lando/cli.exe
certificate-data: WINDOZE_CERT_DATA
certificate-password: WINDOZE_CERT_PASSWORD
result: lando-win-x64-${{ github.ref_name }}.exe
- os: windows-2022
key: cli-node16-win-arm64-${{ github.sha }}
key: cli-node18-win-arm64-${{ github.sha }}
file: lando/cli.exe
certificate-data: WINDOZE_CERT_DATA
certificate-password: WINDOZE_CERT_PASSWORD
result: lando-win-arm64-${{ github.ref_name }}.exe
- os: macos-12
key: cli-node16-macos-x64-${{ github.sha }}
key: cli-node18-macos-x64-${{ github.sha }}
file: lando/cli
certificate-data: APPLE_CERT_DATA
certificate-password: APPLE_CERT_PASSWORD
Expand All @@ -87,7 +87,7 @@ jobs:
options: --options runtime --entitlements entitlements.xml
result: lando-macos-x64-${{ github.ref_name }}
- os: macos-12
key: cli-node16-macos-arm64-${{ github.sha }}
key: cli-node18-macos-arm64-${{ github.sha }}
file: lando/cli
certificate-data: APPLE_CERT_DATA
certificate-password: APPLE_CERT_PASSWORD
Expand All @@ -98,11 +98,11 @@ jobs:
options: --options runtime --entitlements entitlements.xml
result: lando-macos-arm64-${{ github.ref_name }}
- os: ubuntu-22.04
key: cli-node16-linux-x64-${{ github.sha }}
key: cli-node18-linux-x64-${{ github.sha }}
file: lando/cli
result: lando-linux-x64-${{ github.ref_name }}
- os: ubuntu-22.04
key: cli-node16-linux-arm64-${{ github.sha }}
key: cli-node18-linux-arm64-${{ github.sha }}
file: lando/cli
result: lando-linux-arm64-${{ github.ref_name }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-docs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:

# Install deps and cache
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- x64
- arm64
node-version:
- '16'
- '18'
os:
- linux
- macos
Expand Down Expand Up @@ -62,19 +62,19 @@ jobs:
matrix:
include:
- os: windows-2022
key: cli-node16-win-x64-${{ github.sha }}
key: cli-node18-win-x64-${{ github.sha }}
file: lando/cli.exe
certificate-data: WINDOZE_CERT_DATA
certificate-password: WINDOZE_CERT_PASSWORD
result: lando-win-x64-snapshot-${{ github.sha }}.exe
- os: windows-2022
key: cli-node16-win-arm64-${{ github.sha }}
key: cli-node18-win-arm64-${{ github.sha }}
file: lando/cli.exe
certificate-data: WINDOZE_CERT_DATA
certificate-password: WINDOZE_CERT_PASSWORD
result: lando-win-arm64-snapshot-${{ github.sha }}.exe
- os: macos-12
key: cli-node16-macos-x64-${{ github.sha }}
key: cli-node18-macos-x64-${{ github.sha }}
file: lando/cli
certificate-data: APPLE_CERT_DATA
certificate-password: APPLE_CERT_PASSWORD
Expand All @@ -85,7 +85,7 @@ jobs:
options: --options runtime --entitlements entitlements.xml
result: lando-macos-x64-snapshot-${{ github.sha }}
- os: macos-12
key: cli-node16-macos-arm64-${{ github.sha }}
key: cli-node18-macos-arm64-${{ github.sha }}
file: lando/cli
certificate-data: APPLE_CERT_DATA
certificate-password: APPLE_CERT_PASSWORD
Expand All @@ -96,11 +96,11 @@ jobs:
options: --options runtime --entitlements entitlements.xml
result: lando-macos-arm64-snapshot-${{ github.sha }}
- os: ubuntu-20.04
key: cli-node16-linux-x64-${{ github.sha }}
key: cli-node18-linux-x64-${{ github.sha }}
file: lando/cli
result: lando-linux-x64-snapshot-${{ github.sha }}
- os: ubuntu-20.04
key: cli-node16-linux-arm64-${{ github.sha }}
key: cli-node18-linux-arm64-${{ github.sha }}
file: lando/cli
result: lando-linux-arm64-snapshot-${{ github.sha }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-runtime-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
leia-test:
- examples/appname
- examples/global
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- ubuntu-22.04
- macos-12
node-version:
- '16'
- '18'
steps:

# Install deps and cache
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- x64
- arm64
node-version:
- '16'
- '18'
os:
- linux
- macos
Expand Down Expand Up @@ -62,19 +62,19 @@ jobs:
matrix:
include:
- os: windows-2022
key: cli-node16-win-x64-${{ github.sha }}
key: cli-node18-win-x64-${{ github.sha }}
file: lando/cli.exe
certificate-data: WINDOZE_CERT_DATA
certificate-password: WINDOZE_CERT_PASSWORD
result: lando-win-x64-${{ github.ref_name }}.exe
- os: windows-2022
key: cli-node16-win-arm64-${{ github.sha }}
key: cli-node18-win-arm64-${{ github.sha }}
file: lando/cli.exe
certificate-data: WINDOZE_CERT_DATA
certificate-password: WINDOZE_CERT_PASSWORD
result: lando-win-arm64-${{ github.ref_name }}.exe
- os: macos-12
key: cli-node16-macos-x64-${{ github.sha }}
key: cli-node18-macos-x64-${{ github.sha }}
file: lando/cli
certificate-data: APPLE_CERT_DATA
certificate-password: APPLE_CERT_PASSWORD
Expand All @@ -85,7 +85,7 @@ jobs:
options: --options runtime --entitlements entitlements.xml
result: lando-macos-x64-${{ github.ref_name }}
- os: macos-12
key: cli-node16-macos-arm64-${{ github.sha }}
key: cli-node18-macos-arm64-${{ github.sha }}
file: lando/cli
certificate-data: APPLE_CERT_DATA
certificate-password: APPLE_CERT_PASSWORD
Expand All @@ -96,11 +96,11 @@ jobs:
options: --options runtime --entitlements entitlements.xml
result: lando-macos-arm64-${{ github.ref_name }}
- os: ubuntu-22.04
key: cli-node16-linux-x64-${{ github.sha }}
key: cli-node18-linux-x64-${{ github.sha }}
file: lando/cli
result: lando-linux-x64-${{ github.ref_name }}
- os: ubuntu-22.04
key: cli-node16-linux-arm64-${{ github.sha }}
key: cli-node18-linux-arm64-${{ github.sha }}
file: lando/cli
result: lando-linux-arm64-${{ github.ref_name }}

Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
16 changes: 8 additions & 8 deletions bin/lando.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

// mods
const argv = require('@lando/argv');
const merge = require('@lando/core/utils/merge');
const path = require('path');

// if DEBUG is set then unset it, we dont want it to toggle any debugging inside of lando
Expand Down Expand Up @@ -46,7 +47,6 @@ const id = path.basename(process.argv[1]);
const debug = require('@lando/core-next/debug')(id || 'lando');

// now load in the runtime selector
const rts = require('../lib/rts');
const pjson = require(path.resolve(__dirname, '..', 'package.json'));

// start the preflight
Expand All @@ -61,18 +61,18 @@ const RUNTIME = process.env.LANDO_CORE_RUNTIME;

// start by "minstrapping" the lando/app config
// primarily this means getting the MININMAL amount of stuff we need to determine the runtime to be used
let config = rts.getDefaultConfig({envPrefix: ENVPREFIX, runtime: RUNTIME, userConfRoot: USERCONFROOT});
let config = require('../utils/get-default-config')({envPrefix: ENVPREFIX, runtime: RUNTIME, userConfRoot: USERCONFROOT});

// @NOTE: is it safe to assume configSources exists and is iterable? i think so?
for (const file of config.configSources) {
config = rts.merge(config, rts.loadFile(file));
config = merge(config, require('../utils/load-file')(file));
debug('merged in additional config source from file %o', file);
}

// merge in any envvars that set things
if (config.envPrefix) {
const data = rts.loadEnvs(config.envPrefix);
config = rts.merge(config, data);
const data = require('../utils/load-envars')(config.envPrefix);
config = merge(config, data);
debug('merged in additional config source from %o envvars with data %o', `${config.envPrefix}_*`, data);
}

Expand All @@ -82,8 +82,8 @@ debug('final assembled minconf is %O', config);
// try to get app configuration if we can
const {preLandoFiles, landoFile, postLandoFiles, userConfRoot} = config;

const landoFiles = rts.getLandoFiles([preLandoFiles, [landoFile], postLandoFiles].flat(1));
const appConfig = (landoFiles.length > 0) ? rts.getApp(landoFiles, userConfRoot) : {};
const landoFiles = require('../utils/get-lando-files')([preLandoFiles, [landoFile], postLandoFiles].flat(1));
const appConfig = (landoFiles.length > 0) ? require('../utils/get-app')(landoFiles, userConfRoot) : {};

// if we have an app then normalize runtime and also log some helpful stuff
if (Object.keys(appConfig).length > 0) debug('detected an app %o at %o', appConfig.name, path.dirname(landoFiles[0]));
Expand Down Expand Up @@ -112,7 +112,7 @@ if (runtime === 4) {

// get what we need for cli-next
const cache = !argv.hasOption('--clear') && !argv.hasOption('--no-cache');
const cacheDir = `${rts.getOclifCacheDir(config.product)}.cli`;
const cacheDir = `${require('@lando/core/utils/get-cache-dir')(config.product)}.cli`;
debug('handing off to %o with caching %o at %o and debug %o', '@lando/cli@4', cache ? 'enabled' : 'disabled', cacheDir, debug.enabled);

// get the cli
Expand Down
1 change: 1 addition & 0 deletions config/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
default: undefined,
helpGroup: 'GLOBAL',
}),
'debug': Flags.boolean({hidden: true}),
'experimental': Flags.boolean({hidden: false}),
'no-cache': Flags.boolean({hidden: false}),
'secret-toggle': Flags.boolean({hidden: false}),
Expand Down
17 changes: 10 additions & 7 deletions lib/cli-next.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const yargs = require('yargs');
// OCLIF pieces we need
const {format, inspect} = require('util');
const {normalizeArgv} = require('@oclif/core/lib/help');
const {CliUx, Errors, Parser} = require('@oclif/core');
const {parse} = require('@oclif/parser');
const {ux, Errors} = require('@oclif/core');

const OConfig = require('@oclif/core').Config;

// global options
Expand Down Expand Up @@ -57,7 +59,7 @@ module.exports = class Cli {
if (!this.cache && fs.existsSync(cacheDir)) this.StorageBackend.flush(cacheDir, debug.extend('#flush'));

// add the CLIUX module from OCLIF
this.ux = CliUx;
this.ux = ux;

// some debugging about what happened
this.debug('instantiated cli with cache %o and hooks %o', this.cache, require('@lando/core-next/utils/get-object-sizes')(this.hooks));
Expand All @@ -81,7 +83,7 @@ module.exports = class Cli {
process.exitCode = process.exitCode ?? err.exitCode ?? 1;
if (!err.message) throw err;
try {
CliUx.ux.action.stop(chalk.bold.red('!'));
this.ux.action.stop(chalk.bold.red('!'));
} catch {}

throw err;
Expand Down Expand Up @@ -305,7 +307,7 @@ module.exports = class Cli {
}

prettify(data, {arraySeparator = ', '} = {}) {
return require('./prettify')(data, {arraySeparator});
return require('../utils/prettify')(data, {arraySeparator});
}

/*
Expand All @@ -317,8 +319,9 @@ module.exports = class Cli {
const yargonaut = require('yargonaut');
yargonaut.style('green').errorsStyle('red');

// get the status of some global flags
const {flags} = await Parser.parse(argv, {strict: false, flags: gflags.oclif});
// NOTE: newer versinos of oclif changed "strict" as a parser option so we use the older one, this is probably
// ok since we only use it here?
const {flags} = await parse(argv, {strict: false, flags: gflags.oclif});

// debug if flag config file doesnt exist
// @NOTE: should this be a proper error?
Expand Down Expand Up @@ -360,7 +363,7 @@ module.exports = class Cli {
// Concat OCLIF hooks from config if applicable, transform to absolute paths
// @NOTE: we do this here instead of passing in during instantiation in bin/lando.js because Config.load is async
// and we want to use that so we can accomodate any "oclif" plugins that add hooks'
const ohooks = oclif.plugins
const ohooks = oclif.getPluginsList()
.map(plugin => require('@lando/core-next/utils/normalize-manifest-paths')({hooks: plugin.hooks}, plugin.root))
.map(plugin => plugin.hooks)
.filter(hooks => Object.keys(hooks).length > 0);
Expand Down
Loading
Loading