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
- 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
@ -66,7 +66,6 @@ branches:
- master
- /^greenkeeper/.*$/
cache:
npm: true
yarn: true
bundler: true
directories:

View File

@ -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`.
@ -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
@ -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:
@ -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:
@ -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
@ -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

View File

@ -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

View File

@ -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
@ -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`.

View File

@ -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

View File

@ -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

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
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).

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-prod": "cross-env PORT=4002 node __sapper__/build",
"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",
"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-template-html": "node -r esm ./bin/build-template-html.js",
"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",
"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-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",

7859
yarn.lock Normal file

File diff suppressed because it is too large Load Diff