dcp-client 4.4.13 → 4.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ #! /bin/bash
2
+ #
3
+ # @file post-publish
4
+ # Hook which tags the package in git with the package version
5
+ # as it gets published.
6
+ # @author Wes Garland, wes@distributive.network
7
+ # @date Nov 2022
8
+ #
9
+ cd `dirname "$0"`/..
10
+ PACKAGE_VERSION=$(cat package.json | egrep '^\s*"version":' | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
11
+ git tag v$PACKAGE_VERSION && git push --tags
@@ -0,0 +1,53 @@
1
+ #! /bin/bash
2
+ # @file prepack
3
+ # Hook which generates the bundle on pack (or publish), and ensures that we only publish
4
+ # release packages.
5
+ # @author Wes Garland, wes@distributive.network
6
+ # @date Oct 2024
7
+
8
+ set -e
9
+ cd `dirname "$0"`/..
10
+ DCP_VERSION=$(node -p "require('./package').dcp.version")
11
+
12
+ if [ $(git rev-parse --abbrev-ref HEAD) != "release" ]; then
13
+ BUILD_TYPE="debug"
14
+ else
15
+ BUILD_TYPE="release"
16
+ fi
17
+
18
+ if [ ! -d node_modules ]; then
19
+ echo "node_modules missing; please run npm ci before packing" >&2
20
+ exit 1
21
+ fi
22
+
23
+ if [ ! "${NPM_PREPACK_SKIP_BUNDLE_REBUILD}" ]; then
24
+ if ! [ -d .dcp-build ]; then
25
+ git clone --filter=blob:none $(node -p "require('./package').dcp.repository") .dcp-build
26
+ else
27
+ git fetch
28
+ fi
29
+
30
+ (
31
+ for var in $(compgen -e | grep '^npm_')
32
+ do
33
+ eval unset ${var}
34
+ done
35
+ set > /tmp/q
36
+ cd .dcp-build
37
+ git checkout "$DCP_VERSION"
38
+ ./configure.sh --with-build="${BUILD_TYPE}" --disable-evaluator
39
+ npm ci
40
+ cd ..
41
+ build/bundle --no-cache --dcp=.dcp-build --build="${BUILD_TYPE}"
42
+ )
43
+ fi
44
+
45
+ if [ "${DCP_VERSION}" != $(node -r ./index -p "require('dcp/build').version") ]; then
46
+ echo "Bundle built from wrong version of DCP repo!" >&2
47
+ exit 1
48
+ fi
49
+
50
+ if [ $(node -r ./index -p "require('dcp/build').config.build") != "${BUILD_TYPE}" ]; then
51
+ echo "Bundle is not a ${BUILD_TYPE} build!" >&2
52
+ exit 1
53
+ fi
@@ -0,0 +1,49 @@
1
+ #! /bin/bash
2
+ #
3
+ # @file pre-publish
4
+ # Hook which prevents package publishing if the repository
5
+ # isn't in a nice, clean state.
6
+ # @author Wes Garland, wes@distributive.network
7
+ # @date Nov 2022
8
+ #
9
+ cd `dirname "$0"`/..
10
+
11
+ yellow='\e[33m'
12
+ normal='\e[0m'
13
+
14
+ git ls-files --error-unmatch `find . -type f | egrep -v '^\./(node_modules|\.git|\.dcp-build|build)'` >/dev/null
15
+ if [ "$?" != "0" ]; then
16
+ echo
17
+ echo -e "${yellow}pre-publish: abort due to files in package which aren't in repo${normal}" >/dev/stderr
18
+ echo
19
+ exit 1
20
+ fi
21
+
22
+ (git status --porcelain; echo DONE DONE) \
23
+ | egrep -v '^ M dist/' \
24
+ | while read status filename
25
+ do
26
+ case "$status" in
27
+ "M")
28
+ echo "${filename} is not checked in"
29
+ EXITCODE=1
30
+ ;;
31
+ "DONE")
32
+ exit $EXITCODE
33
+ ;;
34
+ *)
35
+ ;;
36
+ esac
37
+ done
38
+ if [ "$?" != "0" ]; then
39
+ echo
40
+ echo -e "${yellow}pre-publish: abort due to modified files${normal}" >/dev/stderr
41
+ echo
42
+ exit 1
43
+ fi
44
+
45
+ if [ $(git rev-parse --abbrev-ref HEAD) != "release" ]; then
46
+ echo "${yellow}pre-publish: this is not the release branch!" >&2
47
+ exit 1
48
+ fi
49
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-client",
3
- "version": "4.4.13",
3
+ "version": "4.4.15",
4
4
  "description": "Core libraries for accessing DCP network",
