create-vuepress-site icon indicating copy to clipboard operation
create-vuepress-site copied to clipboard

Improve handling of repo on new app

Open MichaelCurrin opened this issue 4 years ago • 5 comments
trafficstars

Hi

I ran the command to setup an app.

I was confused by the repo argument, in how it appears in the interactive CLI and how it gets used.

Suggestions:

  • There could be improved in the CLI help for clarity.
  • A fix might be needed for where the value gets used.
  • I don't think the value is so useful - it could be removed entirely from CLI questions and from the template where it gets used. Repository is useful if you are listing your package on NPM and want to link to GitHub. I hardly see that being the case for a VuePress site, which is a docs site that you don't expect anyone to find on NPM and install with npm i.

MichaelCurrin avatar Mar 28 '21 14:03 MichaelCurrin

I was confused at this line, because it didn't give any example.

lib/generators/blog/index.js

What's the repo of your project?

It made me wonder - should I enter my-app, or my-user/my-app or https://github.com/my-user/my-app?

So help text would be nice. Like example value on the right or greyed out.

MichaelCurrin avatar Mar 28 '21 14:03 MichaelCurrin

On further inspection, I see the value actually gets used here in the template: lib/generators/blog/templates/package.json

"<%= repo %>/<%= name %>"

Based on working with package.json, I'd expect the finished value to be like:

{
  "repository": "https://github.com/my-user/my-app"
}

I left it blank.

Which then gave me a result like this with a forward slash

{
  "repository": "/my-app"
}

So leaving out repo seems to get weird behavior.

And if I entered https://github.com/my-user/my-app in the CLI, then I got bad URL:

{
  "repository": "https://github.com/my-user/my-app/my-app",
}

So that looks like a bug.


What I would expect is that the app should ask for "Repo URL" so there is no confusion. e.g. "https://github.com/my-user/my-app".

And then that whole value should appear in the result.

Which means a code change. Maybe even name the variable repoUrl instead of repo.

-  "repository": "<%= repo %>/<%= name %>"
+  "repository": "<%= repo %>"

Or ask the user for path to their GitHub account (not their repo)- e.g.

GitHub user URL: https://github.com/my-user

Then this makes sense with a rename.

-  "repository": "<%= repo %>/<%= name %>"
+  "repository": "<%= userUrl %>/<%= name %>"

Or leave out repo as a question and output field altogether.

MichaelCurrin avatar Mar 28 '21 14:03 MichaelCurrin

Any way to solve this issue? I get a really wierd message creating my vuepress project.

C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\mem-fs-editor\node_modules\mkdirp\lib\path-arg.js:20 throw Object.assign(new Error('Illegal characters in path.'), { ^

Error: Illegal characters in path. at pathArg (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\mem-fs-editor\node_modules\mkdirp\lib\path-arg.js:20:27) at Function.mkdirpSync [as sync] (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\mem-fs-editor\node_modules\mkdirp\index.js:18:10) at write (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\mem-fs-editor\lib\actions\commit.js:12:12) at DestroyableTransform._transform (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\mem-fs-editor\lib\actions\commit.js:49:7) at DestroyableTransform.Transform._read (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\readable-stream\lib_stream_transform.js:177:10) at DestroyableTransform.Transform._write (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\readable-stream\lib_stream_transform.js:164:83) at doWrite (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\readable-stream\lib_stream_writable.js:409:139) at writeOrBuffer (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\readable-stream\lib_stream_writable.js:398:5) at DestroyableTransform.Writable.write (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\readable-stream\lib_stream_writable.js:307:11) at DestroyableTransform.ondata (C:\Users\JRIVERA\AppData\Roaming\npm-cache_npx\11860\node_modules\create-vuepress-site\node_modules\readable-stream\lib_stream_readable.js:681:20) { path: 'C:\wamp64\www\c:\wamp64\www\tasker-docs\docs', code: 'EINVAL' }

this jumps even when I leave the question blank, or typing something. I was following this guide vuepress, also bad documentation by the way. Maybe a little guide for what or how use the tool will it be nice.

snithfferx avatar Aug 09 '22 16:08 snithfferx

This issue was created as general improvement of code and documentation. You have a very specific error, possibly specific to your OS or the fields you are entering. Perhaps you can make an new issue instead and link it here. Also it might get more attention that way, as this issue from 2021 hasn't had activity otherwise.

MichaelCurrin avatar Aug 22 '22 13:08 MichaelCurrin

I don't know why, but, this error only jumps in my home computer, at work all go with shining colors. Maybe is something in my setup. Sorry for post it here, I think the project was alive, and the issue also. Thank you for the reply, hope the project goes very fine. I love the simplicity of the deployment (as is at my work). Regards.

snithfferx avatar Aug 23 '22 04:08 snithfferx