Skip to content

Commit

Permalink
chore: switch to yarn (#927)
Browse files Browse the repository at this point in the history
* chore: switch to yarn

BREAKING CHANGE: Pinafore is now using yarn rather than npm, so those
who self-host will need to stop running e.g. `npm install` and run `yarn
install` instead.

* install latest yarn
  • Loading branch information
nolanlawson committed Jan 28, 2019
1 parent 58b0c56 commit d198250
Show file tree
Hide file tree
Showing 10 changed files with 7,895 additions and 10,638 deletions.
11 changes: 5 additions & 6 deletions .travis.yml
Expand Up @@ -37,17 +37,17 @@ addons:
- redis-tools
- zlib1g-dev
before_install:
- npm install -g npm@6
- npm install -g greenkeeper-lockfile@1
# install yarn
- curl -o- -L https://yarnpkg.com/install.sh | bash -s
- export PATH="$HOME/.yarn/bin:$PATH"
- ./bin/setup-mastodon-in-travis.sh
before_script:
- npm run lint
- yarn run lint
- greenkeeper-lockfile-update
after_script:
- greenkeeper-lockfile-upload
install:
- npm ci || npm i
script: travis_retry npm run $COMMAND
script: travis_retry yarn run $COMMAND
env:
global:
- PGPORT=5433
Expand All @@ -66,7 +66,6 @@ branches:
- master
- /^greenkeeper/.*$/
cache:
npm: true
yarn: true
bundler: true
directories:
Expand Down
32 changes: 16 additions & 16 deletions CONTRIBUTING.md
Expand Up @@ -4,7 +4,7 @@

To run a dev server with hot reloading:

npm run dev
yarn run dev

Now it's running at `localhost:4002`.

Expand All @@ -18,11 +18,11 @@ Pinafore uses [JavaScript Standard Style](https://standardjs.com/).

Lint:

npm run lint
yarn run lint

Automatically fix most linting issues:

npm run lint-fix
yarn run lint-fix

## Integration tests

Expand All @@ -42,12 +42,12 @@ Run integration tests, using headless Chrome by default:

Run tests for a particular browser:

BROWSER=chrome npm run test-browser
BROWSER=chrome:headless npm run test-browser
BROWSER=firefox npm run test-browser
BROWSER=firefox:headless npm run test-browser
BROWSER=safari npm run test-browser
BROWSER=edge npm run test-browser
BROWSER=chrome yarn run test-browser
BROWSER=chrome:headless yarn run test-browser
BROWSER=firefox yarn run test-browser
BROWSER=firefox:headless yarn run test-browser
BROWSER=safari yarn run test-browser
BROWSER=edge yarn run test-browser

If the script isn't able to set up the Postgres database, try running:

Expand All @@ -63,11 +63,11 @@ In separate terminals:

1\. Run a Mastodon dev server:

npm run run-mastodon
yarn run run-mastodon

2\. Run a Pinafore dev server:

npm run dev
yarn run dev

3\. Run a debuggable TestCafé instance:

Expand Down Expand Up @@ -115,18 +115,18 @@ or
1. Run `rm -fr mastodon` to clear out all Mastodon data
1. Comment out `await restoreMastodonData()` in `run-mastodon.js` to avoid actually populating the database with statuses/favorites/etc.
2. Update the `GIT_TAG` in `run-mastodon.js` to whatever you want
3. Run `npm run run-mastodon`
4. Run `npm run backup-mastodon-data` to overwrite the data in `fixtures/`
3. Run `yarn run run-mastodon`
4. Run `yarn run backup-mastodon-data` to overwrite the data in `fixtures/`
5. Uncomment `await restoreMastodonData()` in `run-mastodon.js`
6. Commit all changed files
7. Run `rm -fr mastodon/` and `npm run run-mastodon` to confirm everything's working
7. Run `rm -fr mastodon/` and `yarn run run-mastodon` to confirm everything's working

Check `mastodon.log` if you have any issues.

## Unit tests

There are also some unit tests that run in Node using Mocha. You can find them in `tests/unit` and
run them using `npm run test-unit`.
run them using `yarn run test-unit`.

## Debugging Webpack

Expand All @@ -135,7 +135,7 @@ The Webpack Bundle Analyzer `report.html` and `stats.json` are available publicl
- [dev.pinafore.social/report.html](https://dev.pinafore.social/report.html)
- [dev.pinafore.social/stats.json](https://dev.pinafore.social/stats.json)

This is also available locally after `npm run build` at `.sapper/client/report.html`.
This is also available locally after `yarn run build` at `.sapper/client/report.html`.

## Codebase overview

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Expand Up @@ -9,15 +9,15 @@ ADD . /app
RUN apk update && apk upgrade
RUN apk add nodejs npm git python build-base clang

# Upgrading NPM
RUN npm i npm@latest -g
# Install yarn
RUN npm i yarn -g

# Install Pinafore
RUN npm install
RUN npm run build
RUN yarn --pure-lockfile
RUN yarn run build

# Expose port 4002
EXPOSE 4002

# Setting run-command
CMD PORT=4002 npm start
CMD PORT=4002 yarn start
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -52,12 +52,12 @@ Compatible versions of each (Opera, Brave, Samsung, etc.) should be fine.

## Building

Pinafore requires [Node.js](https://nodejs.org/en/) v8+ and `npm`.
Pinafore requires [Node.js](https://nodejs.org/en/) v8+ and [Yarn](https://yarnpkg.com).

To build Pinafore for production:

npm install
npm run build
yarn
yarn run build
PORT=4002 npm start

### Docker
Expand All @@ -79,7 +79,7 @@ To keep your version of Pinafore up to date, you can use `git` to check out the

You can export Pinafore as a static site. Run:

npm run export
yarn run export

Static files will be written to `__sapper__/export`.

Expand Down
2 changes: 1 addition & 1 deletion bin/deploy-all-travis.sh
Expand Up @@ -4,5 +4,5 @@ set -e
set -x

if [ "$TRAVIS_BRANCH" = master -a "$TRAVIS_PULL_REQUEST" = false ]; then
npm run deploy-dev
yarn run deploy-dev
fi
2 changes: 1 addition & 1 deletion bin/setup-mastodon-in-travis.sh
Expand Up @@ -34,7 +34,7 @@ sudo ln -s /home/travis/ffmpeg-static/ffprobe /usr/local/bin/ffprobe
# check versions
ruby --version
node --version
npm --version
yarn --version
postgres --version
redis-server --version
ffmpeg -version
2 changes: 1 addition & 1 deletion docs/Theming.md
Expand Up @@ -28,7 +28,7 @@ const themes = [
]
```

Start the development server (`npm run dev`), go to
Start the development server (`yarn run dev`), go to
`http://localhost:4002/settings/instances/your-instance-name` and select your
newly-created theme. Once you've done that, you can update your theme, and refresh
the page to see the change (you don't have to restart the server).

0 comments on commit d198250

Please sign in to comment.