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

Commit

Permalink
IgnisDa/issue1 (#12)
Browse files Browse the repository at this point in the history
* build(rust): optimize binaries for size

* style(moon): remove comments from file

* build: pin dependencies

* chore(react-ui): add react imports to components

* ci: use `--all` flag to test all projects

* ci: disable pruning of dependencies when running task

* build: install moonrepo-cli as dependency

* feat(main-db): remove empty test case unit

* build: declare chrono as a workspace dependency

* build(website): add routes-gen dependencies

Also remove remix-routes

* feat(website): use routes-gen for route generation

* feat(main-db): new library for edgeql string conversion

* build(website): add uuid package as dependency

* feat(orchestrator): add resolver to get question details

* feat(website): display question details on question/:id page

* chore: delete useless files

* ci: remove log level from check command

* ci(devcontainer): install moon directly from source

* ci(main-db): make `test` depend on `generate` task

* feat(website): remove all tailwind classes

* feat(react-ui): remove button and input components

* feat(website): add logic handling to authentication routes

* ci: add typecheck target to all project

* build(orchestrator): update edgedb versions

* feat(faker): add library to generate fake data

* ci: exclude build task from projects

* ci(eslint): add generated files to ignoring eslint

* ci(faker): configure watch command

* refactor(main-db): handle user data creation from library

* refactor(main-db): use fake random generator from library

* ci(faker): add  moon configuration

* ci: move dep to workspace root

* build: remove moon dev dep

* ci(main-db): mark generate as local task

* feat(website): use pre-populate with fake data in dev mode

* feat(website): replace using `axios` with `fetch`

Using the solution at remix-run/remix#4414 (comment).
However, it would be better if we do not have to write a custom fetch
function at all.

* fix(website): graphql fetch function

* fix(website): throw error when unable to get user details

* fix(website/auth): broken login flow because of error handling

* fix(website): use correct btn label

* ci: use correct moon command to check validity

* feat:  use slug for creating questions

* ci(generated): do not emit declarations

* fix(learning): return correct error when question not exists

* feat(website): handle edge cases while creating questions

Also show correct details non existent question
is requested.

* refactor(website): reference projects directly

Using the guide at
https://moonrepo.dev/docs/guides/javascript/typescript-project-refs#using-paths-aliases.

* ci(website): enable typechecking for project

* feat(generated): replace gql zeus with codegen

* feat(website): migrate to using graphql codegen

* ci: configure tasks for workspace

* refactor(main-db): use package source code directly

* ci(main-db): try to add workspaces support

* fix(website): add connection header to all reqs

Apparently due to changes in how node19 works as described in
https://nodejs.org/en/blog/announcements/v19-release-announce/#http-s-1-1-keepalive-by-default,
we need to add this header to fix the error: `FetchError: request
to http://0.0.0.0:8000/graphql failed, reason: socket hang up`.

* fix(website/playground): add color to loading icon

* build(orchestrator): add comrak deps

* feat(orchestrator): return rendered markdown from problem

* feat(generated): add additional attributes to fetch from backend

* feat(website): add page to solve questions

This is just a skeleton. It does not work yet because it does not take into account the test case
that is displayed on the screen.

* fix(website): redirect to cpp page after question creation

* ci: route outDir to project caches

* fix(website): add correct types to data

* test(main-db): try to fix jest config

* ci(moon): remove useless commands

Also configure the website's typecheck command
to get the correct input files.

* test(main-db): fix broken jest config

* feat(website): change import path for fake module

* ci(vscode): add word to grammar

* feat: add handling for testing questions

* feat: rewrite how test cases are stored

Instead of creating separate models for each test case data
type, we will store them all in a string and let the data
decide how to work with it. However, this method will result
in us losing the ability to do strict output comparisons (we have
implemented only  string based output correctness checking). I
do not think I am willing to give up such a big feature for a little
ease of db schema. However I will keep this in commit history
so that I can reference it later down the line.

* Revert "feat: rewrite how test cases are stored"

This reverts commit c9e20c3.

* ci(devcontainer): install edgedb for non-root user
  • Loading branch information
IgnisDa authored Nov 25, 2022
1 parent e36b9d8 commit 8374c30
Show file tree
Hide file tree
Showing 102 changed files with 5,062 additions and 3,617 deletions.
10 changes: 5 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ RUN groupadd -g ${GUID} ${USERNAME} ; \
RUN pacman -S --noconfirm rustup nodejs npm python3 go tinygo fish curl wget python-pip

RUN printf '#!/bin/sh\nexport PATH=$PATH:$HOME/.cargo/bin\n' >> /etc/profile.d/cargo.sh ;\
chmod +x /etc/profile.d/cargo.sh
printf '#!/bin/sh\nexport PATH=$PATH:$HOME/.local/bin\n' >> /etc/profile.d/edgedb.sh ;\
chmod +x /etc/profile.d/cargo.sh ;\
chmod +x /etc/profile.d/edgedb.sh

RUN set -eu ;\
npm install --global pnpm @moonrepo/cli ;\
curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh -s -- -y --no-modify-path --verbose ;\
mv "/root/.local/bin/edgedb" "/usr/local/bin/edgedb" ;\
chmod +x "/usr/local/bin/edgedb" ;\
wget "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz" -O "/tmp/cargo-binstall.tgz" ;\
tar zxvf "/tmp/cargo-binstall.tgz" ;\
mv cargo-binstall "/usr/bin/"
Expand All @@ -31,10 +29,12 @@ USER $USERNAME

RUN set -eu ;\
npm config set store-dir "$HOME/.store" ;\
curl --proto '=https' --tlsv1.2 -sSf https://sh.edgedb.com | sh -s -- -y --no-modify-path --verbose ;\
curl "https://wasmtime.dev/install.sh" -sSf | bash ;\
sudo cp "$HOME/.wasmtime/bin/wasmtime" "/usr/bin/" ;\
rustup default nightly ;\
rustup target add wasm32-wasi ;\
cargo install moon_cli --git https://github.com/moonrepo/moon.git ;\
cargo binstall cargo-nextest cargo-watch --no-confirm

RUN set -eu ;\
Expand Down
15 changes: 15 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@ jest.config.*
dbschema
build
dist

# Build folders
coverage/
build/
cjs/
dts/
esm/
mjs/
umd/
lib

# website
!apps/website/app/lib

.eslintrc.js
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@ libs/main-db/dbschema/edgeql-js
.moon/cache
.moon/docker

# generated tsconfig
tsconfig.tsbuildinfo
tsconfig.build.tsbuildinfo

# Build folders
coverage/
build/
cjs/
dts/
esm/
mjs/
umd/
lib
5 changes: 3 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

cargo clippy -- -D warnings
cargo clippy --release -- -D warnings
cargo check --release

moon check "website" "react-ui" "generated" "main-db"
moon ci
31 changes: 29 additions & 2 deletions .moon/project.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# https://moonrepo.dev/docs/config/global-project
$schema: 'https://moonrepo.dev/schemas/global-project.json'

fileGroups:
# Application specific files
app: []
configs:
- '*.{js,json,yml,yaml}'
sources:
- 'public/**/*'
- 'src/**/*'
- 'types/**/*'
tests:
- 'tests/**/*.test.*'
- 'tests/**/*.stories.*'
- '**/__tests__/**/*'

tasks:
lint:
command:
- 'eslint'
- eslint
- '--ext'
- '.js,.jsx,.ts,.tsx'
- '--fix'
Expand All @@ -28,10 +42,23 @@ tasks:

test:
command:
- 'jest'
- jest
- '--coverage'
- '--passWithNoTests'
inputs:
- 'src/**/*'
- 'tests/**/*'
- 'jest.config.*'

typecheck:
command:
- tsc
- '--build'
- '--verbose'
inputs:
- '@group(app)'
- '@globs(sources)'
- '@globs(tests)'
- 'tsconfig.json'
- 'tsconfig.*.json'
- '/tsconfig.options.json'
75 changes: 6 additions & 69 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,30 @@
# https://moonrepo.dev/docs/config/workspace
$schema: 'https://moonrepo.dev/schemas/workspace.json'

# Extend and inherit an external configuration file. Must be a valid HTTPS URL or file system path.
# extends: './shared/workspace.yml'

# REQUIRED: A map of all projects found within the workspace, or a list or file system globs.
# When using a map, each entry requires a unique project ID as the map key, and a file system
# path to the project folder as the map value. File paths are relative from the workspace root,
# and cannot reference projects located outside the workspace boundary.
projects:
website: 'apps/website'
generated: 'libs/generated'
main-db: 'libs/main-db'
react-ui: 'libs/react-ui'
faker: 'libs/faker'

# Configures Node.js within the toolchain. moon manages its own version of Node.js
# instead of relying on a version found on the host machine. This ensures deterministic
# and reproducible builds across any machine.
node:
# The version to use. Must be a semantic version that includes major, minor, and patch.
# We suggest using the latest active LTS version: https://nodejs.org/en/about/releases
version: '19.0.0'

# The package manager to use when managing dependencies.
# Accepts "npm" (default), "pnpm", or "yarn".
packageManager: 'pnpm'

# The version of the package manager (above) to use.
pnpm:
version: '7.14.0'

# Add `node.version` as a constraint in the root `package.json` `engines`.
addEnginesConstraint: true

# Use the `package.json` name as an alias for the respective moon project.
# aliasPackageNames: 'name-and-scope'

# Dedupe dependencies after the lockfile has changed.
dedupeOnLockfileChange: true

# Version format to use when syncing dependencies within the project's `package.json`.
# dependencyVersionFormat: 'workspace'

# Infer and automatically create moon tasks from `package.json` scripts, per project.
# BEWARE: Tasks and scripts are not 1:1 in functionality, so please refer to the documentation.
# inferTasksFromScripts: false

# Sync a project's `dependsOn` as dependencies within the project's `package.json`.
dedupeOnLockfileChange: false
syncProjectWorkspaceDependencies: true

# Sync `node.version` to a 3rd-party version manager's config file.
# Accepts "nodenv" (.node-version), "nvm" (.nvmrc), or none.
# syncVersionManagerConfig: 'nvm'

# Configures how moon integrates with TypeScript.
typescript:
# When `syncProjectReferences` is enabled and a dependent project reference
# *does not* have a `tsconfig.json`, automatically create one.
createMissingConfig: true

# Name of `tsconfig.json` file in the project root.
# projectConfigFileName: 'tsconfig.json'

# Name of `tsconfig.json` file in the workspace root.
# rootConfigFileName: 'tsconfig.json'

# Name of the config file in the workspace root that defines shared compiler options
# for all project reference based config files.
# rootOptionsConfigFileName: 'tsconfig.options.json'

# Update the project's `tsconfig.json` to route the `outDir` to moon's cache.
# routeOutDirToCache: true

# Sync a project's `dependsOn` as TypeScript project references within the
# project's `tsconfig.json` and the workspace root `tsconfig.json`.
syncProjectReferences: true
routeOutDirToCache: true

# Sync a project's project references as `paths` aliases.
# syncProjectReferencesToPaths: true

# Configures the version control system to utilize within the workspace. A VCS
# is required for determining touched (added, modified, etc) files, calculating file hashes,
# computing affected files, and much more.
vcs:
# The manager/binary to use when managing the repository.
# Accepts "git", or "svn". Defaults to "git".
manager: 'git'

# The default branch (master/main/trunk) in the repository for comparing the
# local branch against. For git, this is is typically "master" or "main",
# and must include the remote prefix (before /). For svn, this should always be "trunk".
defaultBranch: 'origin/main'

runner:
logRunningCommand: true
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
"codegen",
"codemirror",
"commitlint",
"Comrak",
"cout",
"cssmodule",
"dbschema",
"dedup",
"dedupe",
"devcontainer",
"devcontainers",
"devel",
Expand Down Expand Up @@ -52,6 +54,7 @@
"tinygo",
"tlsv",
"tokei",
"typecheck",
"urql",
"wasi",
"wasmtime",
Expand Down
Loading

0 comments on commit 8374c30

Please sign in to comment.