Git Product home page Git Product logo

Comments (7)

nicolas-brousse avatar nicolas-brousse commented on August 15, 2024 1

How to reproduce the bug

$ rails new demo-app --webpack
$ cd demo-app
$ echo "gem 'komponent'" >> Gemfile
$ bundle
$ rails generate komponent:install
$ rails generate component container
$ rails generate component button

After what I got this inside frontend/components/index.js:

import "components/button/button";
import "components/container/container";

Ok, now I convert double to single quotes inside this file, then I generate a new component rails generate component form.

And frontend/components/index.js now contain:

import "components/form/form";

My two previous components are absent from index.js now.

from komponent.

Spone avatar Spone commented on August 15, 2024 1

Thanks for the instructions, it will help!

from komponent.

nicolas-brousse avatar nicolas-brousse commented on August 15, 2024 1

I think to start it's not really a problem to continue adding new component with double quotes. The main think is to not remove previous added components :)

from komponent.

Spone avatar Spone commented on August 15, 2024 1

Okay, let's merge this fix for now, and we may improve this later.

from komponent.

nicolas-brousse avatar nicolas-brousse commented on August 15, 2024

Maybe the error is due to sort_lines_alphabetically!(path) and not import_to_packs.

from komponent.

Spone avatar Spone commented on August 15, 2024

I think you're right. Can you try modifying the regex from this line?

We would need /^import ["'](.*)["'];$/ to support simple quotes.

from komponent.

Spone avatar Spone commented on August 15, 2024

I added a failing test case here: #101
and pushed this commit 086be84 to fix the issue.

But I'm not sure what behavior we want... Should we rewrite the whole index file with single or double quotes? How do we check what is the expected syntax for the current project?

from komponent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.