An open API service indexing awesome lists of open source software.

https://github.com/yasshi2525/export-gitproject

copy and replace current git project with custom rules for exporting another git project.
https://github.com/yasshi2525/export-gitproject

git

Last synced: 2 months ago
JSON representation

copy and replace current git project with custom rules for exporting another git project.

Awesome Lists containing this project

README

          

# export-gitproject

既存の Git プロジェクトを別のプロジェクトとしてエクスポートします。
ファイルを別のファイルで置き換えたり、一部のファイルを除外してエクスポートできます。

## 使い方

```bash
export-gitproject [--config=] [--cwd=]
```

| オプション名 | 必須か | 値の例 | 省略時のデフォルト値 | 説明 |
| --------------- | ------ | -------------------- | ------------------------ | --------------------------------------------- |
| `--config`,`-c` | No | `custom.config.json` | `export-gitproject.json` | 設定ファイルのパスを指定します |
| `--cwd`,`-d` | No | `other_project` | `.` | 出力対象の Git プロジェクトディレクトリのパス |

### 設定ファイル

本コマンドの実行には設定ファイル `./export-gitproject.json` が必要です。
設定ファイルのパスはコマンドオプション `--config`,`-c` で変更できます。

`./export-gitproject.json` の例

```json
{
"copy": {
"exclude": ["replace"]
},
"replace": [
{
"from": "replace/overwritten_by",
"to": "replace/original"
}
]
}
```

| パラメタ | 必須か | 値の例 | 省略時のデフォルト値 | 説明 |
| -------------------------- | ------ | ---------------- | -------------------- | ---------------------------------------------------------------------- |
| `out` | No | `"dest"` | `"out"` | エクスポート先のパス |
| `copy.exclude` | No | `["lib"]` | `[]` | エクスポートしないパターン |
| `replace` | No | | `[]` | ファイルを置き換えるルール |
| `replace[].from` | Yes | `"dummy-images"` | - | `to`ディレクトリはこのディレクトリに置き換えられます |
| `replace[].to` | Yes | `"images"` | - | このディレクトリは`from`ディレクトリに置き換えられます |
| `replace[].errorOnUnmatch` | No | `true` | `false` | `from`と`to`ディレクトリのファイル構成に差があった場合にエラーとするか |

`copy.exclude` は `.gitignore` で指定可能なパターンを指定できます。
なお、設定によらず `.git`, `.gitignore` にマッチするファイル, 設定ファイル はエクスポートされません。

なお、設定ファイルの JSON スキーマは[こちら](https://raw.githubusercontent.com/yasshi2525/export-gitproject/main/config.schema.json)で公開しています。

# License

MIT License

# Author

yasshi2525 [X](https://x.com/yasshi2525)