-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eb3d1c
commit f51b353
Showing
9 changed files
with
8,011 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Branch Release | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
branch_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' # Specify the Node.js version you want to use | ||
|
||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Set Version from Branch | ||
run: | | ||
BRANCH_NAME=${GITHUB_REF#refs/heads/} | ||
SHORT_SHA=$(git rev-parse --short HEAD) | ||
BASE_VERSION="0.1.0" # Define a base version | ||
VERSION="${BASE_VERSION}-${BRANCH_NAME}-${SHORT_SHA}" | ||
yarn version --new-version $VERSION --no-git-tag-version | ||
- name: Configure NPM Authentication | ||
run: | | ||
echo "@bitte-ai:registry=https://registry.npmjs.org/" > ~/.npmrc | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | ||
- name: Publish with npm | ||
if: ${{ github.ref_name != 'main'}} | ||
run: yarn publish --access public --tag beta | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "my-vue-app", | ||
"name": "bitte-ai-playground", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import express from "express"; | ||
import { Server } from "http"; | ||
import { createProxyMiddleware } from "http-proxy-middleware"; | ||
import path from "path"; | ||
import { createServer } from "vite"; | ||
|
||
interface DevServerConfig { | ||
port: number; | ||
apiPort: number; | ||
define: Record<string, unknown>; | ||
} | ||
|
||
export async function startDevServer(config: DevServerConfig): Promise<Server> { | ||
const app = express(); | ||
|
||
// API proxy setup | ||
app.use("/api", createProxyMiddleware({ | ||
target: `http://localhost:${config.apiPort}`, | ||
changeOrigin: true, | ||
pathRewrite: { | ||
"^/api": "" | ||
} | ||
})); | ||
|
||
// Create Vite server | ||
const vite = await createServer({ | ||
root: path.resolve(process.cwd(), "playground"), | ||
server: { | ||
middlewareMode: true, | ||
hmr: { | ||
port: config.port + 1 | ||
} | ||
}, | ||
define: config.define | ||
}); | ||
|
||
// Use Vite's middleware | ||
app.use(vite.middlewares); | ||
|
||
return new Promise((resolve) => { | ||
const server = app.listen(config.port, () => { | ||
console.log(`Development server running at http://localhost:${config.port}`); | ||
resolve(server); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.