@quadratz/qz-scaff 1.0.3

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 ADDED
@@ -0,0 +1,9 @@
1
+ # qz-scaff
2
+
3
+ A personal-use Bun CLI for scaffolding projects from templates.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ bunx @quadratz/qz-scaff
9
+ ```
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@quadratz/qz-scaff",
3
+ "type": "module",
4
+ "version": "1.0.3",
5
+ "description": "A personal-use Bun CLI for scaffolding projects from templates.",
6
+ "author": "Quadratz",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/Quadratz-Org/qz-scaff#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Quadratz-Org/qz-scaff.git"
12
+ },
13
+ "bugs": "https://github.com/Quadratz-Org/qz-scaff/issues",
14
+ "exports": {
15
+ ".": "./dist/mod.ts",
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "src",
20
+ "template"
21
+ ],
22
+ "scripts": {
23
+ "dev": "bun src/mod.ts",
24
+ "fmt": "prettier . --write",
25
+ "check": "prettier . --check && eslint . && tsc --noEmit",
26
+ "release": "bumpp --commit --push --tag"
27
+ },
28
+ "devDependencies": {
29
+ "@eslint/js": "^9.39.2",
30
+ "@types/bun": "latest",
31
+ "bumpp": "^10.4.1",
32
+ "eslint": "^9.39.2",
33
+ "eslint-config-prettier": "^10.1.8",
34
+ "prettier": "3.8.1",
35
+ "typescript-eslint": "^8.55.0"
36
+ },
37
+ "dependencies": {
38
+ "@clack/prompts": "^1.0.1"
39
+ },
40
+ "module": "index.ts",
41
+ "private": false,
42
+ "peerDependencies": {
43
+ "typescript": "^5.9.3"
44
+ },
45
+ "prettier": {}
46
+ }
package/src/mod.ts ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * A personal-use Bun CLI for scaffolding projects from templates.
3
+ *
4
+ * @example
5
+ * ```sh
6
+ * bunx @quadratz/qz-scaff
7
+ * ```
8
+ */
9
+
10
+ import type { Response } from "./types.ts";
11
+ import { scaffoldProject } from "./scaffold-project.ts";
12
+ import { group, intro, outro, text } from "@clack/prompts";
13
+ import { prepareDestination } from "./prepare-destination.ts";
14
+ import pkg from "../package.json" with { type: "json" };
15
+ import { handleCancel, validateString } from "./utils.ts";
16
+
17
+ await main();
18
+
19
+ /**
20
+ * Main entry point for the scaffolding CLI.
21
+ */
22
+ async function main(): Promise<void> {
23
+ intro(`Qz Project Scaffold v${pkg.version}`);
24
+
25
+ const response = (await group(
26
+ {
27
+ name: () =>
28
+ text({
29
+ message: "Package name:",
30
+ validate: (value) => {
31
+ if (!value || value.length === 0) return "Name is required";
32
+ if (!/^[a-z0-9-]+$/.test(value)) {
33
+ return "Name can only contain lowercase letters, numbers, and hyphens";
34
+ }
35
+ if (value.length > 214) return "Name is too long";
36
+ },
37
+ }),
38
+ description: () =>
39
+ text({
40
+ message: "Package description:",
41
+ validate: validateString,
42
+ }),
43
+ keywords: () => text({ message: `Keywords:` }),
44
+ destination: ({ results: { name } }) => {
45
+ const path = `./${name ?? ""}`;
46
+ return text({
47
+ message: `Project location:`,
48
+ placeholder: path,
49
+ defaultValue: path,
50
+ });
51
+ },
52
+ },
53
+ {
54
+ onCancel: handleCancel,
55
+ },
56
+ )) as Response;
57
+
58
+ // Validate and prepare the destination directory.
59
+ response.destination = await prepareDestination(response.destination);
60
+
61
+ // Scaffold the project.
62
+ await scaffoldProject(response);
63
+
64
+ outro("Selesai!");
65
+ }
@@ -0,0 +1,74 @@
1
+ import { resolve } from "node:path";
2
+ import { rm } from "node:fs/promises";
3
+ import { select } from "@clack/prompts";
4
+ import { checkCancel, isDirEmpty, promptNewPath } from "./utils.ts";
5
+ import { stat } from "node:fs/promises";
6
+
7
+ export { prepareDestination };
8
+
9
+ /**
10
+ * Recursive function to validate and prepare the destination path.
11
+ *
12
+ * Handles existing directories, non-empty directories, and file conflicts.
13
+ *
14
+ * @param inputPath - The path provided by the user.
15
+ * @returns The resolved, valid destination path.
16
+ */
17
+ async function prepareDestination(inputPath: string): Promise<string> {
18
+ // Use resolve instead of realPath to allow non-existent paths.
19
+ const dest = resolve(inputPath);
20
+
21
+ try {
22
+ const destStat = await stat(dest);
23
+
24
+ // Case 1: Path exists and is a file.
25
+ if (!destStat.isDirectory()) {
26
+ const answer = await select({
27
+ message: "The destination exists but is not a directory. Action?",
28
+ options: [
29
+ { value: "new-path", label: "Pick a new location" },
30
+ { value: "cancel", label: "Cancel" },
31
+ ],
32
+ });
33
+ checkCancel(answer);
34
+ return await promptNewPath();
35
+ }
36
+
37
+ // Case 2: Path exists and is a Directory -> Check if empty.
38
+ if (await isDirEmpty(dest)) return dest;
39
+
40
+ // Case 3: Directory is not empty.
41
+ const answer = await select({
42
+ message: "The destination directory is not empty. Action?",
43
+ options: [
44
+ {
45
+ value: "remove-dir",
46
+ label: "Remove the directory",
47
+ },
48
+ { value: "overwrite-dir", label: "Merge/Overwrite existing files" },
49
+ { value: "new-path", label: "Pick a new location" },
50
+ { value: "cancel", label: "Cancel" },
51
+ ],
52
+ });
53
+
54
+ checkCancel(answer);
55
+
56
+ switch (answer) {
57
+ case "remove-dir":
58
+ await rm(dest, { recursive: true, force: true });
59
+ return dest;
60
+
61
+ case "overwrite-dir":
62
+ return dest;
63
+
64
+ default:
65
+ return await promptNewPath();
66
+ }
67
+ } catch (error) {
68
+ // Case 4: Path does not exist (stat threw NotFound).
69
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
70
+ return dest; // Directory will be created by ensureDir later.
71
+ }
72
+ throw error; // Unexpected error.
73
+ }
74
+ }
@@ -0,0 +1,87 @@
1
+ import type { Response } from "./types.ts";
2
+ import { join, basename } from "node:path";
3
+ import { mkdir, readdir, cp } from "node:fs/promises";
4
+ import npmPkg from "../template/package.json" with { type: "json" };
5
+
6
+ export { scaffoldProject };
7
+
8
+ /** Base URL for the organization's GitHub. */
9
+ const GITHUB_BASE_URL = "https://github.com/Quadratz-Org/";
10
+
11
+ /**
12
+ * Writes the project files to the destination.
13
+ * @param resp - The collected user responses.
14
+ */
15
+ async function scaffoldProject(resp: Response): Promise<void> {
16
+ const { destination, name, description, keywords } = resp;
17
+
18
+ // Ensure directory exists before writing specific files.
19
+ await mkdir(destination, { recursive: true });
20
+
21
+ const promises: Promise<number>[] = [];
22
+ const repoUrl = `${GITHUB_BASE_URL}${name}`;
23
+
24
+ // 1. Prepare and write package.json
25
+ const finalPkg = {
26
+ ...npmPkg,
27
+ name,
28
+ description,
29
+ keywords: keywords.split(" ").filter(Boolean),
30
+ homepage: repoUrl,
31
+ repository: { url: `git+${repoUrl}.git` },
32
+ bugs: `${repoUrl}/issues`,
33
+ };
34
+
35
+ promises.push(
36
+ Bun.write(
37
+ join(destination, "package.json"),
38
+ JSON.stringify(finalPkg, null, 2),
39
+ ),
40
+ );
41
+
42
+ const [contributingTxt, readmeTxt] = await Promise.all([
43
+ Bun.file(new URL("../template/CONTRIBUTING.md", import.meta.url)).text(),
44
+ Bun.file(new URL("../template/README.md", import.meta.url)).text(),
45
+ ]);
46
+
47
+ // 2. Write CONTRIBUTING.md
48
+ promises.push(
49
+ Bun.write(
50
+ join(destination, "CONTRIBUTING.md"),
51
+ contributingTxt.replaceAll("{{PACKAGE_NAME}}", name),
52
+ ),
53
+ );
54
+
55
+ // 3. Write README.md
56
+ promises.push(
57
+ Bun.write(
58
+ join(destination, "README.md"),
59
+ readmeTxt
60
+ .replaceAll("{{PACKAGE_NAME}}", name)
61
+ .replace("{{DESCRIPTION}}", description),
62
+ ),
63
+ );
64
+
65
+ await Promise.all(promises);
66
+
67
+ // 4. Copy remaining template files
68
+ const templatePath = new URL("../template", import.meta.url);
69
+ const copyPromises: Promise<void>[] = [];
70
+ const excludedFiles = new Set([
71
+ "CONTRIBUTING.md",
72
+ "package.json",
73
+ "README.md",
74
+ ]);
75
+
76
+ for (const source of await readdir(templatePath)) {
77
+ const fileName = basename(source);
78
+
79
+ if (excludedFiles.has(fileName)) continue;
80
+
81
+ copyPromises.push(
82
+ cp(source, join(destination, fileName), { force: true, recursive: true }),
83
+ );
84
+ }
85
+
86
+ await Promise.all(copyPromises);
87
+ }
package/src/types.ts ADDED
@@ -0,0 +1,15 @@
1
+ export type { Response };
2
+
3
+ /**
4
+ * Interface representing the user's input responses.
5
+ */
6
+ interface Response {
7
+ /** The name of the package. */
8
+ name: string;
9
+ /** A short description of the package. */
10
+ description: string;
11
+ /** Space-separated keywords for npm package.json. */
12
+ keywords: string;
13
+ /** The target directory path for the project. */
14
+ destination: string;
15
+ }
package/src/utils.ts ADDED
@@ -0,0 +1,60 @@
1
+ import { cancel, isCancel, text } from "@clack/prompts";
2
+ import { prepareDestination } from "./prepare-destination.ts";
3
+ import { readdir } from "node:fs/promises";
4
+
5
+ export { checkCancel, handleCancel, isDirEmpty, promptNewPath, validateString };
6
+
7
+ /**
8
+ * Validates that a string input is not empty.
9
+ *
10
+ * @param value - The user input.
11
+ * @returns Error message if invalid, undefined otherwise.
12
+ */
13
+ function validateString(value?: string): string | undefined {
14
+ if (!value || value.trim().length === 0) return "This field is required!";
15
+ }
16
+
17
+ /**
18
+ * Handles the cancellation of the prompt sequence.
19
+ */
20
+ function handleCancel(): never {
21
+ cancel("Installation cancelled!");
22
+ process.exit(1);
23
+ }
24
+
25
+ /**
26
+ * Checks a prompt answer for cancellation tokens.
27
+ *
28
+ * @param answer - The value returned from a prompt.
29
+ */
30
+ function checkCancel(answer: string | symbol): asserts answer is string {
31
+ if (isCancel(answer) || answer === "cancel") {
32
+ handleCancel();
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Checks if a directory contains any files.
38
+ *
39
+ * @param dest - The path to check.
40
+ * @returns True if empty, false otherwise.
41
+ */
42
+ async function isDirEmpty(dest: string): Promise<boolean> {
43
+ return (await readdir(dest)).length === 0;
44
+ }
45
+
46
+ /**
47
+ * Helper to prompt the user for a new path and re-run validation.
48
+ *
49
+ * @returns The resolved valid path.
50
+ */
51
+ async function promptNewPath(): Promise<string> {
52
+ const answer = await text({
53
+ message: "Set a new project location:",
54
+ validate: validateString,
55
+ });
56
+
57
+ checkCancel(answer);
58
+
59
+ return prepareDestination(answer);
60
+ }
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,16 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: quadratz
4
+ # patreon: # Replace with a single Patreon username
5
+ # open_collective: # Replace with a single Open Collective username
6
+ # ko_fi: # Replace with a single Ko-fi username
7
+ # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ # liberapay: # Replace with a single Liberapay username
10
+ # issuehunt: # Replace with a single IssueHunt username
11
+ # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ # polar: # Replace with a single Polar username
13
+ # buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ # thanks_dev: # Replace with a single thanks.dev username
15
+ # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1',
16
+ # 'link2']
@@ -0,0 +1,124 @@
1
+ name: 🐛 Bug Report
2
+ description: Report a bug or unexpected behavior
3
+ title: "[Bug]: "
4
+ labels: ["bug", "needs-triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to report this issue! Please fill out the information below to help us understand and resolve the problem.
10
+
11
+ - type: checkboxes
12
+ id: prerequisites
13
+ attributes:
14
+ label: Prerequisites
15
+ description: Please confirm the following before submitting
16
+ options:
17
+ - label: I have searched existing issues to ensure this bug hasn't been reported
18
+ required: true
19
+ - label: I have checked the documentation
20
+ required: true
21
+ - label: I am using the latest version
22
+ required: false
23
+
24
+ - type: input
25
+ id: version
26
+ attributes:
27
+ label: Package Version
28
+ description: What version of the package are you using?
29
+ placeholder: e.g., 1.2.3
30
+ validations:
31
+ required: true
32
+
33
+ - type: textarea
34
+ id: description
35
+ attributes:
36
+ label: Bug Description
37
+ description: A clear and concise description of what the bug is
38
+ placeholder: What went wrong?
39
+ validations:
40
+ required: true
41
+
42
+ - type: textarea
43
+ id: reproduction
44
+ attributes:
45
+ label: Steps to Reproduce
46
+ description: Detailed steps to reproduce the behavior
47
+ placeholder: |
48
+ 1. Import '...'
49
+ 2. Call function with '...'
50
+ 3. See error
51
+ validations:
52
+ required: true
53
+
54
+ - type: textarea
55
+ id: expected
56
+ attributes:
57
+ label: Expected Behavior
58
+ description: What did you expect to happen?
59
+ placeholder: What should have happened instead?
60
+ validations:
61
+ required: true
62
+
63
+ - type: textarea
64
+ id: actual
65
+ attributes:
66
+ label: Actual Behavior
67
+ description: What actually happened?
68
+ placeholder: Include error messages, screenshots, or logs
69
+ validations:
70
+ required: true
71
+
72
+ - type: textarea
73
+ id: code
74
+ attributes:
75
+ label: Code Sample
76
+ description: Minimal code to reproduce the issue
77
+ placeholder: |
78
+ ```typescript
79
+ // Your code here
80
+ ```
81
+ render: typescript
82
+ validations:
83
+ required: false
84
+
85
+ - type: input
86
+ id: reproduction-link
87
+ attributes:
88
+ label: Reproduction Link
89
+ description: Link to a minimal reproduction (CodeSandbox, StackBlitz, GitHub repo, etc.)
90
+ placeholder: https://codesandbox.io/s/...
91
+ validations:
92
+ required: false
93
+
94
+ - type: textarea
95
+ id: environment
96
+ attributes:
97
+ label: Environment
98
+ description: Please provide your environment details
99
+ placeholder: |
100
+ - OS: [e.g., macOS 14.0, Windows 11, Ubuntu 22.04]
101
+ - Node version: [e.g., 20.10.0]
102
+ - Package manager: [e.g., npm 10.2.3, yarn 4.0.2, pnpm 8.14.0]
103
+ - TypeScript version (if applicable): [e.g., 5.3.3]
104
+ - Browser (if applicable): [e.g., Chrome 120, Safari 17]
105
+ validations:
106
+ required: false
107
+
108
+ - type: textarea
109
+ id: additional
110
+ attributes:
111
+ label: Additional Context
112
+ description: Any other context, screenshots, or information about the problem
113
+ placeholder: Add any other relevant details here
114
+ validations:
115
+ required: false
116
+
117
+ - type: textarea
118
+ id: solution
119
+ attributes:
120
+ label: Possible Solution
121
+ description: If you have suggestions on how to fix this, please share
122
+ placeholder: Optional - your ideas for fixing this issue
123
+ validations:
124
+ required: false
@@ -0,0 +1,100 @@
1
+ name: ✨ Feature Request
2
+ description: Suggest a new feature or enhancement
3
+ title: "[Feature]: "
4
+ labels: ["enhancement", "needs-triage"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for your interest in improving this project! Please describe your feature request in detail.
10
+
11
+ - type: checkboxes
12
+ id: prerequisites
13
+ attributes:
14
+ label: Prerequisites
15
+ description: Please confirm the following before submitting
16
+ options:
17
+ - label: I have searched existing issues to ensure this hasn't been requested
18
+ required: true
19
+ - label: I have checked the documentation to ensure this feature doesn't exist
20
+ required: true
21
+
22
+ - type: textarea
23
+ id: problem
24
+ attributes:
25
+ label: Problem Statement
26
+ description: Is your feature request related to a problem? Please describe.
27
+ placeholder: I'm frustrated when... / It would be helpful if...
28
+ validations:
29
+ required: true
30
+
31
+ - type: textarea
32
+ id: solution
33
+ attributes:
34
+ label: Proposed Solution
35
+ description: Describe the solution you'd like
36
+ placeholder: A clear and concise description of what you want to happen
37
+ validations:
38
+ required: true
39
+
40
+ - type: textarea
41
+ id: alternatives
42
+ attributes:
43
+ label: Alternatives Considered
44
+ description: Describe alternatives you've considered
45
+ placeholder: What other approaches have you thought about?
46
+ validations:
47
+ required: false
48
+
49
+ - type: textarea
50
+ id: examples
51
+ attributes:
52
+ label: Code Examples
53
+ description: Show how you'd like to use this feature
54
+ placeholder: |
55
+ ```typescript
56
+ // Example usage
57
+ ```
58
+ render: typescript
59
+ validations:
60
+ required: false
61
+
62
+ - type: textarea
63
+ id: api
64
+ attributes:
65
+ label: API Design (if applicable)
66
+ description: If this involves new APIs, describe the proposed interface
67
+ placeholder: |
68
+ Proposed function signatures, types, or component props
69
+ render: typescript
70
+ validations:
71
+ required: false
72
+
73
+ - type: textarea
74
+ id: additional
75
+ attributes:
76
+ label: Additional Context
77
+ description: Add any other context, mockups, or screenshots
78
+ placeholder: Links to similar features in other libraries, mockups, etc.
79
+ validations:
80
+ required: false
81
+
82
+ - type: dropdown
83
+ id: priority
84
+ attributes:
85
+ label: Priority
86
+ description: How important is this feature to you?
87
+ options:
88
+ - Low - Nice to have
89
+ - Medium - Would significantly improve my workflow
90
+ - High - Blocking my usage of this library
91
+ validations:
92
+ required: false
93
+
94
+ - type: checkboxes
95
+ id: contribution
96
+ attributes:
97
+ label: Contribution
98
+ description: Would you be willing to contribute this feature?
99
+ options:
100
+ - label: I'm willing to submit a PR to implement this feature
@@ -0,0 +1,68 @@
1
+ name: ❓ Question
2
+ description: Ask a question about usage or clarification
3
+ title: "[Question]: "
4
+ labels: ["question"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for your question! Please provide as much detail as possible so we can help you effectively.
10
+
11
+ - type: checkboxes
12
+ id: prerequisites
13
+ attributes:
14
+ label: Prerequisites
15
+ description: Please confirm the following before submitting
16
+ options:
17
+ - label: I have checked the documentation
18
+ required: true
19
+ - label: I have searched existing issues for similar questions
20
+ required: true
21
+
22
+ - type: textarea
23
+ id: question
24
+ attributes:
25
+ label: Your Question
26
+ description: What would you like to know?
27
+ placeholder: Please be as specific as possible
28
+ validations:
29
+ required: true
30
+
31
+ - type: textarea
32
+ id: context
33
+ attributes:
34
+ label: Context
35
+ description: What are you trying to accomplish?
36
+ placeholder: Describe your use case or what you're building
37
+ validations:
38
+ required: false
39
+
40
+ - type: textarea
41
+ id: code
42
+ attributes:
43
+ label: Code Sample
44
+ description: Share relevant code if applicable
45
+ placeholder: |
46
+ ```typescript
47
+ // Your code here
48
+ ```
49
+ render: typescript
50
+ validations:
51
+ required: false
52
+
53
+ - type: textarea
54
+ id: attempted
55
+ attributes:
56
+ label: What I've Tried
57
+ description: What have you already attempted?
58
+ placeholder: Describe any solutions you've already explored
59
+ validations:
60
+ required: false
61
+
62
+ - type: textarea
63
+ id: additional
64
+ attributes:
65
+ label: Additional Information
66
+ description: Any other details that might be helpful
67
+ validations:
68
+ required: false
@@ -0,0 +1,45 @@
1
+ ## Description
2
+
3
+ <!-- Briefly describe what this PR does -->
4
+
5
+ ## Type of Change
6
+
7
+ <!-- Check the relevant option -->
8
+
9
+ - [ ] 🐛 Bug fix
10
+ - [ ] ✨ New feature
11
+ - [ ] 💥 Breaking change
12
+ - [ ] 📝 Documentation
13
+ - [ ] ♻️ Refactoring
14
+ - [ ] ⚡ Performance
15
+ - [ ] ✅ Tests
16
+ - [ ] 🔧 Build/CI
17
+
18
+ ## Related Issues
19
+
20
+ <!-- Link related issues: Fixes #123, Closes #456 -->
21
+
22
+ ## Changes
23
+
24
+ <!-- List key changes -->
25
+
26
+ -
27
+ -
28
+
29
+ ## Testing
30
+
31
+ <!-- How did you test this? -->
32
+
33
+ - [ ] Tests added/updated
34
+ - [ ] All tests passing
35
+
36
+ ## Checklist
37
+
38
+ - [ ] Code follows project style
39
+ - [ ] Self-reviewed
40
+ - [ ] Documentation updated (if needed)
41
+ - [ ] No breaking changes (or documented)
42
+
43
+ ## Screenshots/Notes
44
+
45
+ <!-- Optional: Add screenshots or additional context -->
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ jobs:
10
+ test:
11
+ name: Test on ${{ matrix.os }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest, windows-latest]
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v6
21
+
22
+ - name: Setup Bun
23
+ uses: oven-sh/setup-bun@v2
24
+
25
+ - name: Install dependencies
26
+ run: bun install --frozen-lockfile
27
+
28
+ - name: Build
29
+ run: bun task build
30
+
31
+ - name: Check
32
+ run: bun task check
@@ -0,0 +1,50 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ release:
14
+ name: Release Package
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v6
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Setup Node
23
+ uses: actions/setup-node@v6
24
+ with:
25
+ node-version: "24"
26
+ registry-url: "https://registry.npmjs.org"
27
+
28
+ - name: Setup Bun
29
+ uses: oven-sh/setup-bun@v2
30
+
31
+ - name: Install dependencies
32
+ run: bun install --frozen-lockfile
33
+
34
+ - name: Build
35
+ run: bun run build
36
+
37
+ - name: Check
38
+ run: bun run check
39
+
40
+ - name: Generate changelog
41
+ run: bunx changelogithub
42
+ continue-on-error: true
43
+ env:
44
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
+
46
+ - name: Update npm
47
+ run: npm install -g npm@latest
48
+
49
+ - name: Publish packages to npm
50
+ run: bunx clean-pkg-json && bun pm pack && npm publish ./*.tgz --access public
@@ -0,0 +1,162 @@
1
+ # Contributor Covenant 3.0 Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We pledge to make our community welcoming, safe, and equitable for all.
6
+
7
+ We are committed to fostering an environment that respects and promotes the
8
+ dignity, rights, and contributions of all individuals, regardless of
9
+ characteristics including race, ethnicity, caste, color, age, physical
10
+ characteristics, neurodiversity, disability, language, philosophy or religion,
11
+ national or social origin, socio-economic position, level of education, or other
12
+ status. The same privileges of participation are extended to everyone who
13
+ participates in good faith and in accordance with this Covenant.
14
+
15
+ ## Encouraged Behaviors
16
+
17
+ While acknowledging differences in social norms, we all strive to meet our
18
+ community's expectations for positive behavior. We also understand that our
19
+ words and actions may be interpreted differently than we intend based on
20
+ culture, background, or native language.
21
+
22
+ With these considerations in mind, we agree to behave mindfully toward each
23
+ other and act in ways that center our shared values, including:
24
+
25
+ 1. Respecting the **purpose of our community**, our activities, and our ways of
26
+ gathering.
27
+ 2. Engaging **kindly and honestly** with others.
28
+ 3. Respecting **different viewpoints** and experiences.
29
+ 4. **Taking responsibility** for our actions and contributions.
30
+ 5. Gracefully giving and accepting **constructive feedback**.
31
+ 6. Committing to **repairing harm** when it occurs.
32
+ 7. Behaving in other ways that promote and sustain the **well-being of our
33
+ community**.
34
+
35
+ ## Restricted Behaviors
36
+
37
+ We agree to restrict the following behaviors in our community. Instances,
38
+ threats, and promotion of these behaviors are violations of this Code of
39
+ Conduct.
40
+
41
+ 1. **Harassment.** Violating explicitly expressed boundaries or engaging in
42
+ unnecessary personal attention after any clear request to stop.
43
+ 2. **Character attacks.** Making insulting, demeaning, or pejorative comments
44
+ directed at a community member or group of people.
45
+ 3. **Stereotyping or discrimination.** Characterizing anyone’s personality or
46
+ behavior on the basis of immutable identities or traits.
47
+ 4. **Sexualization.** Behaving in a way that would generally be considered
48
+ inappropriately intimate in the context or purpose of the community.
49
+ 5. **Violating confidentiality**. Sharing or acting on someone's personal or
50
+ private information without their permission.
51
+ 6. **Endangerment.** Causing, encouraging, or threatening violence or other harm
52
+ toward any person or group.
53
+ 7. Behaving in other ways that **threaten the well-being** of our community.
54
+
55
+ ### Other Restrictions
56
+
57
+ 1. **Misleading identity.** Impersonating someone else for any reason, or
58
+ pretending to be someone else to evade enforcement actions.
59
+ 2. **Failing to credit sources.** Not properly crediting the sources of content
60
+ you contribute.
61
+ 3. **Promotional materials**. Sharing marketing or other commercial content in a
62
+ way that is outside the norms of the community.
63
+ 4. **Irresponsible communication.** Failing to responsibly present content which
64
+ includes, links or describes any other restricted behaviors.
65
+
66
+ ## Reporting an Issue
67
+
68
+ Tensions can occur between community members even when they are trying their
69
+ best to collaborate. Not every conflict represents a code of conduct violation,
70
+ and this Code of Conduct reinforces encouraged behaviors and norms that can help
71
+ avoid conflicts and minimize harm.
72
+
73
+ When an incident does occur, it is important to report it promptly. To report a
74
+ possible violation, please email **quadratz@proton.me** or contact us via
75
+ Telegram at **https://t.me/quadratz**.
76
+
77
+ Community Moderators take reports of violations seriously and will make every
78
+ effort to respond in a timely manner. They will investigate all reports of code
79
+ of conduct violations, reviewing messages, logs, and recordings, or interviewing
80
+ witnesses and other participants. Community Moderators will keep investigation
81
+ and enforcement actions as transparent as possible while prioritizing safety and
82
+ confidentiality. In order to honor these values, enforcement actions are carried
83
+ out in private with the involved parties, but communicating to the whole
84
+ community may be part of a mutually agreed upon resolution.
85
+
86
+ ## Addressing and Repairing Harm
87
+
88
+ If an investigation by the Community Moderators finds that this Code of Conduct
89
+ has been violated, the following enforcement ladder may be used to determine how
90
+ best to repair harm, based on the incident's impact on the individuals involved
91
+ and the community as a whole. Depending on the severity of a violation, lower
92
+ rungs on the ladder may be skipped.
93
+
94
+ 1. Warning
95
+ 1. Event: A violation involving a single incident or series of incidents.
96
+ 2. Consequence: A private, written warning from the Community Moderators.
97
+ 3. Repair: Examples of repair include a private written apology,
98
+ acknowledgement of responsibility, and seeking clarification on
99
+ expectations.
100
+ 2. Temporarily Limited Activities
101
+ 1. Event: A repeated incidence of a violation that previously resulted in a
102
+ warning, or the first incidence of a more serious violation.
103
+ 2. Consequence: A private, written warning with a time-limited cooldown
104
+ period designed to underscore the seriousness of the situation and give
105
+ the community members involved time to process the incident. The cooldown
106
+ period may be limited to particular communication channels or interactions
107
+ with particular community members.
108
+ 3. Repair: Examples of repair may include making an apology, using the
109
+ cooldown period to reflect on actions and impact, and being thoughtful
110
+ about re-entering community spaces after the period is over.
111
+ 3. Temporary Suspension
112
+ 1. Event: A pattern of repeated violation which the Community Moderators have
113
+ tried to address with warnings, or a single serious violation.
114
+ 2. Consequence: A private written warning with conditions for return from
115
+ suspension. In general, temporary suspensions give the person being
116
+ suspended time to reflect upon their behavior and possible corrective
117
+ actions.
118
+ 3. Repair: Examples of repair include respecting the spirit of the
119
+ suspension, meeting the specified conditions for return, and being
120
+ thoughtful about how to reintegrate with the community when the suspension
121
+ is lifted.
122
+ 4. Permanent Ban
123
+ 1. Event: A pattern of repeated code of conduct violations that other steps
124
+ on the ladder have failed to resolve, or a violation so serious that the
125
+ Community Moderators determine there is no way to keep the community safe
126
+ with this person as a member.
127
+ 2. Consequence: Access to all community spaces, tools, and communication
128
+ channels is removed. In general, permanent bans should be rarely used,
129
+ should have strong reasoning behind them, and should only be resorted to
130
+ if working through other remedies has failed to change the behavior.
131
+ 3. Repair: There is no possible repair in cases of this severity.
132
+
133
+ This enforcement ladder is intended as a guideline. It does not limit the
134
+ ability of Community Managers to use their discretion and judgment, in keeping
135
+ with the best interests of our community.
136
+
137
+ ## Scope
138
+
139
+ This Code of Conduct applies within all community spaces, and also applies when
140
+ an individual is officially representing the community in public or other
141
+ spaces. Examples of representing our community include using an official email
142
+ address, posting via an official social media account, or acting as an appointed
143
+ representative at an online or offline event.
144
+
145
+ ## Attribution
146
+
147
+ This Code of Conduct is adapted from the Contributor Covenant, version 3.0,
148
+ permanently available at
149
+ [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
150
+
151
+ Contributor Covenant is stewarded by the Organization for Ethical Source and
152
+ licensed under CC BY-SA 4.0. To view a copy of this license, visit
153
+ [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/)
154
+
155
+ For answers to common questions about Contributor Covenant, see the FAQ at
156
+ [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq).
157
+ Translations are provided at
158
+ [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
159
+ Additional enforcement and community guideline resources can be found at
160
+ [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources).
161
+ The enforcement ladder was inspired by the work of
162
+ [Mozilla’s code of conduct team](https://github.com/mozilla/inclusion).
@@ -0,0 +1,68 @@
1
+ # Contributing to {{PACKAGE_NAME}}
2
+
3
+ Thank you for your interest in contributing to our project! This guide will help
4
+ you get started with the development process.
5
+
6
+ ## Development Setup
7
+
8
+ ### Prerequisites
9
+
10
+ Bun installed on your system. If you haven't installed it yet, please refer to
11
+ the
12
+ [installation guide](https://bun.com/docs/installation).
13
+
14
+ ### Getting Started
15
+
16
+ 1. Fork the repository
17
+ 2. Clone your fork:
18
+ `git clone https://github.com/Quadratz-Org/{{PACKAGE_NAME}}.git`
19
+ 3. Navigate to the project directory: `cd {{PACKAGE_NAME}}`
20
+ 4. Install dependencies: `bun install`
21
+ 5. Start development: `bun run dev`
22
+
23
+ ## Development Workflow
24
+
25
+ 1. Create a new branch: `git checkout -b feature/your-feature-name`
26
+ 2. Make your changes
27
+ 3. Fix formatting issues: `bun run fmt`
28
+ 4. Run check: `bun run check`
29
+ 5. Build the project: `bun run build`
30
+ 6. Commit your changes using the conventions below
31
+ 7. Push your branch to your fork
32
+ 8. Open a pull request
33
+
34
+ ## Commit Message Conventions
35
+
36
+ We follow [Conventional Commits](https://www.conventionalcommits.org/) for clear
37
+ and structured commit messages:
38
+
39
+ - `feat:` New features
40
+ - `fix:` Bug fixes
41
+ - `docs:` Documentation changes
42
+ - `style:` Code style changes (formatting, etc.)
43
+ - `refactor:` Code changes that neither fix bugs nor add features
44
+ - `perf:` Performance improvements
45
+ - `test:` Adding or updating tests
46
+ - `chore:` Maintenance tasks, dependencies, etc.
47
+
48
+ ## Pull Request Guidelines
49
+
50
+ 1. Update documentation if needed
51
+ 2. Ensure all tests pass
52
+ 3. Address any feedback from code reviews
53
+ 4. Once approved, your PR will be merged
54
+
55
+ ## Code of Conduct
56
+
57
+ In short, please be respectful and constructive in all interactions within our
58
+ community. More details can be found in
59
+ [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
60
+
61
+ ## Questions?
62
+
63
+ If you have any questions, please
64
+ [open an issue](https://github.com/Quadratz-Org/{{PACKAGE_NAME}}/issues/new) for
65
+ discussion or contact us via email at <quadratz@proton.me> or via Telegram at
66
+ [@quadratz](https://t.me/quadratz).
67
+
68
+ Thank you for contributing to {{PACKAGE_NAME}}!
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quadratz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,55 @@
1
+ # {{PACKAGE_NAME}}
2
+
3
+ [![npm Badge](https://img.shields.io/npm/v/{{PACKAGE_NAME}}?label=&color=050619&style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsbGVkYnk9ImFsM2VyeHB6YnN5YXhjbjE3cnJmeWs1N2I2YTl5eW8iIGNsYXNzPSJjc3MtMW5pMmpzYSI+PHRpdGxlIGlkPSJhbDNlcnhwemJzeWF4Y24xN3JyZnlrNTdiNmE5eXlvIj5ucG08L3RpdGxlPjxwYXRoIGQ9Ik0yNS45NDMgMEgyLjA1N0MuOTIgMCAwIC45MiAwIDIuMDU3djIzLjg4NkMwIDI3LjA4LjkyIDI4IDIuMDU3IDI4aDIzLjg4NkMyNy4wOCAyOCAyOCAyNy4wOCAyOCAyNS45NDNWMi4wNTdDMjggLjkyIDI3LjA4IDAgMjUuOTQzIDB6IiBmaWxsPSIjQ0IwMDAwIj48L3BhdGg+PHBhdGggZD0iTTUuOTY0IDIyLjM2NWg4LjA4MmwuMDEtMTIuMTAzaDQuMDMxbC0uMDEgMTIuMTEzaDQuMDQxbC4wMS0xNi4xNDNMNS45ODUgNi4yMWwtLjAyMSAxNi4xNTR6IiBmaWxsPSIjZmZmIj48L3BhdGg+PC9zdmc+)](https://www.npmjs.com/package/{{PACKAGE_NAME}})
4
+ [![GitHub Badge](https://img.shields.io/badge/Source-050619?style=for-the-badge&logo=github)](https://github.com/Quadratz-Org/{{PACKAGE_NAME}})
5
+
6
+ {{DESCRIPTION}}
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ # Bun
12
+ bun add {{PACKAGE_NAME}}
13
+
14
+ # Deno
15
+ deno add npm:{{PACKAGE_NAME}}
16
+
17
+ # pnpm
18
+ pnpm add {{PACKAGE_NAME}}
19
+
20
+ # npm
21
+ npm install {{PACKAGE_NAME}}
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```ts
27
+ console.log("Halo, dunia!");
28
+ ```
29
+
30
+ ## API
31
+
32
+ This package exports the following:
33
+
34
+ ### `{{PACKAGE_NAME}}`
35
+
36
+ ```ts
37
+ function {{PACKAGE_NAME}}(options?: Options): void;
38
+ ```
39
+
40
+ The main plugin. It receives one optional parameter to configure behavior. See
41
+ the [`Options` section](#options) below for configuration details.
42
+
43
+ ### `Options`
44
+
45
+ ```ts
46
+ type Options = {};
47
+ ```
48
+
49
+ ## Contributing
50
+
51
+ Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
52
+
53
+ ## License
54
+
55
+ [MIT](./LICENSE)
@@ -0,0 +1,19 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import eslint from "@eslint/js";
3
+ import tseslint from "typescript-eslint";
4
+ import prettierConfig from "eslint-config-prettier";
5
+
6
+ export default defineConfig(
7
+ globalIgnores(["./template/**"]),
8
+ eslint.configs.recommended,
9
+ tseslint.configs.strictTypeChecked,
10
+ tseslint.configs.stylisticTypeChecked,
11
+ {
12
+ languageOptions: {
13
+ parserOptions: {
14
+ projectService: true,
15
+ },
16
+ },
17
+ },
18
+ prettierConfig,
19
+ );
@@ -0,0 +1 @@
1
+ console.log("Halo, dunia!");
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "my-package",
3
+ "type": "module",
4
+ "version": "1.0.0-alpha.1",
5
+ "description": "",
6
+ "author": "Quadratz",
7
+ "keywords": [
8
+ ""
9
+ ],
10
+ "license": "MIT",
11
+ "homepage": "https://github.com/Quadratz-Org/my-package#readme",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Quadratz-Org/my-package.git"
15
+ },
16
+ "bugs": "https://github.com/Quadratz-Org/my-package/issues",
17
+ "exports": {
18
+ ".": "./dist/index.mjs",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "types": "./dist/index.d.mts",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "dev": "tsdown --watch",
27
+ "build": "tsdown",
28
+ "test": "bun test",
29
+ "fmt": "prettier . --write",
30
+ "check": "prettier . --check && eslint . && tsc --noEmit && bun test",
31
+ "release": "bumpp --commit --push --tag"
32
+ },
33
+ "devDependencies": {
34
+ "@eslint/js": "^9.39.2",
35
+ "@types/bun": "latest",
36
+ "@types/node": "^25.2.3",
37
+ "bumpp": "^10.4.1",
38
+ "eslint": "^9.39.2",
39
+ "eslint-config-prettier": "^10.1.8",
40
+ "prettier": "3.8.1",
41
+ "tsdown": "^0.20.3",
42
+ "typescript": "^5.9.3",
43
+ "typescript-eslint": "^8.55.0"
44
+ },
45
+ "dependencies": {}
46
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": ["config:recommended"]
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { test, expect } from "bun:test";
2
+
3
+ test("test", () => {
4
+ expect();
5
+ });
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": ["es2023"],
5
+ "moduleDetection": "force",
6
+ "module": "preserve",
7
+ "moduleResolution": "bundler",
8
+ "allowImportingTsExtensions": true,
9
+ "resolveJsonModule": true,
10
+ "types": ["node"],
11
+ "noUnusedLocals": true,
12
+ "declaration": true,
13
+ "isolatedDeclarations": true,
14
+ "emitDeclarationOnly": true,
15
+ "esModuleInterop": true,
16
+ "isolatedModules": true,
17
+ "verbatimModuleSyntax": true,
18
+ // Best practices
19
+ "strict": true,
20
+ "skipLibCheck": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "noUncheckedIndexedAccess": true,
23
+ "noImplicitOverride": true
24
+ },
25
+ "include": ["src"]
26
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ exports: true,
5
+ failOnWarn: true,
6
+ });