refactor!: modernize toolchain to v1.0.0#36
Closed
nitaking wants to merge 14 commits into
Closed
Conversation
- Replace yarn with pnpm, set engines to Node >= 20 - Upgrade oclif v1 (@oclif/command) to v4 (@oclif/core) - Upgrade TypeScript 3 to 5, replace tslint with eslint - Convert to ESM (type: module, inquirer v9, execa v9) - Resolve all security vulnerabilities (pnpm audit clean) BREAKING CHANGE: requires Node.js >= 20 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove mocha, chai, nyc and related config - Add vitest with utils, prompt, and list command tests - 10 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove .circleci/config.yml (Node 8/10 targets) - Add GitHub Actions workflow with Node 20/22 matrix - Include build, test, audit, and CLI smoke test steps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- `gitmoji search <query>` for static keyword search - `gitmoji search` for interactive autocomplete search Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Include code and emoji in search text for list and search commands, matching the interactive autocomplete behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gitmoji data is cached at ~/.gitmoji/gitmojis.json after first fetch. `gitmoji update` refreshes the cache from remote. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mock homedir for utils cache tests, mock gitmojis() for prompt tests, and add a fixture file for deterministic test data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR modernizes the CLI/tooling stack for gitmoji-c, moving from the older oclif/Yarn/Mocha/TSLint setup to oclif v4, pnpm, Vitest, ESLint, ESM, and Node 20+.
Changes:
- Migrates package/toolchain configuration to pnpm, ESM, oclif core v4, TypeScript 5, Vitest, and ESLint.
- Updates CLI commands and utilities, adding cache support plus new
searchandupdatecommands. - Replaces legacy CI/test/release docs with GitHub Actions, Vitest tests, and release guidance.
Reviewed changes
Copilot reviewed 25 out of 31 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.circleci/config.yml |
Removes legacy CircleCI configuration. |
.github/workflows/ci.yml |
Adds GitHub Actions CI for pnpm build/test/audit. |
.gitignore |
Adds new generated/local paths to ignore. |
.node-version |
Pins Node major version to 20. |
README.md |
Updates installation, requirements, usage, and CI badge. |
RELEASING.md |
Adds release process documentation. |
bin/run |
Migrates CLI bootstrap to oclif core ESM execution. |
eslint.config.mjs |
Adds ESLint flat config for TypeScript sources. |
package.json |
Updates dependencies, scripts, package metadata, ESM type, and Node engine. |
src/commands/commit.ts |
Migrates commit command to oclif core, ESM imports, and new inquirer usage. |
src/commands/hello.ts |
Removes generated sample hello command. |
src/commands/list.ts |
Migrates list command to oclif core and updates search handling. |
src/commands/search.ts |
Adds new search command with static and interactive modes. |
src/commands/update.ts |
Adds cache refresh command. |
src/index.ts |
Updates oclif export source. |
src/prompt.ts |
Refactors prompt questions for ESM and simplified choice mapping. |
src/utils.ts |
Adds remote fetch helpers and local gitmoji cache handling. |
test/commands/hello.test.ts |
Removes tests for deleted sample command. |
test/commands/list.test.ts |
Adds CLI integration tests for list command. |
test/commands/search.test.ts |
Adds CLI integration tests for search command. |
test/fixtures/gitmojis.json |
Adds gitmoji fixture data for tests. |
test/mocha.opts |
Removes Mocha configuration. |
test/prompt.test.ts |
Adds Vitest coverage for prompt behavior. |
test/tsconfig.json |
Removes legacy test TypeScript config. |
test/utils.test.ts |
Adds Vitest coverage for cache and fetch utility paths. |
tsconfig.json |
Updates compiler options for Node 16-style ESM resolution and ES2022 output. |
tslint.json |
Removes TSLint configuration. |
vitest.config.ts |
Adds Vitest configuration. |
yarn.lock |
Removes Yarn v1 lockfile in favor of pnpm tooling. |
Comments suppressed due to low confidence (2)
test/commands/list.test.ts:17
- This spawned CLI uses the real user home/cache, so the assertion can be affected by stale local cache contents and the test can mutate
~/.gitmojion the machine running it. Point the subprocess at a temporary home/cache to keep the test deterministic and non-destructive.
const {stdout} = await execa(bin, ['list', 'bug'], {env: {NODE_ENV: 'production'}})
test/commands/search.test.ts:16
- This test also runs the CLI against the real user cache. A stale or corrupted
~/.gitmoji/gitmojis.jsoncan change the output, and a cache miss will write to the runner's home directory; isolate the subprocess with a temporary home/cache.
const {stdout} = await execa(bin, ['search', 'zzzznotfound'], {env: {NODE_ENV: 'production'}})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "version": "oclif-dev readme && git add README.md", | ||
| "tags": "git push origin --tags" | ||
| "prepack": "rm -rf lib && tsc -b && oclif manifest", | ||
| "test": "vitest run", |
Comment on lines
+5
to
+7
| branches: [main] | ||
| pull_request: | ||
| branches: [main] |
Comment on lines
+3
to
+17
| import {resolve, dirname} from 'path' | ||
| import {fileURLToPath} from 'url' | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)) | ||
| const bin = resolve(__dirname, '../../bin/run') | ||
|
|
||
| describe('list command', () => { | ||
| it('should list all gitmojis', async () => { | ||
| const {stdout} = await execa(bin, ['list'], {env: {NODE_ENV: 'production'}}) | ||
| expect(stdout).toContain('🎨') | ||
| expect(stdout).toContain('🐛') | ||
| }) | ||
|
|
||
| it('should search gitmojis by keyword', async () => { | ||
| const {stdout} = await execa(bin, ['list', 'bug'], {env: {NODE_ENV: 'production'}}) |
Comment on lines
+3
to
+16
| import {resolve, dirname} from 'path' | ||
| import {fileURLToPath} from 'url' | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)) | ||
| const bin = resolve(__dirname, '../../bin/run') | ||
|
|
||
| describe('search command', () => { | ||
| it('should find matching gitmojis', async () => { | ||
| const {stdout} = await execa(bin, ['search', 'bug'], {env: {NODE_ENV: 'production'}}) | ||
| expect(stdout).toContain('🐛') | ||
| }) | ||
|
|
||
| it('should show message when no results found', async () => { | ||
| const {stdout} = await execa(bin, ['search', 'zzzznotfound'], {env: {NODE_ENV: 'production'}}) |
Comment on lines
+22
to
+23
| const raw = readFileSync(CACHE_FILE, 'utf-8') | ||
| return JSON.parse(raw).gitmojis |
Comment on lines
+38
to
+41
| const {gitmojis} = await import('../src/utils.js') | ||
| const list = await gitmojis() | ||
| expect(Array.isArray(list)).toBe(true) | ||
| expect(list.length).toBeGreaterThan(0) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.