Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use yarn instead of npm in docs and scripts #796

Merged
merged 4 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jspm_packages
# Optional npm cache directory
.npm

# Optional local Yarn settings
.yarn
.yarnrc

# Optional REPL history
.node_repl_history

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict = true
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ inside the `MatrixEventProcessor` class.

* You will need to [setup the bridge](https://github.com/Half-Shot/matrix-appservice-discord/tree/develop#setup-the-bridge) similarly to how we describe,
but you should setup a homeserver locally on your development machine. We would recommend [Synapse](https://github.com/matrix-org/synapse).
* The bridge uses `yarn` for dependency management and package scripts instead of `npm`.
For details, view the full setup instructions in the [README](README.md#set-up-the-bridge).

## Testing

Expand All @@ -33,5 +35,4 @@ Refer to the main matrix.org bridge contributing guide for instructions on how t
[test](https://github.com/matrix-org/matrix-appservice-bridge/blob/develop/CONTRIBUTING.md#-tests--ci).

Please bear in mind that you will need to cover the whole, or a reasonable
degree of your code. You can check to see if you have with `npm run
coverage`.
degree of your code. You can check to see if you have with `yarn coverage`.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@ Please also be aware that this is an unoffical project worked on in our spare ti
The bridge has been tested against the [Synapse](https://github.com/matrix-org/synapse) homeserver, although any homeserver
that implements the [AS API](https://matrix.org/docs/spec/application_service/r0.1.0.html) should work with this bridge.

The bridge supports any version of Node.js >= v12.X, including all [current releases](https://nodejs.org/en/about/releases/).
The bridge supports any version of Node.js v12.X - v16.X. View the [releases](https://nodejs.org/en/about/releases/) for more details.

The bridge uses Yarn for dependency management and package scripts.
For the time being, **only Yarn Classic / v1 is supported.** To install it, follow [these instructions](https://classic.yarnpkg.com/en/docs/install).

If you already have Yarn 2+ installed, you may configure just this project to use Yarn Classic
by running ``yarn set version classic`` in the directory where you cloned this repository.

### Set up the bridge

* Run ``npm install`` to grab the dependencies. `npm` may complain about peer dependencies, but you can safely ignore these.
* Run ``npm run build`` to build the typescript into javascript.
* Run ``yarn`` to grab the dependencies.
* Copy ``config/config.sample.yaml`` to ``config.yaml`` and edit it to reflect your setup.
* Note that you are expected to set ``domain`` and ``homeserverURL`` to your **public** host name.
While localhost would work, it does not resolve correctly with Webhooks/Avatars.
Expand Down Expand Up @@ -95,7 +100,7 @@ should show up in the network list on Element and other clients.

* Create a new application via https://discordapp.com/developers/applications
* Make sure to create a bot user. Fill in ``config.yaml``
* Run ``npm run addbot`` to get a authorisation link.
* Run ``yarn addbot`` to get a authorisation link.
* Give this link to owners of the guilds you plan to bridge.
* Finally, you can join a room with ``#_discord_guildid_channelid``
* These can be taken from the url ("/$GUILDID/$CHANNELID") when you are in a channel.
Expand All @@ -108,7 +113,7 @@ should show up in the network list on Element and other clients.
### Running the Bridge

* For the bot to appear online on Discord you need to run the bridge itself.
* ``npm start``
* ``yarn start``
* Particular configuration keys can be overridden by defining corresponding environment variables. For instance, `auth.botToken` can be set with `APPSERVICE_DISCORD_AUTH_BOT_TOKEN`.

[Howto](./docs/howto.md)
Expand Down
1 change: 1 addition & 0 deletions changelog.d/796.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `yarn` instead of `npm` for package management and scripts.
4 changes: 2 additions & 2 deletions docs/howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ is formatted as https://discord.com/channels/``guildid``/``channelid``

* The ``adminme`` script is provided to set Admin/Moderator or any other custom power level to a specific user.
* e.g. To set Alice to Admin on her ``example.com`` HS on default config. (``config.yaml``)
* ``npm run adminme -- -r '!AbcdefghijklmnopqR:example.com' -u '@Alice:example.com' -p '100'``
* Run ``npm run adminme -- -h`` for usage.
* ``yarn adminme -r '!AbcdefghijklmnopqR:example.com' -u '@Alice:example.com' -p '100'``
* Run ``yarn adminme -h`` for usage.

Please note that `!AbcdefghijklmnopqR:example.com` is the internal room id and will always begin with `!`.
You can find this internal id in the room settings in Element.
Expand Down
2 changes: 1 addition & 1 deletion docs/puppeting.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ You should be able to puppet with 2FA enabled on your account

* Follow https://discordhelp.net/discord-token to find your discord token.
* Stop the bridge, if it is running.
* Run `npm run usertool -- --add` and follow the instructions.
* Run `yarn usertool --add` and follow the instructions.
* If all is well, you can start the bridge.
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
"version": "1.0.0",
"description": "A bridge between Matrix and Discord",
"main": "discordas.js",
"engines": {
"npm": "please-use-yarn",
"node": "12.x - 16.x"
},
AndrewFerr marked this conversation as resolved.
Show resolved Hide resolved
"scripts": {
"test": "mocha -r ts-node/register test/config.ts test/test_*.ts test/**/test_*.ts",
"lint": "eslint -c .eslintrc --max-warnings 200 src/**/*.ts test/**/*.ts",
"coverage": "tsc && nyc mocha build/test/config.js build/test",
"build": "tsc",
"postinstall": "npm run build",
"start": "npm run-script build && node ./build/src/discordas.js -c config.yaml",
"debug": "npm run-script build && node --inspect ./build/src/discordas.js -c config.yaml",
"postinstall": "yarn build",
"start": "yarn build && node ./build/src/discordas.js -c config.yaml",
"debug": "yarn build && node --inspect ./build/src/discordas.js -c config.yaml",
"addbot": "node ./build/tools/addbot.js",
"adminme": "node ./build/tools/adminme.js",
"usertool": "node ./build/tools/userClientTools.js",
Expand Down