5
5
  "keywords": [
6
6
  "dcp"
@@ -9,6 +9,10 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/Distributed-Compute-Labs/dcp-client/issues"
11
11
  },
12
+ "dcp": {
13
+ "version": "379a3131205d78e903405b80ba03575479eece7b",
14
+ "repository": "git@gitlab.com:Distributed-Compute-Protocol/dcp.git"
15
+ },
12
16
  "repository": {
13
17
  "type": "git",
14
18
  "url": "git+ssh://git@github.com/Distributed-Compute-Labs/dcp-client.git"
@@ -22,7 +26,10 @@
22
26
  "scripts": {
23
27
  "build": "./build/bundle",
24
28
  "test": "npx peter tests",
25
- "vtest": "npx peter -v tests"
29
+ "vtest": "npx peter -v tests",
30
+ "prepack": "npm-hooks/prepack",
31
+ "postpublish": "npm-hooks/postpublish",
32
+ "prepublishOnly": "npm-hooks/prepublish"
26
33
  },
27
34
  "dependencies": {
28
35
  "@kingsds/socket.io-client": "^4.5.4",
package/.tidelift DELETED
@@ -1,2 +0,0 @@
1
- TIDELIFT_ORGANIZATION=team/Distributive
2
- TIDELIFT_PROJECT=dcp-client
@@ -1,74 +0,0 @@
1
- #! /usr/bin/env bash
2
- #
3
- # @file publish-docs.sh
4
- # @athor Brandon Christie <brandon@distributive.network>
5
- # @date Aug 2023
6
- #
7
- # @description Publishes the docs for each component
8
- # to backstage.
9
-
10
- set -euo pipefail
11
-
12
- cd "$(dirname "$0")/.."
13
-
14
- ROOT_DIR=$PWD
15
-
16
- echo "TechDocs Bucket Name: $TECHDOCS_S3_BUCKET_NAME"
17
- echo "Namespace: $ENTITY_NAMESPACE"
18
-
19
- ENTITY_KIND=$(yq ".kind" < catalog-info.yaml)
20
- echo "Kind: $ENTITY_KIND"
21
-
22
- ENTITY_NAME=$(yq ".metadata.name" < catalog-info.yaml)
23
- echo "Name: $ENTITY_NAME"
24
-
25
- TECHDOCS_REF=$(yq ".metadata.annotations.\"backstage.io/techdocs-ref\"" < catalog-info.yaml)
26
- echo "TechDocs Ref: $TECHDOCS_REF"
27
-
28
- # An example of the the techdocs-ref in the YAML file:
29
- # dir:./docs/dcp
30
- #
31
- # The Regex below will isolate the directory path giving the
32
- # result 'docs/dcp' for the given example.
33
- if [[ "$TECHDOCS_REF" =~ dir:\.(.*) ]]; then
34
- RELATIVE_DOCS_DIR="${BASH_REMATCH[1]%%[[:space:]]*}"
35
- DOCS_DIR="$ROOT_DIR/$RELATIVE_DOCS_DIR"
36
- fi
37
-
38
- # The techdocs-cli commands must be called in the directory where the
39
- # mkdocs.yml file is present.
40
- cd "$DOCS_DIR"
41
-
42
- # MkDocs requires an index.md or README.md file, if one does not exist it will
43
- # be generated automatically.
44
- if ! [ -f index.md ] && ! [ -f README.md ]; then
45
- if [ -z "$CI" ]; then
46
- AUTHOR="$(git config user.name) <$(git config user.email)>"
47
- else
48
- AUTHOR="$CI_COMMIT_AUTHOR"
49
- fi
50
-
51
- echo "README.md or index.md was not found and will be automatically generated."
52
- cat >> index.md <<EOF
53
- <!--
54
- @author $AUTHOR
55
- @date $(date)
56
- @machine $HOSTNAME
57
- @rev $(git rev-parse HEAD)
58
- -->
59
- > **Warning**: MkDocs requires a top level index.md or README.md (case sensitive)
60
- This index.md file has been generated automatically to ensure MkDocs works correctly
61
- EOF
62
- fi
63
-
64
- npx techdocs-cli generate --no-docker --verbose
65
-
66
- npx techdocs-cli publish \
67
- --publisher-type awsS3 \
68
- --storage-name "$TECHDOCS_S3_BUCKET_NAME" \
69
- --entity "$ENTITY_NAMESPACE"/"$ENTITY_KIND"/"$ENTITY_NAME" \
70
- --directory "$DOCS_DIR"/site
71
-
72
- rm -r "$DOCS_DIR"/site
73
-
74
- echo "View generated component: https://backstage.overwatch.distributive.network/docs/default/component/$ENTITY_NAME"
package/catalog-info.yaml DELETED
@@ -1,21 +0,0 @@
1
- # @file catalog-info.yml
2
- # @author Brandon Christie <brandon@distributive.network>
3
- # @date Mar 2023
4
- #
5
- # @description Lists all of the components and the paths to all
6
- # the documentation that will be published to backstage.
7
-
8
- apiVersion: backstage.io/v1alpha1
9
- kind: Component
10
- metadata:
11
- name: dcp-client
12
- description: Documentation for the dcp-client.
13
- tags:
14
- - documentation
15
- annotations:
16
- gitlab.com/project-id: '9874684'
17
- backstage.io/techdocs-ref: dir:./docs
18
- spec:
19
- type: library
20
- lifecycle: production
21
- owner: core
@@ -1,48 +0,0 @@
1
- /**
2
- * @file dcp-config.js
3
- * Bare-bones config for worker loaded. For use with localexec,
4
- * or so the tree exists for
5
- *
6
- * @author Ryan Saweczko <ryan@kingsds.network>
7
- * @date Sep 2022
8
- */
9
-
10
- return {
11
- worker: {
12
- /* Allow lists permitting supervisor network access beyond DCP messages to services */
13
- allowOrigins: {
14
- any: [],
15
- fetchWorkFunctions: [],
16
- fetchArguments: [],
17
- fetchData: [],
18
- sendResults: [],
19
- },
20
-
21
- minimumWage: {
22
- CPU: 0,
23
- GPU: 0,
24
- 'in': 0,
25
- out: 0,
26
- },
27
-
28
- computeGroups: {}, // integer-one-indexed; format is 1:{ joinKey,joinHash } or 2:{ joinKey, joinSecret }
29
- jobAddresses: [], // Specific job addresses the worker may work on. If not empty, worker will only work on those jobs.
30
- maxWorkingSandboxes: 1,
31
- paymentAddress: null, // user must to specify
32
- evaluatorOptions: {}
33
- },
34
-
35
- standaloneWorker:
36
- {
37
- quiet: false,
38
- debug: process.env.DCP_SAW_DEBUG,
39
- evaluatorConnectBackoff:
40
- {
41
- maxInterval: 5 * 60 * 1000, // max: 5 minutes
42
- baseInterval: 10 * 1000, // start: 10s
43
- backoffFactor: 1.1 // each fail, back off by 10%
44
- },
45
- reloadBehaviour: 'process.exit(12)',
46
- },
47
- }
48
-