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

fix: upgrade deprecated dependencies #658

Merged
merged 17 commits into from
Feb 5, 2024
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 14.21.3
node-version: 18.14.0
cache: 'yarn'
- name: Cache node_modules
uses: actions/cache@v3
Expand All @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.21.2
node-version: 18.14.0
cache: 'yarn'
- name: Cache node_modules
uses: actions/cache@v3
Expand All @@ -60,9 +60,9 @@ jobs:
needs: [lint]
strategy:
matrix:
node: [14, 16, 18, 20]
node: [18, 20]
include:
- node: 14
- node: 18
withCoverage: ${{ true }}
steps:
- uses: actions/checkout@v3
Expand All @@ -84,7 +84,7 @@ jobs:
run: yarn test
- name: Test with Node ${{ matrix.node }} & Send coverage
uses: paambaati/codeclimate-action@5f637ccd517bc8960de0fe59379dd922bcba9486
if: matrix.withCoverage && matrix.node == 14
if: matrix.withCoverage && matrix.node == 18
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
Expand All @@ -107,7 +107,7 @@ jobs:
persist-credentials: false # GITHUB_TOKEN must not be set for the semantic release
- uses: actions/setup-node@v3
with:
node-version: 14.21.2
node-version: 18.14.0
cache: 'yarn'
- uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18-alpine

WORKDIR /usr/src/cli

Expand Down
7 changes: 4 additions & 3 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node

