diff --git a/.tx/config b/.tx/config index 5fd1dc434..49dac1bb3 100644 --- a/.tx/config +++ b/.tx/config @@ -145,3 +145,8 @@ file_filter = localizations/research/.json source_file = src/views/research/l10n.json source_lang = en type = KEYVALUEJSON + +[scratch-website.preview-l10njson] +source_file = src/views/preview/l10n.json +source_lang = en +type = KEYVALUEJSON diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..7ed7e0da3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:8 + +RUN mkdir -p /var/app/current +WORKDIR /var/app/current +COPY . ./ +RUN rm -rf ./node_modules +RUN npm install + +EXPOSE 8333 + diff --git a/README.md b/README.md index cc2541a39..210e72876 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ### Where am I? Physically? No idea. -Digitally? You’re at Scratch’s open source web client! +Digitally? You’re at Scratch’s open source web client! We’re working to update the [Scratch website](https://scratch.mit.edu) to use a new codebase, contained in this repository. @@ -23,7 +23,7 @@ We’re currently building Scratch using [React](https://facebook.github.io/reac ### Before Getting Started * Make sure you have node (v4.2 or higher) and npm [installed](https://docs.npmjs.com/getting-started/installing-node) -We use npm (Node Package Manager) to maintain and update packages required to build the site. +We use npm (Node Package Manager) to maintain and update packages required to build the site. ### Update Packages It's important to make sure that all of the dependencies are up to date because the scratch-www code only works with specific versions of the dependencies. You can update the packages by running this command: @@ -98,6 +98,9 @@ npm test ``` ### To Deploy + +Deploying to staging or production will upload code to S3 and configure Fastly. + ```bash npm install virtualenv ENV @@ -132,3 +135,35 @@ Additionally, if you set `FALLBACK=https://scratch.mit.edu`, be aware that click #### Windows Some users have experienced difficulties when trying to get our web client to work on Windows. One solution could be to use [Cygwin](https://www.cygwin.com/). If that doesn't work, you might want to use [Wubi](https://wiki.ubuntu.com/WubiGuide) (Windows XP, Vista, 7) or [Wubiuefi](https://github.com/hakuna-m/wubiuefi) (Windows 8 or higher). Wubi(uefi) is a Windows Installer for Ubuntu that allows you to have Ubuntu and Windows on one disk, without the need of an extra partition. + +#### Docker + +_This section is only relevant to the Scratch Team since it requires access to private repositories, so is not usable by 3rd party contributors._ + +A set of [Docker](https://www.docker.com/what-docker) related files are provided to create isolated [container](https://www.docker.com/what-container) environments suitable for end-to-end local development: + +* Dockerfile +* docker-compose.yml +* docker_entrypoint.sh + +##### Docker Quick Start (CLI) + +Make sure you already have the Scratch REST API running locally in its docker environment. + +``` +$ docker-compose up +``` + +After this has launched you will be able to access a running copy of `scratch-www` on port 8333 via `http://localhost:8333` + +##### Docker Configuration + +`Dockerfile` defines how a `scratch-www` docker image is created. + +`docker-compose.yml` takes care of launching `scratch-www` into a development environment that is composed of other components, such as the Scratch REST API server and the legacy Scratch code. If you have not already setup the Scratch REST API in your local environment, you will need to modify `docker-compose.yml` by removing `external: true` from: + +```yaml +networks: + scratchapi_scratch_network: + external: true +``` diff --git a/TRADEMARK b/TRADEMARK index 3e1ec5bf4..17b5d4c91 100644 --- a/TRADEMARK +++ b/TRADEMARK @@ -1,7 +1 @@ -The Scratch trademarks, including the Scratch name, logo, the Scratch Cat, Gobo, Pico, Nano, Tera and Giga graphics (the "Marks"), are property of the Massachusetts Institute of Technology (MIT), and the use of the Marks is governed by this policy. - -You may use the Marks to refer to Scratch in Substantially Unmodified form. - -"Substantially Unmodified" means the source code provided by MIT, possibly with minor modifications including but not limited to: bug fixes (including security), changing the locations of files for better integration with the host operating system, adding documentation, and changes to the dynamic linking of libraries. - -A version is not "Substantially Unmodified" if it incorporates features not present in a release of Scratch by MIT. If you do make a substantial modification, to avoid confusion with versions of Scratch produced by MIT you must remove all Marks from your version of the software and refrain from using any of the Marks to refer to your version. +The Scratch trademarks, including the Scratch name, logo, the Scratch Cat, Gobo, Pico, Nano, Tera and Giga graphics (the "Marks"), are property of the Massachusetts Institute of Technology (MIT). Marks may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..7f550e83f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: '3.4' +volumes: + npm_data: + runtime_data: + intl_data: + +networks: + scratchapi_scratch_network: + external: true + +services: + app: + container_name: scratch-www-app + hostname: scratch-www-app + environment: + - API_HOST=http://localhost:8491 + - FALLBACK=http://scratchr2-app:8080 + build: + context: ./ + dockerfile: Dockerfile + image: scratch-www:latest + command: ./docker_entrypoint.sh npm start + volumes: + - type: bind + source: ./ + target: /var/app/current + volume: + nocopy: true + - type: bind + source: ../scratch-gui + target: /var/app/current/scratch-gui + volume: + nocopy: true + - npm_data:/var/app/current/node_modules + - runtime_data:/runtime + - intl_data:/var/app/current/intl + ports: + - "8333:8333" + networks: + - scratchapi_scratch_network diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh new file mode 100755 index 000000000..5e95584c3 --- /dev/null +++ b/docker_entrypoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +echo "App Entrypoint" + +if [ ! -f /runtime/.translations ]; then + echo "Generating intl/translations" + make translations + touch /runtime/.translations +fi + +exec "$@" diff --git a/package.json b/package.json index 951a6e528..a299c2442 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,9 @@ "start": "make start", "stop": "make stop", "test": "make test", - "smoke": "make smoke", + "smoke": "tap ./test/integration/smoke-testing/*.js --timeout=3600", "smoke-verbose": "make smoke-verbose", + "smoke-sauce": "tap ./test/integration/smoke-testing/*.js --timeout=60000", "watch": "make watch", "build": "make build", "dev": "make watch && make start &" @@ -30,7 +31,8 @@ "lodash.defaults": "4.0.1", "newrelic": "1.25.4", "raven": "0.10.0", - "scratch-gui": "0.1.0-prerelease.20180529181946" + "scratch-parser": "^4.2.0", + "scratch-storage": "^0.5.1" }, "devDependencies": { "ajv": "6.4.0", @@ -97,6 +99,7 @@ "redux-thunk": "2.0.1", "sass-lint": "1.5.1", "sass-loader": "6.0.6", + "scratch-gui": "latest", "scratchr2_translations": "git://github.com/LLK/scratchr2_translations.git#master", "slick-carousel": "1.6.0", "source-map-support": "0.3.2", diff --git a/src/components/forms/inplace-input.jsx b/src/components/forms/inplace-input.jsx index 559de34e6..c3a97b95c 100644 --- a/src/components/forms/inplace-input.jsx +++ b/src/components/forms/inplace-input.jsx @@ -38,6 +38,8 @@ class InplaceInput extends React.Component { { - if (err) log.error(err); - this.setState({ - prompt: this.props.intl.formatMessage({id: 'report.promptPlaceholder'}), - reason: '', - waiting: false - }); - }); + lookupPrompt (value) { + const prompt = REPORT_OPTIONS.find(item => item.value === value).prompt; + return this.props.intl.formatMessage(prompt); } render () { const { intl, onReport, // eslint-disable-line no-unused-vars + report, type, ...modalProps } = this.props; @@ -66,6 +91,7 @@ class ReportModal extends React.Component {
@@ -88,68 +114,38 @@ class ReportModal extends React.Component { />