wevm / vocs

Minimal Documentation Framework, powered by React + Vite.
https://vocs.dev
Other
1.04k stars 40 forks source link

BUG Missing Git Ignore #106

Open codingwithmanny opened 4 months ago

codingwithmanny commented 4 months ago

Context

Missing .gitignore when creating a new project.

Steps To Reproduce

pnpm create vocs;

# follow steps

Then take a look at the full directory.

tree .;

.
├── README.md
├── docs
│   └── pages
│       ├── example.mdx
│       ├── getting-started.mdx
│       └── index.mdx
├── package.json
├── tsconfig.json
└── vocs.config.ts

Solution

Include the .gitignore with ./create-vocs/templates/default/.gitignore

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# production
/docs/dist

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# typescript
*.tsbuildinfo
FaybianB commented 4 months ago

Hey @codingwithmanny @tmm, may I be assigned this issue?

dicethedev commented 4 months ago

@codingwithmanny is the issue assigned to somebody already?

codingwithmanny commented 4 months ago

Hi @FaybianB and @dicethedev just need @jxom or @tmm to assign it.

I wish I was a maintainer on this repo, but just a contributor 😂

dicethedev commented 4 months ago

Hi @FaybianB and @dicethedev just need @jxom or @tmm to assign it.

I wish I was a maintainer on this repo, but just a contributor 😂

No problem

jxom commented 4 months ago

First PR wins.

dicethedev commented 4 months ago

Missing .gitignore when creating a new project.

I made a PR - https://github.com/wevm/vocs/pull/111

FaybianB commented 4 months ago

Well, I lost the PR race (nice quickness @dicethedev) but I still would like to submit a solution. It seems like init.ts is copying all of the contents of the templates/default directory to the user's project except .gitignore. I think either copySync is ignoring hidden files or the hidden file is being removed immediately after.

However, I haven't gotten init.ts to reflect any of my changes to the file to test my theory. Any suggestions @jxom @tmm? I've ran the build after my changes via pnpm build and still nothing.

codingwithmanny commented 4 months ago

Hey @FaybianB, not sure if this will help but the way I was testing it to try and figure out was trying was running the script directory in the create-vocs folder.

# FROM: ./

pnpm build;
cd ./create-vocs;

Then run the built binary in the newly created _lib

# FROM: ./create-vocs

# Modify permissions
chmod +x ./_lib/bin.js;

# Run binary
./_lib/bin.js;

# [Expected Output]:
# ┌  Welcome to Vocs!
# │
# ◇  Enter the name of your project
# │  tmp
# │
# ◆  Project successfully scaffolded in /path/to/vocs/create-vocs/tmp!
# │
# │  Next steps:
# │
# ◇  1. cd ./tmp - Navigate to project
# │
# ◇  2. npm install - Install dependencies
# │
# ◇  3. npm run dev - Start dev server
# │
# ◇  4. Head to http://localhost:5173
# │
# └  Happy documenting! 📝

This will create that new tmp folder, but as you can see it showing the .gitignore which is where I left off 🤷

# FROM: ./create-vocs

tree tmp -a; 

# [Expected Output]:
# tmp
# ├── .gitignore <------ HUH????
# ├── README.md
# ├── docs
# │   └── pages
# │       ├── example.mdx
# │       ├── getting-started.mdx
# │       └── index.mdx
# ├── package.json
# ├── tsconfig.json
# └── vocs.config.ts
codingwithmanny commented 4 months ago

Missing .gitignore when creating a new project.

I made a PR - #111

How did you test that this worked?

FaybianB commented 4 months ago

@codingwithmanny You know, following your testing method works for me and I too see the .gitignore file present in the tree lol. I'm not sure where to go from here either, actually.

codingwithmanny commented 4 months ago

@FaybianB it's something to do with the bundling that goes to npm packages.

If you create a new folder and install create-vocs you can see it.

mkdir test-create-vocs;
cd test-create-vocs;
pnpm init;
pnpm add create-vocs;

Then tree the directory and you'll see that the .gitignore isn't present:

# FROM: test-create-vocs;

tree node_modules/create-vocs/templates/default -a;

# [Expected Output]:
# node_modules/create-vocs/templates/default
# ├── README.md
# ├── docs
# │   └── pages
# │       ├── example.mdx
# │       ├── getting-started.mdx
# │       └── index.mdx
# ├── package.json
# ├── tsconfig.json
# └── vocs.config.ts

I suspect it has to do with a script in the ./scripts folder.

Hopefully that would help with a direction.

codingwithmanny commented 4 months ago

Ended up figuring it out @FaybianB see PR

sarthakxv commented 4 months ago

@codingwithmanny I was figuring out the fix, but just saw that you've already made a PR. Happy to see a solution.