@ricardohsmello/mongodb-cli-lab 1.0.0 → 1.0.1
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/.github/workflows/publish.yml +35 -0
- package/README.md +47 -0
- package/RELEASING.md +39 -0
- package/package.json +2 -2
- /package/{index.js → src/index.js} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 20
|
|
24
|
+
registry-url: https://registry.npmjs.org
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm install
|
|
28
|
+
|
|
29
|
+
- name: Verify package contents
|
|
30
|
+
run: npm pack --dry-run
|
|
31
|
+
|
|
32
|
+
- name: Publish to npm
|
|
33
|
+
run: npm publish --access public
|
|
34
|
+
env:
|
|
35
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# MongoDB CLI Lab
|
|
2
|
+
|
|
3
|
+
`MongoDB CLI Lab` is an npm CLI for learning and testing MongoDB sharding in a local Docker environment.
|
|
4
|
+
|
|
5
|
+
It helps you create a sharded cluster automatically so you can focus on understanding the workflow instead of setting everything up by hand.
|
|
6
|
+
|
|
7
|
+
With the CLI, you can:
|
|
8
|
+
|
|
9
|
+
- create a local MongoDB sharded cluster
|
|
10
|
+
- choose the number of shards
|
|
11
|
+
- choose the number of replica set members per shard
|
|
12
|
+
- choose the MongoDB version
|
|
13
|
+
- define the `mongos` port
|
|
14
|
+
- create collections
|
|
15
|
+
- enable sharding for collections
|
|
16
|
+
- run simple experiments to understand shard distribution
|
|
17
|
+
|
|
18
|
+
This project is intended for study, demos, and local experiments. It is a learning lab, not a production-ready solution.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
Before running the CLI, you need:
|
|
23
|
+
|
|
24
|
+
- Docker installed
|
|
25
|
+
- Docker running
|
|
26
|
+
|
|
27
|
+
## How to run
|
|
28
|
+
|
|
29
|
+
1. Install the package:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm i @ricardohsmello/mongodb-cli-lab
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. Run the CLI:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx mongodb-cli-lab
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The command opens an interactive flow where you can create the cluster, configure shards, and work with sharded collections.
|
|
42
|
+
|
|
43
|
+
## Important
|
|
44
|
+
|
|
45
|
+
This tool was built for educational purposes only.
|
|
46
|
+
|
|
47
|
+
It should not be used in production as-is. Any production usage would require a proper technical review, operational hardening, and validation by whoever decides to adopt it.
|
package/RELEASING.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
This project publishes to npm automatically through GitHub Actions when a new Git tag is pushed.
|
|
4
|
+
|
|
5
|
+
## Release flow
|
|
6
|
+
|
|
7
|
+
1. Update the version in `package.json`:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch --no-git-tag-version
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Commit the version change:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git add .
|
|
17
|
+
git commit -m "release: v1.0.6"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. Create the Git tag:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git tag v1.0.6
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
4. Push the branch and the tag:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git push origin main --tags
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
When the tag is pushed, GitHub Actions publishes the package to npm automatically.
|
|
33
|
+
|
|
34
|
+
## Notes
|
|
35
|
+
|
|
36
|
+
- The npm package manifest lives in the repository root.
|
|
37
|
+
- The CLI entrypoint is `src/index.js`.
|
|
38
|
+
- Replace `patch` with `minor` or `major` when needed.
|
|
39
|
+
- The published package name is `@ricardohsmello/mongodb-cli-lab`.
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricardohsmello/mongodb-cli-lab",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI to create a local MongoDB sharded cluster using Docker",
|
|
5
5
|
"bin": {
|
|
6
|
-
"mongodb-cli-lab": "./index.js"
|
|
6
|
+
"mongodb-cli-lab": "./src/index.js"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"dependencies": {
|
|
File without changes
|