I have an existing repository. I have cleared all the unwanted files as I wanted to start a new NX-integrated project. But, I want to continue using the same repository as there are some files which I would prefer to be present in the root directory.
If I run npx create-nx-workspace@latest --preset=next --packageManager=yarn
, it will ask a bunch of questions and create the project under the workspace name. I want the files to reside directly under the existing current directory rather than creating a new directory with the workspace name under the current directory.
For example, instead of
my-project
--nx-workspace-name
----package.json
----lib
I want the files to be under
my-project
--package.json
--lib
I went through all the create work space
flags but didn't find a relevant flag which could resolve this issue. At present, I copy all the files and place them in the root directory. Then, I delete the folder with the workspace name.
An example would be to use something like the --flat
flag while creating the NX react component which creates the files in the same directory without nesting the files under any new directory.
Is it possible to avoid this extra step?
I had the same issue and it seems create-nx-workspace command do not have any build-in flag to ignore hidden ".git" directory. I tried to use " --skipGit=true " flag but still it complains about hidden ".git" directory. What worked for me is to do things from scratch by using local git repo and then connecting it to remote git repo.
Steps:
cd my-org-repo
and run git remote add origin [your-git-repo-url]
git remote -v
. It should show something like origin [your-git-repo-url] (fetch)
origin [your-git-repo-url] (push)
git push --set-upstream origin main
. Replace main
with your branch name in case it's different
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.