Skip to content

Commit

Permalink
Update to oclif 3 (#96)
Browse files Browse the repository at this point in the history
* Update to oclif 3

* Update versions

* Update remaining package

* add back tslib
  • Loading branch information
grant0417 authored Dec 20, 2023
1 parent db6e926 commit b0c38ef
Show file tree
Hide file tree
Showing 17 changed files with 976 additions and 1,761 deletions.
2 changes: 1 addition & 1 deletion cli/create-completion-spec/boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
"lint-staged": "^12.4.1",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"typescript": "~5.2.0"
"typescript": "^5.2.0"
}
}
6 changes: 3 additions & 3 deletions cli/create-completion-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
},
"devDependencies": {
"@fig/complete-commander": "workspace:^",
"@types/node": "^20.9.3",
"tsx": "^4.1.4",
"typescript": "~5.2.0"
"@types/node": "^20.10.5",
"tsx": "^4.7.0",
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
14 changes: 7 additions & 7 deletions cli/publish-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@
"homepage": "https://github.com/withfig/autocomplete-tools#readme",
"dependencies": {
"commander": "^11.1.0",
"esbuild": "^0.19.6",
"esbuild": "^0.19.10",
"node-fetch": "^3.3.2",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"prompts": "^2.4.2"
},
"devDependencies": {
"@fig/complete-commander": "workspace:^",
"@types/express": "^4.17.21",
"@types/multer": "^1.4.10",
"@types/node": "^20.9.2",
"@types/multer": "^1.4.11",
"@types/node": "^20.10.5",
"@types/node-fetch": "^2.6.9",
"@types/prompts": "latest",
"@types/prompts": "^2.4.9",
"express": "^4.18.2",
"multer": "1.4.5-lts.1",
"picocolors": "^1.0.0",
"tsx": "^4.1.4",
"typescript": "~5.2.0"
"tsx": "^4.7.0",
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 6 additions & 6 deletions cli/tools-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@fig/autocomplete-helpers": "workspace:^",
"@fig/autocomplete-merge": "workspace:^",
"@types/semver": "^7.5.5",
"@types/semver": "^7.5.6",
"chalk": "^4.1.2",
"chokidar": "^3.5.3",
"commander": "^11.1.0",
"create-completion-spec": "workspace:^",
"esbuild": "^0.19.6",
"esbuild": "^0.19.10",
"fast-glob": "^3.3.2",
"module-from-string": "^3.3.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"semver": "^7.5.4",
"typescript": "~5.2.0"
"typescript": "^5.3.3"
},
"types": "build/index.d.ts",
"files": [
"build/"
],
"devDependencies": {
"@fig/complete-commander": "workspace:^",
"@types/node": "^20.9.2",
"@types/node": "^20.10.5",
"@withfig/autocomplete-types": "workspace:^",
"tsx": "^4.1.4"
"tsx": "^4.7.0"
},
"fig": {
"build": {
Expand Down
4 changes: 2 additions & 2 deletions eslint/config-autocomplete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"license": "MIT",
"main": "./index.js",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@withfig/eslint-plugin-fig-linter": "workspace:^",
"eslint-plugin-compat": "^4.2.0"
},
Expand Down
10 changes: 5 additions & 5 deletions generators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"lib/"
],
"devDependencies": {
"@types/chai": "^4.3.10",
"@types/mocha": "^10.0.4",
"@types/node": "^20.9.2",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^20.10.5",
"@types/sinon-chai": "^3.2.12",
"@withfig/autocomplete-types": "workspace:^",
"chai": "^4.3.10",
"mocha": "^10.2.0",
"sinon": "^17.0.1",
"sinon-chai": "^3.7.0",
"tsx": "^4.1.4",
"typescript": "~5.2.0"
"tsx": "^4.7.0",
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
10 changes: 5 additions & 5 deletions helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
"author": "Fig Team",
"dependencies": {
"semver": "^7.5.4",
"typescript": "~5.2.2"
"typescript": "^5.3.3"
},
"devDependencies": {
"@tsconfig/recommended": "^1.0.3",
"@types/jest": "^29.5.9",
"@types/node": "^20.9.3",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"@types/semver": "^7.5.6",
"@withfig/autocomplete-types": "workspace:^",
"jest": "^29.7.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"ts-jest": "^29.1.1",
"tsx": "^4.1.4"
"tsx": "^4.7.0"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"react": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.37",
"@types/react": "^18.2.45",
"@withfig/autocomplete-types": "workspace:^",
"typescript": "~5.2.0"
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions integrations/commander/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
"commander": "^11.1.0"
},
"dependencies": {
"prettier": "^3.1.0"
"prettier": "^3.1.1"
},
"devDependencies": {
"@types/node": "^20.9.2",
"@types/node": "^20.10.5",
"@withfig/autocomplete-types": "workspace:^",
"chalk": "^5.3.0",
"commander": "^11.1.0",
"tsx": "^4.1.4",
"typescript": "~5.2.0"
"tsx": "^4.7.0",
"typescript": "^5.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
15 changes: 4 additions & 11 deletions integrations/oclif/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@
"author": "Matt Schrage @mattschrage",
"bugs": "https://github.com/withfig/autocomplete-tools/issues",
"dependencies": {
"@oclif/command": "^1.8.36",
"@oclif/config": "^1.18.17",
"prettier": "^3.1.0"
"@oclif/core": "^3.15.0",
"prettier": "^3.1.1"
},
"devDependencies": {
"@oclif/dev-cli": "^1.26.10",
"@oclif/plugin-help": "^6.0.7",
"@types/node": "^20.9.2",
"@types/node": "^20.10.5",
"@withfig/autocomplete-types": "workspace:^",
"globby": "^14.0.0",
"tslib": "^2.6.2",
"typescript": "~5.2.0"
},
"engines": {
"node": ">=18.0.0"
"typescript": "^5.3.3"
},
"files": [
"/lib",
Expand Down
34 changes: 13 additions & 21 deletions integrations/oclif/src/commands/generate-fig-spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Command } from "@oclif/command";
import { Command as ICommand } from "@oclif/config";
import * as fs from "fs";
import { Command } from "@oclif/core";
import * as fs from "node:fs";
import * as prettier from "prettier";

function getFigArgs(args: ICommand.Arg[]): Fig.Arg[] {
function getFigArgs(args: Command.Arg.Cached[]): Fig.Arg[] {
const figArgs: Fig.Arg[] = [];
for (const arg of args) {
if (arg.hidden) continue;
Expand All @@ -18,12 +17,12 @@ function getFigArgs(args: ICommand.Arg[]): Fig.Arg[] {
return figArgs;
}

function getFigOptions(options: [string, ICommand.Flag][]): Fig.Option[] {
function getFigOptions(options: Command.Flag.Cached[]): Fig.Option[] {
const figOptions: Fig.Option[] = [];
for (const [name, flag] of options) {
for (const flag of options) {
if (flag.hidden) continue;
figOptions.push({
name: flag.char ? [`-${flag.char}`, `--${name}`] : `--${name}`,
name: flag.char ? [`-${flag.char}`, `--${flag.name}`] : `--${flag.name}`,
...(flag.description && { description: flag.description }),
...(flag.type === "option" && {
args: {
Expand All @@ -32,24 +31,24 @@ function getFigOptions(options: [string, ICommand.Flag][]): Fig.Option[] {
},
}),
...(flag.required === true && { isRequired: true }),
...(flag.type === "boolean" && flag.allowNo && { exclusiveOn: [`--no-${name}`] }),
...(flag.type === "boolean" && flag.allowNo && { exclusiveOn: [`--no-${flag.name}`] }),
});
if (flag.type === "boolean" && flag.allowNo) {
figOptions.push({
name: `--no-${name}`,
name: `--no-${flag.name}`,
});
}
}
return figOptions;
}

function getFigSubcommands(commands: ICommand.Plugin[]): Fig.Subcommand[] {
function getFigSubcommands(commands: Command.Loadable[]): Fig.Subcommand[] {
const subcommands: Fig.Subcommand[] = [];
for (const command of commands) {
// skip this command or hidden commands
if (command.id === "generate-fig-spec" || command.hidden) continue;
const options: Fig.Option[] = getFigOptions(Object.entries(command.flags));
const args: Fig.Arg[] = getFigArgs(command.args);
const options: Fig.Option[] = getFigOptions(Object.values(command.flags));
const args: Fig.Arg[] = getFigArgs(Object.values(command.args));
subcommands.push({
name: command.aliases.length > 0 ? [command.id, ...command.aliases] : command.id,
...(command.description && { description: command.description }),
Expand All @@ -63,16 +62,8 @@ function getFigSubcommands(commands: ICommand.Plugin[]): Fig.Subcommand[] {
export class GenerateFigSpecCommand extends Command {
static description = "Generate a Fig completion spec";

// static flags = {
// help: flags.help({ char: "h" }),
// output: flags.string({
// char: "o",
// description: "Output filepath",
// }),
// };

async run() {
const { flags: parsedFlags } = this.parse(GenerateFigSpecCommand);
const { flags: parsedFlags } = await this.parse(GenerateFigSpecCommand);

const spec: Fig.Spec = {
name: this.config.name,
Expand All @@ -89,6 +80,7 @@ export class GenerateFigSpecCommand extends Command {
`,
{ parser: "typescript" }
);

if (parsedFlags.output) {
fs.writeFileSync(parsedFlags.output, template);
} else {
Expand Down
8 changes: 4 additions & 4 deletions merge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"dependencies": {
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"ts-morph": "^12.2.0",
"typescript": "~5.2.0"
"typescript": "^5.3.3"
},
"files": [
"lib/"
],
"devDependencies": {
"@types/node": "^20.9.2",
"tsx": "^4.1.4"
"@types/node": "^20.10.5",
"tsx": "^4.7.0"
},
"fig": {
"build": {
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"name": "root",
"private": true,
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"eslint": "^8.54.0",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"lint-staged": "^15.2.0",
"prettier": "3.1.0",
"turbo": "^1.10.16"
"turbo": "^1.11.2"
},
"scripts": {
"lint": "eslint .",
Expand Down
Loading

0 comments on commit b0c38ef

Please sign in to comment.