Skip to content

refactor!: modernize toolchain to v1.0.0#36

Closed
nitaking wants to merge 14 commits into
mainfrom
feature/upgrade
Closed

refactor!: modernize toolchain to v1.0.0#36
nitaking wants to merge 14 commits into
mainfrom
feature/upgrade

Conversation

@nitaking
Copy link
Copy Markdown
Owner

No description provided.

nitaking and others added 13 commits May 14, 2026 22:50
- 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>
Copilot AI review requested due to automatic review settings May 14, 2026 14:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 search and update commands.
  • 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 ~/.gitmoji on 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.json can 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.

Comment thread package.json
"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 thread .github/workflows/ci.yml
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 thread src/utils.ts
Comment on lines +22 to +23
const raw = readFileSync(CACHE_FILE, 'utf-8')
return JSON.parse(raw).gitmojis
Comment thread test/utils.test.ts
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants