From a9ebba4e952257240034f64f52a88d39d0e4cbe7 Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Date: Fri, 8 Dec 2023 09:31:51 -0400 Subject: [PATCH 1/5] Add Scala 2 template --- .gitignore | 1 + examples/scala2/INSTRUCTIONS | 6 + .../scala2/scala-shopping-cart/.gitignore | 4 + .../scala2/scala-shopping-cart/.scalafmt.conf | 15 + examples/scala2/scala-shopping-cart/build.sbt | 45 ++ .../scala-shopping-cart/componentize.js | 13 + .../scala2/scala-shopping-cart/metadata.json | 8 + .../scala-shopping-cart/package-lock.json | 760 ++++++++++++++++++ .../scala2/scala-shopping-cart/package.json | 10 + .../project/build.properties | 1 + .../scala-shopping-cart/project/plugins.sbt | 1 + .../src/main/scala/example/main.scala | 90 +++ .../scala2/scala-shopping-cart/wit/main.wit | 37 + 13 files changed, 991 insertions(+) create mode 100644 examples/scala2/INSTRUCTIONS create mode 100644 examples/scala2/scala-shopping-cart/.gitignore create mode 100644 examples/scala2/scala-shopping-cart/.scalafmt.conf create mode 100644 examples/scala2/scala-shopping-cart/build.sbt create mode 100644 examples/scala2/scala-shopping-cart/componentize.js create mode 100644 examples/scala2/scala-shopping-cart/metadata.json create mode 100644 examples/scala2/scala-shopping-cart/package-lock.json create mode 100644 examples/scala2/scala-shopping-cart/package.json create mode 100644 examples/scala2/scala-shopping-cart/project/build.properties create mode 100644 examples/scala2/scala-shopping-cart/project/plugins.sbt create mode 100644 examples/scala2/scala-shopping-cart/src/main/scala/example/main.scala create mode 100644 examples/scala2/scala-shopping-cart/wit/main.wit diff --git a/.gitignore b/.gitignore index eb0379d..e726e3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ templates/**/*.wasm /target .idea +.DS_Store diff --git a/examples/scala2/INSTRUCTIONS b/examples/scala2/INSTRUCTIONS new file mode 100644 index 0000000..4ad6da3 --- /dev/null +++ b/examples/scala2/INSTRUCTIONS @@ -0,0 +1,6 @@ +See the documentation about installing tooling: https://golem.cloud/learn/scala2 + +Build the project with sbt: + sbt component + +The `target/dist/component-name.wasm` file is ready to be uploaded to Golem Cloud! diff --git a/examples/scala2/scala-shopping-cart/.gitignore b/examples/scala2/scala-shopping-cart/.gitignore new file mode 100644 index 0000000..93dcf0e --- /dev/null +++ b/examples/scala2/scala-shopping-cart/.gitignore @@ -0,0 +1,4 @@ +.bsp +.idea +target +node_modules diff --git a/examples/scala2/scala-shopping-cart/.scalafmt.conf b/examples/scala2/scala-shopping-cart/.scalafmt.conf new file mode 100644 index 0000000..ad7cdcd --- /dev/null +++ b/examples/scala2/scala-shopping-cart/.scalafmt.conf @@ -0,0 +1,15 @@ +version = 2.7.5 +maxColumn = 120 +align = most +continuationIndent.defnSite = 2 +assumeStandardLibraryStripMargin = true +docstrings = JavaDoc +lineEndings = preserve +includeCurlyBraceInSelectChains = false +danglingParentheses = true +spaces { + inImportCurlyBraces = true +} +optIn.annotationNewlines = true + +rewrite.rules = [SortImports, RedundantBraces] \ No newline at end of file diff --git a/examples/scala2/scala-shopping-cart/build.sbt b/examples/scala2/scala-shopping-cart/build.sbt new file mode 100644 index 0000000..0f598ec --- /dev/null +++ b/examples/scala2/scala-shopping-cart/build.sbt @@ -0,0 +1,45 @@ +ThisBuild / version := "0.1.0" + +ThisBuild / scalaVersion := "2.13.12" + +lazy val root = (project in file(".")) + .settings( + name := "component-name" + ) + .enablePlugins(ScalaJSPlugin) + .settings( + scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }, + Compile / fullLinkJS / scalaJSLinkerOutputDirectory := target.value / "dist" + ) + +lazy val witBindgen = taskKey[Unit]("Runs golem-scalajs-wit-bindgen to generate WIT bindings") + +witBindgen := { + import scala.sys.process._ + + Seq("bash", "-xc", "golem-scalajs-wit-bindgen -w wit/main.wit -p example").!! +} + +lazy val component = taskKey[Unit]("Runs componentize-js on the generated main.js file") + +component := { + import scala.sys.process._ + + Seq("bash", "-xc", "npm install").!! + Seq("bash", "-xc", "npm run build").!! +} + +component := (component dependsOn (Compile / fullLinkJS)).value + +Compile / sourceGenerators += Def.task { + import scala.sys.process._ + + val file = (Compile / sourceManaged).value / "scala" / "example" / "Api.scala" + + IO.write( + file, + Seq("bash", "-xc", "golem-scalajs-wit-bindgen -w wit/main.wit -p example").!! + ) + + Seq(file) +}.taskValue diff --git a/examples/scala2/scala-shopping-cart/componentize.js b/examples/scala2/scala-shopping-cart/componentize.js new file mode 100644 index 0000000..44bfd16 --- /dev/null +++ b/examples/scala2/scala-shopping-cart/componentize.js @@ -0,0 +1,13 @@ +import { componentize } from '@bytecodealliance/componentize-js'; +import { readFile, writeFile } from 'node:fs/promises'; +import { resolve } from 'node:path'; + +const jsSource = await readFile('target/dist/main.js', 'utf8'); + +const { component } = await componentize(jsSource, { + witPath: resolve('wit'), + enableStdout: true, + preview2Adapter: 'adapters/tier2/wasi_snapshot_preview1.wasm' +}); + +await writeFile('target/dist/component-name.wasm', component); diff --git a/examples/scala2/scala-shopping-cart/metadata.json b/examples/scala2/scala-shopping-cart/metadata.json new file mode 100644 index 0000000..0185579 --- /dev/null +++ b/examples/scala2/scala-shopping-cart/metadata.json @@ -0,0 +1,8 @@ +{ + "description": "A stateful Golem actor representing a shopping cart, implemented in Scala 2", + "requiresAdapter": true, + "exclude": [ + "target", + "node_modules" + ] +} \ No newline at end of file diff --git a/examples/scala2/scala-shopping-cart/package-lock.json b/examples/scala2/scala-shopping-cart/package-lock.json new file mode 100644 index 0000000..71d8a39 --- /dev/null +++ b/examples/scala2/scala-shopping-cart/package-lock.json @@ -0,0 +1,760 @@ +{ + "name": "component-name", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@bytecodealliance/componentize-js": "0.2.0", + "@bytecodealliance/jco": "0.11.1" + } + }, + "node_modules/@bytecodealliance/componentize-js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.2.0.tgz", + "integrity": "sha512-JXWwSawSmsbVrnjqsupzwkrvLeB4B3VJ1EQ21n6SWvbHbdVnErW1QiiGgHPQMoww/fE4b8FhQUw3krKN8jksqg==", + "dev": true, + "dependencies": { + "@bytecodealliance/jco": "^0.11.0", + "@bytecodealliance/wizer": "^3.0.1" + } + }, + "node_modules/@bytecodealliance/jco": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.11.1.tgz", + "integrity": "sha512-GVwJ/C1Ii/GVX1U6d6nbpxGIJPAXerpW1Z0sG8eV3BkXNKKawbrFQJ5fZnXyEnqzfr8JieZ7NCSuinIV337ReA==", + "dev": true, + "dependencies": { + "@bytecodealliance/preview2-shim": "0.0.14", + "binaryen": "^111.0.0", + "chalk-template": "^0.4.0", + "commander": "^9.4.1", + "mkdirp": "^1.0.4", + "ora": "^6.1.2", + "terser": "^5.16.1" + }, + "bin": { + "jco": "src/jco.js" + } + }, + "node_modules/@bytecodealliance/preview2-shim": { + "version": "0.0.14", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.14.tgz", + "integrity": "sha512-xX3CTJiIV52BC1G+rtYhuO29yJ7OQZU/iJSSera7bWn0GVy+faqRpZj93Yn6OVnYwxCE+fS08I6oUBX239lJPQ==", + "dev": true + }, + "node_modules/@bytecodealliance/wizer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-3.0.1.tgz", + "integrity": "sha512-f0NBiBHCNBkbFHTPRbA7aKf/t4KyNhi2KvSqw3QzCgi8wFF/uLZ0dhejj93rbiKO/iwWbmU7v9K3SVkW81mcjQ==", + "dev": true, + "bin": { + "wizer": "wizer.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@bytecodealliance/wizer-darwin-arm64": "3.0.1", + "@bytecodealliance/wizer-darwin-x64": "3.0.1", + "@bytecodealliance/wizer-linux-arm64": "3.0.1", + "@bytecodealliance/wizer-linux-s390x": "3.0.1", + "@bytecodealliance/wizer-linux-x64": "3.0.1", + "@bytecodealliance/wizer-win32-x64": "3.0.1" + } + }, + "node_modules/@bytecodealliance/wizer-darwin-arm64": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-3.0.1.tgz", + "integrity": "sha512-/8KYSajyhO9koAE3qQhYfC6belZheJw9X3XqW7hrizTpj6n4z4OJFhhqwJmiYFUUsPtC7OxcXMFFPbTuSQPBcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "wizer-darwin-arm64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-darwin-x64": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-3.0.1.tgz", + "integrity": "sha512-bMReultN/r+W/BRXV0F+28U5dZwbQT/ZO0k4icZlhUhrv5/wpQJix7Z/ZvBnVQ+/JHb0QDUpFk2/zCtgkRXP6Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "wizer-darwin-x64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-arm64": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-arm64/-/wizer-linux-arm64-3.0.1.tgz", + "integrity": "sha512-35ZhAeYxWK3bTqqgwysbBWlGlrlMNKNng3ZITQV2PAtafpE7aCeqywl7VAS4lLRG5eTb7wxNgN7zf8d3wiIFTQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-arm64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-s390x": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-s390x/-/wizer-linux-s390x-3.0.1.tgz", + "integrity": "sha512-Smvy9mguEMtX0lupDLTPshXUzAHeOhgscr1bhGNjeCCLD1sd8rIjBvWV19Wtra0BL1zTuU2EPOHjR/4k8WoyDg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-s390x": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-x64": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-3.0.1.tgz", + "integrity": "sha512-uUue78xl7iwndsGgTsagHLTLyLBVHhwzuywiwHt1xw8y0X0O8REKRLBoB7+LdM+pttDPdFtKJgbTFL4UPAA7Yw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-x64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-win32-x64": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-3.0.1.tgz", + "integrity": "sha512-ycd38sx1UTZpHZwh8IfH/4N3n0OQUB8awxkUSLXf9PolEd088YbxoPB3noHy4E+L2oYN7KZMrg9517pX0z2RhQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "bin": { + "wizer-win32-x64": "wizer" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/binaryen": { + "version": "111.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-111.0.0.tgz", + "integrity": "sha512-PEXOSHFO85aj1aP4t+KGzvxQ00qXbjCysWlsDjlGkP1e9owNiYdpEkLej21Ax8LDD7xJ01rEmJDqZ/JPoW2GXw==", + "dev": true, + "bin": { + "wasm-opt": "bin/wasm-opt", + "wasm2js": "bin/wasm2js" + } + }, + "node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dev": true, + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk-template": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz", + "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/chalk-template?sponsor=1" + } + }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.1.tgz", + "integrity": "sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dev": true, + "dependencies": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-6.3.1.tgz", + "integrity": "sha512-ERAyNnZOfqM+Ao3RAvIXkYh5joP220yf59gVe2X/cI6SiCxIdi4c9HZKZD8R6q/RDXEje1THBju6iExiSsgJaQ==", + "dev": true, + "dependencies": { + "chalk": "^5.0.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.6.1", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.1.0", + "log-symbols": "^5.1.0", + "stdin-discarder": "^0.1.0", + "strip-ansi": "^7.0.1", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz", + "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==", + "dev": true, + "dependencies": { + "bl": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/terser": { + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.20.0.tgz", + "integrity": "sha512-e56ETryaQDyebBwJIWYB2TT6f2EZ0fL0sW/JRXNMN26zZdKi2u/E/5my5lG6jNxym6qsrVXfFRmOdV42zlAgLQ==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, + "dependencies": { + "defaults": "^1.0.3" + } + } + } +} \ No newline at end of file diff --git a/examples/scala2/scala-shopping-cart/package.json b/examples/scala2/scala-shopping-cart/package.json new file mode 100644 index 0000000..075d7ee --- /dev/null +++ b/examples/scala2/scala-shopping-cart/package.json @@ -0,0 +1,10 @@ +{ + "type": "module", + "devDependencies": { + "@bytecodealliance/jco": "0.11.1", + "@bytecodealliance/componentize-js": "0.2.0" + }, + "scripts": { + "build": "node componentize.js" + } +} \ No newline at end of file diff --git a/examples/scala2/scala-shopping-cart/project/build.properties b/examples/scala2/scala-shopping-cart/project/build.properties new file mode 100644 index 0000000..303541e --- /dev/null +++ b/examples/scala2/scala-shopping-cart/project/build.properties @@ -0,0 +1 @@ +sbt.version = 1.9.6 diff --git a/examples/scala2/scala-shopping-cart/project/plugins.sbt b/examples/scala2/scala-shopping-cart/project/plugins.sbt new file mode 100644 index 0000000..bd3a24b --- /dev/null +++ b/examples/scala2/scala-shopping-cart/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") diff --git a/examples/scala2/scala-shopping-cart/src/main/scala/example/main.scala b/examples/scala2/scala-shopping-cart/src/main/scala/example/main.scala new file mode 100644 index 0000000..c613bda --- /dev/null +++ b/examples/scala2/scala-shopping-cart/src/main/scala/example/main.scala @@ -0,0 +1,90 @@ +package example + +import scala.scalajs.js.annotation.{ JSExportAll, JSExportTopLevel } + +final case class State(userId: String, items: List[ProductItem]) { self => + def withUserId(userId: String): State = self.copy(userId = userId) + + def addItem(item: ProductItem): State = self.copy(items = self.items :+ item) + + def removeItem(productId: String): State = self.copy(items = self.items.filterNot(_.productId == productId)) + + def updateItemQuantity(productId: String, quantity: Integer): State = + self.copy(items = self.items.map { item => + if (item.productId == productId) ProductItem(item.productId, item.name, item.price, quantity) + else item + }) + + def clear: State = self.copy(items = List.empty) +} +object State { + val empty = State(userId = "", items = List.empty) +} + +@JSExportTopLevel("api") +@JSExportAll +object ComponentName extends Api { self => + private var state = State.empty + + def initializeCart(userId: String): WitResult[String, String] = { + println(s"Initializing cart for user $userId") + if (math.random() > 0.1) { + state = state.withUserId(userId) + WitResult.ok(userId) + } else WitResult.err("Error while initializing cart") + } + + def addItem(item: ProductItem): Unit = { + println(s"Adding item to the cart of user ${state.userId}") + state = state.addItem(item) + } + + def removeItem(productId: String): Unit = { + println(s"Removing item with product ID $productId from the cart of user ${state.userId}") + state = state.removeItem(productId) + } + + def updateItemQuantity(productId: String, quantity: Integer): Unit = { + println(s"Updating quantity of item with product ID $productId to $quantity in the cart of user ${state.userId}") + + state = state.updateItemQuantity(productId, quantity) + } + + def checkout(): CheckoutResult = { + def reserveInventory(): Either[String, Unit] = + if (math.random() < 0.1) Left("Inventory not available") else Right(()) + + def chargeCreditCard(): Either[String, Unit] = Right(()) + + def generateOrder(): String = "238738674" + + def dispatchOrder(): Either[String, Unit] = Right(()) + + def clearState(): Unit = state = state.clear + + val result = + for { + _ <- reserveInventory() + _ <- chargeCreditCard() + orderId = generateOrder() + _ <- dispatchOrder() + _ = clearState() + _ = println(s"Checkout for order $orderId") + } yield OrderConfirmation(orderId) + + result match { + case Right(orderConfirmation) => CheckoutResult.success(orderConfirmation) + case Left(error) => CheckoutResult.error(error) + } + } + + def getCartContents(): WitList[ProductItem] = { + println(s"Getting cart contents for user ${state.userId}") + WitList.fromList(state.items) + } + + def getFirstItem(): WitOption[ProductItem] = { + println(s"Getting first item for user ${state.userId}") + WitOption.fromOption(state.items.headOption) + } +} diff --git a/examples/scala2/scala-shopping-cart/wit/main.wit b/examples/scala2/scala-shopping-cart/wit/main.wit new file mode 100644 index 0000000..b73a4f5 --- /dev/null +++ b/examples/scala2/scala-shopping-cart/wit/main.wit @@ -0,0 +1,37 @@ +package pack:name + +interface api { + record product-item { + product-id: string, + name: string, + price: float32, + quantity: u32, + } + + record order-confirmation { + order-id: string, + } + + variant checkout-result { + error(string), + success(order-confirmation), + } + + initialize-cart: func(user-id: string) -> result + + add-item: func(item: product-item) -> () + + remove-item: func(product-id: string) -> () + + update-item-quantity: func(product-id: string, quantity: u32) -> () + + checkout: func() -> checkout-result + + get-cart-contents: func() -> list + + get-first-item: func() -> option +} + +world component-name { + export api +} \ No newline at end of file From 371ce43ba7f7cc1e7eaa568d79b8089c2eefee2f Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Date: Fri, 8 Dec 2023 09:38:05 -0400 Subject: [PATCH 2/5] Add Scala 2 as supported lang --- src/model.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/model.rs b/src/model.rs index 72eada6..4f8c065 100644 --- a/src/model.rs +++ b/src/model.rs @@ -83,6 +83,7 @@ pub enum GuestLanguage { Swift, Grain, Python, + Scala2, } impl GuestLanguage { @@ -97,6 +98,7 @@ impl GuestLanguage { "swift" => Some(GuestLanguage::Swift), "grain" => Some(GuestLanguage::Grain), "py" | "python" => Some(GuestLanguage::Python), + "scala2" => Some(GuestLanguage::Scala2), _ => None, } } @@ -112,6 +114,7 @@ impl GuestLanguage { GuestLanguage::Swift => GuestLanguageTier::Tier3, GuestLanguage::Grain => GuestLanguageTier::Tier3, GuestLanguage::Python => GuestLanguageTier::Tier2, + GuestLanguage::Scala2 => GuestLanguageTier::Tier2, } } @@ -126,6 +129,7 @@ impl GuestLanguage { GuestLanguage::Swift => "Swift", GuestLanguage::Grain => "Grain", GuestLanguage::Python => "Python", + GuestLanguage::Scala2 => "Scala 2", } } } From c7cf0b64d8630ea85f90c1374372d4e86eba0000 Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Date: Fri, 8 Dec 2023 09:42:11 -0400 Subject: [PATCH 3/5] Change example name --- .../{scala-shopping-cart => scala2-shopping-cart}/.gitignore | 0 .../{scala-shopping-cart => scala2-shopping-cart}/.scalafmt.conf | 0 .../{scala-shopping-cart => scala2-shopping-cart}/build.sbt | 0 .../{scala-shopping-cart => scala2-shopping-cart}/componentize.js | 0 .../{scala-shopping-cart => scala2-shopping-cart}/metadata.json | 0 .../package-lock.json | 0 .../{scala-shopping-cart => scala2-shopping-cart}/package.json | 0 .../project/build.properties | 0 .../project/plugins.sbt | 0 .../src/main/scala/example/main.scala | 0 .../{scala-shopping-cart => scala2-shopping-cart}/wit/main.wit | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/.gitignore (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/.scalafmt.conf (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/build.sbt (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/componentize.js (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/metadata.json (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/package-lock.json (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/package.json (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/project/build.properties (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/project/plugins.sbt (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/src/main/scala/example/main.scala (100%) rename examples/scala2/{scala-shopping-cart => scala2-shopping-cart}/wit/main.wit (100%) diff --git a/examples/scala2/scala-shopping-cart/.gitignore b/examples/scala2/scala2-shopping-cart/.gitignore similarity index 100% rename from examples/scala2/scala-shopping-cart/.gitignore rename to examples/scala2/scala2-shopping-cart/.gitignore diff --git a/examples/scala2/scala-shopping-cart/.scalafmt.conf b/examples/scala2/scala2-shopping-cart/.scalafmt.conf similarity index 100% rename from examples/scala2/scala-shopping-cart/.scalafmt.conf rename to examples/scala2/scala2-shopping-cart/.scalafmt.conf diff --git a/examples/scala2/scala-shopping-cart/build.sbt b/examples/scala2/scala2-shopping-cart/build.sbt similarity index 100% rename from examples/scala2/scala-shopping-cart/build.sbt rename to examples/scala2/scala2-shopping-cart/build.sbt diff --git a/examples/scala2/scala-shopping-cart/componentize.js b/examples/scala2/scala2-shopping-cart/componentize.js similarity index 100% rename from examples/scala2/scala-shopping-cart/componentize.js rename to examples/scala2/scala2-shopping-cart/componentize.js diff --git a/examples/scala2/scala-shopping-cart/metadata.json b/examples/scala2/scala2-shopping-cart/metadata.json similarity index 100% rename from examples/scala2/scala-shopping-cart/metadata.json rename to examples/scala2/scala2-shopping-cart/metadata.json diff --git a/examples/scala2/scala-shopping-cart/package-lock.json b/examples/scala2/scala2-shopping-cart/package-lock.json similarity index 100% rename from examples/scala2/scala-shopping-cart/package-lock.json rename to examples/scala2/scala2-shopping-cart/package-lock.json diff --git a/examples/scala2/scala-shopping-cart/package.json b/examples/scala2/scala2-shopping-cart/package.json similarity index 100% rename from examples/scala2/scala-shopping-cart/package.json rename to examples/scala2/scala2-shopping-cart/package.json diff --git a/examples/scala2/scala-shopping-cart/project/build.properties b/examples/scala2/scala2-shopping-cart/project/build.properties similarity index 100% rename from examples/scala2/scala-shopping-cart/project/build.properties rename to examples/scala2/scala2-shopping-cart/project/build.properties diff --git a/examples/scala2/scala-shopping-cart/project/plugins.sbt b/examples/scala2/scala2-shopping-cart/project/plugins.sbt similarity index 100% rename from examples/scala2/scala-shopping-cart/project/plugins.sbt rename to examples/scala2/scala2-shopping-cart/project/plugins.sbt diff --git a/examples/scala2/scala-shopping-cart/src/main/scala/example/main.scala b/examples/scala2/scala2-shopping-cart/src/main/scala/example/main.scala similarity index 100% rename from examples/scala2/scala-shopping-cart/src/main/scala/example/main.scala rename to examples/scala2/scala2-shopping-cart/src/main/scala/example/main.scala diff --git a/examples/scala2/scala-shopping-cart/wit/main.wit b/examples/scala2/scala2-shopping-cart/wit/main.wit similarity index 100% rename from examples/scala2/scala-shopping-cart/wit/main.wit rename to examples/scala2/scala2-shopping-cart/wit/main.wit From 5bdbb2e4e05ecc4bee5d521a77e49cdda83ef5dd Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Date: Fri, 8 Dec 2023 09:43:27 -0400 Subject: [PATCH 4/5] Fix metadata --- examples/scala2/scala2-shopping-cart/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/scala2/scala2-shopping-cart/metadata.json b/examples/scala2/scala2-shopping-cart/metadata.json index 0185579..0f6b132 100644 --- a/examples/scala2/scala2-shopping-cart/metadata.json +++ b/examples/scala2/scala2-shopping-cart/metadata.json @@ -1,5 +1,5 @@ { - "description": "A stateful Golem actor representing a shopping cart, implemented in Scala 2", + "description": "A stateful Golem actor representing a shopping cart, implemented in Scala 2 using Scala.js", "requiresAdapter": true, "exclude": [ "target", From cc59998664cb9e0b569973ead51c1aea5da1a022 Mon Sep 17 00:00:00 2001 From: Jorge Vasquez Date: Fri, 8 Dec 2023 09:56:50 -0400 Subject: [PATCH 5/5] Fix --- examples/scala2/scala2-shopping-cart/.scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/scala2/scala2-shopping-cart/.scalafmt.conf b/examples/scala2/scala2-shopping-cart/.scalafmt.conf index ad7cdcd..e23cdbb 100644 --- a/examples/scala2/scala2-shopping-cart/.scalafmt.conf +++ b/examples/scala2/scala2-shopping-cart/.scalafmt.conf @@ -12,4 +12,4 @@ spaces { } optIn.annotationNewlines = true -rewrite.rules = [SortImports, RedundantBraces] \ No newline at end of file +rewrite.rules = [SortImports, RedundantBraces]