require('../dist/index').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'));
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
})();
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
MySQL-MIN:
image: mysql:5.6
container_name: forestadmin_test_toolbelt_mysql_min
platform: linux/amd64
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: forestadmin_test_toolbelt-sequelize
Expand Down
17 changes: 7 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
"dependencies": {
"@forestadmin/context": "1.37.1",
"@forestadmin/datasource-sql": "1.6.4",
"@oclif/command": "1.5.4",
"@oclif/config": "1.8.8",
"@oclif/core": "2.8.5",
"@oclif/errors": "1.2.2",
"@oclif/plugin-help": "2.1.3",
"@oclif/plugin-not-found": "1.2.4",
"@oclif/plugin-warn-if-update-available": "1.7.0",
"@oclif/core": "3.18.2",
"@oclif/plugin-help": "6.0.12",
"@oclif/plugin-not-found": "3.0.10",
"@oclif/plugin-warn-if-update-available": "3.0.10",
"app-root-path": "3.0.0",
"atob": "2.1.2",
"bluebird": "3.5.2",
Expand Down Expand Up @@ -59,9 +56,9 @@
"validate-npm-package-name": "3.0.0"
},
"devDependencies": {
"oclif": "4.4.2",
"@commitlint/cli": "17.4.2",
"@commitlint/config-conventional": "17.4.2",
"@oclif/dev-cli": "1.22.2",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/git": "10.0.1",
"@swc/core": "1.3.34",
Expand Down Expand Up @@ -93,7 +90,7 @@
"typescript": "^4.5.4"
},
"engines": {
"node": ">=14.0.0"
"node": ">=18.0.0"
},
"files": [
"/bin",
Expand Down Expand Up @@ -130,7 +127,7 @@
"scripts": {
"lint": "eslint src test",
"prepare": "husky install",
"prepack": "oclif-dev manifest",
"prepack": "yarn build && oclif manifest && oclif readme",
"postpack": "rm -f oclif.manifest.json",
"build": "tsc",
"build:watch": "tsc-watch --onSuccess 'yarn postbuild'",
Expand Down
4 changes: 2 additions & 2 deletions src/abstract-authenticated-command.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type Authenticator from './services/authenticator';
import type * as Config from '@oclif/config';
import type { Config } from '@oclif/core';

import AbstractCommand from './abstract-command';

export default abstract class AbstractAuthenticatedCommand extends AbstractCommand {
protected readonly authenticator: Authenticator;

constructor(argv: string[], config: Config.IConfig, plan?) {
constructor(argv: string[], config: Config, plan?) {
super(argv, config, plan);

const { assertPresent, authenticator } = this.context;
Expand Down
6 changes: 3 additions & 3 deletions src/abstract-command.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type Logger from './services/logger';
import type * as Config from '@oclif/config';
import type { Config } from '@oclif/core';
import type { Chalk } from 'chalk';

import Context from '@forestadmin/context';
import { Command } from '@oclif/command';
import { Command } from '@oclif/core';

import defaultPlan from './context/plan';

export default abstract class AbstractCommand extends Command {
protected readonly context: any;

Check warning on line 11 in src/abstract-command.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type

protected readonly logger: Logger;

protected readonly chalk: Chalk;

constructor(argv: string[], config: Config.IConfig, plan?) {
constructor(argv: string[], config: Config, plan?) {
super(argv, config);

Context.init(plan || defaultPlan, true);
Expand Down
17 changes: 11 additions & 6 deletions src/abstract-project-create-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import type EventSender from './utils/event-sender';
import type { Language } from './utils/languages';
import type Messages from './utils/messages';
import type * as OptionParser from './utils/option-parser';
import type * as OclifConfig from '@oclif/config';
import type { Config as OclifConfig } from '@oclif/core';

import { Args } from '@oclif/core';

import AbstractAuthenticatedCommand from './abstract-authenticated-command';
import { getDialect } from './services/projects/create/options';
Expand All @@ -28,15 +30,18 @@ export default abstract class AbstractProjectCreateCommand extends AbstractAuthe

protected abstract readonly agent: string | null;

/** @see https://oclif.io/docs/args */
static override readonly args = [
{ name: 'applicationName', required: true, description: 'Name of the project to create.' },
];
static override args = {
applicationName: Args.string({
name: 'applicationName',
required: true,
description: 'Name of the project to create.',
}),
};

/** @see https://oclif.io/docs/commands */
static override description = 'Create a new Forest Admin project.';

constructor(argv: string[], config: OclifConfig.IConfig, plan) {
constructor(argv: string[], config: OclifConfig, plan) {
super(argv, config, plan);

const {
Expand Down
24 changes: 12 additions & 12 deletions src/commands/branch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { flags } = require('@oclif/command');
const { Flags, Args } = require('@oclif/core');
const AbstractAuthenticatedCommand = require('../abstract-authenticated-command').default;
const BranchManager = require('../services/branch-manager');
const ProjectManager = require('../services/project-manager');
Expand Down Expand Up @@ -68,7 +68,7 @@ class BranchCommand extends AbstractAuthenticatedCommand {
}

async runAuthenticated() {
const parsed = this.parse(BranchCommand);
const parsed = await this.parse(BranchCommand);
const envSecret = this.env.FOREST_ENV_SECRET;
const commandOptions = { ...parsed.flags, ...parsed.args, envSecret };
let config;
Expand Down Expand Up @@ -111,37 +111,37 @@ BranchCommand.aliases = ['branches'];
BranchCommand.description = 'Create a new branch or list your existing branches.';

BranchCommand.flags = {
projectId: flags.integer({
projectId: Flags.integer({
description: 'The id of the project to create a branch in.',
}),
delete: flags.boolean({
delete: Flags.boolean({
char: 'd',
description: 'Delete the branch.',
}),
force: flags.boolean({
force: Flags.boolean({
description: 'When deleting a branch, skip confirmation.',
}),
help: flags.boolean({
help: Flags.boolean({
description: 'Display usage information.',
}),
format: flags.string({
format: Flags.string({
char: 'format',
description: 'Output format.',
options: ['table', 'json'],
default: 'table',
}),
origin: flags.string({
origin: Flags.string({
char: 'o',
description: 'Set the origin of the created branch.',
}),
};

BranchCommand.args = [
{
BranchCommand.args = {
BRANCH_NAME: Args.string({
name: 'BRANCH_NAME',
required: false,
description: 'The name of the branch to create.',
},
];
}),
};

module.exports = BranchCommand;
10 changes: 5 additions & 5 deletions src/commands/deploy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { flags } = require('@oclif/command');
const { Flags } = require('@oclif/core');
const AbstractAuthenticatedCommand = require('../abstract-authenticated-command').default;
const EnvironmentManager = require('../services/environment-manager');
const ProjectManager = require('../services/project-manager');
Expand All @@ -21,7 +21,7 @@ class DeployCommand extends AbstractAuthenticatedCommand {
*/
async getConfig() {
const envSecret = this.env.FOREST_ENV_SECRET;
const parsed = this.parse(DeployCommand);
const parsed = await this.parse(DeployCommand);
const commandOptions = { ...parsed.flags, ...parsed.args, envSecret };
const config = await withCurrentProject({ ...this.env, ...commandOptions });

Expand Down Expand Up @@ -76,14 +76,14 @@ DeployCommand.aliases = ['environments:deploy'];
DeployCommand.description = 'Deploy layout changes of the current branch to the reference one.';

DeployCommand.flags = {
help: flags.boolean({
help: Flags.boolean({
description: 'Display usage information.',
}),
force: flags.boolean({
force: Flags.boolean({
char: 'f',
description: 'Skip deploy confirmation.',
}),
projectId: flags.integer({
projectId: Flags.integer({
char: 'p',
description: 'The id of the project you want to deploy.',
default: null,
Expand Down
8 changes: 4 additions & 4 deletions src/commands/environments.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { flags } = require('@oclif/command');
const { Flags } = require('@oclif/core');

const EnvironmentManager = require('../services/environment-manager');
const AbstractAuthenticatedCommand = require('../abstract-authenticated-command').default;
Expand All @@ -14,7 +14,7 @@ class EnvironmentCommand extends AbstractAuthenticatedCommand {
}

async runAuthenticated() {
const parsed = this.parse(EnvironmentCommand);
const parsed = await this.parse(EnvironmentCommand);
const config = await withCurrentProject({ ...this.env, ...parsed.flags });
const manager = new EnvironmentManager(config);
const environments = await manager.listEnvironments();
Expand All @@ -27,12 +27,12 @@ EnvironmentCommand.aliases = ['environments:list'];
EnvironmentCommand.description = 'Manage environments.';

EnvironmentCommand.flags = {
projectId: flags.integer({
projectId: Flags.integer({
char: 'p',
description: 'Forest project ID.',
default: null,
}),
format: flags.string({
format: Flags.string({
char: 'format',
description: 'Ouput format.',
options: ['table', 'json'],
Expand Down
14 changes: 7 additions & 7 deletions src/commands/environments/create.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { flags } = require('@oclif/command');
const { Flags } = require('@oclif/core');
const EnvironmentManager = require('../../services/environment-manager');
const AbstractAuthenticatedCommand = require('../../abstract-authenticated-command').default;
const withCurrentProject = require('../../services/with-current-project');
Expand All @@ -13,7 +13,7 @@ class CreateCommand extends AbstractAuthenticatedCommand {
}

async runAuthenticated() {
const parsed = this.parse(CreateCommand);
const parsed = await this.parse(CreateCommand);
const config = await withCurrentProject({ ...this.env, ...parsed.flags });
const manager = new EnvironmentManager(config);

Expand Down Expand Up @@ -42,28 +42,28 @@ class CreateCommand extends AbstractAuthenticatedCommand {
CreateCommand.description = 'Create a new environment.';

CreateCommand.flags = {
projectId: flags.integer({
projectId: Flags.integer({
char: 'p',
description: 'Forest project ID.',
default: null,
}),
name: flags.string({
name: Flags.string({
char: 'n',
description: 'Environment name.',
required: true,
}),
url: flags.string({
url: Flags.string({
char: 'u',
description: 'Application URL.',
required: true,
}),
format: flags.string({
format: Flags.string({
char: 'format',
description: 'Ouput format.',
options: ['table', 'json'],
default: 'table',
}),
disableRoles: flags.boolean({
disableRoles: Flags.boolean({
description: 'Disable roles on new environment.',
default: false,
}),
Expand Down
Loading
Loading