Giter Site home page Giter Site logo

Comments (9)

CVarisco avatar CVarisco commented on May 18, 2024 1

Hi @nealoke !

Thanks a lot for your feedback 🙂
Could you explain much better what is the problem and what are you doing? 🌴

from create-component-app.

nealoke avatar nealoke commented on May 18, 2024 1

@CVarisco see updated explanation, it was a mess before sorry!

from create-component-app.

CVarisco avatar CVarisco commented on May 18, 2024 1

@nealoke Thanks a lot for your information!

There is a bug on the copy of the templates files to the destination folder.
I will investigate in these days to fix as soon as possible the bug.
(If you want to contribute, you are welcome 🌮 )

But for clarification, the path value on config file should be components without / because the destination folder when the script start is ${path}/ files.js:84

from create-component-app.

nealoke avatar nealoke commented on May 18, 2024 1

See #27 👍

My first contrib to anything opensourced 🔥 🚀 😄

from create-component-app.

CVarisco avatar CVarisco commented on May 18, 2024 1

Woooooo 🔝 🎉

I'm very happy for you 🙂 !
I hope that my project will be the first of a lot of others 🥇

I published a new version (v0.8.5) on NPM with your fix!
Thanks again and have a nice day 👓

from create-component-app.

nealoke avatar nealoke commented on May 18, 2024

Waaw that was fast 😄

Basically I'm trying to create my own templates for all possible files (eg styles, stories, tests, index and componentName.js)

I'm using the following config.json which is working just fine for the styles.scss, index.js and componentName.js. However it is not using or copying the componentName.spec.js and componentName.stories.js for some reason.

My config.json file

{
  "type": "custom",
  "templatesPath": "ccarc/templates",
  "path": "components/"
}

Template folder (ccarc/templates)

  • index.js
  • template.js
  • COMPONENT_NAME.styles.scss
  • COMPONENT_NAME.spec.js
  • COMPONENT_NAME.stories.js

Expected output

  • index.js
  • componentName.styles.scss
  • componentName.js
  • componentName.spec.js
  • componentName.stories.js

Actual output

  • index.js
  • styles.scss
  • componentName.js

from create-component-app.

CVarisco avatar CVarisco commented on May 18, 2024

So, the problem is the naming of the file after the choice of component name?

from create-component-app.

nealoke avatar nealoke commented on May 18, 2024

@CVarisco Thank you so very much for this tool and for looking into it :)

I will have a look but I really am not familiar with contributing to projects 😢 . I've stripped the / from the path now.

Also be aware that the componentName.styles.scss is also renamed to simply styles.scss.

from create-component-app.

nealoke avatar nealoke commented on May 18, 2024

@CVarisco I've figured out where it is going wrong, you mind pushing this to NPM?

The issue lies in the generateFileName function.

Current

function generateFileName(newFilePath, newFileName, fileName) {
  // Suppose that the index file don't be renamed
  if (fileName.indexOf('index') !== -1) {
    return fileName
  }

  if (fs.existsSync(newFilePath)) {
    return fileName
  }

  return newFileName
}

So this does not replace the COMPONENT_NAME in the fileName. A simple if statement solves the issue :)

Fixed

function generateFileName(newFilePath, newFileName, fileName) {
  // Suppose that the index file don't be renamed
  if (fileName.indexOf('index') !== -1) {
    return fileName
  }

  if (fs.existsSync(newFilePath)) {
    return fileName
  }

  if (fileName.includes('COMPONENT_NAME')) {
    return fileName.replace(/COMPONENT_NAME/g, newFileName)
  }

  return newFileName
}


from create-component-app.

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.