Skip to content

Commit ac1c057

Browse files
authored
Merge pull request #2 from martian56/vite-react-support
[FEAT] Add support for Vite/React
2 parents 431dcd7 + 5969b31 commit ac1c057

File tree

17 files changed

+2560
-21
lines changed

17 files changed

+2560
-21
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish npm Package to npm
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Install dependencies
26+
working-directory: ./ufazien-cli-js
27+
run: npm ci
28+
29+
- name: Build package
30+
working-directory: ./ufazien-cli-js
31+
run: npm run build
32+
33+
- name: Publish to npm
34+
working-directory: ./ufazien-cli-js
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
run: npm publish --access public
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish Python Package to PyPI
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.12'
23+
24+
- name: Install build dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build twine
28+
29+
- name: Build package
30+
working-directory: ./ufazien-cli-py
31+
run: |
32+
python -m build
33+
34+
- name: Publish to PyPI
35+
working-directory: ./ufazien-cli-py
36+
env:
37+
TWINE_USERNAME: __token__
38+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
39+
run: |
40+
python -m twine upload dist/*

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 0.1.0)'
11+
required: true
12+
type: string
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Get version from tag or input
27+
id: get_version
28+
run: |
29+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
30+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
31+
echo "tag=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
32+
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
33+
VERSION=${GITHUB_REF#refs/tags/v}
34+
echo "version=$VERSION" >> $GITHUB_OUTPUT
35+
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Get package versions
39+
id: get_package_versions
40+
run: |
41+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/* ]]; then
42+
# Extract versions from package files
43+
PYTHON_VERSION=$(grep -E '^version\s*=' ufazien-cli-py/pyproject.toml | sed -E 's/.*version\s*=\s*"([^"]+)".*/\1/' | sed -E 's/.*version\s*=\s*([0-9.]+).*/\1/')
44+
NPM_VERSION=$(grep -E '"version"' ufazien-cli-js/package.json | head -1 | sed -E 's/.*"version"\s*:\s*"([^"]+)".*/\1/')
45+
echo "python_version=$PYTHON_VERSION" >> $GITHUB_OUTPUT
46+
echo "npm_version=$NPM_VERSION" >> $GITHUB_OUTPUT
47+
else
48+
echo "python_version=${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT
49+
echo "npm_version=${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Create Release
53+
uses: softprops/action-gh-release@v1
54+
with:
55+
tag_name: ${{ steps.get_version.outputs.tag }}
56+
name: Release ${{ steps.get_version.outputs.tag }}
57+
body: |
58+
## Changes in ${{ steps.get_version.outputs.tag }}
59+
60+
### Python Package
61+
- Version: ${{ steps.get_package_versions.outputs.python_version }}
62+
- Install: `pip install ufazien-cli==${{ steps.get_package_versions.outputs.python_version }}`
63+
64+
### npm Package
65+
- Version: ${{ steps.get_package_versions.outputs.npm_version }}
66+
- Install: `npm install -g ufazien-cli@${{ steps.get_package_versions.outputs.npm_version }}`
67+
68+
## Installation
69+
70+
**Python:**
71+
```bash
72+
pip install ufazien-cli
73+
```
74+
75+
**Node.js:**
76+
```bash
77+
npm install -g ufazien-cli
78+
```
79+
draft: false
80+
prerelease: false
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test npm Package
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- 'ufazien-cli-js/**'
8+
- '.github/workflows/test_npm_package.yml'
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Install dependencies
24+
working-directory: ./ufazien-cli-js
25+
run: npm ci
26+
27+
- name: Build package
28+
working-directory: ./ufazien-cli-js
29+
run: npm run build
30+
31+
- name: Test package installation
32+
working-directory: ./ufazien-cli-js
33+
shell: bash
34+
run: |
35+
npm pack
36+
PACKAGE_FILE=$(ls ufazien-cli-*.tgz 2>/dev/null | head -1)
37+
if [ -n "$PACKAGE_FILE" ]; then
38+
npm install -g "$PACKAGE_FILE"
39+
else
40+
echo "Package file not found"
41+
exit 1
42+
fi
43+
44+
- name: Verify CLI command
45+
run: |
46+
ufazienjs --help || ufazienjs -V
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test Python Package
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- 'ufazien-cli-py/**'
8+
- '.github/workflows/test_python_pkg.yml'
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install dependencies
24+
working-directory: ./ufazien-cli-py
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e .
28+
29+
- name: Test package installation
30+
working-directory: ./ufazien-cli-py
31+
run: |
32+
python -m pip install build
33+
python -m build
34+
pip install dist/*.whl
35+
36+
- name: Verify CLI command
37+
run: |
38+
ufazien --help

ufazien-cli-js/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Dependencies
22
node_modules/
3-
package-lock.json
43
yarn.lock
54
pnpm-lock.yaml
65

76
# Build output
87
dist/
8+
test/
99
*.tsbuildinfo
1010

1111
# Environment

0 commit comments

Comments
 (0)