Comments (9)
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.
@CVarisco see updated explanation, it was a mess before sorry!
from create-component-app.
@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.
See #27 👍
My first contrib to anything opensourced 🔥 🚀 😄
from create-component-app.
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.
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.
So, the problem is the naming of the file after the choice of component name?
from create-component-app.
@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.
@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)
- Does not process files in template subdirectories HOT 1
- Ability to create a component without creating it's parent directory? HOT 6
- Support for TypeScript components HOT 2
- import styles from './undefined.css' HOT 3
- Does not work with no config or example configs HOT 5
- Change file naming format for tests HOT 5
- there's no `--path` param HOT 2
- Proposal: Searching for config file from `.` to `/` HOT 1
- [Error] Cannot convert undefined or null to object HOT 1
- Proposal: Do you want semicolons ? HOT 4
- Proposal: Make create-component-app usable from other apps
- Proposal: Create a tree components configuration object
- Extraneous`null` emitted HOT 2
- Proposal: componentMethods option - unintuitive behavior HOT 2
- support for typescript HOT 3
- Template Creation Docs Are Unclear HOT 2
- Control Case Of Template Name HOT 1
- Proposal: Alter the default path in a template HOT 1
- Proposal - add support for .ts and .tsx extensions HOT 3
- No config file detected HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from create-component-app.