Merge branch 'main' into dboreham/mainnet-laconic-v2-fixes

This commit is contained in:
David Boreham 2024-07-31 07:24:04 -06:00
commit 0fa6e9f649
12 changed files with 69 additions and 39 deletions

View File

@ -51,7 +51,7 @@ $ laconic-so build-npms --include <package-name>
``` ```
e.g. e.g.
``` ```
$ laconic-so build-npms --include laconic-sdk $ laconic-so build-npms --include registry-sdk
``` ```
Build the packages for a stack: Build the packages for a stack:
``` ```

View File

@ -56,7 +56,7 @@ laconic-so --stack fixturenet-laconicd build-npms
Navigate to the Gitea console and switch to the `cerc-io` user then find the `Packages` tab to confirm that these two npm packages have been published: Navigate to the Gitea console and switch to the `cerc-io` user then find the `Packages` tab to confirm that these two npm packages have been published:
- `@cerc-io/laconic-registry-cli` - `@cerc-io/laconic-registry-cli`
- `@cerc-io/laconic-sdk` - `@cerc-io/registry-sdk`
### Build and deploy fixturenet containers ### Build and deploy fixturenet containers

View File

@ -68,5 +68,5 @@ ENV PATH="${PATH}:/scripts"
COPY entrypoint.sh . COPY entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"] ENTRYPOINT ["./entrypoint.sh"]
# Placeholder CMD : generally this will be overridden at run time like : # Placeholder CMD : generally this will be overridden at run time like :
# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build' # docker run -it -v /home/builder/cerc/registry-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build'
CMD node --version CMD node --version

View File

