Skip to content

Commit

Permalink
Update hyper-commerce backend to use modus (#34)
Browse files Browse the repository at this point in the history
* update commerce to use modus

* update ts and eslint versions

* Create ci-modus-build.yml

* Delete .github/workflows/ci-hypermode-functions.yml

* Update package.json

* project updates

* Delete package.json

---------

Co-authored-by: Ryan Fox-Tyler <[email protected]>
  • Loading branch information
StephDietz and ryanfoxtyler authored Nov 18, 2024
1 parent ad13f8b commit 022b3a8
Show file tree
Hide file tree
Showing 18 changed files with 401 additions and 295 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/ci-hypermode-functions.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/ci-modus-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

name: Build and publish Modus app

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

env:
MODUS_DIR: ""

permissions:
contents: read

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Locate directory with modus.json
id: set-dir
run: |
MODUS_JSON=$(find $(pwd) -name 'modus.json' -print0 | xargs -0 -n1 echo)
if [ -n "$MODUS_JSON" ]; then
MODUS_DIR=$(dirname "$MODUS_JSON")
echo "MODUS_DIR=$MODUS_DIR" >> $GITHUB_ENV
else
echo "modus.json not found"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Setup Go
uses: actions/setup-go@v5

- name: Setup TinyGo
uses: acifani/setup-tinygo@v2
with:
tinygo-version: "0.34.0"

- name: Build project
run: npx -p @hypermode/modus-cli -y modus build
working-directory: ${{ env.MODUS_DIR }}
shell: bash

- name: Publish GitHub artifact
uses: actions/upload-artifact@v4
with:
name: build
path: ${{ env.MODUS_DIR }}/build/*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Hypermode
Copyright (c) 2024 Hypermode Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions backend/asconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./node_modules/@hypermode/modus-sdk-as/plugin.asconfig.json",
"options": {
"transform": ["@hypermode/modus-sdk-as/transform", "json-as/transform"]
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { collections } from "@hypermode/functions-as";
import { collections } from "@hypermode/modus-sdk-as";
import { Product, Cart, CartItemObject, consts } from "./types";

export function upsertProduct(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { models } from "@hypermode/functions-as";
import { EmbeddingsModel } from "@hypermode/models-as/models/experimental/embeddings";
import { collections } from "@hypermode/functions-as";
import { models } from "@hypermode/modus-sdk-as";
import { EmbeddingsModel } from "@hypermode/modus-sdk-as/models/experimental/embeddings";
import { collections } from "@hypermode/modus-sdk-as";
import { getProduct, getCart } from "./crud";
import { ProductSearchResult, ProductSearchObject, consts } from "./types";

Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions backend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @ts-check

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import aseslint from "@hypermode/modus-sdk-as/tools/assemblyscript-eslint";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
aseslint.config,
);
13 changes: 0 additions & 13 deletions backend/functions/.eslintrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions backend/functions/.prettierrc

This file was deleted.

6 changes: 0 additions & 6 deletions backend/functions/asconfig.json

This file was deleted.

35 changes: 0 additions & 35 deletions backend/functions/package.json

This file was deleted.

11 changes: 9 additions & 2 deletions backend/hypermode.json → backend/modus.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"$schema": "https://manifest.hypermode.com/hypermode.json",
"$schema": "https://schema.hypermode.com/modus.json",
"endpoints": {
"default": {
"type": "graphql",
"path": "/graphql",
"auth": "bearer-token"
}
},
"models": {
"minilm": {
"sourceModel": "sentence-transformers/all-MiniLM-L6-v2",
"provider": "hugging-face",
"host": "hypermode"
"connection": "hypermode"
}
},
"collections": {
Expand Down
Loading

0 comments on commit 022b3a8

Please sign in to comment.