@9of9solutions/replikator 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -65
- package/main.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,93 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Replikator
|
|
2
2
|
|
|
3
|
+
Replikator is a command-line tool designed to share and synchronize code between multiple applications in a monorepo. It enables you to maintain shared code in a single source directory and automatically replicate it to multiple target applications, keeping everything in sync.
|
|
3
4
|
|
|
5
|
+
## Features
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
- **Code Sharing**: Maintain shared TypeScript/JavaScript code in one location and replicate it to multiple applications.
|
|
8
|
+
- **Real-time Synchronization**: Automatically sync changes to shared code across all target applications.
|
|
9
|
+
- **File Watching**: Continuously monitor source files and instantly propagate changes to all targets.
|
|
10
|
+
- **Selective Inclusion**: Specify which directories and files should be replicated to each target application.
|
|
11
|
+
- **Read-only Protection**: Replicated files are marked as read-only with clear headers indicating their source.
|
|
12
|
+
- **Monorepo Support**: Works seamlessly with monorepos and includes special support for Turborepo.
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
-
|
|
11
|
-
## Add your files
|
|
14
|
+
## Installation
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
16
|
+
To install Replikator, ensure you have Node.js installed, then run:
|
|
15
17
|
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @9of9solutions/replikator
|
|
16
20
|
```
|
|
17
|
-
cd existing_repo
|
|
18
|
-
git remote add origin https://gitlab.com/9-of-9-solutions/replikator.git
|
|
19
|
-
git branch -M main
|
|
20
|
-
git push -uf origin main
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Integrate with your tools
|
|
24
|
-
|
|
25
|
-
- [ ] [Set up project integrations](https://gitlab.com/9-of-9-solutions/replikator/-/settings/integrations)
|
|
26
|
-
|
|
27
|
-
## Collaborate with your team
|
|
28
|
-
|
|
29
|
-
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
|
30
|
-
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
|
31
|
-
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
|
32
|
-
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
|
33
|
-
- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
34
|
-
|
|
35
|
-
## Test and Deploy
|
|
36
21
|
|
|
37
|
-
|
|
22
|
+
## Usage
|
|
38
23
|
|
|
39
|
-
|
|
40
|
-
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
|
41
|
-
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
|
42
|
-
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
|
43
|
-
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
|
24
|
+
Replikator provides the following commands:
|
|
44
25
|
|
|
45
|
-
|
|
26
|
+
- **rpk init**: Initialize Replikator configuration for your project.
|
|
27
|
+
- **rpk run**: Start the file watcher and synchronization process.
|
|
28
|
+
- **rpk include**: Specify which directories should be included in the replication.
|
|
29
|
+
- **rpk update**: Update the Replikator tool.
|
|
46
30
|
|
|
47
|
-
|
|
31
|
+
To set up Replikator:
|
|
48
32
|
|
|
49
|
-
|
|
33
|
+
```bash
|
|
34
|
+
# Initialize configuration
|
|
35
|
+
rpk init
|
|
50
36
|
|
|
51
|
-
|
|
37
|
+
# Select files to include
|
|
38
|
+
rpk include
|
|
52
39
|
|
|
53
|
-
|
|
40
|
+
# Start synchronization
|
|
41
|
+
rpk run
|
|
42
|
+
```
|
|
54
43
|
|
|
55
|
-
##
|
|
56
|
-
Choose a self-explaining name for your project.
|
|
44
|
+
## Development
|
|
57
45
|
|
|
58
|
-
|
|
59
|
-
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
46
|
+
For development purposes, you can use the following script in target applications:
|
|
60
47
|
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
```bash
|
|
49
|
+
npm run dev
|
|
50
|
+
```
|
|
63
51
|
|
|
64
|
-
|
|
65
|
-
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
52
|
+
This will navigate to the parent directory and execute the `rpk run` command.
|
|
66
53
|
|
|
67
|
-
##
|
|
68
|
-
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
54
|
+
## Dependencies
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
56
|
+
Replikator relies on several key dependencies:
|
|
72
57
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
58
|
+
- **commander**: For command-line interfaces.
|
|
59
|
+
- **chokidar**: For file watching and event handling.
|
|
60
|
+
- **fs-extra**: For enhanced file system operations.
|
|
61
|
+
- **inquirer**: For interactive command-line prompts.
|
|
78
62
|
|
|
79
63
|
## Contributing
|
|
80
|
-
State if you are open to contributions and what your requirements are for accepting them.
|
|
81
64
|
|
|
82
|
-
|
|
65
|
+
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
|
|
66
|
+
|
|
67
|
+
## License
|
|
83
68
|
|
|
84
|
-
|
|
69
|
+
This project is licensed under the ISC License.
|
|
85
70
|
|
|
86
|
-
##
|
|
87
|
-
Show your appreciation to those who have contributed to the project.
|
|
71
|
+
## Author
|
|
88
72
|
|
|
89
|
-
|
|
90
|
-
For open source projects, say how it is licensed.
|
|
73
|
+
Germain LESPINGAL
|
|
91
74
|
|
|
92
|
-
## Project status
|
|
93
|
-
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
package/main.js
CHANGED
|
@@ -232,7 +232,7 @@ async function run(prompt) {
|
|
|
232
232
|
console.log(dest)
|
|
233
233
|
await fs.copy(src, dest, { overwrite: true, filter: filterFn });
|
|
234
234
|
|
|
235
|
-
if ((await fs.lstat(src)).isFile()) {
|
|
235
|
+
if ((await fs.lstat(src)).isFile() && !src.endsWith('.svg') && !src.endsWith('.png') && !src.endsWith('.jpg') && !src.endsWith('.jpeg') && !src.endsWith('.gif')) {
|
|
236
236
|
const data = await fs.readFile(src);
|
|
237
237
|
const fd = await fs.open(dest, 'w+');
|
|
238
238
|
const header = Buffer.from(await getReplicatedFileHeader(src));
|
|
@@ -344,7 +344,7 @@ async function syncFile(event, filePath, srcDir, targets, include) {
|
|
|
344
344
|
if (patterns.filter(p => (rel).startsWith(p)).length > 0) {
|
|
345
345
|
await fs.ensureDir(path.dirname(destPath));
|
|
346
346
|
await fs.copy(filePath, destPath, { overwrite: true });
|
|
347
|
-
if ((await fs.lstat(filePath)).isFile()) {
|
|
347
|
+
if ((await fs.lstat(filePath)).isFile() && !filePath.endsWith('.svg') && !filePath.endsWith('.png') && !filePath.endsWith('.jpg') && !filePath.endsWith('.jpeg') && !filePath.endsWith('.gif')) {
|
|
348
348
|
const data = await fs.readFile(filePath);
|
|
349
349
|
const fd = await fs.open(destPath, 'w+');
|
|
350
350
|
const buffer = Buffer.from(await getReplicatedFileHeader(filePath));
|