Skip to content

Commit

Permalink
feat: handle https remotes when trying to guess project name (#73)
Browse files Browse the repository at this point in the history
* feat: handle https remotes and close #54

* chore: add test and migrate from jest to vitest

* fix: package lock

* chore: add fixture project to allow for better testing

* chore: add a fixture project and explicitly pass remote url to guess project name

* feat: improve cherry init and add test

* chore: checkout submodules

* chore: add project one as submodule

* chore: rollback submodule

* chore: remove fake project

* chore: automate the creation of a dummy repo

* chore: debug

* chore: log uncommitted files

* chore: show status

* chore: improve test setup

* chore: add files to error message

* chore: setup git user for ci

* chore: setup git user for ci

* chore: cleanup logs from ci

* chore: upgrade to setup node v4

* rollback

* chore: rollback debug

* chore: fix test

* chore: improve tests

* chore: remove empty lines
  • Loading branch information
fwuensche authored Sep 7, 2024
1 parent a18ec6e commit a254986
Show file tree
Hide file tree
Showing 16 changed files with 3,318 additions and 4,834 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
env: {
node: true,
es2021: true,
jest: true,
},
extends: ['eslint:recommended', 'prettier'],
overrides: [],
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
ref: ${{ github.head_ref || github.ref_name }}

- name: Set up node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
Expand All @@ -39,12 +39,8 @@ jobs:
- name: Run lint
run: npm run lint

# - name: Run format
# run: |
# FILES=$(git diff --name-only --diff-filter=d origin/main... | grep "\.js$")
# if [ -n "$FILES" ]; then
# npx prettier --check $FILES
# fi
- name: Setup fixtures for tests
run: npm run test:setup

- name: Run tests
run: npm test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ node_modules
/vendor/bundle
latest.dump
results.json

# Ignore test fixtures
test/fixtures/fake-remote
test/fixtures/project-one
15 changes: 8 additions & 7 deletions bin/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ export default function (program) {
prompt.message = ''
prompt.start()

let projectName = await git.guessProjectName()
if (!projectName) {
projectName = await prompt.get({
properties: {
repo: { message: 'Enter your project name', required: true },
},
}).repo
const remoteUrl = await git.getRemoteUrl()
let projectName = git.guessProjectName(remoteUrl)

if (projectName === null) {
const { repo } = await prompt.get({
properties: { repo: { message: 'Enter your project name', required: true } },
})
projectName = repo
}
createConfigurationFile(projectName)

Expand Down
Loading

0 comments on commit a254986

Please sign in to comment.