Skip to content

Commit

Permalink
Windows Compat (mdn#141)
Browse files Browse the repository at this point in the history
* Replace Makefile with yarn workspace & package.json scripts

* Include stumptown in yarn workspace

* delete unused lockfiles

* Revert "Include stumptown in yarn workspace"

This reverts commit 0f466a1

* Remove auditing from travis

* Remove auditing from travis

* Create touchthis.js trough Node to have it work cross-platform

* Hoist resolutions to the root package.json
  • Loading branch information
Gregor authored and peterbe committed Sep 27, 2019
1 parent 6e98ece commit 5c6fa14
Show file tree
Hide file tree
Showing 16 changed files with 12,410 additions and 21,670 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 27,5 @@ client/build/
server/dist/
cli/node_modules/
cli/dist/
.make.built
.make.installed
watcher/node_modules/
.make.touchthis
client/src/touchthis.js
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 18,7 @@ before_install:
- npm install -g yarn
- yarn --version
# All nodes of the matrix will need and benefit from this
- make install
- yarn

matrix:
include:
Expand All @@ -33,9 33,5 @@ matrix:
- name: end-to-end
cache: yarn
script:
- make build-content
- make deployment-build
- name: yarn-audit
cache: yarn
script:
- make yarn-audit-all
- yarn build-content
- yarn deployment-build
65 changes: 0 additions & 65 deletions Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,4 1,4 @@
server: make run-server
web: PORT=3000 make run-dev
watch: make watch-content
buildserver: make build-json-server
server: yarn workspace server start
web: yarn cross-env PORT=3000 yarn workspace client start
watch: yarn workspace cli start --watch
buildserver: yarn workspace cli build-json-server
53 changes: 24 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 8,8 @@ These steps should get you started, locally, straight away:

git clone --recursive https://github.com/mdn/stumptown-renderer.git
cd stumptown-renderer
make install
nf start
yarn
yarn start
open http://localhost:3000

To really understand how it starts and how to break down the various
Expand Down Expand Up @@ -71,10 71,10 @@ After you have cloned the repo and want to pull in upstream changes run:

To do local development, there are many services to start. The simplest
is to use `nf` which is a dev dependency that gets installed by the
root `package.json`:
root `package.json` and executed like this:

make install
nf start
yarn
yarn start

That will start a React dev-server at `http://localhost:3000`. If you
change any of them files in `client/src` it will reload and refresh your
Expand All @@ -89,11 89,11 @@ But even then, using `docker-compose` should and will be optional.

Open two terminals. In one, run (this will take a little time the first time):

make run-server
yarn workspace server start

In another terminal:

make run-dev
yarn workspace client start

Now you should have two servers:

Expand All @@ -108,12 108,12 @@ the browser to see the effect immediately. If you want re-build the
content made available to the `React` components, open another terminal
and run:

make build-content
yarn build-content

To re-run any of the installation and build steps you can, at any time,
run:

make clean
yarn

## Building

Expand All @@ -126,7 126,7 @@ it and learn how the default commands work.
For example, the most important command beyond the active development one
mentioned in the section above is:

make deployment-build
yarn deployment-build

That one does "everything" and you end up with a full directory that has
all the static bundles of JavaScript, CSS, and the .html files. That directory
Expand All @@ -139,18 139,18 @@ then you can set the `STUMPTOWN_CONTENT_ROOT` environment variable.
For example:

cd ~/projects/stumptown-renderer
# running 'make build' now would use ~/projects/stumptown-renderer/stumptown
STUMPTOWN_CONTENT_ROOT=~/stumptown-content make build
# running 'yarn build' now would use ~/projects/stumptown-renderer/stumptown
yarn cross-env STUMPTOWN_CONTENT_ROOT=~/stumptown-content yarn build
# or
STUMPTOWN_CONTENT_ROOT=~/stumptown-content make deployment-build
yarn cross-env STUMPTOWN_CONTENT_ROOT=~/stumptown-content yarn deployment-build

### Security Auditing

To check that all node modules are up to date to secure versions you can run

make yarn-audit-all
yarn audit

It will execute `yarn audit` in each directory where possible. To remedy
It will execute `yarn audit` in each sub-package. To remedy
`yarn` auditing warnings, refer to the official `yarn` documentation.

### Linting (formatting)
Expand All @@ -164,26 164,21 @@ no trailing commas, etc.

To check *all* files once run:

make lint-check
yarn prettier-check

To only check the files you have touched in the current git stage:

make lint-dev
yarn pretty-quick --branch master

Note this command **does not complain, it fixes**. Meaning, if you make an edit to a `.js` file and accidentally violate the Prettier rules, simply running this will *fix* the violation. For example:

emacs client/src/app.js
make lint-dev

To run all Prettier checking but across all relevant files and not just
the ones you've touched run:

make lint-check
yarn pretty-quick --branch master

And if you just want to format all existing files (might be useful after
you've run `yarn upgrade prettier --latest` for example):

make lint-format
yarn prettier-format

## Server-Sider Rendering

Expand All @@ -207,12 202,12 @@ Deployment means that you prepare one whole single directory that is
all that is needed. This build directory is ready to ship to wherever you
host your static site. Build everything with:

make deployment-build
yarn deployment-build

What it does is a mix of `make run-server` and `make run-dev` but without
starting a server. It also, builds a `index.html` file for every document
found and processed by the `cli`. This whole directory is ready to be
uploaded to S3 or Netlify.
What it does is a mix of `yarn workspace server start` and
`yarn workspace client start` but without starting a server. It also,
builds a `index.html` file for every document found and processed by the
`cli`. This whole directory is ready to be uploaded to S3 or Netlify.

## Goals and Not-Goals

Expand Down
41 changes: 0 additions & 41 deletions bin/yarn-audit-all.sh

This file was deleted.

10 changes: 3 additions & 7 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 5,17 @@
"license": "MPL-2.0",
"scripts": {
"build": "webpack --config webpack.config.js --mode=development",
"start": "node dist/cli.js",
"run": "yarn run build && yarn run start",
"start": "yarn build && node dist/cli.js",
"build:watch": "webpack --config webpack.config.js --watch --mode=development",
"dev:run": "NODE_ENV=development nodemon dist/cli.js --watch dist/cli.js",
"dev:run": "cross-env NODE_ENV=development nodemon dist/cli.js --watch dist/cli.js",
"test": "jest",
"build-json-server": "node build-json-server.js"
},
"dependencies": {
"@reach/router": "1.2.1",
"chalk": "2.4.2",
"cheerio": "1.0.0-rc.3",
"cross-env": "^6.0.0",
"dotenv": "8.0.0",
"glob": "7.1.4",
"minimist": "1.2.0",
Expand Down Expand Up @@ -47,9 47,5 @@
"webpack": "4.35.3",
"webpack-cli": "3.3.6",
"webpack-node-externals": "1.7.2"
},
"resolutions": {
"mixin-deep": ">=1.3.2",
"set-value": ">=2.0.1"
}
}
Loading

0 comments on commit 5c6fa14

Please sign in to comment.