diff --git a/docs/cli.md b/docs/cli.md index e9f06108..1421291e 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -51,7 +51,7 @@ $ laconic-so build-npms --include ``` e.g. ``` -$ laconic-so build-npms --include laconic-sdk +$ laconic-so build-npms --include registry-sdk ``` Build the packages for a stack: ``` diff --git a/docs/gitea-with-laconicd-fixturenet.md b/docs/gitea-with-laconicd-fixturenet.md index e245f6fd..f9ed86ab 100644 --- a/docs/gitea-with-laconicd-fixturenet.md +++ b/docs/gitea-with-laconicd-fixturenet.md @@ -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: - `@cerc-io/laconic-registry-cli` -- `@cerc-io/laconic-sdk` +- `@cerc-io/registry-sdk` ### Build and deploy fixturenet containers diff --git a/stack_orchestrator/data/container-build/cerc-builder-js/Dockerfile b/stack_orchestrator/data/container-build/cerc-builder-js/Dockerfile index 9e02327e..8c2f2fb9 100644 --- a/stack_orchestrator/data/container-build/cerc-builder-js/Dockerfile +++ b/stack_orchestrator/data/container-build/cerc-builder-js/Dockerfile @@ -68,5 +68,5 @@ ENV PATH="${PATH}:/scripts" COPY entrypoint.sh . ENTRYPOINT ["./entrypoint.sh"] # 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 diff --git a/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/build-app.sh b/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/build-app.sh index 2360d2d8..26d7db9e 100755 --- a/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/build-app.sh +++ b/stack_orchestrator/data/container-build/cerc-nextjs-base/scripts/build-app.sh @@ -98,39 +98,67 @@ try { console.log(envMap); EOF -CONFIG_LINES=$(wc -l ${NEXT_CONFIG_JS} | awk '{ print $1 }') -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 +grep 'withPWA' ${NEXT_CONFIG_JS} >/dev/null && HAS_WITHPWA=true || HAS_WITHPWA=false -if [ -n "$WEBPACK_CONF_LINE" ]; then - WEBPACK_CONF_VAR=$(egrep -n 'webpack:\s+\([^,]+,' ${NEXT_CONFIG_JS} | cut -d',' -f1 | cut -d'(' -f2) - head -$(( ${WEBPACK_CONF_LINE} )) ${NEXT_CONFIG_JS} > ${NEXT_CONFIG_JS}.2 - cat > ${NEXT_CONFIG_JS}.3 < ${NEXT_CONFIG_JS}.2 - cat > ${NEXT_CONFIG_JS}.3 < { +if [ "$HAS_WITHPWA" == "true" ]; then + if [ "$IMPORT_OR_REQUIRE" == "import" ]; then + cat > ${NEXT_CONFIG_JS}.2 < { + const realPWA = withPWA(p); + return (nextConfig) => { + const modConfig = {...nextConfig}; + + modConfig.webpack = (config) => { config.plugins.push(new webpack.DefinePlugin(envMap)); - return config; - }, + return nextConfig.webpack ? nextConfig.webpack(config) : config; + }; + + return realPWA(modConfig); + }; +}; EOF - NEXT_SECTION_ADJUSTMENT=1 - NEXT_SECTION_LINE=$ENV_LINE + else + cat > ${NEXT_CONFIG_JS}.3 < { + 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 - echo "WARNING: Cannot find location to insert environment variable map in ${NEXT_CONFIG_JS}" 1>&2 - rm -f ${NEXT_CONFIG_JS}.* - NEXT_SECTION_LINE=0 + cat > ${NEXT_CONFIG_JS}.3 < { + 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 -tail -$(( ${CONFIG_LINES} - ${NEXT_SECTION_LINE} + ${NEXT_SECTION_ADJUSTMENT} )) ${NEXT_CONFIG_JS} > ${NEXT_CONFIG_JS}.4 rm -f ${NEXT_CONFIG_JS} -for ((i=0; i <=5; i++)); do - if [ -f "${NEXT_CONFIG_JS}.${i}" ]; then +for ((i=0; i <= 10; i++)); do + if [ -s "${NEXT_CONFIG_JS}.${i}" ]; then if [ $i -le 2 ] ; then cat ${NEXT_CONFIG_JS}.${i} >> ${NEXT_CONFIG_JS} else @@ -139,6 +167,8 @@ for ((i=0; i <=5; i++)); do fi done 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 diff --git a/stack_orchestrator/data/npm-package-list.txt b/stack_orchestrator/data/npm-package-list.txt index f194e627..95a284dd 100644 --- a/stack_orchestrator/data/npm-package-list.txt +++ b/stack_orchestrator/data/npm-package-list.txt @@ -1,4 +1,4 @@ -laconic-sdk +registry-sdk laconic-registry-cli laconic-console debug diff --git a/stack_orchestrator/data/repository-list.txt b/stack_orchestrator/data/repository-list.txt index cddaccce..dba0ed74 100644 --- a/stack_orchestrator/data/repository-list.txt +++ b/stack_orchestrator/data/repository-list.txt @@ -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-db 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-console github.com/cerc-io/mobymask-watcher-ts diff --git a/stack_orchestrator/data/stacks/build-support/README.md b/stack_orchestrator/data/stacks/build-support/README.md index 48487731..39bd7dca 100644 --- a/stack_orchestrator/data/stacks/build-support/README.md +++ b/stack_orchestrator/data/stacks/build-support/README.md @@ -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): ``` $ 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 ``` diff --git a/stack_orchestrator/data/stacks/fixturenet-laconic-loaded/stack.yml b/stack_orchestrator/data/stacks/fixturenet-laconic-loaded/stack.yml index 6c8aae4a..40ab1cd1 100644 --- a/stack_orchestrator/data/stacks/fixturenet-laconic-loaded/stack.yml +++ b/stack_orchestrator/data/stacks/fixturenet-laconic-loaded/stack.yml @@ -7,11 +7,11 @@ repos: - github.com/lirewine/crypto - github.com/lirewine/gem - 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-console npms: - - laconic-sdk + - registry-sdk - laconic-registry-cli - debug - crypto diff --git a/stack_orchestrator/data/stacks/fixturenet-laconicd/stack.yml b/stack_orchestrator/data/stacks/fixturenet-laconicd/stack.yml index adab9e3e..f7e284ee 100644 --- a/stack_orchestrator/data/stacks/fixturenet-laconicd/stack.yml +++ b/stack_orchestrator/data/stacks/fixturenet-laconicd/stack.yml @@ -3,10 +3,10 @@ name: fixturenet-laconicd description: "A laconicd fixturenet" repos: - 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 npms: - - laconic-sdk + - registry-sdk - laconic-registry-cli containers: - cerc/laconicd diff --git a/stack_orchestrator/data/stacks/mainnet-laconic/stack.yml b/stack_orchestrator/data/stacks/mainnet-laconic/stack.yml index d0986891..bb733ec6 100644 --- a/stack_orchestrator/data/stacks/mainnet-laconic/stack.yml +++ b/stack_orchestrator/data/stacks/mainnet-laconic/stack.yml @@ -7,12 +7,12 @@ repos: - github.com/lirewine/crypto - github.com/lirewine/gem - 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-console - github.com/ping-pub/explorer npms: - - laconic-sdk + - registry-sdk - laconic-registry-cli - debug - crypto diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index 54cda3da..fbe0c5fc 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -109,7 +109,7 @@ Setup a test chain: ```bash 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 diff --git a/tests/smoke-test/run-smoke-test.sh b/tests/smoke-test/run-smoke-test.sh index 2fb4d322..c29c3ef4 100755 --- a/tests/smoke-test/run-smoke-test.sh +++ b/tests/smoke-test/run-smoke-test.sh @@ -20,7 +20,7 @@ echo "Cloning repositories into: $CERC_REPO_BASE_DIR" rm -rf $CERC_REPO_BASE_DIR mkdir -p $CERC_REPO_BASE_DIR # 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_TARGET_SO --stack test setup-repositories # Test building the a stack container