https://github.com/chinanf-boy/path-run
rewrite And change project Path require|from 更改项目文件-被其他文件导入的所在位置 ✅
https://github.com/chinanf-boy/path-run
abs-path change cli from path require
Last synced: about 2 months ago
JSON representation
rewrite And change project Path require|from 更改项目文件-被其他文件导入的所在位置 ✅
- Host: GitHub
- URL: https://github.com/chinanf-boy/path-run
- Owner: chinanf-boy
- License: mit
- Created: 2018-04-30T10:09:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T08:08:07.000Z (over 6 years ago)
- Last Synced: 2025-03-18T11:13:00.079Z (2 months ago)
- Topics: abs-path, change, cli, from, path, require
- Language: JavaScript
- Homepage:
- Size: 2.48 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.en.md
- License: license
Awesome Lists containing this project
README
# path-run[](https://travis-ci.org/chinanf-boy/Path-run) [](https://codecov.io/gh/chinanf-boy/Path-run?branch=master) [](https://github.com/chinanf-boy/path-run-explain)
> Esay change you require paths now
[Chinese](./readme.md)\|[English](./readme.en.md)
If you change the location of a file, then the corresponding file modification of other files is a problem.
You can try`path-run`, change your file location is not so manual
## Install
npm install --global path-run
## Correct use of -cli
1. Copy files to destination
- demo
- index.js
- input
- input1.js
- input2.js
- output
- output1.js
- output2.js- demo
- index.js
- input
- ✂️input1.js // <===== copy to output
- input2.js
- output
- ➕output3.js // <===== from input/input1.js
- output1.js
- output2.js2. Running`Cli`
```bash
path-run demo/input/input1.js demo/output/output3.js
# path-run [input] [output]
```1⃣️`Process.cwd()`All references below`Input`The path will become`Output`
2⃣️ `Output` file , inside `require/import` file path change right relative path3. Remove`Input1.js`
- demo
- index.js
- input
<===== ✂️cut
- input2.js
- output
- output3.js // <===== from input/input1.js
- output1.js
- output2.js[real-project transltemds](https://github.com/chinanf-boy/translate-mds/commit/af88620139276479a86185c731f4862ec54a54e4)
cli demo

inpath with outpath diff

other require file diff

* * *
## Warnning⚠️ , `path-run` do not change `package.json` main or bin string, pleace rechange yourself
---
## Api
### Pathrun({options})
#### Options
##### 1. InPath
Type:`String`
Abs path
##### 2. OutPath
Type:`String`
Abs path
##### 3. cwd
Type:`String`
Default :`Process.cwd()`
##### return
Type: `Array`
`Array[i]` like this
``` js
const options = {
files: 'path/to/file',
from: /foo/g,
to: 'bar',
};
```by `replace-in-file` use
https://github.com/adamreisnz/replace-in-file
## Cli
npm install --global path-run
esay change you require paths Now
Usage
$ path-run [input] [output]Options
input 「want to change」
output [turn on ]Examples
$ path-run './index' './lib/index'will change all process.cwd()/* files require Path 'index' => './lib/index'
## concat
[nodepaths](https://github.com/chinanf-boy/NodePath) js module map
## License
Mit ©[Chinanf-boy](http://llever.com)