Commit Graph

30 Commits (1fb1a090e4bad84a9f01309e543248b02a8afe59)

Author SHA1 Message Date
renovate[bot] 385816436f
fix(deps): pin dependencies (#46128)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-05-24 12:57:08 +05:30
Oliver Eyton-Williams cf4b9a1557
feat: client overhaul proof of concept (#45844)
* chore: initial setup of web package

This is *not* a workspace, yet, because it would be nice to use the
latest React, but /client can't migrate (yet).

Having two React versions creates issues in workspaces since /.bin/next
gets hoisted to root... and finds the root React version :(

* feat: add config for next

* fix: use jsx-runtime for web linting

* chore: init curriculum-server with json-server

* chore: integrate curriculum-server with TS/eslint

* feat: add patch script

json-server doesn't like keys with '/'s in so, for now I'm just patching
them out.

This lets us keep a strong separation between this WIP and the rest of
the code.

* fix: use port 8000 to avoid conflicts

* feat: crude ISR demo using challenge pages

* feat: extend ISR demo to use params

* feat: return props for specific superblocks

* chore: re-organise folders

* refactor: put data fetching in a single module

* refactor: challenge page slightly

* feat: add link to test ISR

You can see that, if you run next dev, the linked page gets regenerated
whenever you navigate to it.  However, if you run next build that is no
longer the case and the page has to be reloaded for the user to see the
latest version.

The implication is that we'll need another method (Web worker, probably)
to detect if the page needs to be updated.

* feat: render static paths for rwd

* feat: add monaco Editor

* feat: send less data via props

Rather than sending superblocks, this now sends blocks. Next step, just
the challenge!

* fix: only send individual challenge's data

* feat: send /learn/stuff/<id> to the challenge page

* fix: redirect to path with trailing id

* fix: handle all possible path prefixes

* feat: add superblocks with trailing ids

* chore: rename block -> blockOrId

* chore: remove logs

* fix: return notFound if page id is missing

* chore: add a note about increasing TS strictness

* feat: serverside redirects

This should be a touch more performant, but mostly it separates the
concerns.

Since the server already has the responsibility of choosing what pages
to render, redirects fit naturally with its concerns.

* refactor: clean up param validation

* feat: create list of blocks in superblock

* feat: add challenge links to map

* feat: link to full path, not just id

* refactor: ensure props match getStaticProps

By specifying the props for GetStaticProps we ensure that it returns the
expected data and use InferGetStaticPropsType to get the type out again
for use in the component

* feat: improve and document dev experience

* refactor: separate routing from rendering

* refactor: extract routing logic into functions

* refactor: naming consistency

* refactor: move data wrangling into get-curriculum

* refactor: align blockOrId and id

* chore: remove the server from workspaces

* chore: remove the lock

* docs: paths

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

* chore: install before linting

* fix: create env.json before installing new client

* chore: ignore generated json file

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2022-05-09 11:30:15 -05:00
Naveen f2580f58a6
chore: set permissions for GitHub actions (#45876)
* chore: Set permissions for GitHub actions

 Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>

* Update .github/workflows/codeql-analysis.yml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

* Update .github/workflows/labeler.yaml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

* Update .github/workflows/node.js-tests-upcoming.yml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

* Update .github/workflows/node.js-tests.yml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

* Update .github/workflows/codeql-analysis.yml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

* Update .github/workflows/labeler.yaml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

* Update .github/workflows/labeler.yaml

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
2022-05-08 15:17:44 +05:30
Oliver Eyton-Williams 4cc20172c5
fix: fallback to english challenges (#45635)
* fix: fallback to english challenges

All challenges will use the english version if a translated file is not
available.  SHOW_NEW_CURRICULUM still gates what's shown in the client.

* refactor: use closures to simplify createChallenge

* refactor: remove messy destructure

* refactor: add meta via helper

* fix: fallback to [] for meta.required

* fix: repair challenge.block

* refactor: use CONST_CASE for meta + challenge dirs

* fix: catch empty superblocks immediately

* fix: clean up path.resolves

* fix: invalid syntax in JS project steps

* fix: default to english comments and relax tests

Instead of always throwing errors when a comment is not translated, the
tests now warn while SHOW_UPCOMING_CHANGES is true, so that tests will
pass while we're developing and allow translators time to work.

They still throw when SHOW_UPCOMING_CHANGES is false to catch issues
in production

* test: update createCommentMap test

* refactor: delete stale comment

* refactor: clarify validate with explanatory consts

* feat: throw if audited cert falls back to english

* fix: stop testing upcoming localized curriculum
2022-04-15 09:17:49 -05:00
Oliver Eyton-Williams f485bc1c16
chore: update CI tests (#45401)
* chore: echo npm version in CI (as debugging info)

* chore: remove redundant alterations to .env

sample.env already has SHOW_NEW_CURRICULUM=true
2022-03-10 10:09:06 -08:00
renovate[bot] d96ab11ffd
chore(deps): update actions/setup-node action to v3 (#45329)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-03 13:42:39 +05:30
renovate[bot] 15232456b1
chore(deps): update actions/checkout action to v3 (#45324)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-03 06:29:31 +00:00
Mrugesh Mohapatra 94be3c3e7d
fix: ensure only one lockfile is used (#45230)
* fix: ensure only one lockfile is used

* fix: remove extra lockfiles
2022-02-24 09:23:30 +01:00
Oliver Eyton-Williams 7216ca55cc
refactor: organise TypeScript config and migrate helpers (#44747)
* feat: allow more 1000 steps to be created at once

* refactor: start migrating to typescript

* refactor: delete-step to ts

* refactor: migrated some helpers

* refactor: migrate create-empty-steps

* refactor: migrate create-step-between

* refactor: finish migrating to TS

* refactor: migrate tests

* fix: ensure mock.restore is done after each test

* fix: prevent double-tscing

* fix: repair the tests

* chore: use ts-node for scripts

We don't need the performance boost of incremental compilation and
ts-node is easier to work with

* refactor: consolidate tsconfigs

* refactor: replace gulp

* fix: use ts-node for build-curriculum

* fix: allow ts compilation of config

* feat: create and use create:config script

* fix: add /config to eslint projects

* fix: remove gulp script
2022-01-25 11:34:16 +01:00
Oliver Eyton-Williams 36363f277d
test: enable tests for steps (#44550)
* fix: handle missing solutions correctly

Rather than creating an [[]] the parser now creates [] which isEmpty().
This makes the test suite check the next challenge for a solution.

In addition, the logic for testing solutions was fixed.

* chore: update snapshots

* test: build new superblock in node.js-tests CI

* test: allow forward slash in superblock slug

* fix: borked tests oops

* test: ignore duplicated projects

* fix: i did not break these shaun did :)

* fix: idIndex is index of id not id

Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
2021-12-22 12:18:06 -08:00
Oliver Eyton-Williams 48f88428e8
test: login more directly (#44467)
* test: login more directly

* test: separate login from other visits

In a single test, Cypress can only visit within a single domain, hence
the separation.

* chore: fail slowly for all strategies

* test: user certified user for showing cert

* test: fix and cleanup certifications
2021-12-11 14:34:16 +05:30
Mrugesh Mohapatra 4574e4e81d chore: update all workflows to Node.js v16 2021-11-03 15:06:19 +05:30
Mrugesh Mohapatra f84d6078fd
chore(actions): use Ubuntu-20.04 in all workflows (#44095) 2021-11-02 17:19:50 +05:30
Oscar Dominguez 93ad0ae036
ci(workflow): add cache to workflows using actions/setup-node (#43830) 2021-10-13 13:04:58 +05:30
Mrugesh Mohapatra 0a0caf18ae
fix(actions): use inbuilt cache with setup-node (#42730) 2021-07-03 14:09:25 +01:00
Oliver Eyton-Williams c69a1cb483
test: enable testing for upcoming challenges (#42360)
* test: enable testing for upcoming challenges

* fix: enable SHOW_UPCOMING_CHANGES during test

* Revert "fix: enable SHOW_UPCOMING_CHANGES during test"

This reverts commit f1bd00fdba.

* Revert "test: enable testing for upcoming challenges"

This reverts commit d0409fef66.

* feat: test upcoming changes in separate job
2021-06-08 16:57:27 +01:00
Nicholas Carrigan (he/him) 4ed75cb79f
fix(tools): ignore renovate (#42008)
Ignore the branches renovate creates for the push events.
2021-05-06 00:20:38 +05:30
Oliver Eyton-Williams 275e12ba80
tools: test all languages in CI (#41512)
* tools: test all languages in CI

Co-authored-by: Mrugesh Mohapatra <1884376+raisedadead@users.noreply.github.com>
2021-04-01 06:20:43 -07:00
Mrugesh Mohapatra 275b17a414
fix(actions): remove node 12 - diligently this time (#41682) 2021-03-31 10:09:15 +02:00
Mrugesh Mohapatra ca6cb07838
chore(ci): deprecate node 12 (#41585) 2021-03-26 17:07:02 +05:30
Mrugesh Mohapatra b0bfc00f21 fix(actions): update workflow matrices & docs
This commit intentionally adds a matrix to keep supporting Node.js 12
while we evaluate it
2021-03-11 12:19:42 +05:30
Mrugesh Mohapatra b5f4754e2a
fix: re-revert the API decoupling (#41263)
* fix(api): decouple api from curriculum

This reverts commit 8f0e441644 and
introduces the implementations from #40703.

* fix(gitpod): add curriculum build to GitPod

This reverts commit 706d70f58d and
introduces implementations from #41234.

* docs: update DevOps manual for api change (#41259)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-02-25 12:02:35 -08:00
Oliver Eyton-Williams b73022c81b
fix: make missing scripts fail linting/testing (#41260)
If a script is not present, we would like an error letting us know.
2021-02-25 20:06:01 +05:30
Mrugesh Mohapatra 8f0e441644 revert(api): decouple api from curriculum
This reverts commit c077ffe4b9
via PR #40703
2021-02-25 03:40:09 +05:30
Oliver Eyton-Williams c077ffe4b9
feat(api): decouple api from curriculum (#40703) 2021-02-22 12:23:59 +05:30
Mrugesh Mohapatra eab14b8235
fix(CI): update runner, display .env for upcoming (#39808) 2020-10-07 16:20:59 +05:30
Mrugesh Mohapatra 3ac415154c chore(actions): cache dependencies 2020-09-25 00:37:40 +05:30
Mrugesh Mohapatra 6e16a50329 fix(tools): fix syntax errors and test special branch 2020-08-09 01:44:36 +05:30
Mrugesh Mohapatra e242852bef fix(tools): misc. updates to action workflows 2020-08-09 00:58:13 +05:30
Mrugesh Mohapatra 5c60070cc5 fix(tools): add node.js CI tests 2020-08-09 00:56:22 +05:30