Skip to content

Updated dependencies. Added CORS/windows scripts. #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ terraform*
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
language: node_js
node_js:
- 9
cache: yarn
branches:
except:
- /^no-ci.*$/
script:
- yarn format:ci
- yarn build-css
- yarn tslint -p .
- yarn test-coveralls
- npm run format:ci
- npm run build-css
- npm run tslint
- npm run test-coveralls
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@

## Development Setup

1. Install a stable version of Yarn and NodeJS (use node version 4-9 with nvm).
2. Run `yarn` to install dependencies.
1. Install a stable version of NodeJS (tested: Node 10.15.0).
2. Run `npm install` to install dependencies.
3. Copy the `.env.example` file as `.env` and set the variable `REACT_APP_IVLE_KEY`
to contain your IVLE Lapi key.
4. Run `yarn start` to start the server at `localhost:80`. Admin permissions may
4. Run `npm start` to start the server at `localhost:80`. Admin permissions may
be required for your OS to serve at port 80.
5. If running cadet without ngix, `npm run cors-proxy` to solve CORS problems.

## IVLE LAPI Key
For NUS students, you can access your IVLE LAPI key [here](https://ivle.nus.edu.sg/LAPI/default.aspx).

## For Windows Users

### Running cadet-frontend
In package.json, change line 19:\
"start-js": "rm -r coverage; BROWSER=none PORT=80 react-scripts-ts start",\
to:\
"start-js": "set PORT=80 & react-scripts-ts start",\
Run `npm run win-start`

### Dealing with hooks
In package.json, change line 28:\
Expand All @@ -43,7 +41,7 @@ to toggle native (default is native enabled).
### To run local copy of js-slang

1. Follow the instructions on the js-slang repository to transpile your own copy
2. Edit line 41 of package.json in this project to link to the directory of your js-slang and then run `yarn`:
2. Edit line 41 of package.json in this project to link to the directory of your js-slang and then run `npm install`:

`"js-slang": "file:path/to/js-slang",`

Expand All @@ -54,7 +52,7 @@ You may try [this](https://medium.com/@alexishevia/the-magic-behind-npm-link-d94
## For Editing And Creating New Local XML Missions

1. Use the branch 'mission-editing' in cadet-frontend
2. Run in browser with yarn start
2. Run in browser with npm start
2. Go to Incubator tab.

## Application Structure
Expand Down
11,137 changes: 5,853 additions & 5,284 deletions package-lock.json

Large diffs are not rendered by default.

83 changes: 45 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@
"build-js": "react-scripts-ts build",
"coverage": "./scripts/coverage-fix.sh do && react-scripts-ts test --env=jsdom --coverage && ./scripts/coverage-fix.sh undo",
"format": "prettier --write 'src/**/*.{ts,tsx}' 'externalLibs/**/*.js' '!externalLibs/assert_compiled.js'; prettier --write --parser scss 'src/**/*.scss'",
"format:ci": "prettier --list-different 'src/**/*.{ts,tsx}' && prettier --list-different --parser scss 'src/**/*.scss'",
"format:tsx": "prettier --list-different 'src/**/*.{ts,tsx}'",
"format:scss": "prettier --list-different --parser scss 'src/**/*.scss'",
"format:ci": "npm run format:tsx && npm run format:scss",
"start-js": "rm -r coverage; BROWSER=none PORT=80 react-scripts-ts start",
"win-start-js": "set PORT=80 & react-scripts-ts start",
"start": "npm-run-all -p watch-css start-js",
"win-start": "npm-run-all -p watch-css win-start-js",
"test": "react-scripts-ts test --env=jsdom",
"test-coveralls": "./scripts/coverage-fix.sh do && react-scripts-ts test --env=jsdom --coverage --coverageReporters=text-lcov | coveralls",
"update-ui-snapshots": "jest --updateSnapshot",
"watch-css": "node-sass-chokidar src/ -o src/ --watch --recursive"
"watch-css": "node-sass-chokidar src/ -o src/ --watch --recursive",
"tslint": "tslint -p .",
"cors-proxy": "lcp --proxyUrl http://localhost:4000 --port 4001 --proxyPartial \"\""
},
"husky": {
"hooks": {
Expand All @@ -32,79 +38,80 @@
"acorn": "6.1.0",
"ag-grid": "^18.0.1",
"ag-grid-react": "^18.0.0",
"astring": "^1.3.0",
"astring": "^1.4.0",
"common-tags": "^1.7.2",
"draft-js": "^0.10.5",
"flexboxgrid": "^6.3.1",
"flexboxgrid-helpers": "^1.1.3",
"js-slang": "0.2.1-alpha.4",
"lodash": "^4.17.11",
"lz-string": "^1.4.4",
"moment": "^2.22.2",
"moment": "^2.24.0",
"node-sass-chokidar": "^1.3.4",
"normalize.css": "^8.0.0",
"normalize.css": "^8.0.1",
"npm-run-all": "^4.1.5",
"pixi-filters": "^2.6.1",
"pixi.js": "^4.8.0",
"query-string": "^6.1.0",
"re-resizable": "^4.4.8",
"react": "^16.6.0",
"pixi-filters": "^2.7.1",
"pixi.js": "^4.8.7",
"query-string": "^6.4.2",
"re-resizable": "^4.11.0",
"react": "^16.8.6",
"react-ace": "^6.4.0",
"react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.3.1",
"react-dom": "^16.8.6",
"react-dom-factories": "^1.0.2",
"react-hotkeys": "^1.1.4",
"react-mde": "^5.6.0",
"react-redux": "^5.1.0",
"react-redux": "^5.1.1",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-transition-group": "^2.3.1",
"react-transition-group": "^2.9.0",
"redux": "^3.7.2",
"redux-mock-store": "^1.5.1",
"redux-saga": "^0.15.6",
"showdown": "^1.9.0",
"typesafe-actions": "^3.2.1",
"utility-types": "^2.0.0"
"typesafe-actions": "^3.4.0",
"utility-types": "^2.1.0"
},
"devDependencies": {
"@blueprintjs/core": "^2.1.1",
"@blueprintjs/icons": "^3.6.0",
"@blueprintjs/icons": "^3.8.0",
"@blueprintjs/select": "^2.0.1",
"@types/acorn": "^4.0.3",
"@types/classnames": "^2.2.3",
"@types/common-tags": "^1.4.0",
"@types/acorn": "^4.0.5",
"@types/classnames": "^2.2.7",
"@types/common-tags": "^1.8.0",
"@types/dotenv": "^6.1.1",
"@types/draft-js": "^0.10.23",
"@types/draft-js": "^0.10.30",
"@types/enzyme": "3.1.17",
"@types/enzyme-adapter-react-16": "^1.0.2",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/estree": "^0.0.39",
"@types/invariant": "^2.2.29",
"@types/jest": "^22.2.3",
"@types/lodash": "^4.14.123",
"@types/lz-string": "^1.3.32",
"@types/node": "^11.13.0",
"@types/pixi.js": "^4.7.3",
"@types/lz-string": "^1.3.33",
"@types/node": "^11.13.2",
"@types/pixi.js": "^4.8.7",
"@types/query-string": "^5.1.0",
"@types/react": "^16.3.10",
"@types/react": "^16.8.13",
"@types/react-copy-to-clipboard": "^4.2.5",
"@types/react-dom": "^16.0.5",
"@types/react-dom": "^16.8.3",
"@types/react-redux": "^5.0.16",
"@types/react-router": "^4.0.24",
"@types/react-router-dom": "^4.2.6",
"@types/react-router-redux": "^5.0.13",
"@types/react-test-renderer": "^16.0.1",
"@types/react-router": "^4.4.5",
"@types/react-router-dom": "^4.3.1",
"@types/react-router-redux": "^5.0.18",
"@types/react-test-renderer": "^16.8.1",
"@types/redux-mock-store": "^0.0.13",
"@types/showdown": "^1.7.5",
"@types/showdown": "^1.9.2",
"babel-core": "6",
"babel-runtime": "^6.23.0",
"coveralls": "^3.0.1",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"coveralls": "^3.0.3",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.12.1",
"husky": "^1.3.1",
"prettier": "^1.12.0",
"react-scripts-ts": "^2.16.0",
"react-test-renderer": "^16.3.1",
"typescript": "^2.8.1"
"local-cors-proxy": "^1.0.2",
"prettier": "^1.16.4",
"react-scripts-ts": "^2.17.0",
"react-test-renderer": "^16.8.6",
"typescript": "^2.9.2"
}
}
6 changes: 3 additions & 3 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ main() {
echo " If you cancel this pre-push hook, use \`git stash pop\` to retrieve your"
echo " unstaged changes."

prettier_ts="yarn prettier --list-different src/**/*.{ts,tsx}"
prettier_scss="yarn prettier --list-different --parser scss src/**/*.scss"
jest_ts="yarn test"
prettier_ts="npm run format:tsx"
prettier_scss="npm run format:scss"
jest_ts="npm test"

run_cmd "${prettier_ts}"; prettier_ts_exit=$?
run_cmd "${prettier_scss}"; prettier_scss_exit=$?
Expand Down
2 changes: 1 addition & 1 deletion src/components/__tests__/__snapshots__/Login.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`Login renders correctly 1`] = `
<Blueprint2.Button className=\\"pt-large\\" rightIcon=\\"log-in\\" onClick={[Function: handleLogin]}>
Log in with IVLE
</Blueprint2.Button>
<NavLink to=\\"/playground\\" activeClassName=\\"active\\" ariaCurrent=\\"true\\">
<NavLink to=\\"/playground\\" activeClassName=\\"active\\" aria-current=\\"page\\">
<Blueprint2.Button className=\\"pt-large\\" rightIcon=\\"code\\">
Try out the playground
</Blueprint2.Button>
Expand Down
16 changes: 8 additions & 8 deletions src/components/__tests__/__snapshots__/NavigationBar.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
exports[`NavigationBar renders "Not logged in" correctly 1`] = `
"<Blueprint2.Navbar className=\\"NavigationBar primary-navbar pt-dark\\">
<Blueprint2.NavbarGroup align=\\"left\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/academy\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/academy\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"symbol-diamond\\" />
<Blueprint2.NavbarHeading className=\\"hidden-xs\\">
Source Academy
</Blueprint2.NavbarHeading>
</NavLink>
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://ivle.nus.edu.sg/v1/Module/Student/default.aspx?CourseID=a6579f36-4d7d-41fb-b394-92a00b78148b\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://ivle.nus.edu.sg/v1/Module/Student/default.aspx?CourseID=a6579f36-4d7d-41fb-b394-92a00b78148b\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"book\\" />
<div className=\\"navbar-button-text hidden-xs\\">
News &amp; Material
</div>
</NavLink>
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://piazza.com/nus.edu.sg/fall2018/cs1101s\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://piazza.com/nus.edu.sg/fall2018/cs1101s\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"chat\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Forum
</div>
</NavLink>
</Blueprint2.NavbarGroup>
<Blueprint2.NavbarGroup align=\\"right\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/playground\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/playground\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"code\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Playground
Expand All @@ -43,27 +43,27 @@ exports[`NavigationBar renders "Not logged in" correctly 1`] = `
exports[`NavigationBar renders correctly with username 1`] = `
"<Blueprint2.Navbar className=\\"NavigationBar primary-navbar pt-dark\\">
<Blueprint2.NavbarGroup align=\\"left\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/academy\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/academy\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"symbol-diamond\\" />
<Blueprint2.NavbarHeading className=\\"hidden-xs\\">
Source Academy
</Blueprint2.NavbarHeading>
</NavLink>
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://ivle.nus.edu.sg/v1/Module/Student/default.aspx?CourseID=a6579f36-4d7d-41fb-b394-92a00b78148b\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://ivle.nus.edu.sg/v1/Module/Student/default.aspx?CourseID=a6579f36-4d7d-41fb-b394-92a00b78148b\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"book\\" />
<div className=\\"navbar-button-text hidden-xs\\">
News &amp; Material
</div>
</NavLink>
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://piazza.com/nus.edu.sg/fall2018/cs1101s\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" target=\\"_blank\\" to=\\"https://piazza.com/nus.edu.sg/fall2018/cs1101s\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"chat\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Forum
</div>
</NavLink>
</Blueprint2.NavbarGroup>
<Blueprint2.NavbarGroup align=\\"right\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/playground\\" ariaCurrent=\\"true\\">
<NavLink activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" to=\\"/playground\\" aria-current=\\"page\\">
<Blueprint2.Icon icon=\\"code\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Playground
Expand Down
Loading