使用NPM重命名文件 [英] Rename file with NPM

查看:237
本文介绍了使用NPM重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在npm脚本中重命名单个文件?我想准备要分发的文件,但是我需要建立的文件的命名方式与它们在源代码中的不同...

Is there a way to rename a single file in npm scripts? I want to prepare files for distribution, but I need the built files to be named differently than they are in the source...

我试过orn,但只有似乎在命令行上工作,而不是作为npm脚本。我特别想要添加一个跨平台依赖项来完成我的项目,而不是编写我自己的javascript脚本来复制文件。

I have tried orn, but that only seems to work on the command line, not as an npm script. I'm specifically looking to just add a cross-platform dependency to do my project, rather than writing my own javascript script to copy files over.

我的理想解决方案是我可以在 package.json 中包含一行命令,例如重命名old-file-name new-file-name

My ideal solution is something I can include in the package.json, as a one line command, e.g. rename old-file-name new-file-name

推荐答案

转动在npm库中 cash 提供了几个基本的命令行实用程序,可以作为单行命令运行一个package.json。对于重命名,您可以使用子包 cash-mv 重命名特定文件。

Turns out the npm library cash offers several basic command line utilities that can be run as a single line command from a package.json. For renaming, you can use the sub-package cash-mv to rename a specific file.

这篇关于使用NPM重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