-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test utils, logger improvements, general polish (#12)
* Avoid resolving relative paths * Cleanup * Add a type param to `Plugin` for the `meta` field * Cleanup terminology in Hooks * Make HooksEmitter a generic * Add default type to param * Change type param name * Improve logger plugin * Switch context function props to methods (immutability should be handled elsewhere) * Improve comment * Remove 'node:' prefix from imports * Add client getter to state * Bump help plugin version * Improve comment * Update command-menu plugin info * Rename test folder * Revert making context functions methods * Improve hooks comments * Move format-file-name to utils * Rename data option in state and ensure it's used * Add missing export for formatFileName * Update tsconfigs * Improve and export test-utils * Replace `skip` option with `enabled` on command-menu, improve testing * Update regex link * Switch to biome * Update biome settings * Fix optionValues type in State.fork * Wrap custom logger hooks in util fns * Add changesets * Quote command in workflow * Add yarn.lock * Fix workflow * Remove unused deep freeze util * Don't lint PRs for now
- Loading branch information
Showing
68 changed files
with
1,082 additions
and
1,090 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"clide-plugin-command-menu": minor | ||
--- | ||
|
||
Renamed `skip` option to `enabled`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"clide-js": minor | ||
--- | ||
|
||
- Polished up internal ✨**test utils**✨ and added them to the exports so you can easily test you're CLIs and plugins! | ||
- Made the `logger` plugin more full featured with `prefix`, `logFile`, and `enabled` options, and util functions for enabling/disabling the logger during runtime. | ||
- Added `formatFileName` util function to exports. | ||
- Added getters to `State` for `client`, ... so they can be accessed without needing to go through through `Context`. | ||
- Made the `Hooks` type a generic which takes a `HooksObject` type param. | ||
- Made the `PluginInfo` type a generic which takes a `PluginMeta` type param. | ||
- Renamed `StateOptions.data` to `StateOptions.initialData`. | ||
- Refactored command resolution to ignore relative paths. | ||
- Fixed the `optionValues` type on `State.fork` to work with command types that have an optional `options` field. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
{ | ||
"cSpell.words": [ | ||
"cfonts", | ||
"cliui", | ||
"divs", | ||
"signale", | ||
"unmock" | ||
] | ||
} | ||
"cSpell.words": ["cfonts", "cliui", "divs", "signale", "unmock"], | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"quickfix.biome": "explicit", | ||
"source.organizeImports.biome": "explicit" | ||
}, | ||
"[json]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[jsonc]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[javascript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[yaml]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[markdown]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.7.2/schema.json", | ||
"formatter": { | ||
"enabled": true, | ||
"formatWithErrors": false, | ||
"indentStyle": "space", | ||
"indentWidth": 2, | ||
"lineEnding": "lf", | ||
"lineWidth": 80, | ||
"attributePosition": "auto", | ||
"ignore": ["**/node_modules/**", "**/dist/**"] | ||
}, | ||
"organizeImports": { "enabled": true }, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true, | ||
"correctness": { | ||
"noUnusedImports": "error" | ||
}, | ||
"style": { | ||
"useNodejsImportProtocol": "warn" | ||
}, | ||
"suspicious": { | ||
"noExplicitAny": "warn", | ||
"noDoubleEquals": "warn" | ||
} | ||
}, | ||
"ignore": ["./**/dist/**", "./**/node_modules/**"] | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"jsxQuoteStyle": "double", | ||
"quoteProperties": "asNeeded", | ||
"trailingComma": "all", | ||
"semicolons": "always", | ||
"arrowParentheses": "always", | ||
"bracketSpacing": true, | ||
"bracketSameLine": false, | ||
"quoteStyle": "single", | ||
"attributePosition": "auto" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
{ | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build:clide": "turbo run build --filter=./packages/clide*", | ||
"build": "turbo run build", | ||
"format": "prettier --write \"**/*.{ts,md}\"", | ||
"lint": "turbo run lint", | ||
"format": "biome format --write ./packages/", | ||
"lint": "biome lint ./packages/", | ||
"release": "turbo run build && changeset publish", | ||
"test": "turbo run test:ci", | ||
"typecheck": "turbo run typecheck" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.7.2", | ||
"@changesets/cli": "^2.27.1", | ||
"eslint": "^9.1.0", | ||
"prettier": "^3.2.5", | ||
"prettier-plugin-organize-imports": "^3.2.4", | ||
"tsconfig": "*", | ||
"turbo": "latest" | ||
}, | ||
"name": "clide", | ||
"packageManager": "yarn@1.22.19", | ||
"workspaces": [ | ||
"packages/*", | ||
"examples/*", | ||
".github/actions/*" | ||
] | ||
"workspaces": ["packages/*", "examples/*", ".github/actions/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { command } from 'src/core/command'; | ||
|
||
export default command({ | ||
description: 'Get a greeting', | ||
options: { | ||
name: { | ||
type: 'string', | ||
description: 'The name to greet', | ||
}, | ||
}, | ||
handler: async ({ options }) => { | ||
console.log(options); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
#!/usr/bin/env node | ||
import { run } from 'src/core/run'; | ||
import { help } from 'src/plugins/help'; | ||
import { logger } from 'src/plugins/logger'; | ||
|
||
const result = await run({ | ||
plugins: [logger(), help()], | ||
plugins: [ | ||
logger({ | ||
enabled: process.env.NODE_ENV === 'development', | ||
}), | ||
help(), | ||
], | ||
}).catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); | ||
|
||
console.log('result', result); | ||
console.log('result:', result); |
Oops, something went wrong.