diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6dd12bac..772b9432 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,22 +31,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Auth to Github Package Docker Registry - run: | - echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin - - ## Try getting the node modules from cache, if failed npm ci - - uses: actions/cache@v2 - id: cache-npm - with: - path: node_modules - key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node-${{ matrix.node }}-${{ env.cache-name }}- - ${{ runner.OS }}-node-${{ matrix.node }}- - - name: Install npm deps - run: npm install -g npm && npm ci && npm install -g @fairdatasociety/fdp-play + run: npm ci && npm install -g @fairdatasociety/fdp-play - name: Start fdp-play environment run: npm run bee diff --git a/src/command/utility/get-bee.ts b/src/command/utility/get-bee.ts index cdd60fc1..a8103274 100644 --- a/src/command/utility/get-bee.ts +++ b/src/command/utility/get-bee.ts @@ -1,5 +1,6 @@ +import { Strings } from 'cafe-utility' import { execSync } from 'child_process' -import { writeFileSync } from 'fs' +import { existsSync, writeFileSync } from 'fs' import { LeafCommand } from 'furious-commander' import fetch from 'node-fetch' import { RootCommand } from '../root-command' @@ -34,14 +35,41 @@ export class GetBee extends RootCommand implements LeafCommand { await fetch(url) .then(x => x.arrayBuffer()) .then(x => writeFileSync(`bee${suffixString}`, Buffer.from(x))) - this.console.info('Bee downloaded successfully') + this.console.log('Bee downloaded successfully') if (process.platform !== 'win32') { - this.console.info(`Running chmod +x bee`) + this.console.info(`Running chmod +x bee to make it executable`) execSync('chmod +x bee') } - this.console.log('Verify the version of the downloaded Bee binary by running:') - this.console.log('') - this.console.log('./bee version') + + if (existsSync('config.yaml')) { + this.console.log('config.yaml already exists, done') + + return + } + + this.console.info('') + this.console.info('Ultra-light: Limited download capabilities, no funding required.') + this.console.info('Light: Full functionality; requires xDAI to launch and xBZZ for uploading and retrieving data.') + + const type = await this.console.promptList(['ultra-light', 'light'], 'Select the type of configuration to create') + writeFileSync( + 'config.yaml', + `api-addr: 127.0.0.1:1633 +blockchain-rpc-endpoint: "https://xdai.fairdatasociety.org" +cors-allowed-origins: ["*"] +data-dir: "${process.cwd()}/data-dir" +full-node: false +mainnet: true +resolver-options: ["https://cloudflare-eth.com"] +storage-incentives-enable: false +swap-enable: ${type === 'light' ? 'true' : 'false'} +password: "${Strings.randomAlphanumeric(20)}"`, + ) + + this.console.info('') + this.console.log('All set! Start Bee node by running:') + this.console.info('') + this.console.log('./bee start --config=config.yaml') } }