ts-migrate
ts-migrate copied to clipboard
Always prompt [ Must provide a command ], no matter how I call the command
1.My environment:
Windows10
WebStorm2020.2.2
npm 6.13.4
node.js 12.16.1
ts-migrate 0.1.6
2.Error report & log
Administrator@TIONGEDESKTOP MINGW64 /d/Program_Files/JetBrains_ToolBox/projects/WebStorm/use-on-demand (master)
$ ts-migrate -- init aaa
Usage: npm run ts-migrate -- <command> [options]
Commands:
npm run ts-migrate -- init <folder> Initialize tsconfig.json file in
<folder>
npm run ts-migrate -- init:extended Initialize tsconfig.json file in
<folder> <folder>
npm run ts-migrate -- rename <folder> Rename files in folder from JS/JSX
to TS/TSX
npm run ts-migrate -- migrate <folder> Fix TypeScript errors, using
codemods
npm run ts-migrate -- reignore <folder> Re-run ts-ignore on a project
Options:
-h, --help Show help [boolean]
Examples:
npm run ts-migrate -- --help Show help
npm run ts-migrate -- init frontend/foo Create tsconfig.json file at
frontend/foo/tsconfig.json
npm run ts-migrate -- init:extended Create extended from the base
frontend/foo tsconfig.json file at
frontend/foo/tsconfig.json
npm run ts-migrate -- rename Rename files in frontend/foo from
frontend/foo JS/JSX to TS/TSX
Must provide a command.
3.Other Info
$ npm run ts-migrate -- migrate "./"
npm ERR! missing script: ts-migrate
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-09-28T03_56_16_853Z-debug.log
I did not manually add the [ts-migrate] script, because the [Repo Document] did not say to do so.
4._
Try npx ts-migrate init aaa
instead.
Any update on that? I'm stuck with the same message and not able to use the tool. Not sure how init
would help, but also I don't really want to use init command.
Use npx ts-migrate rename . --sources="path/to/folder/**/*"
or
Use npx ts-migrate migrate . --sources="path/to/folder/**/*"
You get the idea. .
defines that the current folder is my project folder.
Use
npx ts-migrate rename . --sources="path/to/folder/**/*"
or Usenpx ts-migrate migrate . --sources="path/to/folder/**/*"
You get the idea.
.
defines that the current folder is my project folder.
I was having an issue with running ts-migrate
via npx
like so: npx ts-migrate -- rename .
, like it is documented in Github, but turns out --
is what was breaking for me. The above commands without --
worked for me.
https://docs.npmjs.com/cli/v7/commands/npx
npm exec -- <pkg>[@<version>] [args...]
npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
npm exec -c '<cmd> [args...]'
npm exec --package=foo -c '<cmd> [args...]'
npx <pkg>[@<specifier>] [args...]
npx -p <pkg>[@<specifier>] <cmd> [args...]
npx -c '<cmd> [args...]'
npx -p <pkg>[@<specifier>] -c '<cmd> [args...]'
--
should not be used in npx
.
The help displayed by ts-config
is terrible and misleading.
Obviously, running npm run ts-migrate
won't work also -- init <folder>
or -- migrate <folder>
suggests you must include two dash signs and space 😕 That's not going to work either.
Solution:
Use npx ts-migrate init <folder>
or npx ts-migrate migrate <folder>
, i.e. general format is: ts-migrate <command> <args>
where the command
is init
, rename
, migrate
etc.
Please update help displayed!
In addition to the above, the docs should be revisited wrt ts-migrate-full
, as that package does not seem to exist.
$ npx ts-migrate-full .
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/ts-migrate-full - Not found
npm ERR! 404
npm ERR! 404 'ts-migrate-full@latest' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.