@ -98,39 +98,67 @@ try {
console.log(envMap); console.log(envMap);
EOF EOF
CONFIG_LINES=$(wc -l ${NEXT_CONFIG_JS} | awk '{ print $1 }') grep 'withPWA' ${NEXT_CONFIG_JS} >/dev/null && HAS_WITHPWA=true || HAS_WITHPWA=false
ENV_LINE=$(grep -n 'env:' ${NEXT_CONFIG_JS} | cut -d':' -f1)
WEBPACK_CONF_LINE=$(egrep -n 'webpack:\s+\([^,]+,' ${NEXT_CONFIG_JS} | cut -d':' -f1)
NEXT_SECTION_ADJUSTMENT=0
if [ -n "$WEBPACK_CONF_LINE" ]; then if [ "$HAS_WITHPWA" == "true" ]; then
WEBPACK_CONF_VAR=$(egrep -n 'webpack:\s+\([^,]+,' ${NEXT_CONFIG_JS} | cut -d',' -f1 | cut -d'(' -f2) if [ "$IMPORT_OR_REQUIRE" == "import" ]; then
head -$(( ${WEBPACK_CONF_LINE} )) ${NEXT_CONFIG_JS} > ${NEXT_CONFIG_JS}.2 cat > ${NEXT_CONFIG_JS}.2 <<EOF
cat > ${NEXT_CONFIG_JS}.3 <<EOF const __xPWA__ = (p) => {
$WEBPACK_CONF_VAR.plugins.push(new webpack.DefinePlugin(envMap)); const realPWA = withPWA(p);
EOF return (nextConfig) => {
NEXT_SECTION_LINE=$((WEBPACK_CONF_LINE)) const modConfig = {...nextConfig};
elif [ -n "$ENV_LINE" ]; then
head -$(( ${ENV_LINE} - 1 )) ${NEXT_CONFIG_JS} > ${NEXT_CONFIG_JS}.2 modConfig.webpack = (config) => {
cat > ${NEXT_CONFIG_JS}.3 <<EOF
webpack: (config) => {
config.plugins.push(new webpack.DefinePlugin(envMap)); config.plugins.push(new webpack.DefinePlugin(envMap));
return config; return nextConfig.webpack ? nextConfig.webpack(config) : config;
}, };
return realPWA(modConfig);
};
};
EOF EOF
NEXT_SECTION_ADJUSTMENT=1 else
NEXT_SECTION_LINE=$ENV_LINE cat > ${NEXT_CONFIG_JS}.3 <<EOF
const __xPWA__ = (nextConfig) => {
const modConfig = {...nextConfig};
modConfig.webpack = (config) => {
config.plugins.push(new webpack.DefinePlugin(envMap));
return nextConfig.webpack ? nextConfig.webpack(config) : config;
};
return withPWA(modConfig);
};
EOF
fi
cat ${NEXT_CONFIG_JS} | js-beautify | sed 's/withPWA(/__xPWA__(/g' > ${NEXT_CONFIG_JS}.4
else else
echo "WARNING: Cannot find location to insert environment variable map in ${NEXT_CONFIG_JS}" 1>&2 cat > ${NEXT_CONFIG_JS}.3 <<EOF
rm -f ${NEXT_CONFIG_JS}.* const __xCfg__ = (nextConfig) => {
NEXT_SECTION_LINE=0 const modConfig = {...nextConfig};
modConfig.webpack = (config) => {
config.plugins.push(new webpack.DefinePlugin(envMap));
return nextConfig.webpack ? nextConfig.webpack(config) : config;
};
return modConfig;
};
EOF
if [ "$IMPORT_OR_REQUIRE" == "import" ]; then
cat ${NEXT_CONFIG_JS} | js-beautify | sed 's/export\s\+default\s\+/const __orig_cfg__ = /g' > ${NEXT_CONFIG_JS}.4
echo "export default __xCfg__(__orig_cfg__);" > ${NEXT_CONFIG_JS}.5
else
cat ${NEXT_CONFIG_JS} | js-beautify | sed 's/module.exports\s\+=\s\+/const __orig_cfg__ = /g' > ${NEXT_CONFIG_JS}.4
echo "module.exports = __xCfg__(__orig_cfg__);" > ${NEXT_CONFIG_JS}.5
fi
fi fi
tail -$(( ${CONFIG_LINES} - ${NEXT_SECTION_LINE} + ${NEXT_SECTION_ADJUSTMENT} )) ${NEXT_CONFIG_JS} > ${NEXT_CONFIG_JS}.4
rm -f ${NEXT_CONFIG_JS} rm -f ${NEXT_CONFIG_JS}
for ((i=0; i <=5; i++)); do for ((i=0; i <= 10; i++)); do
if [ -f "${NEXT_CONFIG_JS}.${i}" ]; then if [ -s "${NEXT_CONFIG_JS}.${i}" ]; then
if [ $i -le 2 ] ; then if [ $i -le 2 ] ; then
cat ${NEXT_CONFIG_JS}.${i} >> ${NEXT_CONFIG_JS} cat ${NEXT_CONFIG_JS}.${i} >> ${NEXT_CONFIG_JS}
else else
@ -139,6 +167,8 @@ for ((i=0; i <=5; i++)); do
fi fi
done done
rm ${NEXT_CONFIG_JS}.* rm ${NEXT_CONFIG_JS}.*
cat ${NEXT_CONFIG_JS} | js-beautify > ${NEXT_CONFIG_JS}.pretty
mv ${NEXT_CONFIG_JS}.pretty ${NEXT_CONFIG_JS}
"${SCRIPT_DIR}/find-env.sh" "$(pwd)" > .env-list.json "${SCRIPT_DIR}/find-env.sh" "$(pwd)" > .env-list.json

View File

@ -1,4 +1,4 @@
laconic-sdk registry-sdk
laconic-registry-cli laconic-registry-cli
laconic-console laconic-console
debug debug

View File

@ -7,7 +7,7 @@ github.com/cerc-io/ipld-eth-db-validator
github.com/cerc-io/ipld-eth-beacon-indexer github.com/cerc-io/ipld-eth-beacon-indexer
github.com/cerc-io/ipld-eth-beacon-db github.com/cerc-io/ipld-eth-beacon-db
github.com/cerc-io/laconicd github.com/cerc-io/laconicd
github.com/cerc-io/laconic-sdk github.com/cerc-io/registry-sdk
github.com/cerc-io/laconic-registry-cli github.com/cerc-io/laconic-registry-cli
github.com/cerc-io/laconic-console github.com/cerc-io/laconic-console
github.com/cerc-io/mobymask-watcher-ts github.com/cerc-io/mobymask-watcher-ts

View File

@ -58,5 +58,5 @@ Now npm packages can be built:
Ensure that `CERC_NPM_AUTH_TOKEN` is set with the token printed above when the package-registry stack was deployed (the actual token value will be different than shown in this example): Ensure that `CERC_NPM_AUTH_TOKEN` is set with the token printed above when the package-registry stack was deployed (the actual token value will be different than shown in this example):
``` ```
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45 $ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
$ laconic-so build-npms --include laconic-sdk,laconic-registry-cli $ laconic-so build-npms --include registry-sdk,laconic-registry-cli
``` ```

View File

@ -7,11 +7,11 @@ repos:
- github.com/lirewine/crypto - github.com/lirewine/crypto
- github.com/lirewine/gem - github.com/lirewine/gem
- github.com/lirewine/sdk - github.com/lirewine/sdk
- git.vdb.to/cerc-io/laconic-sdk - git.vdb.to/cerc-io/registry-sdk
- git.vdb.to/cerc-io/laconic-registry-cli - git.vdb.to/cerc-io/laconic-registry-cli
- git.vdb.to/cerc-io/laconic-console - git.vdb.to/cerc-io/laconic-console
npms: npms:
- laconic-sdk - registry-sdk
- laconic-registry-cli - laconic-registry-cli
- debug - debug
- crypto - crypto

View File

@ -3,10 +3,10 @@ name: fixturenet-laconicd
description: "A laconicd fixturenet" description: "A laconicd fixturenet"
repos: repos:
- git.vdb.to/cerc-io/laconicd - git.vdb.to/cerc-io/laconicd
- git.vdb.to/cerc-io/laconic-sdk - git.vdb.to/cerc-io/registry-sdk
- git.vdb.to/cerc-io/laconic-registry-cli - git.vdb.to/cerc-io/laconic-registry-cli
npms: npms:
- laconic-sdk - registry-sdk
- laconic-registry-cli - laconic-registry-cli
containers: containers:
- cerc/laconicd - cerc/laconicd

View File

@ -7,12 +7,12 @@ repos:
- github.com/lirewine/crypto - github.com/lirewine/crypto
- github.com/lirewine/gem - github.com/lirewine/gem
- github.com/lirewine/sdk - github.com/lirewine/sdk
- git.vdb.to/cerc-io/laconic-sdk - git.vdb.to/cerc-io/registry-sdk
- git.vdb.to/cerc-io/laconic-registry-cli - git.vdb.to/cerc-io/laconic-registry-cli
- git.vdb.to/cerc-io/laconic-console - git.vdb.to/cerc-io/laconic-console
- github.com/ping-pub/explorer - github.com/ping-pub/explorer
npms: npms:
- laconic-sdk - registry-sdk
- laconic-registry-cli - laconic-registry-cli
- debug - debug
- crypto - crypto

View File

@ -109,7 +109,7 @@ Setup a test chain:
```bash ```bash
export CERC_NPM_REGISTRY_URL=https://git.vdb.to/api/packages/cerc-io/npm/ export CERC_NPM_REGISTRY_URL=https://git.vdb.to/api/packages/cerc-io/npm/
laconic-so --stack fixturenet-laconic-loaded setup-repositories --include git.vdb.to/cerc-io/laconicd,git.vdb.to/cerc-io/laconic-sdk,git.vdb.to/cerc-io/laconic-registry-cli,git.vdb.to/cerc-io/laconic-console laconic-so --stack fixturenet-laconic-loaded setup-repositories --include git.vdb.to/cerc-io/laconicd,git.vdb.to/cerc-io/registry-sdk,git.vdb.to/cerc-io/laconic-registry-cli,git.vdb.to/cerc-io/laconic-console
laconic-so --stack fixturenet-laconic-loaded build-containers laconic-so --stack fixturenet-laconic-loaded build-containers

View File

@ -20,7 +20,7 @@ echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
rm -rf $CERC_REPO_BASE_DIR rm -rf $CERC_REPO_BASE_DIR
mkdir -p $CERC_REPO_BASE_DIR mkdir -p $CERC_REPO_BASE_DIR
# Pull an example small public repo to test we can pull a repo # Pull an example small public repo to test we can pull a repo
$TEST_TARGET_SO setup-repositories --include cerc-io/laconic-sdk $TEST_TARGET_SO setup-repositories --include cerc-io/registry-sdk
# Test pulling a stack # Test pulling a stack
$TEST_TARGET_SO --stack test setup-repositories $TEST_TARGET_SO --stack test setup-repositories
# Test building the a stack container # Test building the a stack container