NPM cra-template not copying folder structure - npm

I'm trying to create my first cra-template on NPM and for some weird reason when I try my template locally using the file:./cra-template-[mytemplate] everything copy overs without problem. When I publish it and try using the npx create-react-app my-project --template [mytemplate] all files are being installed but not folder structure. What am I doing wrong?
My Folder structure goes like that :
template
|
|--src
|
|--api
|--components
ect..
Thank you for the help

Ok so I figured it out. You need to actually put a file inside the folder, .gitkeep as an example. If you don’t github is not going to create an empty folder and so when you are going to pull your template all files are going to be there but no folder.

Related

Powershell files created outside of node_modules

Up until yesterday, whenever I installed a package (e.g. nodemon), they would be added to the node_modules dir. This morning, when I installed a bigger project, the powershell and cmd files were saved outside of that directory, in addition to a file without an extension. It looked like this:
dependencies
Why is example, example.cmd and example.ps1 saved outside of node_modules?
I would like to answer my own question. I had accidentally messed around with the npm prefix. If this happens to you, go to the cmd prompt and type npm set prefix C:/bin and you should be alright :)

How to change src code of Vue in node_modules for testing

I am using Vue 2 (doesn't really matter which version exactly).
I want to test some things that happen behind the hood in Vue. So I decided to add console.log('test123') in Vue's files in node_modules. It turns out that the console log never fires. I put that in all files of Vue in node_modules, even in all files of dist's folder of Vue.
How can I achieve this ? If I fork the repo, then I'd have to upload new versions each time on my repo and then run npm install. I know that will work but wanted to achieve this without forking.
Any ideas what I am missing ?
there are many ways .. but i feel more comfortable using this method :
you can download any npm package in a seperated folder next to your project...
open the folder of the package then run this in the terminal:
npm link
then open the project folder and run
npm link ../package-path # link the dir of your dependency
References
npm-link
How to test an npm package locally

Vue.js - Reverse back after npm run build

I have made a website with Vue.js and i have npm run build it. After that it will create a dist folder that contain your CSS, image, JavaScript, index.html and so on. But now i have lost my project folder and have only the dist folder.
How can i convert it back to before i have use npm run build ?
You can't. It's like trying to split a cake back to ingredients.
I mean you can if you have connected it to git and just undo changes from source control

Vue CLI not building subdirectory

I believe I have a webpack configuration change that needs to be made by creating a vue.config file? Some guidance is appreciated.
I have this directory structure
src/assets/backgrounds/desktop
src/assets/backgrounds/mobile
src/assets/backgrounds/
src/assets/flags/
src/assets/fonts/
src/assets/logo/
src/assets/sounds/
My issue is that when I run
npm run build (vue-cli-service build)
The build doesn't create the subdirectories in the backgrounds folder.
src/assets/backgrounds/desktop
src/assets/backgrounds/mobile
I end up with a dist folder like so.
dist/css/
dist/img/
dist/js/
dist/media/
dist/
I was expecting
dist/img/desktop/
dist/img/mobile/
Any help is appreciated, thank you.
As said in the folowing documentation, static assets have to be put in /public folder:
https://cli.vuejs.org/guide/html-and-static-assets.html#static-assets-handling
In your case:
public/img/desktop/
public/img/mobile/

react-native init in current folder

I have a folder setup with some files I already want to have in the folder. I want to be able to run
react-native init PROJECTNAME
and instead of creating a folder PROJECTNAME it would init a react-native project in the folder I am currently in.
Is this possible?
Currently, I have my setup already created from previous projects that I enjoy using (packages.json, config files, etc). I delete the node_modules, and then react-native init PROJECTNAME. Then I take the PROJECTNAME/ios PROJECTNAME/android folders generated within that folder, move them into the main project folder and it works pretty smoothly. Just not optimal.
You can do
$ cd .. && react-native init folder_name
It will overwrite your package.json but keep the non-default files.
This issue is currently tracked there.
You should have install react-native-cli instead of react-native globally as described here.
And then the command is:
npx react-native-cli init appname --directory ./appPathToDir
The reason I wanted to do this was to have a sort of mono-repo, but I have transitioned away from this approach as I am not sure it is beneficial.
expo init /.
this will create expo app in current directory using the folder name