Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit 9a9e833

Browse files
committed
feat(explorer): add mui, fix nx config
1 parent 84dbfb8 commit 9a9e833

14 files changed

+344
-301
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@
1010
},
1111
"editor.formatOnSave": true,
1212
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
13+
"[html]": {
14+
"editor.defaultFormatter": "esbenp.prettier-vscode"
15+
},
1316
}

nx.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
{
2-
"extends": "@nrwl/workspace/presets/core.json",
3-
"npmScope": "dstack-js",
42
"affected": {
53
"defaultBase": "main"
64
},
75
"cli": {
86
"defaultCollection": "@nrwl/workspace"
97
},
8+
"extends": "@nrwl/workspace/presets/core.json",
9+
"npmScope": "dstack-js",
1010
"tasksRunnerOptions": {
1111
"default": {
12-
"runner": "@nrwl/nx-cloud",
1312
"options": {
13+
"accessToken": "MjBiYTU3ODktZDVlZC00MmNkLWI2YmQtNmNlNDIwOWY3ZDU1fHJlYWQtd3JpdGU=",
1414
"cacheableOperations": [
1515
"build",
1616
"lint",
1717
"test",
18-
"e2e"
19-
],
20-
"accessToken": "MjBiYTU3ODktZDVlZC00MmNkLWI2YmQtNmNlNDIwOWY3ZDU1fHJlYWQtd3JpdGU="
21-
}
18+
"e2e",
19+
"serve"
20+
]
21+
},
22+
"runner": "@nrwl/nx-cloud"
2223
}
2324
}
2425
}

package.json

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
{
2-
"name": "dstack-js",
3-
"version": "0.2.30",
4-
"license": "GPl-3.0",
5-
"scripts": {
6-
"prepare": "husky install",
7-
"build": "nx run-many --all --target=build",
8-
"release": "standard-version --bumpFiles package.json packages/lib/package.json packages/ipfs/package.json packages/relay/package.json"
9-
},
10-
"private": true,
112
"dependencies": {
123
"tslib": "^2.0.0"
134
},
14-
"workspaces": [
15-
"packages/*",
16-
"docs"
17-
],
185
"devDependencies": {
196
"@commitlint/cli": "^16.1.0",
207
"@commitlint/config-conventional": "^16.0.0",
@@ -48,10 +35,25 @@
4835
"yaml-crypt": "^0.7.6",
4936
"zx": "^4.3.0"
5037
},
38+
"license": "GPl-3.0",
5139
"lint-staged": {
5240
"*.{js,ts,css,md}": [
5341
"prettier --write",
5442
"eslint --cache --fix"
5543
]
56-
}
44+
},
45+
"name": "dstack-js",
46+
"private": true,
47+
"scripts": {
48+
"build": "nx run-many --all --target=build",
49+
"lint": "nx run-many --all --target=lint",
50+
"prepare": "husky install",
51+
"release": "standard-version --bumpFiles package.json packages/lib/package.json packages/ipfs/package.json packages/relay/package.json",
52+
"serve": "nx run-many --all --target=serve"
53+
},
54+
"version": "0.2.30",
55+
"workspaces": [
56+
"packages/*",
57+
"docs"
58+
]
5759
}

packages/explorer/.babelrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"plugins": [
3-
"@emotion/babel-plugin"
3+
"@emotion/babel-plugin",
4+
"babel-plugin-styled-components"
45
]
56
}

packages/explorer/.parcelrc

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compressors": {
33
"*.{html,css,js,svg,map}": [
4-
"...",
54
"@parcel/compressor-gzip",
65
"@parcel/compressor-brotli"
76
]

packages/explorer/.postcssrc

-6
This file was deleted.

packages/explorer/package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"browserslist": "> 0.5%, last 2 versions, not dead",
88
"dependencies": {
99
"@emotion/react": "^11.7.1",
10-
"awesome-react-repl": "^1.0.0",
10+
"@emotion/styled": "^11.6.0",
11+
"@mui/lab": "^5.0.0-alpha.67",
12+
"@mui/material": "^5.4.0",
1113
"react": "^17.0.2",
1214
"react-dom": "^17.0.2"
1315
},
@@ -21,17 +23,16 @@
2123
"@types/react": "^17.0.38",
2224
"@types/react-dom": "^17.0.11",
2325
"autoprefixer": "^10.4.2",
26+
"babel-plugin-styled-components": "^2.0.2",
2427
"parcel": "^2.2.1",
25-
"parcel-resolver-ts-base-url": "^1.1.5",
26-
"postcss": "^8.4.5",
27-
"tailwindcss": "^3.0.16"
28+
"parcel-resolver-ts-base-url": "^1.1.5"
2829
},
2930
"license": "GPL-3.0",
3031
"name": "@dstack-js/explorer",
3132
"private": true,
3233
"repository": "https://github.com/dstack-js/dstack.git",
3334
"scripts": {
34-
"build": "parcel build",
35+
"build": "parcel build src/index.html --experimental-scope-hoisting",
3536
"serve": "parcel"
3637
},
3738
"source": "src/index.html",

packages/explorer/project.json

