Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(add): strip .ts and .vue extension from name #345

Merged
merged 5 commits into from
Mar 18, 2024

Conversation

shinGangan
Copy link
Contributor

@shinGangan shinGangan commented Feb 20, 2024

πŸ”— Linked issue

closed #175 .

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Fixed nuxi add command to check arg.name extension.

❯ npx nuxi add component blog/BlogFeeds.vue
β„Ή πŸͺ„ Generated a new component in /Users/k/vc/web/components/blog/BlogFeeds.vue
❯ npx nuxi add component blog/BlogFeeds
β„Ή πŸͺ„ Generated a new component in /Users/k/vc/web/components/blog/BlogFeeds.vue
❯ npx nuxi add component Modal/index
β„Ή πŸͺ„ Generated a new component in /Users/k/vc/web/components/Modal/index.vue
  • Non Implementation 1: use of endsWith
  • Non implementation 2: Checking for anything other than .ts, .vue
    • Users who want to use nuxi add command often want to generate .vue or .ts files.

    • If the number of extensions to be checked increases, the following is also acceptable

      const exts = ['.ts', '.vue']
      function checkExt(name: string) {
        for (let i=0; i < exts.length; i++) {
          if(name.endsWith(exts[i])) {
            return name.replace(f, '')
          }
        }
        return name
      }
      
      /***/
      const name = checkExt(ctx.args.name)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@shinGangan shinGangan changed the title refactor(add): check the arg.name extensions refactor(add): check the arg.name extensions (#345) Feb 20, 2024
package.json Outdated Show resolved Hide resolved
@shinGangan
Copy link
Contributor Author

shinGangan commented Feb 20, 2024

Hi @pi0 . πŸ™

The review has a low priority. Please review when you have a time.
Thank you for your reviews everytime. πŸ™

@shinGangan shinGangan changed the title refactor(add): check the arg.name extensions (#345) refactor(add): check the arg.name extensions Mar 9, 2024
src/commands/add.ts Outdated Show resolved Hide resolved
@shinGangan shinGangan mentioned this pull request Mar 10, 2024
9 tasks
@pi0 pi0 changed the title refactor(add): check the arg.name extensions refactor(add): strip .ts and .vue extension Mar 18, 2024
@pi0 pi0 changed the title refactor(add): strip .ts and .vue extension refactor(add): strip .ts and .vue extension from name Mar 18, 2024
@pi0 pi0 merged commit 01418e5 into nuxt:main Mar 18, 2024
2 checks passed
@shinGangan shinGangan deleted the refactor/175 branch March 19, 2024 03:44
@shinGangan
Copy link
Contributor Author

@pi0 , thanks for support for me πŸ™

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.

make nuxi add detect and accomodate extensions
2 participants