Skip to content

Commit bccaa0c

Browse files
committed
Push libs
1 parent 85a8e2f commit bccaa0c

135 files changed

Lines changed: 7699 additions & 146 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish-registry.yml

Lines changed: 115 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -11,118 +11,118 @@ permissions:
1111
contents: write
1212

1313
jobs:
14-
publish:
15-
runs-on: ubuntu-latest
16-
env:
17-
TZ: Europe/Prague
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
# Set to 'true' to allow the workflow to push updates to the registry branch
20-
PUSH_REGISTRY: 'true'
21-
# Set to 'true' to override whole branch with generated content (keeps just one commit history)
22-
OVERRIDE_BRANCH: 'false'
23-
# Default registry repo URL; derived from the current repository
24-
REGISTRY_GIT_URL: https://github.com/${{ github.repository }}.git
25-
steps:
26-
- name: Checkout repository
27-
uses: actions/checkout@v5
28-
with:
29-
fetch-depth: 0 # Full history for tags
30-
31-
- name: Set up Node.js
32-
uses: actions/setup-node@v3
33-
with:
34-
node-version: '24.x'
35-
36-
- name: Setup pnpm
37-
uses: pnpm/action-setup@v3
38-
with:
39-
version: latest
40-
41-
- name: Get pnpm store directory
42-
id: pnpm-cache
43-
shell: bash
44-
run: |
45-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46-
47-
- name: Setup pnpm cache
48-
uses: actions/cache@v4
49-
with:
50-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52-
restore-keys: |
53-
${{ runner.os }}-pnpm-store-
54-
55-
- name: Checkout Jaculus-tools
56-
run: |
57-
git clone https://github.com/jaculus-org/Jaculus-tools.git --branch feat/lib ../Jaculus-tools
58-
cd ../Jaculus-tools
59-
pnpm install
60-
pnpm build
61-
62-
- name: Clone and Build Registry Tool
63-
run: |
64-
git clone https://github.com/jaculus-org/Jaculus-registry.git ../jaculus-registry
65-
cd ../jaculus-registry
66-
pnpm install
67-
# Link local jaculus packages (if any) from the previously cloned Jaculus-tools
68-
for pkg in ../Jaculus-tools/packages/*; do
69-
if [ -f "$pkg/package.json" ]; then
70-
echo "Linking local package: $pkg"
71-
pnpm link "$pkg" || true
72-
fi
73-
done
74-
pnpm build || true
75-
pnpm link || true
76-
77-
- name: Clone target registry repo (dist)
78-
run: |
79-
git clone $REGISTRY_GIT_URL ../jaculus-registry-dist
80-
cd ../jaculus-registry-dist
81-
git fetch --all
82-
git checkout registry || git checkout -b registry
83-
cd -
84-
85-
- name: Prepare filtered registry source and Generate registry
86-
run: |
87-
# Use the previously cloned dist repo as the destination
88-
jaculus-registry generate ./ ../jaculus-registry-dist
89-
90-
- name: Copy dist to accessible location
91-
run: |
92-
mkdir -p jaculus-registry-artifact
93-
cp -r ../jaculus-registry-dist/* jaculus-registry-artifact/
94-
95-
- name: Upload registry dist artifact
96-
uses: actions/upload-artifact@v4
97-
with:
98-
name: registry-dist
99-
path: jaculus-registry-artifact/
100-
101-
- name: Push registry branch (optional)
102-
if: ${{ env.PUSH_REGISTRY == 'true' && github.event_name == 'push' }}
103-
run: |
104-
set -euo pipefail
105-
cd ../jaculus-registry-dist
106-
107-
# Configure git (email is optional - GitHub Actions provides defaults)
108-
git config user.name "github-actions[bot]"
109-
git config user.email "github-actions[bot]@users.noreply.github.com"
110-
111-
# Set up authentication
112-
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
113-
git checkout registry || git checkout -b registry
114-
115-
# If OVERRIDE_BRANCH is enabled, reset to single commit, otherwise just add commit
116-
if [ "${{ env.OVERRIDE_BRANCH }}" = "true" ]; then
117-
# Remove all history and keep only current state
118-
git add -A
119-
git commit --allow-empty -m "Update registry via GitHub Actions (${GITHUB_SHA})"
120-
git reset --soft $(git rev-list --max-parents=0 HEAD)
121-
git commit --amend -m "Registry build from $(git rev-parse --short HEAD:../Jaculus-libraries/.git/HEAD || echo 'main')"
122-
git push --force origin registry
123-
else
124-
# Regular commit and push
125-
git add -A
126-
git commit -m "Update registry via GitHub Actions (${GITHUB_SHA})" || echo "No changes to commit"
127-
git push origin registry
128-
fi
14+
publish:
15+
runs-on: ubuntu-latest
16+
env:
17+
TZ: Europe/Prague
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
# Set to 'true' to allow the workflow to push updates to the registry branch
20+
PUSH_REGISTRY: "true"
21+
# Set to 'true' to override whole branch with generated content (keeps just one commit history)
22+
OVERRIDE_BRANCH: "false"
23+
# Default registry repo URL; derived from the current repository
24+
REGISTRY_GIT_URL: https://github.com/${{ github.repository }}.git
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v5
28+
with:
29+
fetch-depth: 0 # Full history for tags
30+
31+
- name: Set up Node.js
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: "24.x"
35+
36+
- name: Setup pnpm
37+
uses: pnpm/action-setup@v3
38+
with:
39+
version: latest
40+
41+
- name: Get pnpm store directory
42+
id: pnpm-cache
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46+
47+
- name: Setup pnpm cache
48+
uses: actions/cache@v4
49+
with:
50+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
54+
55+
- name: Checkout Jaculus-tools
56+
run: |
57+
git clone https://github.com/jaculus-org/Jaculus-tools.git --branch feat/lib ../Jaculus-tools
58+
cd ../Jaculus-tools
59+
pnpm install
60+
pnpm build
61+
62+
- name: Clone and Build Registry Tool
63+
run: |
64+
git clone https://github.com/jaculus-org/Jaculus-registry.git ../jaculus-registry
65+
cd ../jaculus-registry
66+
pnpm install
67+
# Link local jaculus packages (if any) from the previously cloned Jaculus-tools
68+
for pkg in ../Jaculus-tools/packages/*; do
69+
if [ -f "$pkg/package.json" ]; then
70+
echo "Linking local package: $pkg"
71+
pnpm link "$pkg" || true
72+
fi
73+
done
74+
pnpm build || true
75+
pnpm link || true
76+
77+
- name: Clone target registry repo (dist)
78+
run: |
79+
git clone $REGISTRY_GIT_URL ../jaculus-registry-dist
80+
cd ../jaculus-registry-dist
81+
git fetch --all
82+
git checkout registry || git checkout -b registry
83+
cd -
84+
85+
- name: Prepare filtered registry source and Generate registry
86+
run: |
87+
# Use the previously cloned dist repo as the destination
88+
jaculus-registry generate ./ ../jaculus-registry-dist
89+
90+
- name: Copy dist to accessible location
91+
run: |
92+
mkdir -p jaculus-registry-artifact
93+
cp -r ../jaculus-registry-dist/* jaculus-registry-artifact/
94+
95+
- name: Upload registry dist artifact
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: registry-dist
99+
path: jaculus-registry-artifact/
100+
101+
- name: Push registry branch (optional)
102+
if: ${{ env.PUSH_REGISTRY == 'true' && github.event_name == 'push' }}
103+
run: |
104+
set -euo pipefail
105+
cd ../jaculus-registry-dist
106+
107+
# Configure git (email is optional - GitHub Actions provides defaults)
108+
git config user.name "github-actions[bot]"
109+
git config user.email "github-actions[bot]@users.noreply.github.com"
110+
111+
# Set up authentication
112+
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
113+
git checkout registry || git checkout -b registry
114+
115+
# If OVERRIDE_BRANCH is enabled, reset to single commit, otherwise just add commit
116+
if [ "${{ env.OVERRIDE_BRANCH }}" = "true" ]; then
117+
# Remove all history and keep only current state
118+
git add -A
119+
git commit --allow-empty -m "Update registry via GitHub Actions (${GITHUB_SHA})"
120+
git reset --soft $(git rev-list --max-parents=0 HEAD)
121+
git commit --amend -m "Registry build from $(git rev-parse --short HEAD:../Jaculus-libraries/.git/HEAD || echo 'main')"
122+
git push --force origin registry
123+
else
124+
# Regular commit and push
125+
git add -A
126+
git commit -m "Update registry via GitHub Actions (${GITHUB_SHA})" || echo "No changes to commit"
127+
git push origin registry
128+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
dist
33

44
.jaculus-libs-dist/
5+
.DS_Store

@types/jaculus/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

@types/jaculus/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Empty Library Template
2+
3+
This is a minimal template for creating a new library in TypeScript. It includes the basic structure and files needed to get started with library development.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"version": "1.0.0",
3+
"author": "Jakub Andrysek",
4+
"github": "JakubAndrysek",
5+
"license": "MIT",
6+
7+
"category": "adc",
8+
"name": "%T%",
9+
"description": "%T%",
10+
"docs": "/docs/blocks/adc",
11+
"colour": "#9C27B0",
12+
"icon": "AudioWaveform",
13+
"priority": 105,
14+
"libraries": ["import * as adc from \"adc\";"],
15+
"contents": [
16+
{
17+
"kind": "block",
18+
"type": "adc_configure",
19+
"message0": "%T%",
20+
"args0": [
21+
{
22+
"type": "input_value",
23+
"name": "PIN",
24+
"check": "Number"
25+
},
26+
{
27+
"type": "field_dropdown",
28+
"name": "ATTEN",
29+
"options": [
30+
["0 dB", "adc.Attenuation.Db0"],
31+
["2.5 dB", "adc.Attenuation.Db2_5"],
32+
["6 dB", "adc.Attenuation.Db6"],
33+
["11 dB", "adc.Attenuation.Db11"]
34+
]
35+
}
36+
],
37+
"inputs": {
38+
"PIN": {
39+
"shadow": {
40+
"type": "math_number",
41+
"fields": {
42+
"NUM": 42
43+
}
44+
}
45+
}
46+
},
47+
"tooltip": "%T%",
48+
"code": "adc.configure($[PIN], $[ATTEN]);",
49+
"previousStatement": null,
50+
"nextStatement": null
51+
},
52+
{
53+
"kind": "block",
54+
"type": "adc_read",
55+
"message0": "%T%",
56+
"args0": [
57+
{
58+
"type": "input_value",
59+
"name": "PIN",
60+
"check": "Number"
61+
}
62+
],
63+
"inputs": {
64+
"PIN": {
65+
"shadow": {
66+
"type": "math_number",
67+
"fields": {
68+
"NUM": 42
69+
}
70+
}
71+
}
72+
},
73+
"output": "Number",
74+
"tooltip": "%T%",
75+
"code": "adc.read($[PIN])"
76+
}
77+
]
78+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": "1.0.0",
3+
"author": "Jakub Andrysek",
4+
"github": "JakubAndrysek",
5+
"license": "MIT",
6+
7+
"category": "control",
8+
"name": "%T%",
9+
"description": "%T%",
10+
"docs": "/docs/blocks/control",
11+
"colour": "#9C27B0",
12+
"icon": "Bolt",
13+
"priority": 125,
14+
"libraries": ["import * as adc from \"adc\";"],
15+
"contents": [
16+
{
17+
"kind": "block",
18+
"type": "control_exit",
19+
"message0": "%T%",
20+
"args0": [
21+
{
22+
"type": "input_value",
23+
"name": "EXIT_CODE",
24+
"check": "Number",
25+
"shadow": {
26+
"type": "math_number",
27+
"fields": {
28+
"NUM": 0
29+
}
30+
}
31+
}
32+
],
33+
"previousStatement": null,
34+
"nextStatement": null,
35+
"tooltip": "%T%",
36+
"code": "exit($[EXIT_CODE]);"
37+
},
38+
{
39+
"kind": "block",
40+
"type": "control_dateNow",
41+
"message0": "%T%",
42+
"output": "Number",
43+
"tooltip": "%T%",
44+
"code": "Date.now()"
45+
}
46+
]
47+
}

0 commit comments

Comments
 (0)