diff --git a/samples/golang-mongodb-atlas/compose.yaml b/samples/golang-mongodb-atlas/compose.yaml index 358b784b..ad446e64 100644 --- a/samples/golang-mongodb-atlas/compose.yaml +++ b/samples/golang-mongodb-atlas/compose.yaml @@ -1,9 +1,8 @@ -version: '3.9' services: app: restart: unless-stopped build: - context: . + context: ./app dockerfile: Dockerfile ports: - mode: ingress @@ -11,4 +10,3 @@ services: published: 8080 environment: - MONGO_URI=your mongo db URI connection string - \ No newline at end of file diff --git a/samples/meteor/.dockerignore b/samples/meteor/.dockerignore new file mode 100644 index 00000000..38d178b1 --- /dev/null +++ b/samples/meteor/.dockerignore @@ -0,0 +1,5 @@ +# Ignore node_modules directory +node_modules + +# Ignore Meteor's local build directory +.meteor/local \ No newline at end of file diff --git a/samples/meteor/.gitignore b/samples/meteor/.gitignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/samples/meteor/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/samples/meteor/.meteor/.finished-upgraders b/samples/meteor/.meteor/.finished-upgraders new file mode 100644 index 00000000..c07b6ff7 --- /dev/null +++ b/samples/meteor/.meteor/.finished-upgraders @@ -0,0 +1,19 @@ +# This file contains information which helps Meteor properly upgrade your +# app when you run 'meteor update'. You should check it into version control +# with your project. + +notices-for-0.9.0 +notices-for-0.9.1 +0.9.4-platform-file +notices-for-facebook-graph-api-2 +1.2.0-standard-minifiers-package +1.2.0-meteor-platform-split +1.2.0-cordova-changes +1.2.0-breaking-changes +1.3.0-split-minifiers-package +1.4.0-remove-old-dev-bundle-link +1.4.1-add-shell-server-package +1.4.3-split-account-service-packages +1.5-add-dynamic-import-package +1.7-split-underscore-from-meteor-base +1.8.3-split-jquery-from-blaze diff --git a/samples/meteor/.meteor/.gitignore b/samples/meteor/.meteor/.gitignore new file mode 100644 index 00000000..40830374 --- /dev/null +++ b/samples/meteor/.meteor/.gitignore @@ -0,0 +1 @@ +local diff --git a/samples/meteor/.meteor/.id b/samples/meteor/.meteor/.id new file mode 100644 index 00000000..8eedd89e --- /dev/null +++ b/samples/meteor/.meteor/.id @@ -0,0 +1,7 @@ +# This file contains a token that is unique to your project. +# Check it into your repository along with the rest of this directory. +# It can be used for purposes such as: +# - ensuring you don't accidentally deploy one app on top of another +# - providing package authors with aggregated statistics + +tp3bejc2h4ai.gwxx0phxb6jq diff --git a/samples/meteor/.meteor/packages b/samples/meteor/.meteor/packages new file mode 100644 index 00000000..eb65ea6a --- /dev/null +++ b/samples/meteor/.meteor/packages @@ -0,0 +1,22 @@ +# Meteor packages used by this project, one per line. +# Check this file (and the other files in this directory) into your repository. +# +# 'meteor add' and 'meteor remove' will edit this file for you, +# but you can also edit it by hand. + +meteor-base@1.5.1 # Packages every Meteor app needs to have +mobile-experience@1.1.1 # Packages for a great mobile UX +mongo@1.16.10 # The database Meteor supports right now +reactive-var@1.0.12 # Reactive variable for tracker + +standard-minifier-css@1.9.2 # CSS minifier run for production mode +standard-minifier-js@2.8.1 # JS minifier run for production mode +es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers +ecmascript@0.16.8 # Enable ECMAScript2015+ syntax in app code +typescript@4.9.5 # Enable TypeScript syntax in .ts and .tsx modules +shell-server@0.5.0 # Server-side component of the `meteor shell` command +hot-module-replacement@0.5.3 # Update client in development without reloading the page + + +static-html@1.3.2 # Define static page content in .html files +react-meteor-data # React higher-order component for reactively tracking Meteor data diff --git a/samples/meteor/.meteor/platforms b/samples/meteor/.meteor/platforms new file mode 100644 index 00000000..efeba1b5 --- /dev/null +++ b/samples/meteor/.meteor/platforms @@ -0,0 +1,2 @@ +server +browser diff --git a/samples/meteor/.meteor/release b/samples/meteor/.meteor/release new file mode 100644 index 00000000..5152abe9 --- /dev/null +++ b/samples/meteor/.meteor/release @@ -0,0 +1 @@ +METEOR@2.16 diff --git a/samples/meteor/.meteor/versions b/samples/meteor/.meteor/versions new file mode 100644 index 00000000..892d35d5 --- /dev/null +++ b/samples/meteor/.meteor/versions @@ -0,0 +1,71 @@ +allow-deny@1.1.1 +autoupdate@1.8.0 +babel-compiler@7.10.5 +babel-runtime@1.5.1 +base64@1.0.12 +binary-heap@1.0.11 +blaze-tools@1.1.3 +boilerplate-generator@1.7.2 +caching-compiler@1.2.2 +caching-html-compiler@1.2.1 +callback-hook@1.5.1 +check@1.4.1 +ddp@1.4.1 +ddp-client@2.6.2 +ddp-common@1.4.1 +ddp-server@2.7.1 +diff-sequence@1.1.2 +dynamic-import@0.7.3 +ecmascript@0.16.8 +ecmascript-runtime@0.8.1 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.3 +es5-shim@4.8.0 +fetch@0.1.4 +geojson-utils@1.0.11 +hot-code-push@1.0.4 +hot-module-replacement@0.5.3 +html-tools@1.1.3 +htmljs@1.1.1 +id-map@1.1.1 +inter-process-messaging@0.1.1 +launch-screen@2.0.0 +logging@1.3.4 +meteor@1.11.5 +meteor-base@1.5.1 +minifier-css@1.6.4 +minifier-js@2.8.0 +minimongo@1.9.4 +mobile-experience@1.1.1 +mobile-status-bar@1.1.0 +modern-browsers@0.1.10 +modules@0.20.0 +modules-runtime@0.13.1 +modules-runtime-hot@0.14.2 +mongo@1.16.10 +mongo-decimal@0.1.3 +mongo-dev-server@1.1.0 +mongo-id@1.0.8 +npm-mongo@4.17.2 +ordered-dict@1.1.0 +promise@0.12.2 +random@1.2.1 +react-fast-refresh@0.2.8 +react-meteor-data@2.7.2 +reactive-var@1.0.12 +reload@1.3.1 +retry@1.1.0 +routepolicy@1.1.1 +shell-server@0.5.0 +socket-stream-client@0.5.2 +spacebars-compiler@1.3.1 +standard-minifier-css@1.9.2 +standard-minifier-js@2.8.1 +static-html@1.3.2 +templating-tools@1.2.2 +tracker@1.3.3 +typescript@4.9.5 +underscore@1.6.1 +webapp@1.13.8 +webapp-hashing@1.1.1 diff --git a/samples/meteor/Dockerfile b/samples/meteor/Dockerfile new file mode 100644 index 00000000..280fc5f3 --- /dev/null +++ b/samples/meteor/Dockerfile @@ -0,0 +1,26 @@ +# Build stage +FROM zcloudws/meteor-build:2.11.0 as builder + +USER root + +RUN mkdir -p /build/source && chown zcloud:zcloud -R /build + +USER zcloud + +COPY --chown=zcloud:zcloud . /build/source + +RUN cd /build/source && \ + meteor npm install && \ + meteor build --directory ../app-build + +# Clean image with builded app +FROM zcloudws/meteor-node-mongodb-runtime:2.11.0 + +COPY --from=builder /build/app-build/bundle /home/zcloud/app + +RUN cd /home/zcloud/app/programs/server && npm install + +WORKDIR /home/zcloud/app + +# Entrypoint from image +ENTRYPOINT ["/scripts/startup.sh"] diff --git a/samples/meteor/client/main.css b/samples/meteor/client/main.css new file mode 100644 index 00000000..7f354f0f --- /dev/null +++ b/samples/meteor/client/main.css @@ -0,0 +1,4 @@ +body { + padding: 10px; + font-family: sans-serif; +} diff --git a/samples/meteor/client/main.html b/samples/meteor/client/main.html new file mode 100644 index 00000000..a9c30892 --- /dev/null +++ b/samples/meteor/client/main.html @@ -0,0 +1,7 @@ + + Defang X Meteor + + + +

