quar 1.3.1 → 1.4.2
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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/workflows/publish.yaml +50 -0
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -21
- package/README.md +96 -95
- package/dummy_models/posts.model.js +52 -52
- package/dummy_models/user.model.js +44 -44
- package/index.js +102 -66
- package/package.json +11 -3
- package/public/scripts/insertTab.js +155 -155
- package/public/scripts/keyboardCommands.js +15 -15
- package/public/scripts/main.js +364 -364
- package/public/scripts/popup.js +25 -25
- package/public/styles/insertTab.css +73 -73
- package/public/styles/popup.css +70 -70
- package/public/styles/sidebar.css +33 -33
- package/public/styles/style.css +306 -306
- package/public/styles/variables.css +8 -8
- package/server.js +241 -241
- package/utils/loadModels.js +26 -26
- package/views/base.zare +16 -16
- package/views/components/insertTab.zare +7 -7
- package/views/components/popup.zare +11 -11
- package/views/components/sidebar.zare +11 -11
- package/views/pages/index.zare +48 -48
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changesets
|
|
2
|
+
|
|
3
|
+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
+
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
+
|
|
7
|
+
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "restricted",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
release:
|
|
14
|
+
if: github.ref == 'refs/heads/main' && github.repository == 'IsmailBinMujeeb/Quar-Studio'
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
pull-requests: write
|
|
19
|
+
actions: write
|
|
20
|
+
id-token: write
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v6
|
|
24
|
+
|
|
25
|
+
- name: Setup Node.js
|
|
26
|
+
uses: actions/setup-node@v6
|
|
27
|
+
with:
|
|
28
|
+
node-version: 24
|
|
29
|
+
registry-url: https://registry.npmjs.org
|
|
30
|
+
cache: npm
|
|
31
|
+
|
|
32
|
+
- name: Set npm token
|
|
33
|
+
run: |
|
|
34
|
+
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
|
35
|
+
npm config set provenance true
|
|
36
|
+
|
|
37
|
+
- name: Install dependencies
|
|
38
|
+
run: npm ci
|
|
39
|
+
|
|
40
|
+
- name: Create Release Pull Request or Publish to npm
|
|
41
|
+
id: changesets
|
|
42
|
+
uses: changesets/action@v1
|
|
43
|
+
with:
|
|
44
|
+
version: npm run changeset version
|
|
45
|
+
publish: npm run changeset publish
|
|
46
|
+
createGithubReleases: true
|
|
47
|
+
commit: "chore(release): version packages"
|
|
48
|
+
title: "chore(release): version packages"
|
|
49
|
+
env:
|
|
50
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/CHANGELOG.md
ADDED
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Ismail Bin Mujeeb
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ismail Bin Mujeeb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,95 +1,96 @@
|
|
|
1
|
-
# Quar Studio – Quick UI for Mongoose Models
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="./assets/icon.png" alt="logo" width="200px"/>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
Instantly spin up a web-based editor for your Mongoose models.
|
|
8
|
-
Built for developers who loves quick database interaction!
|
|
9
|
-
|
|
10
|
-
## Install & Run
|
|
11
|
-
```bash
|
|
12
|
-
npx quar
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| <kbd>ctrl +
|
|
80
|
-
| <kbd>ctrl +
|
|
81
|
-
| <kbd>ctrl +
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
# Quar Studio – Quick UI for Mongoose Models
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="./assets/icon.png" alt="logo" width="200px"/>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
Instantly spin up a web-based editor for your Mongoose models.
|
|
8
|
+
Built for developers who loves quick database interaction!
|
|
9
|
+
|
|
10
|
+
## Install & Run
|
|
11
|
+
```bash
|
|
12
|
+
npx quar
|
|
13
|
+
```
|
|
14
|
+
It will ask you for model folder path, database name and database URI (optional).
|
|
15
|
+
This will load all Mongoose models from the folder and start a local web UI to Create, view, update, and delete documents.
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
- Loads your Mongoose models dynamically
|
|
19
|
+
- Connects to your MongoDB database
|
|
20
|
+
- Gives a tabbed UI for each model
|
|
21
|
+
- View nested documents in a tree-style
|
|
22
|
+
- Supports Create, Read, update and delete
|
|
23
|
+
|
|
24
|
+
## Folder Structure
|
|
25
|
+
Your models folder can contain files like this:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
// ./models/Post.js
|
|
29
|
+
import mongoose from "mongoose"
|
|
30
|
+
|
|
31
|
+
const postSchema = new mongoose.Schema({
|
|
32
|
+
title: String,
|
|
33
|
+
body: String,
|
|
34
|
+
author: {
|
|
35
|
+
name: String,
|
|
36
|
+
age: Number
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export default mongoose.model("Post", postSchema);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
1. Install Quar as dev deps
|
|
46
|
+
```bash
|
|
47
|
+
npm i quar --save-dev
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. Execute Command
|
|
51
|
+
```bash
|
|
52
|
+
npx quar
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Set Models Folder
|
|
56
|
+
```bash
|
|
57
|
+
npx quar --model <folder-path>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
4. Set Database Name
|
|
61
|
+
```bash
|
|
62
|
+
npx quar --model <folder-path> --db <db-name>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
5. Set Database URI `(Optional)`
|
|
66
|
+
```bash
|
|
67
|
+
npx quar --model <folder-path> --db <db-name> --uri <db-uri>
|
|
68
|
+
```
|
|
69
|
+
> ***Note:** By default it will try to connect local mongodb if uri not provided
|
|
70
|
+
|
|
71
|
+
## Usage Tips
|
|
72
|
+
- Supports nested schemas & subdocuments
|
|
73
|
+
- Clean tabbed navigation per model
|
|
74
|
+
- Auto-refreshes data after updates
|
|
75
|
+
- Keyboard shortcuts support
|
|
76
|
+
|
|
77
|
+
| Command | Performs |
|
|
78
|
+
|---------|----------|
|
|
79
|
+
| <kbd>ctrl + o</kbd> | Toggles Insert Tab |
|
|
80
|
+
| <kbd>ctrl + r</kbd> | Refresh Model |
|
|
81
|
+
| <kbd>ctrl + ></kbd> | Go To Next Page |
|
|
82
|
+
| <kbd>ctrl + <</kbd> | Go To Previous Page |
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Dev Notes
|
|
87
|
+
|
|
88
|
+
- Built for development use
|
|
89
|
+
- Doesn’t expose MONGO_URI publicly
|
|
90
|
+
- Uses Mongoose’s model.schema.tree for schema info
|
|
91
|
+
- Modular and extendable
|
|
92
|
+
|
|
93
|
+
## Contribute
|
|
94
|
+
Pull requests, suggestions, and ideas are welcome!
|
|
95
|
+
|
|
96
|
+
***Icon: <a href="https://www.flaticon.com/free-icons/thunder" title="thunder icons">Thunder icons created by Hexagon075 - Flaticon</a>***
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
|
|
3
|
-
const postSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
author: {
|
|
6
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
-
ref: "User",
|
|
8
|
-
required: true,
|
|
9
|
-
},
|
|
10
|
-
title: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: [true, "Post title is required"],
|
|
13
|
-
trim: true,
|
|
14
|
-
maxlength: [120, "Title cannot exceed 120 characters"],
|
|
15
|
-
},
|
|
16
|
-
content: {
|
|
17
|
-
type: String,
|
|
18
|
-
required: [true, "Post content is required"],
|
|
19
|
-
},
|
|
20
|
-
image: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: null,
|
|
23
|
-
},
|
|
24
|
-
likes: [
|
|
25
|
-
{
|
|
26
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
-
ref: "User",
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
// comments: [
|
|
31
|
-
// {
|
|
32
|
-
// user: {
|
|
33
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
34
|
-
// ref: "User",
|
|
35
|
-
// },
|
|
36
|
-
// text: {
|
|
37
|
-
// type: String,
|
|
38
|
-
// required: true,
|
|
39
|
-
// },
|
|
40
|
-
// createdAt: {
|
|
41
|
-
// type: Date,
|
|
42
|
-
// default: Date.now,
|
|
43
|
-
// },
|
|
44
|
-
// },
|
|
45
|
-
// ],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
timestamps: true,
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
export default mongoose.model("Post", postSchema);
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
const postSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
author: {
|
|
6
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
7
|
+
ref: "User",
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
title: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: [true, "Post title is required"],
|
|
13
|
+
trim: true,
|
|
14
|
+
maxlength: [120, "Title cannot exceed 120 characters"],
|
|
15
|
+
},
|
|
16
|
+
content: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: [true, "Post content is required"],
|
|
19
|
+
},
|
|
20
|
+
image: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: null,
|
|
23
|
+
},
|
|
24
|
+
likes: [
|
|
25
|
+
{
|
|
26
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
+
ref: "User",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
// comments: [
|
|
31
|
+
// {
|
|
32
|
+
// user: {
|
|
33
|
+
// type: mongoose.Schema.Types.ObjectId,
|
|
34
|
+
// ref: "User",
|
|
35
|
+
// },
|
|
36
|
+
// text: {
|
|
37
|
+
// type: String,
|
|
38
|
+
// required: true,
|
|
39
|
+
// },
|
|
40
|
+
// createdAt: {
|
|
41
|
+
// type: Date,
|
|
42
|
+
// default: Date.now,
|
|
43
|
+
// },
|
|
44
|
+
// },
|
|
45
|
+
// ],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
timestamps: true,
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export default mongoose.model("Post", postSchema);
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
|
|
3
|
-
const userSchema = new mongoose.Schema(
|
|
4
|
-
{
|
|
5
|
-
username: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: [true, "Username is required"],
|
|
8
|
-
unique: true,
|
|
9
|
-
trim: true,
|
|
10
|
-
minlength: [3, "Username must be at least 3 characters long"],
|
|
11
|
-
},
|
|
12
|
-
email: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: [true, "Email is required"],
|
|
15
|
-
unique: true,
|
|
16
|
-
lowercase: true,
|
|
17
|
-
match: [/.+@.+\..+/, "Please enter a valid email address"],
|
|
18
|
-
},
|
|
19
|
-
password: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: [true, "Password is required"],
|
|
22
|
-
minlength: [6, "Password must be at least 6 characters long"],
|
|
23
|
-
select: false,
|
|
24
|
-
},
|
|
25
|
-
avatar: {
|
|
26
|
-
type: String,
|
|
27
|
-
},
|
|
28
|
-
bio: {
|
|
29
|
-
type: String,
|
|
30
|
-
maxlength: [160, "Bio cannot exceed 160 characters"],
|
|
31
|
-
},
|
|
32
|
-
posts: [
|
|
33
|
-
{
|
|
34
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
35
|
-
ref: "Post",
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
timestamps: true,
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
export default mongoose.model("User", userSchema);
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
const userSchema = new mongoose.Schema(
|
|
4
|
+
{
|
|
5
|
+
username: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: [true, "Username is required"],
|
|
8
|
+
unique: true,
|
|
9
|
+
trim: true,
|
|
10
|
+
minlength: [3, "Username must be at least 3 characters long"],
|
|
11
|
+
},
|
|
12
|
+
email: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: [true, "Email is required"],
|
|
15
|
+
unique: true,
|
|
16
|
+
lowercase: true,
|
|
17
|
+
match: [/.+@.+\..+/, "Please enter a valid email address"],
|
|
18
|
+
},
|
|
19
|
+
password: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: [true, "Password is required"],
|
|
22
|
+
minlength: [6, "Password must be at least 6 characters long"],
|
|
23
|
+
select: false,
|
|
24
|
+
},
|
|
25
|
+
avatar: {
|
|
26
|
+
type: String,
|
|
27
|
+
},
|
|
28
|
+
bio: {
|
|
29
|
+
type: String,
|
|
30
|
+
maxlength: [160, "Bio cannot exceed 160 characters"],
|
|
31
|
+
},
|
|
32
|
+
posts: [
|
|
33
|
+
{
|
|
34
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
35
|
+
ref: "Post",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
timestamps: true,
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export default mongoose.model("User", userSchema);
|