Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

feat: a bunch of user friendliness changes #4

Merged
merged 37 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
486b9bd
WIP
wyhaines Aug 17, 2023
95a57ac
Usability changes
wyhaines Aug 22, 2023
fa0f10e
Temporary file that had slipped my mind that I had made. It was just …
wyhaines Aug 23, 2023
91efee7
Make imports follow suggestion of separating local imports by a blank…
wyhaines Aug 23, 2023
6720abb
Let prettier do its magic.
wyhaines Aug 23, 2023
abf7a65
Convert uses of snake_case to camelCase.
wyhaines Aug 23, 2023
c5708cc
Update src/commands/clean.command.ts
wyhaines Aug 23, 2023
d02b254
Update src/commands/clean.command.ts
wyhaines Aug 23, 2023
0d5d357
Simplify subscribe without callbacks.
wyhaines Aug 23, 2023
f94c313
Cleaned up the directory verification methods and messaging.
wyhaines Aug 23, 2023
1f17453
Remove the \n in strings and simplify a tiny bit.
wyhaines Aug 23, 2023
b492302
Little cleanups.
wyhaines Aug 23, 2023
05eebcb
Minor cleanup of quiet + version handling.
wyhaines Aug 24, 2023
38e89d8
Clean up a subscribe call.
wyhaines Aug 24, 2023
63caa0d
Added a little more self-explanatory name than globalThis.lconsole.
wyhaines Aug 24, 2023
850690f
Refactored globals.ts -> initializers.ts
wyhaines Aug 24, 2023
d9d72f4
Renamed the getters for the logging console and the logging file to m…
wyhaines Aug 24, 2023
ef5cec5
Simplify another subscribe() call.
wyhaines Aug 24, 2023
77dbf39
Simplify _shutdownRedis().
wyhaines Aug 24, 2023
147b389
Rename the new root command from NewRootCommand to just root, per PR …
wyhaines Aug 24, 2023
27b7858
chore: clean and refactor a few things
sebastiendan Aug 25, 2023
25dd6a0
Fixed bugs and layout.
wyhaines Aug 26, 2023
0b938db
Refactored version checks to all happen within next(), without using …
wyhaines Aug 28, 2023
d822dfd
fix: use concatMap to fix redis down logging
sebastiendan Aug 29, 2023
6d5d693
ci: add smoke test workflow
sebastiendan Aug 29, 2023
19aca19
ci: merge release pipeline workflow with npm package
sebastiendan Aug 29, 2023
9ceea96
ci: add verbose flag
sebastiendan Aug 29, 2023
b9b1c98
fix: revert start error logging
sebastiendan Aug 29, 2023
6a713b3
fix: keep errors for file loggers after all
sebastiendan Aug 29, 2023
18748cb
ci: upload logs
sebastiendan Aug 29, 2023
49b6207
ci: set git config
sebastiendan Aug 29, 2023
6fdebf0
fix: use right path for logs
sebastiendan Aug 29, 2023
9df5bf5
chore: clean clean command
sebastiendan Aug 29, 2023
5f2bb8a
fix: revert fake repo endpoint
sebastiendan Aug 29, 2023
496d19a
fix: clone repo with http
sebastiendan Aug 29, 2023
a39d39f
ci: kill process when start completes
sebastiendan Aug 29, 2023
c7bf021
fix: return success when string is found
sebastiendan Aug 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/npm-package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Publish Package to NPM Registry

on:
release:
types: [published]

jobs:
npm-package:
runs-on: ubuntu-latest-16-core
Expand All @@ -17,3 +19,18 @@ jobs:
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

notification:
runs-on: ubuntu-latest-16-core
needs: npm-package
steps:
- name: Send Slack notification
uses: slackapi/[email protected]
with:
payload: |
{
"repository": "${{ github.repository }}",
"version": "${{ github.ref }}"
}
env:
SLACK_WEBHOOK_URL: ${{ vars.RELEASE_PIPELINE_SLACK_WEBHOOK_URL }}
20 changes: 0 additions & 20 deletions .github/workflows/release-pipeline.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/test:smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Smoke test

on:
pull_request:
branches:
- main

jobs:
smoke-test:
runs-on: ubuntu-latest-16-core
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install deps
run: npm ci