Defang X Meteor

+ diff --git a/samples/meteor/client/main.jsx b/samples/meteor/client/main.jsx new file mode 100644 index 00000000..d2e380f9 --- /dev/null +++ b/samples/meteor/client/main.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import { Meteor } from 'meteor/meteor'; +import { App } from '/imports/ui/App'; + +Meteor.startup(() => { + const container = document.getElementById('react-target'); + const root = createRoot(container); + root.render(); +}); diff --git a/samples/meteor/compose.dev.yaml b/samples/meteor/compose.dev.yaml new file mode 100644 index 00000000..4b869802 --- /dev/null +++ b/samples/meteor/compose.dev.yaml @@ -0,0 +1,28 @@ +version: "3" + +services: + meteor-app: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" + environment: + - ROOT_URL=http://localhost:3000 + - MONGO_URL=mongodb://mongo:27017/meteorapp + volumes: + - .:/usr/src/app + - /usr/src/app/node_modules + command: meteor run --allow-superuser + depends_on: + - mongo + + mongo: + image: mongo:latest + volumes: + - mongo-data:/data/db + ports: + - "27017:27017" + +volumes: + mongo-data: diff --git a/samples/meteor/compose.yaml b/samples/meteor/compose.yaml new file mode 100644 index 00000000..b6680fe0 --- /dev/null +++ b/samples/meteor/compose.yaml @@ -0,0 +1,23 @@ +version: "3" + +services: + meteor-app: + build: . + ports: + - target: 3000 + published: 3000 + protocol: tcp + mode: ingress + environment: + - ROOT_URL=http://localhost:3000 + - MONGO_URL=mongodb://mongo:27017/meteorapp + depends_on: + - mongo + + mongo: + image: mongo:latest + volumes: + - mongo-data:/data/db + +volumes: + mongo-data: diff --git a/samples/meteor/imports/api/links.js b/samples/meteor/imports/api/links.js new file mode 100644 index 00000000..050c508e --- /dev/null +++ b/samples/meteor/imports/api/links.js @@ -0,0 +1,3 @@ +import { Mongo } from 'meteor/mongo'; + +export const LinksCollection = new Mongo.Collection('links'); diff --git a/samples/meteor/imports/ui/App.jsx b/samples/meteor/imports/ui/App.jsx new file mode 100644 index 00000000..6f7340ca --- /dev/null +++ b/samples/meteor/imports/ui/App.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { Hello } from './Hello.jsx'; +import { Info } from './Info.jsx'; + +export const App = () => ( +
+

