Skip to content

Commit

Permalink
make javascript library free of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Jun 20, 2024
1 parent 5e5a64d commit e491820
Show file tree
Hide file tree
Showing 15 changed files with 2,204 additions and 1,184 deletions.
16 changes: 0 additions & 16 deletions javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@ Create and deploy generative ([LLMs](https://github.com/Hannibal046/Awesome-LLM)

Focus on AI (RAG, fine-tuning, alignment, training) and skip engineering tasks (frontend development, backend integration, deployment, operations).

## Getting started

Create a chatbot backend following the documentation in [hal9.com/docs](https://hal9.com/docs), then embed your chatbot as follows:

```html
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/hal9@latest/dist/hal9.min.js"></script>
</head>
<body>
<div id="hal9" style="width: 100%; height: 500px;"></div>
<script>hal9.init('hal9');</script>
<body>
</html>
```

# Development

Local setup
Expand Down
15 changes: 9 additions & 6 deletions javascript/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<!doctype html>
<html lang="en">
<!DOCTYPE html>
<html>
<head>
<title>Hal9: Effortlessly create AI coworkers</title>
<meta charset="utf-8" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
<script src="./dist/hal9.js"></script>
<script>
debugger;
h9.init()
</script>
</body>
</html>
</html>
47 changes: 23 additions & 24 deletions javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{
"name": "hal9",
"version": "2.1.0",
"scripts": {
"clean": "rm -rf node_modules",
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"version": "1.3.0",
"license": "MIT",
"dependencies": {
"vue": "^2.7.14"
"description": "Hal9: Create and Share Generative Apps",
"main": "dist/hal9.js",
"repository": "https://github.com/hal9ai/hal9",
"author": "Hal9 Inc",
"scripts": {
"build": "webpack --mode=production",
"dev": "webpack-dev-server --config src/web/web.config.js --mode development --history-api-fallback",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production"
},
"keywords": [
"javascript",
"chatbot",
"langchain",
"chatgpt"
],
"devDependencies": {
"@vitejs/plugin-vue2": "^2.2.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.50.0",
"postcss": "^8.4.30",
"postcss-extend-rule": "^4.0.0",
"prettier": "^3.0.3",
"prettier-plugin-css-order": "^2.0.0",
"prettier-plugin-tailwindcss": "^0.5.4",
"rollup-plugin-copy": "^3.5.0",
"sass": "^1.70.0",
"tailwindcss": "^3.3.3",
"terser": "^5.20.0",
"vite": "^4.4.9",
"vite-plugin-environment": "^1.1.3"
}
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.70.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^5.0.4"
},
"dependencies": {}
}
8 changes: 0 additions & 8 deletions javascript/postcss.config.js

This file was deleted.

9 changes: 0 additions & 9 deletions javascript/prettier.config.js

This file was deleted.

Binary file removed javascript/public/fonts/SpaceGrotesk-Variable.woff2
Binary file not shown.
Binary file removed javascript/public/fonts/Supreme-Variable.woff2
Binary file not shown.
32 changes: 0 additions & 32 deletions javascript/src/app.vue

This file was deleted.

4 changes: 4 additions & 0 deletions javascript/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

export function init () {
console.log('Hal9 Init')
}
10 changes: 0 additions & 10 deletions javascript/src/main.js

This file was deleted.

55 changes: 0 additions & 55 deletions javascript/src/styles/main.css

This file was deleted.

24 changes: 0 additions & 24 deletions javascript/tailwind.config.js

This file was deleted.

54 changes: 0 additions & 54 deletions javascript/vite.config.js

This file was deleted.

25 changes: 25 additions & 0 deletions javascript/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
entry: {
'hal9': './src/index.js',
'hal9.min': './src/index.js',
},
devtool: "source-map",
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
globalObject: 'this',
library: {
name: 'h9',
type: 'umd',
},
},
optimization: {
minimize: false,
minimizer: [new UglifyJsPlugin({
include: /\.min\.js$/
})]
}
}
Loading

0 comments on commit e491820

Please sign in to comment.