Feature/devcontv2 (#1622)

* Updated apt-packages source for devcontainer

Switched the devcontainer's package source to a different repository to
align with updated dependencies and package availability. The previous
source from 'rocker-org' is replaced with 'devcontainers-contrib', which
may offer more recent or relevant development tools.

* Subject: Centralize prettier ignores and refine
config

Body:
Centralized all prettier ignore rules by removing individual
`.prettierignore` files in subprojects and updating the root
`.prettierignore` to include previously ignored patterns, ensuring
consistency across the workspace. Additionally, the prettier
configuration was refined by making the file pattern for `.config.js`
files consistent and adjusting quote styles for better readability. All
lint scripts across the project were updated to respect the centralized
ignore path, enhancing maintainability.

The consolidation simplifies the process of managing ignore rules as the
project scales, ensuring developers can focus on writing code without
worrying about divergent formatting standards. These changes also align
with introducing comprehensive linting across multiple environments to
keep the codebase clean and consistent.

This adjustment is a foundational step towards a more streamlined and
unified code base, making it easier for new contributors to adhere to
established coding standards and reducing the cognitive load associated
with managing multiple configuration files across the project.

* unset package json changes

---------

Co-authored-by: Francisco Bischoff <franzbischoff@gmail.com>
Co-authored-by: Francisco Bischoff <984592+franzbischoff@users.noreply.github.com>
This commit is contained in:
Timothy Carambat 2024-06-07 03:50:42 +08:00 committed by GitHub
parent d29292ebd2
commit 98cef508a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 21 additions and 29 deletions

View File

@ -22,7 +22,7 @@
// Terraform support // Terraform support
"ghcr.io/devcontainers/features/terraform:1": {}, "ghcr.io/devcontainers/features/terraform:1": {},
// Just a wrap to install needed packages // Just a wrap to install needed packages
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { "ghcr.io/devcontainers-contrib/features/apt-packages:1": {
// Dependencies copied from ../docker/Dockerfile plus some dev stuff // Dependencies copied from ../docker/Dockerfile plus some dev stuff
"packages": [ "packages": [
"build-essential", "build-essential",

View File

@ -10,3 +10,7 @@ frontend/bundleinspector.html
#server #server
server/swagger/openapi.json server/swagger/openapi.json
#embed
**/static/**
embed/src/utils/chat/hljs.js

View File

@ -17,7 +17,7 @@
} }
}, },
{ {
"files": "*.config.js", "files": ["*.config.js"],
"options": { "options": {
"semi": false, "semi": false,
"parser": "flow", "parser": "flow",

View File

@ -12,7 +12,7 @@
"scripts": { "scripts": {
"dev": "NODE_ENV=development nodemon --ignore hotdir --ignore storage --trace-warnings index.js", "dev": "NODE_ENV=development nodemon --ignore hotdir --ignore storage --trace-warnings index.js",
"start": "NODE_ENV=production node index.js", "start": "NODE_ENV=production node index.js",
"lint": "yarn prettier --write ./processSingleFile ./processLink ./utils index.js" "lint": "yarn prettier --ignore-path ../.prettierignore --write ./processSingleFile ./processLink ./utils index.js"
}, },
"dependencies": { "dependencies": {
"@googleapis/youtube": "^9.0.0", "@googleapis/youtube": "^9.0.0",

View File

@ -1,9 +0,0 @@
# defaults
**/.git
**/.svn
**/.hg
**/node_modules
**/dist
**/static/**
src/utils/chat/hljs.js

View File

@ -4,9 +4,7 @@
"target": "esnext", "target": "esnext",
"jsx": "react", "jsx": "react",
"paths": { "paths": {
"@/*": [ "@/*": ["./src/*"],
"./src/*" },
], },
}
}
} }

View File

@ -1,6 +1,7 @@
{ {
"name": "anythingllm-embedded-chat", "name": "anythingllm-embedded-chat",
"private": false, "private": false,
"license": "MIT",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "nodemon -e js,jsx,css --watch src --exec \"yarn run dev:preview\"", "dev": "nodemon -e js,jsx,css --watch src --exec \"yarn run dev:preview\"",
@ -8,7 +9,7 @@
"dev:build": "vite build && cat src/static/tailwind@3.4.1.js >> dist/anythingllm-chat-widget.js", "dev:build": "vite build && cat src/static/tailwind@3.4.1.js >> dist/anythingllm-chat-widget.js",
"build": "vite build && cat src/static/tailwind@3.4.1.js >> dist/anythingllm-chat-widget.js && npx terser --compress -o dist/anythingllm-chat-widget.min.js -- dist/anythingllm-chat-widget.js", "build": "vite build && cat src/static/tailwind@3.4.1.js >> dist/anythingllm-chat-widget.js && npx terser --compress -o dist/anythingllm-chat-widget.min.js -- dist/anythingllm-chat-widget.js",
"build:publish": "yarn build && mkdir -p ../frontend/public/embed && cp -r dist/anythingllm-chat-widget.min.js ../frontend/public/embed/anythingllm-chat-widget.min.js", "build:publish": "yarn build && mkdir -p ../frontend/public/embed && cp -r dist/anythingllm-chat-widget.min.js ../frontend/public/embed/anythingllm-chat-widget.min.js",
"lint": "yarn prettier --write ./src" "lint": "yarn prettier --ignore-path ../.prettierignore --write ./src"
}, },
"dependencies": { "dependencies": {
"@microsoft/fetch-event-source": "^2.0.1", "@microsoft/fetch-event-source": "^2.0.1",

View File

@ -38,7 +38,7 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
external: [ external: [
// Reduces transformation time by 50% and we don't even use this variant, so we can ignore. // Reduces transformation time by 50% and we don't even use this variant, so we can ignore.
/@phosphor-icons\/react\/dist\/ssr/, /@phosphor-icons\/react\/dist\/ssr/
] ]
}, },
commonjsOptions: { commonjsOptions: {
@ -51,7 +51,7 @@ export default defineConfig({
emptyOutDir: true, emptyOutDir: true,
inlineDynamicImports: true, inlineDynamicImports: true,
assetsDir: "", assetsDir: "",
sourcemap: 'inline', sourcemap: "inline"
}, },
optimizeDeps: { optimizeDeps: {
esbuildOptions: { esbuildOptions: {
@ -60,5 +60,5 @@ export default defineConfig({
}, },
plugins: [] plugins: []
} }
}, }
}) })

View File

@ -4,9 +4,7 @@
"target": "esnext", "target": "esnext",
"jsx": "react", "jsx": "react",
"paths": { "paths": {
"@/*": [ "@/*": ["./src/*"]
"./src/*"
],
} }
} }
} }

View File

@ -7,7 +7,7 @@
"start": "vite --open", "start": "vite --open",
"dev": "NODE_ENV=development vite --debug --host=0.0.0.0", "dev": "NODE_ENV=development vite --debug --host=0.0.0.0",
"build": "vite build", "build": "vite build",
"lint": "yarn prettier --write ./src", "lint": "yarn prettier --ignore-path ../.prettierignore --write ./src",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {

View File

@ -51,7 +51,7 @@ export default defineConfig({
rollupOptions: { rollupOptions: {
external: [ external: [
// Reduces transformation time by 50% and we don't even use this variant, so we can ignore. // Reduces transformation time by 50% and we don't even use this variant, so we can ignore.
/@phosphor-icons\/react\/dist\/ssr/, /@phosphor-icons\/react\/dist\/ssr/
] ]
}, },
commonjsOptions: { commonjsOptions: {

View File

@ -12,7 +12,7 @@
"scripts": { "scripts": {
"dev": "NODE_ENV=development nodemon --ignore documents --ignore vector-cache --ignore storage --ignore swagger --trace-warnings index.js", "dev": "NODE_ENV=development nodemon --ignore documents --ignore vector-cache --ignore storage --ignore swagger --trace-warnings index.js",
"start": "NODE_ENV=production node index.js", "start": "NODE_ENV=production node index.js",
"lint": "yarn prettier --write ./endpoints ./models ./utils index.js", "lint": "yarn prettier --ignore-path ../.prettierignore --write ./endpoints ./models ./utils index.js",
"swagger": "node ./swagger/init.js", "swagger": "node ./swagger/init.js",
"sqlite:migrate": "cd ./utils/prisma && node migrateFromSqlite.js" "sqlite:migrate": "cd ./utils/prisma && node migrateFromSqlite.js"
}, },