Welcome to Meteor!

+ + +
+); diff --git a/samples/meteor/imports/ui/Hello.jsx b/samples/meteor/imports/ui/Hello.jsx new file mode 100644 index 00000000..15e0f185 --- /dev/null +++ b/samples/meteor/imports/ui/Hello.jsx @@ -0,0 +1,16 @@ +import React, { useState } from 'react'; + +export const Hello = () => { + const [counter, setCounter] = useState(0); + + const increment = () => { + setCounter(counter + 1); + }; + + return ( +
+ +

You've pressed the button {counter} times.

+
+ ); +}; diff --git a/samples/meteor/imports/ui/Info.jsx b/samples/meteor/imports/ui/Info.jsx new file mode 100644 index 00000000..a9a7a45c --- /dev/null +++ b/samples/meteor/imports/ui/Info.jsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { useFind, useSubscribe } from 'meteor/react-meteor-data'; +import { LinksCollection } from '../api/links'; + +export const Info = () => { + const isLoading = useSubscribe('links'); + const links = useFind(() => LinksCollection.find()); + + if(isLoading()) { + return
Loading...
; + } + + return ( +
+

Learn Meteor!

+ +
+ ); +}; diff --git a/samples/meteor/package-lock.json b/samples/meteor/package-lock.json new file mode 100644 index 00000000..9e9f75cb --- /dev/null +++ b/samples/meteor/package-lock.json @@ -0,0 +1,848 @@ +{ + "name": "meteor", + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/runtime": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.7.tgz", + "integrity": "sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==", + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "meteor-node-stubs": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.2.9.tgz", + "integrity": "sha512-EKRezc1/PblYtYiK4BOT3h5geWDo9AFBBSYNamPNh8AC5msUbVCcg8kekzAa7r7JPzBX8nZWaXEQVar4t8q/Hg==", + "requires": { + "@meteorjs/crypto-browserify": "^3.12.1", + "assert": "^2.1.0", + "browserify-zlib": "^0.2.0", + "buffer": "^5.7.1", + "console-browserify": "^1.2.0", + "constants-browserify": "^1.0.0", + "domain-browser": "^4.23.0", + "elliptic": "^6.5.4", + "events": "^3.3.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "^1.0.1", + "process": "^0.11.10", + "punycode": "^1.4.1", + "querystring-es3": "^0.2.1", + "readable-stream": "^3.6.2", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "string_decoder": "^1.3.0", + "timers-browserify": "^2.0.12", + "tty-browserify": "0.0.1", + "url": "^0.11.3", + "util": "^0.12.5", + "vm-browserify": "^1.1.2" + }, + "dependencies": { + "@meteorjs/crypto-browserify": { + "version": "3.12.1", + "bundled": true, + "requires": { + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "dependencies": { + "hash-base": { + "version": "3.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + } + } + }, + "asn1.js": { + "version": "4.10.1", + "bundled": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "assert": { + "version": "2.1.0", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" + } + }, + "available-typed-arrays": { + "version": "1.0.5", + "bundled": true + }, + "base64-js": { + "version": "1.5.1", + "bundled": true + }, + "bn.js": { + "version": "5.2.0", + "bundled": true + }, + "brorand": { + "version": "1.1.0", + "bundled": true + }, + "browserify-aes": { + "version": "1.2.0", + "bundled": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "bundled": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "bundled": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.1.0", + "bundled": true, + "requires": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.2.3", + "bundled": true, + "requires": { + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.5", + "hash-base": "~3.0", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "bundled": true + }, + "hash-base": { + "version": "3.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "readable-stream": { + "version": "2.3.8", + "bundled": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "bundled": true + } + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "bundled": true + } + } + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "bundled": true, + "requires": { + "pako": "~1.0.5" + } + }, + "buffer": { + "version": "5.7.1", + "bundled": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-xor": { + "version": "1.0.3", + "bundled": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "bundled": true + }, + "call-bind": { + "version": "1.0.5", + "bundled": true, + "requires": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + } + }, + "cipher-base": { + "version": "1.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "console-browserify": { + "version": "1.2.0", + "bundled": true + }, + "constants-browserify": { + "version": "1.0.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.3", + "bundled": true + }, + "create-ecdh": { + "version": "4.0.4", + "bundled": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "bundled": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "bundled": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "define-data-property": { + "version": "1.1.1", + "bundled": true, + "requires": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "define-properties": { + "version": "1.2.1", + "bundled": true, + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "des.js": { + "version": "1.0.1", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "diffie-hellman": { + "version": "5.0.3", + "bundled": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "domain-browser": { + "version": "4.23.0", + "bundled": true + }, + "elliptic": { + "version": "6.5.5", + "bundled": true, + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "events": { + "version": "3.3.0", + "bundled": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "bundled": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "for-each": { + "version": "0.3.3", + "bundled": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "function-bind": { + "version": "1.1.2", + "bundled": true + }, + "get-intrinsic": { + "version": "1.2.2", + "bundled": true, + "requires": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + } + }, + "gopd": { + "version": "1.0.1", + "bundled": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "has-property-descriptors": { + "version": "1.0.1", + "bundled": true, + "requires": { + "get-intrinsic": "^1.2.2" + } + }, + "has-proto": { + "version": "1.0.1", + "bundled": true + }, + "has-symbols": { + "version": "1.0.3", + "bundled": true + }, + "has-tostringtag": { + "version": "1.0.0", + "bundled": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hash-base": { + "version": "3.1.0", + "bundled": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "hash.js": { + "version": "1.1.7", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hasown": { + "version": "2.0.0", + "bundled": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "bundled": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "https-browserify": { + "version": "1.0.0", + "bundled": true + }, + "ieee754": { + "version": "1.2.1", + "bundled": true + }, + "inherits": { + "version": "2.0.4", + "bundled": true + }, + "is-arguments": { + "version": "1.1.1", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "bundled": true + }, + "is-generator-function": { + "version": "1.0.10", + "bundled": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-nan": { + "version": "1.3.2", + "bundled": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, + "is-typed-array": { + "version": "1.1.12", + "bundled": true, + "requires": { + "which-typed-array": "^1.1.11" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "md5.js": { + "version": "1.3.5", + "bundled": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "bundled": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "bundled": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "bundled": true + }, + "object-inspect": { + "version": "1.13.1", + "bundled": true + }, + "object-is": { + "version": "1.1.5", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "object-keys": { + "version": "1.1.1", + "bundled": true + }, + "object.assign": { + "version": "4.1.4", + "bundled": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "os-browserify": { + "version": "0.3.0", + "bundled": true + }, + "pako": { + "version": "1.0.11", + "bundled": true + }, + "parse-asn1": { + "version": "5.1.7", + "bundled": true, + "requires": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "dependencies": { + "hash-base": { + "version": "3.0.4", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + } + } + }, + "path-browserify": { + "version": "1.0.1", + "bundled": true + }, + "pbkdf2": { + "version": "3.1.2", + "bundled": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "process": { + "version": "0.11.10", + "bundled": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true + }, + "public-encrypt": { + "version": "4.0.3", + "bundled": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "bundled": true + } + } + }, + "punycode": { + "version": "1.4.1", + "bundled": true + }, + "qs": { + "version": "6.11.2", + "bundled": true, + "requires": { + "side-channel": "^1.0.4" + } + }, + "querystring-es3": { + "version": "0.2.1", + "bundled": true + }, + "randombytes": { + "version": "2.1.0", + "bundled": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "bundled": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "3.6.2", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "ripemd160": { + "version": "2.0.2", + "bundled": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "bundled": true + }, + "set-function-length": { + "version": "1.1.1", + "bundled": true, + "requires": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "setimmediate": { + "version": "1.0.5", + "bundled": true + }, + "sha.js": { + "version": "2.4.11", + "bundled": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "side-channel": { + "version": "1.0.4", + "bundled": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "stream-browserify": { + "version": "3.0.0", + "bundled": true, + "requires": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "stream-http": { + "version": "3.2.0", + "bundled": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "string_decoder": { + "version": "1.3.0", + "bundled": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "timers-browserify": { + "version": "2.0.12", + "bundled": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tty-browserify": { + "version": "0.0.1", + "bundled": true + }, + "url": { + "version": "0.11.3", + "bundled": true, + "requires": { + "punycode": "^1.4.1", + "qs": "^6.11.2" + } + }, + "util": { + "version": "0.12.5", + "bundled": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "vm-browserify": { + "version": "1.1.2", + "bundled": true + }, + "which-typed-array": { + "version": "1.1.13", + "bundled": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.4", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "xtend": { + "version": "4.0.2", + "bundled": true + } + } + }, + "react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + } + }, + "regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "requires": { + "loose-envify": "^1.1.0" + } + } + } +} diff --git a/samples/meteor/package.json b/samples/meteor/package.json new file mode 100644 index 00000000..7bd9c253 --- /dev/null +++ b/samples/meteor/package.json @@ -0,0 +1,23 @@ +{ + "name": "meteor", + "private": true, + "scripts": { + "start": "meteor run", + "test": "meteor test --once --driver-package meteortesting:mocha", + "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha", + "visualize": "meteor --production --extra-packages bundle-visualizer" + }, + "dependencies": { + "@babel/runtime": "^7.23.5", + "meteor-node-stubs": "^1.2.7", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "meteor": { + "mainModule": { + "client": "client/main.jsx", + "server": "server/main.js" + }, + "testModule": "tests/main.js" + } +} diff --git a/samples/meteor/server/main.js b/samples/meteor/server/main.js new file mode 100644 index 00000000..49452ad3 --- /dev/null +++ b/samples/meteor/server/main.js @@ -0,0 +1,37 @@ +import { Meteor } from 'meteor/meteor'; +import { LinksCollection } from '/imports/api/links'; + +async function insertLink({ title, url }) { + await LinksCollection.insertAsync({ title, url, createdAt: new Date() }); +} + +Meteor.startup(async () => { + // If the Links collection is empty, add some data. + if (await LinksCollection.find().countAsync() === 0) { + await insertLink({ + title: 'Do the Tutorial', + url: 'https://react-tutorial.meteor.com/simple-todos/01-creating-app.html', + }); + + await insertLink({ + title: 'Follow the Guide', + url: 'https://guide.meteor.com', + }); + + await insertLink({ + title: 'Read the Docs', + url: 'https://docs.meteor.com', + }); + + await insertLink({ + title: 'Discussions', + url: 'https://forums.meteor.com', + }); + } + + // We publish the entire Links collection to all clients. + // In order to be fetched in real-time to the clients + Meteor.publish("links", function () { + return LinksCollection.find(); + }); +}); diff --git a/samples/meteor/tests/main.js b/samples/meteor/tests/main.js new file mode 100644 index 00000000..33db2381 --- /dev/null +++ b/samples/meteor/tests/main.js @@ -0,0 +1,20 @@ +import assert from "assert"; + +describe("meteor", function () { + it("package.json has correct name", async function () { + const { name } = await import("../package.json"); + assert.strictEqual(name, "meteor"); + }); + + if (Meteor.isClient) { + it("client is not server", function () { + assert.strictEqual(Meteor.isServer, false); + }); + } + + if (Meteor.isServer) { + it("server is not client", function () { + assert.strictEqual(Meteor.isClient, false); + }); + } +});