- name: Build
run: npm run build

- name: Smoke root command
run: node dist/main --help

- name: Smoke start command
run: (node dist/main start -v | tee >(grep -q "🔥 Everything is done! 🔥" && pkill -P $$); [ $? -eq 143 ])

- name: Smoke clean command
run: node dist/main clean -v

- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: logs
path: /home/runner/.local/state/topos-playground/logs
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img src="./.github/assets/topos_logo_dark.png#gh-dark-mode-only" alt="Logo" width="200">
<br />
<p align="center">
<b>Topos Playground</b> is the CLI to run a local devnet to test the Topos ecosystem 🚀
<b>Topos Playground</b> is a CLI make it simple to run a local Topos devnet 🚀
</p>
<br />
</div>
Expand All @@ -26,10 +26,29 @@ $ npm install -g @topos-protocol/topos-playground

### Run the CLI

If you installed the package manually, you can run it like so
If you have installed the package manually, you can run it like so:

```
$ topos-playground [start|clean]
$ topos-playground --help
```

The playground respects XDG Base Directory Specifications, so by default, it will store
wyhaines marked this conversation as resolved.
Show resolved Hide resolved
data used while running in `$HOME/.local/share/topos-playground` and it will store logs
in `$HOME/.state/topos-playground/logs`.

To override these default locations, you can set your `HOME`, `XDG_DATA_HOME` and `XDG_STATE_HOME`
environment variables, or specify them in a `.env` file.

```
$ HOME=/tmp topos-playground start
```

By default, topos-playground sends output to both your console and to a log file when it is running.
To disable this, you can use the `--quiet` flag to prevent output from going to the console, or the
`--no-log` flag to prevent output from going to the log file.

```
$ topos-playground start --quiet
```

Otherwise, you can use `npx` to abstract the installation
Expand Down
53 changes: 33 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@topos-protocol/topos-playground",
"version": "0.0.2",
"description": "CLI to run local Topos devnets with subnets, a TCE network, and apps",
"description": "topos-playground is a CLI tool which handles all of the orchestration necessary to run local Topos devnets with subnets, a TCE network, and apps.",
"author": "Sébastien Dan <[email protected]>",
"license": "MIT",
"bin": {
Expand All @@ -18,8 +18,11 @@
"dependencies": {
"@nestjs/common": "^9.0.0",
"@nestjs/core": "^9.0.0",
"chalk": "^4.1.2",
"dotenv": "^16.3.1",
"ethers": "^5.7.2",
"nest-commander": "^3.7.1",
"semver": "^7.5.4",
"winston": "^3.8.2"
},
"devDependencies": {
Expand Down
7 changes: 6 additions & 1 deletion src/ReactiveSpawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ChildProcess, spawn } from 'child_process'
import { userInfo } from 'os'
import { Observable } from 'rxjs'

import { log } from './loggers'

export interface Next {
origin: 'stdout' | 'stderr'
output: string | ChildProcess
Expand All @@ -12,6 +14,9 @@ export class ReactiveSpawn {

reactify(command: string, options?: { runInBackground }) {
return new Observable<Next>((subscriber) => {
if (globalThis.verbose) {
log(`🏃 Running command: ${command}`)
}
const childProcess = spawn(command, { ...options, shell: this._shell })

if (options && options.runInBackground) {
Expand All @@ -22,7 +27,7 @@ export class ReactiveSpawn {
const output = data.toString()
subscriber.next({ origin: 'stdout', output })
})

childProcess.stderr.on('data', (data: Buffer) => {
const output = data.toString()
subscriber.next({ origin: 'stderr', output })
Expand Down
5 changes: 4 additions & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { Module } from '@nestjs/common'

import { CleanCommand } from './commands/clean.command'
import { StartCommand } from './commands/start.command'
import { VersionCommand } from './commands/version.command'
import { Root } from './commands/root.command'

import { ReactiveSpawn } from './ReactiveSpawn'

@Module({
providers: [ReactiveSpawn, CleanCommand, StartCommand],
providers: [ReactiveSpawn, CleanCommand, StartCommand, VersionCommand, Root],
})
export class AppModule {}
Loading
Loading