chore: 去掉 test 相关及修复移除 src-tauri 导致的构建问题
This commit is contained in:
parent
b2303d81e1
commit
8e40d21aed
|
@ -1,39 +0,0 @@
|
||||||
name: Run Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- "!*"
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- review_requested
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: "yarn"
|
|
||||||
|
|
||||||
- name: Cache node_modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node_modules-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: yarn install
|
|
||||||
|
|
||||||
- name: Run Jest tests
|
|
||||||
run: yarn test:ci
|
|
|
@ -1,128 +0,0 @@
|
||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
We as members, contributors, and leaders pledge to make participation in our
|
|
||||||
community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
||||||
identity and expression, level of experience, education, socio-economic status,
|
|
||||||
nationality, personal appearance, race, religion, or sexual identity
|
|
||||||
and orientation.
|
|
||||||
|
|
||||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
||||||
diverse, inclusive, and healthy community.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to a positive environment for our
|
|
||||||
community include:
|
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
|
||||||
* Giving and gracefully accepting constructive feedback
|
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
||||||
and learning from the experience
|
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
|
||||||
overall community
|
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
|
||||||
advances of any kind
|
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or email
|
|
||||||
address, without their explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
|
||||||
|
|
||||||
Community leaders are responsible for clarifying and enforcing our standards of
|
|
||||||
acceptable behavior and will take appropriate and fair corrective action in
|
|
||||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
||||||
or harmful.
|
|
||||||
|
|
||||||
Community leaders have the right and responsibility to remove, edit, or reject
|
|
||||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
||||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
||||||
decisions when appropriate.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies within all community spaces, and also applies when
|
|
||||||
an individual is officially representing the community in public spaces.
|
|
||||||
Examples of representing our community include using an official e-mail address,
|
|
||||||
posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported to the community leaders responsible for enforcement at
|
|
||||||
flynn.zhang@foxmail.com.
|
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
|
||||||
reporter of any incident.
|
|
||||||
|
|
||||||
## Enforcement Guidelines
|
|
||||||
|
|
||||||
Community leaders will follow these Community Impact Guidelines in determining
|
|
||||||
the consequences for any action they deem in violation of this Code of Conduct:
|
|
||||||
|
|
||||||
### 1. Correction
|
|
||||||
|
|
||||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
||||||
unprofessional or unwelcome in the community.
|
|
||||||
|
|
||||||
**Consequence**: A private, written warning from community leaders, providing
|
|
||||||
clarity around the nature of the violation and an explanation of why the
|
|
||||||
behavior was inappropriate. A public apology may be requested.
|
|
||||||
|
|
||||||
### 2. Warning
|
|
||||||
|
|
||||||
**Community Impact**: A violation through a single incident or series
|
|
||||||
of actions.
|
|
||||||
|
|
||||||
**Consequence**: A warning with consequences for continued behavior. No
|
|
||||||
interaction with the people involved, including unsolicited interaction with
|
|
||||||
those enforcing the Code of Conduct, for a specified period of time. This
|
|
||||||
includes avoiding interactions in community spaces as well as external channels
|
|
||||||
like social media. Violating these terms may lead to a temporary or
|
|
||||||
permanent ban.
|
|
||||||
|
|
||||||
### 3. Temporary Ban
|
|
||||||
|
|
||||||
**Community Impact**: A serious violation of community standards, including
|
|
||||||
sustained inappropriate behavior.
|
|
||||||
|
|
||||||
**Consequence**: A temporary ban from any sort of interaction or public
|
|
||||||
communication with the community for a specified period of time. No public or
|
|
||||||
private interaction with the people involved, including unsolicited interaction
|
|
||||||
with those enforcing the Code of Conduct, is allowed during this period.
|
|
||||||
Violating these terms may lead to a permanent ban.
|
|
||||||
|
|
||||||
### 4. Permanent Ban
|
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
|
||||||
the community.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
||||||
version 2.0, available at
|
|
||||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
||||||
|
|
||||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
||||||
enforcement ladder](https://github.com/mozilla/diversity).
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see the FAQ at
|
|
||||||
https://www.contributor-covenant.org/faq. Translations are available at
|
|
||||||
https://www.contributor-covenant.org/translations.
|
|
|
@ -1,4 +1,4 @@
|
||||||
import tauriConfig from "../../src-tauri/tauri.conf.json";
|
import packageJson from "../../package.json";
|
||||||
import { DEFAULT_INPUT_TEMPLATE } from "../constant";
|
import { DEFAULT_INPUT_TEMPLATE } from "../constant";
|
||||||
|
|
||||||
export const getBuildConfig = () => {
|
export const getBuildConfig = () => {
|
||||||
|
@ -10,7 +10,7 @@ export const getBuildConfig = () => {
|
||||||
|
|
||||||
const buildMode = process.env.BUILD_MODE ?? "standalone";
|
const buildMode = process.env.BUILD_MODE ?? "standalone";
|
||||||
const isApp = !!process.env.BUILD_APP;
|
const isApp = !!process.env.BUILD_APP;
|
||||||
const version = "v" + tauriConfig.package.version;
|
const version = "v" + packageJson.version;
|
||||||
|
|
||||||
const commitInfo = (() => {
|
const commitInfo = (() => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -10,34 +10,4 @@ declare module "*.scss" {
|
||||||
|
|
||||||
declare module "*.svg";
|
declare module "*.svg";
|
||||||
|
|
||||||
declare interface Window {
|
declare interface Window {}
|
||||||
__TAURI__?: {
|
|
||||||
writeText(text: string): Promise<void>;
|
|
||||||
invoke(command: string, payload?: Record<string, unknown>): Promise<any>;
|
|
||||||
dialog: {
|
|
||||||
save(options?: Record<string, unknown>): Promise<string | null>;
|
|
||||||
};
|
|
||||||
fs: {
|
|
||||||
writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
|
|
||||||
writeTextFile(path: string, data: string): Promise<void>;
|
|
||||||
};
|
|
||||||
notification: {
|
|
||||||
requestPermission(): Promise<Permission>;
|
|
||||||
isPermissionGranted(): Promise<boolean>;
|
|
||||||
sendNotification(options: string | Options): void;
|
|
||||||
};
|
|
||||||
updater: {
|
|
||||||
checkUpdate(): Promise<UpdateResult>;
|
|
||||||
installUpdate(): Promise<void>;
|
|
||||||
onUpdaterEvent(
|
|
||||||
handler: (status: UpdateStatusResult) => void,
|
|
||||||
): Promise<UnlistenFn>;
|
|
||||||
};
|
|
||||||
http: {
|
|
||||||
fetch<T>(
|
|
||||||
url: string,
|
|
||||||
options?: Record<string, unknown>,
|
|
||||||
): Promise<Response<T>>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
import type { Config } from "jest";
|
|
||||||
import nextJest from "next/jest.js";
|
|
||||||
|
|
||||||
const createJestConfig = nextJest({
|
|
||||||
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
|
|
||||||
dir: "./",
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add any custom config to be passed to Jest
|
|
||||||
const config: Config = {
|
|
||||||
coverageProvider: "v8",
|
|
||||||
testEnvironment: "jsdom",
|
|
||||||
testMatch: ["**/*.test.js", "**/*.test.ts", "**/*.test.jsx", "**/*.test.tsx"],
|
|
||||||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
|
||||||
moduleNameMapper: {
|
|
||||||
"^@/(.*)$": "<rootDir>/$1",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
|
|
||||||
export default createJestConfig(config);
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Learn more: https://github.com/testing-library/jest-dom
|
|
||||||
import "@testing-library/jest-dom";
|
|
||||||
|
|
||||||
global.fetch = jest.fn(() =>
|
|
||||||
Promise.resolve({
|
|
||||||
ok: true,
|
|
||||||
status: 200,
|
|
||||||
json: () => Promise.resolve({}),
|
|
||||||
headers: new Headers(),
|
|
||||||
redirected: false,
|
|
||||||
statusText: "OK",
|
|
||||||
type: "basic",
|
|
||||||
url: "",
|
|
||||||
clone: function () {
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
body: null,
|
|
||||||
bodyUsed: false,
|
|
||||||
arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),
|
|
||||||
blob: () => Promise.resolve(new Blob()),
|
|
||||||
formData: () => Promise.resolve(new FormData()),
|
|
||||||
text: () => Promise.resolve(""),
|
|
||||||
}),
|
|
||||||
);
|
|
15
package.json
15
package.json
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "nextchat",
|
"name": "nextchat",
|
||||||
"private": false,
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
"license": "mit",
|
"license": "mit",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"mask": "npx tsx app/masks/build.ts",
|
"mask": "npx tsx app/masks/build.ts",
|
||||||
|
@ -11,13 +12,9 @@
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"export": "yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build",
|
"export": "yarn mask && cross-env BUILD_MODE=export BUILD_APP=1 next build",
|
||||||
"export:dev": "concurrently -r \"yarn mask:watch\" \"cross-env BUILD_MODE=export BUILD_APP=1 next dev\"",
|
"export:dev": "concurrently -r \"yarn mask:watch\" \"cross-env BUILD_MODE=export BUILD_APP=1 next dev\"",
|
||||||
"app:dev": "concurrently -r \"yarn mask:watch\" \"yarn tauri dev\"",
|
|
||||||
"app:build": "yarn mask && yarn tauri build",
|
|
||||||
"prompts": "node ./scripts/fetch-prompts.mjs",
|
"prompts": "node ./scripts/fetch-prompts.mjs",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev",
|
"proxy-dev": "sh ./scripts/init-proxy.sh && proxychains -f ./scripts/proxychains.conf yarn dev"
|
||||||
"test": "jest --watch",
|
|
||||||
"test:ci": "jest --ci"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortaine/fetch-event-source": "^3.0.6",
|
"@fortaine/fetch-event-source": "^3.0.6",
|
||||||
|
@ -56,12 +53,8 @@
|
||||||
"rt-client": "https://github.com/Azure-Samples/aoai-realtime-audio-sdk/releases/download/js/v0.5.0/rt-client-0.5.0.tgz"
|
"rt-client": "https://github.com/Azure-Samples/aoai-realtime-audio-sdk/releases/download/js/v0.5.0/rt-client-0.5.0.tgz"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/api": "^1.6.0",
|
|
||||||
"@tauri-apps/cli": "1.5.11",
|
|
||||||
"@testing-library/dom": "^10.4.0",
|
"@testing-library/dom": "^10.4.0",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
|
||||||
"@testing-library/react": "^16.0.1",
|
"@testing-library/react": "^16.0.1",
|
||||||
"@types/jest": "^29.5.14",
|
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^20.11.30",
|
"@types/node": "^20.11.30",
|
||||||
|
@ -77,8 +70,6 @@
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"eslint-plugin-unused-imports": "^3.2.0",
|
"eslint-plugin-unused-imports": "^3.2.0",
|
||||||
"husky": "^8.0.0",
|
"husky": "^8.0.0",
|
||||||
"jest": "^29.7.0",
|
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
|
||||||
"lint-staged": "^13.2.2",
|
"lint-staged": "^13.2.2",
|
||||||
"prettier": "^3.0.2",
|
"prettier": "^3.0.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Set the pipefail option.
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Get the Vercel API endpoints.
|
|
||||||
GET_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v6/deployments"
|
|
||||||
DELETE_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v13/deployments"
|
|
||||||
|
|
||||||
# Create a list of deployments.
|
|
||||||
deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID&teamId=$VERCEL_ORG_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
|
|
||||||
#deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID" -H "Authorization: Bearer $VERCEL_TOKEN ")
|
|
||||||
|
|
||||||
# Filter the deployments list by meta.base_hash === meta tag.
|
|
||||||
filtered_deployments=$(echo -E $deployments | jq --arg META_TAG "$META_TAG" '[.deployments[] | select(.meta.base_hash | type == "string" and contains($META_TAG)) | .uid] | join(",")')
|
|
||||||
filtered_deployments="${filtered_deployments//\"/}" # Remove double quotes
|
|
||||||
|
|
||||||
# Clears the values from filtered_deployments
|
|
||||||
IFS=',' read -ra values <<<"$filtered_deployments"
|
|
||||||
|
|
||||||
echo "META_TAG ${META_TAG}"
|
|
||||||
echo "Filtered deployments ${filtered_deployments}"
|
|
||||||
|
|
||||||
# Iterate over the filtered deployments list.
|
|
||||||
for uid in "${values[@]}"; do
|
|
||||||
echo "Deleting ${uid}"
|
|
||||||
|
|
||||||
delete_url="${DELETE_DEPLOYMENTS_ENDPOINT}/${uid}?teamId=${VERCEL_ORG_ID}"
|
|
||||||
echo $delete_url
|
|
||||||
|
|
||||||
# Make DELETE a request to the /v13/deployments/{id} endpoint.
|
|
||||||
curl -X DELETE $delete_url -H "Authorization: Bearer $VERCEL_TOKEN"
|
|
||||||
|
|
||||||
echo "Deleted!"
|
|
||||||
done
|
|
|
@ -1,31 +0,0 @@
|
||||||
import { getModelProvider } from "../app/utils/model";
|
|
||||||
|
|
||||||
describe("getModelProvider", () => {
|
|
||||||
test("should return model and provider when input contains '@'", () => {
|
|
||||||
const input = "model@provider";
|
|
||||||
const [model, provider] = getModelProvider(input);
|
|
||||||
expect(model).toBe("model");
|
|
||||||
expect(provider).toBe("provider");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should return model and undefined provider when input does not contain '@'", () => {
|
|
||||||
const input = "model";
|
|
||||||
const [model, provider] = getModelProvider(input);
|
|
||||||
expect(model).toBe("model");
|
|
||||||
expect(provider).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should handle multiple '@' characters correctly", () => {
|
|
||||||
const input = "model@provider@extra";
|
|
||||||
const [model, provider] = getModelProvider(input);
|
|
||||||
expect(model).toBe("model@provider");
|
|
||||||
expect(provider).toBe("extra");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("should return empty strings when input is empty", () => {
|
|
||||||
const input = "";
|
|
||||||
const [model, provider] = getModelProvider(input);
|
|
||||||
expect(model).toBe("");
|
|
||||||
expect(provider).toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,9 +0,0 @@
|
||||||
function sum(a: number, b: number) {
|
|
||||||
return a + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("sum module", () => {
|
|
||||||
test("adds 1 + 2 to equal 3", () => {
|
|
||||||
expect(sum(1, 2)).toBe(3);
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue