@coloop-ai/create-package 0.1.0
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 +33 -0
- package/bin/create-package +70 -0
- package/package.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @coloop-ai/create-package
|
|
2
|
+
|
|
3
|
+
Scaffold a new @coloop-ai TypeScript package from the [template](https://github.com/Genei-Ltd/ts-package-template).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun create @coloop-ai/package my-cool-lib "A really cool library"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @coloop-ai/create-package my-cool-lib "A really cool library"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- [Bun](https://bun.sh)
|
|
20
|
+
- [GitHub CLI](https://cli.github.com) (`gh auth login`)
|
|
21
|
+
- Write access to the [Genei-Ltd](https://github.com/Genei-Ltd) GitHub org
|
|
22
|
+
|
|
23
|
+
## What it does
|
|
24
|
+
|
|
25
|
+
1. Creates a new GitHub repo from the [ts-package-template](https://github.com/Genei-Ltd/ts-package-template)
|
|
26
|
+
2. Replaces template placeholders with your package name and description
|
|
27
|
+
3. Installs dependencies
|
|
28
|
+
4. Builds the package (generates `exports` field via tsdown)
|
|
29
|
+
5. Makes an initial commit and pushes
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# ── @coloop-ai/create-package ────────────────────────────────────
|
|
5
|
+
# Scaffolds a new @coloop-ai TypeScript package from the template.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# bun create @coloop-ai/package <name> ["description"]
|
|
9
|
+
# npx @coloop-ai/create-package <name> ["description"]
|
|
10
|
+
#
|
|
11
|
+
# Example:
|
|
12
|
+
# bun create @coloop-ai/package my-cool-lib "A really cool library"
|
|
13
|
+
# ──────────────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
TEMPLATE_REPO="Genei-Ltd/ts-package-template"
|
|
16
|
+
GITHUB_ORG="Genei-Ltd"
|
|
17
|
+
|
|
18
|
+
# ── Parse arguments ───────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
if [ $# -lt 1 ]; then
|
|
21
|
+
echo "Usage: bun create @coloop-ai/package <name> [\"description\"]"
|
|
22
|
+
echo ""
|
|
23
|
+
echo "Example: bun create @coloop-ai/package my-cool-lib \"A really cool library\""
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
PACKAGE_NAME="$1"
|
|
28
|
+
DESCRIPTION="${2:-A TypeScript package published to @coloop-ai}"
|
|
29
|
+
|
|
30
|
+
# ── Preflight checks ─────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
for cmd in gh git bun; do
|
|
33
|
+
if ! command -v "$cmd" &> /dev/null; then
|
|
34
|
+
echo "Error: '${cmd}' is required but not installed."
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
done
|
|
38
|
+
|
|
39
|
+
if ! gh auth status &> /dev/null; then
|
|
40
|
+
echo "Error: GitHub CLI is not authenticated. Run 'gh auth login' first."
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
if [ -d "$PACKAGE_NAME" ]; then
|
|
45
|
+
echo "Error: Directory '${PACKAGE_NAME}' already exists."
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# ── Create repo from template ────────────────────────────────────
|
|
50
|
+
|
|
51
|
+
echo "Creating ${GITHUB_ORG}/${PACKAGE_NAME} from template..."
|
|
52
|
+
gh repo create "${GITHUB_ORG}/${PACKAGE_NAME}" \
|
|
53
|
+
--template "$TEMPLATE_REPO" \
|
|
54
|
+
--clone \
|
|
55
|
+
--public
|
|
56
|
+
|
|
57
|
+
cd "$PACKAGE_NAME"
|
|
58
|
+
|
|
59
|
+
# ── Run init.sh ──────────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
./init.sh "$PACKAGE_NAME" "$DESCRIPTION"
|
|
62
|
+
|
|
63
|
+
# ── Push ──────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
echo "Pushing to origin..."
|
|
66
|
+
git push -u origin main --force
|
|
67
|
+
|
|
68
|
+
echo ""
|
|
69
|
+
echo "Your package @coloop-ai/${PACKAGE_NAME} is live at:"
|
|
70
|
+
echo " https://github.com/${GITHUB_ORG}/${PACKAGE_NAME}"
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@coloop-ai/create-package",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Scaffold a new @coloop-ai TypeScript package from the template.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Genei-Ltd/create-package.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/Genei-Ltd/create-package/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/Genei-Ltd/create-package#readme",
|
|
14
|
+
"bin": "./bin/create-package",
|
|
15
|
+
"files": [
|
|
16
|
+
"bin"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.0.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
24
|
+
}
|