chore: switch to yarn (#927)

* 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
This commit is contained in:
Nolan Lawson 2019-01-27 17:44:30 -08:00 committed by GitHub
parent 58b0c56ad8
commit d198250eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 7895 additions and 10638 deletions

View File

@ -37,17 +37,17 @@ addons:
- redis-tools - redis-tools
- zlib1g-dev - zlib1g-dev
before_install: before_install:
- npm install -g npm@6
- npm install -g greenkeeper-lockfile@1 - 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 - ./bin/setup-mastodon-in-travis.sh
before_script: before_script:
- npm run lint - yarn run lint
- greenkeeper-lockfile-update - greenkeeper-lockfile-update
after_script: after_script:
- greenkeeper-lockfile-upload - greenkeeper-lockfile-upload
install: script: travis_retry yarn run $COMMAND
- npm ci || npm i
script: travis_retry npm run $COMMAND
env: env:
global: global:
- PGPORT=5433 - PGPORT=5433
@ -66,7 +66,6 @@ branches:
- master - master
- /^greenkeeper/.*$/ - /^greenkeeper/.*$/
cache: cache:
npm: true
yarn: true yarn: true
bundler: true bundler: true
directories: directories:

View File

@ -4,7 +4,7 @@
To run a dev server with hot reloading: To run a dev server with hot reloading:
npm run dev yarn run dev
Now it's running at `localhost:4002`. Now it's running at `localhost:4002`.
@ -18,11 +18,11 @@ Pinafore uses [JavaScript Standard Style](https://standardjs.com/).
Lint: Lint:
npm run lint yarn run lint
Automatically fix most linting issues: Automatically fix most linting issues:
npm run lint-fix yarn run lint-fix
## Integration tests ## Integration tests
@ -42,12 +42,12 @@ Run integration tests, using headless Chrome by default:
Run tests for a particular browser: Run tests for a particular browser:
BROWSER=chrome npm run test-browser BROWSER=chrome yarn run test-browser
BROWSER=chrome:headless npm run test-browser BROWSER=chrome:headless yarn run test-browser
BROWSER=firefox npm run test-browser BROWSER=firefox yarn run test-browser
BROWSER=firefox:headless npm run test-browser BROWSER=firefox:headless yarn run test-browser
BROWSER=safari npm run test-browser BROWSER=safari yarn run test-browser
BROWSER=edge npm run test-browser BROWSER=edge yarn run test-browser
If the script isn't able to set up the Postgres database, try running: If the script isn't able to set up the Postgres database, try running:
@ -63,11 +63,11 @@ In separate terminals:
1\. Run a Mastodon dev server: 1\. Run a Mastodon dev server:
npm run run-mastodon yarn run run-mastodon
2\. Run a Pinafore dev server: 2\. Run a Pinafore dev server:
npm run dev yarn run dev
3\. Run a debuggable TestCafé instance: 3\. Run a debuggable TestCafé instance:
@ -115,18 +115,18 @@ or
1. Run `rm -fr mastodon` to clear out all Mastodon data 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. 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 2. Update the `GIT_TAG` in `run-mastodon.js` to whatever you want
3. Run `npm run run-mastodon` 3. Run `yarn run run-mastodon`
4. Run `npm run backup-mastodon-data` to overwrite the data in `fixtures/` 4. Run `yarn run backup-mastodon-data` to overwrite the data in `fixtures/`
5. Uncomment `await restoreMastodonData()` in `run-mastodon.js` 5. Uncomment `await restoreMastodonData()` in `run-mastodon.js`
6. Commit all changed files 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. Check `mastodon.log` if you have any issues.
## Unit tests ## Unit tests
There are also some unit tests that run in Node using Mocha. You can find them in `tests/unit` and 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 ## Debugging Webpack
@ -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/report.html](https://dev.pinafore.social/report.html)
- [dev.pinafore.social/stats.json](https://dev.pinafore.social/stats.json) - [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 ## Codebase overview

View File

@ -9,15 +9,15 @@ ADD . /app
RUN apk update && apk upgrade RUN apk update && apk upgrade
RUN apk add nodejs npm git python build-base clang RUN apk add nodejs npm git python build-base clang
# Upgrading NPM # Install yarn
RUN npm i npm@latest -g RUN npm i yarn -g
# Install Pinafore # Install Pinafore
RUN npm install RUN yarn --pure-lockfile
RUN npm run build RUN yarn run build
# Expose port 4002 # Expose port 4002
EXPOSE 4002 EXPOSE 4002
# Setting run-command # Setting run-command
CMD PORT=4002 npm start CMD PORT=4002 yarn start

View File

@ -52,12 +52,12 @@ Compatible versions of each (Opera, Brave, Samsung, etc.) should be fine.
## Building ## 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: To build Pinafore for production:
npm install yarn
npm run build yarn run build
PORT=4002 npm start PORT=4002 npm start
### Docker ### Docker
@ -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: You can export Pinafore as a static site. Run:
npm run export yarn run export
Static files will be written to `__sapper__/export`. Static files will be written to `__sapper__/export`.

View File

@ -4,5 +4,5 @@ set -e
set -x set -x
if [ "$TRAVIS_BRANCH" = master -a "$TRAVIS_PULL_REQUEST" = false ]; then if [ "$TRAVIS_BRANCH" = master -a "$TRAVIS_PULL_REQUEST" = false ]; then
npm run deploy-dev yarn run deploy-dev
fi fi

View File

@ -34,7 +34,7 @@ sudo ln -s /home/travis/ffmpeg-static/ffprobe /usr/local/bin/ffprobe
# check versions # check versions
ruby --version ruby --version
node --version node --version
npm --version yarn --version
postgres --version postgres --version
redis-server --version redis-server --version
ffmpeg -version ffmpeg -version

View File

@ -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 `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 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). the page to see the change (you don't have to restart the server).

10601
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,16 +10,16 @@
"sapper-dev": "cross-env NODE_ENV=development PORT=4002 sapper dev", "sapper-dev": "cross-env NODE_ENV=development PORT=4002 sapper dev",
"sapper-prod": "cross-env PORT=4002 node __sapper__/build", "sapper-prod": "cross-env PORT=4002 node __sapper__/build",
"before-build": "run-s build-template-html build-third-party-assets", "before-build": "run-s build-template-html build-third-party-assets",
"build": "cross-env NODE_ENV=production npm run build-steps", "build": "cross-env NODE_ENV=production run-s build-steps",
"build-steps": "run-s before-build sapper-build", "build-steps": "run-s before-build sapper-build",
"sapper-build": "sapper build", "sapper-build": "sapper build",
"start": "cross-env NODE_ENV=production npm run sapper-prod", "start": "cross-env NODE_ENV=production run-s sapper-prod",
"build-and-start": "run-s build start", "build-and-start": "run-s build start",
"build-template-html": "node -r esm ./bin/build-template-html.js", "build-template-html": "node -r esm ./bin/build-template-html.js",
"build-template-html-watch": "node -r esm ./bin/build-template-html.js --watch", "build-template-html-watch": "node -r esm ./bin/build-template-html.js --watch",
"build-third-party-assets": "node -r esm ./bin/build-third-party-assets.js", "build-third-party-assets": "node -r esm ./bin/build-third-party-assets.js",
"run-mastodon": "node -r esm ./bin/run-mastodon.js", "run-mastodon": "node -r esm ./bin/run-mastodon.js",
"test": "cross-env BROWSER=chrome:headless npm run test-browser", "test": "cross-env BROWSER=chrome:headless run-s test-browser",
"test-browser": "run-p --race run-mastodon build-and-start test-mastodon", "test-browser": "run-p --race run-mastodon build-and-start test-mastodon",
"test-mastodon": "run-s wait-for-mastodon-to-start wait-for-mastodon-data testcafe", "test-mastodon": "run-s wait-for-mastodon-to-start wait-for-mastodon-data testcafe",
"test-browser-suite0": "run-p --race run-mastodon build-and-start test-mastodon-suite0", "test-browser-suite0": "run-p --race run-mastodon build-and-start test-mastodon-suite0",

7859
yarn.lock Normal file

File diff suppressed because it is too large Load Diff