+39-21
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,49 @@
11
{
2+
"implicitDependencies": [
3+
"lib",
4+
"ipfs"
5+
],
26
"projectType": "application",
37
"root": "packages/explorer",
4-
"serve": {
5-
"executor": "@nrwl/workspace:run-commands",
6-
"options": {
7-
"commands": [
8-
"nx build lib",
9-
"nx build ipfs",
10-
"cd packages/explorer && yarn serve"
11-
],
12-
"cwd": "/"
13-
}
14-
},
158
"sourceRoot": "packages/explorer/src",
169
"tags": [],
1710
"targets": {
18-
"executor": "@nrwl/workspace:run-commands",
19-
"options": {
20-
"commands": [
21-
"nx build lib",
22-
"nx build ipfs",
23-
"yarn build"
11+
"build": {
12+
"dependsOn": [
13+
{
14+
"projects": "dependencies",
15+
"target": "build"
16+
}
2417
],
25-
"cwd": "/"
18+
"executor": "@nrwl/workspace:run-commands",
19+
"options": {
20+
"commands": [
21+
"yarn build"
22+
],
23+
"cwd": "packages/explorer"
24+
},
25+
"outputs": [
26+
"packages/explorer/dist",
27+
".parcel-cache"
28+
]
2629
},
27-
"outputs": [
28-
"packages/explorer/dist"
29-
]
30+
"serve": {
31+
"dependsOn": [
32+
{
33+
"projects": "dependencies",
34+
"target": "build"
35+
}
36+
],
37+
"executor": "@nrwl/workspace:run-commands",
38+
"options": {
39+
"commands": [
40+
"yarn serve"
41+
],
42+
"cwd": "packages/explorer"
43+
},
44+
"outputs": [
45+
".parcel-cache"
46+
]
47+
}
3048
}
3149
}

packages/explorer/src/app.tsx

+25-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import { create } from '@dstack-js/ipfs';
22
import { Stack, Shard, ShardKind } from '@dstack-js/lib';
3+
import Box from '@mui/material/Box';
4+
import LoadingButton from '@mui/lab/LoadingButton';
5+
import TextField from '@mui/material/TextField';
36
import React, { useState } from 'react';
47
import { Dashboard } from './dashboard';
58

69
export const App: React.FunctionComponent<{}> = () => {
710
const [stack, setStack] = useState<Stack | null>(null);
8-
const [fillInfo, setFillInfo] = useState(true);
11+
const [loading, setLoading] = useState(false);
912
const [namespace, setNamespace] = useState('dstack');
1013

1114
const init = async (): Promise<void> => {
12-
setFillInfo(false);
15+
setLoading(true);
1316
localStorage.setItem('debug', '*');
1417

1518
const ipfs = await create();
@@ -22,21 +25,32 @@ export const App: React.FunctionComponent<{}> = () => {
2225
// @ts-expect-error
2326
window.ShardKind = ShardKind;
2427

28+
setLoading(false);
2529
setStack(stack);
2630
};
2731

28-
if (fillInfo) {
32+
if (!stack) {
2933
return (
30-
<div>
31-
<input
32-
type="text"
33-
value={namespace}
34+
<Box
35+
component="form"
36+
sx={{
37+
'& > :not(style)': { m: 1, width: '25ch' },
38+
}}
39+
noValidate
40+
autoComplete="off"
41+
>
42+
<TextField
43+
label="Stack namespace"
3444
onChange={(e) => setNamespace(e.target.value)}
35-
></input>
36-
<button onClick={init}>Start</button>
37-
</div>
45+
value={namespace}
46+
focused
47+
/>
48+
<LoadingButton loading={loading} onClick={init}>
49+
Create
50+
</LoadingButton>
51+
</Box>
3852
);
3953
}
4054

41-
return stack ? <Dashboard stack={stack} /> : <h3>Initializing</h3>;
55+
return <Dashboard stack={stack} />;
4256
};

packages/explorer/src/index.html

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Explorer</title>
8+
<link
9+
rel="stylesheet"
10+
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
11+
/>
12+
<link
13+
rel="stylesheet"
14+
href="https://fonts.googleapis.com/icon?family=Material+Icons"
15+
/>
816
</head>
917
<body>
1018
<div id="root"></div>

packages/explorer/tailwind.config.js

-9
This file was deleted.

packages/lib/project.json

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
{
2+
"projectType": "library",
23
"root": "packages/lib",
34
"sourceRoot": "packages/lib/src",
4-
"projectType": "library",
5+
"tags": [],
56
"targets": {
67
"build": {
78
"executor": "@nrwl/js:tsc",
8-
"outputs": ["{options.outputPath}"],
99
"options": {
10-
"outputPath": "dist/packages/lib",
10+
"assets": [
11+
"packages/lib/*.md"
12+
],
1113
"main": "packages/lib/src/index.ts",
12-
"tsConfig": "packages/lib/tsconfig.lib.json",
13-
"assets": ["packages/lib/*.md"]
14-
}
14+
"outputPath": "dist/packages/lib",
15+
"tsConfig": "packages/lib/tsconfig.lib.json"
16+
},
17+
"outputs": [
18+
"{options.outputPath}"
19+
]
1520
},
1621
"lint": {
1722
"executor": "@nrwl/linter:eslint",
18-
"outputs": ["{options.outputFile}"],
1923
"options": {
20-
"lintFilePatterns": ["packages/lib/**/*.ts"]
21-
}
24+
"lintFilePatterns": [
25+
"packages/lib/**/*.ts"
26+
]
27+
},
28+
"outputs": [
29+
"{options.outputFile}"
30+
]
2231
},
2332
"test": {
2433
"executor": "@nrwl/jest:jest",
25-
"outputs": ["coverage/packages/lib"],
2634
"options": {
2735
"jestConfig": "packages/lib/jest.config.js",
2836
"passWithNoTests": true
29-
}
37+
},
38+
"outputs": [
39+
"coverage/packages/lib"
40+
]
3041
}
31-
},
32-
"tags": []
42+
}
3343
}

0 commit comments

Comments
 (0)