infinitered / gluegun

A delightful toolkit for building TypeScript-powered command-line apps.
MIT License
2.93k stars 147 forks source link

Windows still not working after 5.0.0 #751

Open ImmaZoni opened 2 years ago

ImmaZoni commented 2 years ago

Hello! First off, great project thank you for building out this wonderful utility!

I saw that this issue was mentioned here https://github.com/infinitered/gluegun/issues/737 and was closed and supposedly fixed win version 5.0.0. I am running version 5.0.0 and having trouble.

System

Windows 10 - 10.0.19042 Node - 16.13.2 Gluegun - 5.0.0 image

Note: I use NVM and have done my best to ensure yarn is properly installed for each version and it isnt a path issue with yarn or something like that, but please im open to suggestions.

I have provided screenshots and a direct text log of my terminal when attempting to create an example project.

Example

image

Log

PS C:\Users\Justin> npx gluegun new example
Need to install the following packages:
  gluegun
Ok to proceed? (y) y

√ Which language would you like to use? · TypeScript - Gives you a build pipeline out of the box (default)
Language used: TypeScript
warning jest > @jest/core > jest-haste-map > sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning jest > @jest/core > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[########################################################################################################################################################################################################################################################] 1230/1230 
yarn run v1.22.17
$ eslint "**/*.{js,jsx,ts,tsx}" --fix && prettier "**/*.{js,jsx,ts,tsx,json}" --write
=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0

YOUR TYPESCRIPT VERSION: 4.5.5

Please only submit bug reports when using the officially supported version.

=============
__tests__\cli-integration.test.ts 50ms
.eslintrc.js 19ms
package.json 10ms
src\cli.ts 16ms
src\commands\example.ts 13ms
src\commands\generate.ts 11ms
src\extensions\cli-extension.ts 13ms
src\types.ts 3ms
tsconfig.json 6ms
Done in 15.08s.

Generated example CLI with Gluegun 5.0.0.
Using TypeScript
  $ cd example
  $ yarn test
  $ yarn link
  $ example

Since you generated a TypeScript project, we've included a build script.
When you link and run the project, it will use ts-node locally to test.
However, you can test the generated JavaScript locally like this:

  $ yarn build
  $ example --compiled-build

npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.4.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.4.0
npm notice
PS C:\Users\Justin> cd example
PS C:\Users\Justin\example> yarn test
yarn run v1.22.17
ts-jest[config] (WARN) Got `sourceMap: false` from tsconfig file "C:/Users/Justin/example/tsconfig.json". This will disable source map support in ts-jest 27. Please set `sourceMap: true` in your tsconfig file "C:/Users/Justin/example/tsconfig.json" if you want 
to keep source map support on
 PASS  __tests__/cli-integration.test.ts (12.047 s)
  √ outputs version (2243 ms)
  √ outputs help (1710 ms)
  √ generates file (1762 ms)

Tests:       3 passed, 3 total
Snapshots:   0 total
Time:        12.871 s
Ran all test suites.
Done in 20.34s.
PS C:\Users\Justin\example> yarn link
yarn link v1.22.17
success Registered "example".
info You can now run `yarn link "example"` in the projects where you want to use this package and it will be used instead.
PS C:\Users\Justin\example> example
At line:1 char:1
+ example
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (example:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\Justin\example> yarn build
$ yarn clean-build && yarn compile && yarn copy-templates
$ rm -rf ./build
'rm' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
jamonholmgren commented 2 years ago

@ImmaZoni Thanks so much for the kind words! Glad you're using Gluegun.

It looks like we're using rm -rf instead of rimraf on the generated CLIs. Just needs to be updated to that.

https://github.com/infinitered/gluegun/blob/fa720a853c98fa21a3ad2f3facf9efa5d528046e/src/cli/templates/cli/package.json.ejs#L14

Not sure about the original error, though.

ImmaZoni commented 2 years ago

@ImmaZoni Thanks so much for the kind words! Glad you're using Gluegun.

It looks like we're using rm -rf instead of rimraf on the generated CLIs. Just needs to be updated to that.

https://github.com/infinitered/gluegun/blob/fa720a853c98fa21a3ad2f3facf9efa5d528046e/src/cli/templates/cli/package.json.ejs#L14

Not sure about the original error, though.

Thank you for the reply, I will give that a shot!

As for the other issue, im pretty sure it has to do with Yarn/NVM/Symlinks & of course Windows. (likely not a gluegun issue from my testing, feel free to disregard that portion)

jamonholmgren commented 2 years ago

Awesome @ImmaZoni. Just let me know when you have a PR queued up on this.

rossi-p commented 1 year ago

I was having the same issue here.

Windows 10 Node - 18.12.0 Gluegun - 5.1.2

Using yarn(v1.16.0) i got this error: image

Using npm(v8.12.2) instead of yarn it worked. Uninstall ts-node using npm, than install it again with npm. image

After that use npm link, and it works. image

image