Giter Club home page Giter Club logo

examples's Introduction

Sapphire Logo

Sapphire Dev

GitHub app for Sapphire

GitHub

Description

The GitHub app that we use in Sapphire for automating various tasks.

Usage

Setup

# Install dependencies
yarn install

You will need to configure the Wrangler secrets for Cloudflare Workers environment. You will need the following secrets:

  • APP_ID

  • WEBHOOK_SECRET

  • PRIVATE_KEY

The private-key.pem file from GitHub needs to be transformed from the PKCS#1 format to PKCS#8, as the crypto APIs do not support PKCS#1:

openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in private-key.pem -out private-key-pkcs8.pem

Then set the private key

cat private-key-pkcs8.pem | wrangler secret put PRIVATE_KEY

For information on what these values are and how to get them see this guide

Buy us some doughnuts

Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!

We accept donations through Open Collective, Ko-fi, Paypal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.

Donate With Address
Open Collective Click Here
Ko-fi Click Here
Patreon Click Here
PayPal Click Here

Contributors

Please make sure to read the Contributing Guide before making a pull request.

Thank you to all the people who already contributed to Sapphire!

examples's People

Contributors

bensegal855 avatar cats3153 avatar classy-giraffe avatar favna avatar fc5570 avatar harryallen1 avatar hugoferrant avatar jurienhamaker avatar nytelife26 avatar r-priyam avatar renovate-bot avatar renovate[bot] avatar undiedgamer avatar zoriot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

examples's Issues

request: update examples to cover @sapphire/framework v4 / discord.js v14 changes

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

Sapphire Framework v4 has released / will release in the future and we should update the examples to match

Desired solution

Examples should be updated

Alternatives considered

N.A.

Additional context

N.A.

bug: (docker install) can't build image without npm install locally first

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

While attempting to build the docker image for production, I encounter an error which stop the build process.
The error is :

Step 8/17 : COPY ./package.json package-lock.json /opt/app/
COPY failed: file not found in build context or excluded by .dockerignore: stat package-lock.json: file does not exist

And docker is right, the file does not exist. It can be fixed by running a quick npm install before building with docker, but it's not written in the readme, and is not intuitive, as we are in a yarn setup.

Steps To Reproduce

  1. Run sapphire new
  2. Choose the docker setup
  3. Choose yarn (both v3 and v2 repro)
  4. Deal with the .env file (even if I don't think it's necessary for the repro)
  5. Directly run the docker build . -t sapphire-sample-bot
  6. See the error at the end

Expected behavior

Either :

  • the readme/doc should mention that a local npm install is required before building image
    or
  • the bug should be fixed (I don't have a clear idea of how, hence this issue instead of a PR. Maybe track the lock file in the git template ?)

Screenshots

No response

Additional context

No response

bug: cannot import ES modules

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Currently, after creating a new project from scratch (with typescript starter) and importing lowdb (which is an ES library, which is the one I want to use as a database), I get an error saying that I cannot import ES modules:

Error when loading '...\test-bot\dist\commands\ping.js': Error [ERR_REQUIRE_ESM]: require() of ES Module ...\test-bot\node_modules\lowdb\lib\index.js from ...\test-bot\dist\lib\database.js not supported.
Instead change the require of index.js in A:\Programación\HTML + CSS + JS\test-bot\dist\lib\database.js to a dynamic import() which is available in all CommonJS modules.

I don't know if this is intentional or a bug in the typescript configuration of the initial project.

Steps To Reproduce

  1. Generate a new project using sapphire new
  2. Select typescript-starter
  3. Import an ES Module (I'm using lowdb)
  4. Compile and see the error

Expected behavior

As @sapphire/ts-config has esModuleInterop enabled, I would expect to compile without problems.

Screenshots

No response

Additional context

Node version: 16.16.0

You can also see additional information on this stack overflow question.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update all non-major dependencies (prettier, yarn)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/continuous-integration.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/labelsync.yml
  • actions/checkout v4
  • crazy-max/ghaction-github-labeler v5
npm
package.json
  • @commitlint/cli ^19.3.0
  • @commitlint/config-conventional ^19.2.2
  • @sapphire/eslint-config ^5.0.5
  • @sapphire/prettier-config ^2.0.0
  • @types/node ^20.14.2
  • @types/ws ^8.5.10
  • cz-conventional-changelog ^3.3.0
  • eslint ^8.57.0
  • lint-staged ^15.2.5
  • npm-run-all2 ^6.2.0
  • prettier ^3.3.1
  • typescript ^5.4.5
  • ansi-regex ^5.0.1
  • minimist ^1.2.8
  • yarn 4.2.2

  • Check this box to trigger a request for Renovate to run again on this repository

bug: (docker install) python error at build

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

While attempting to build the docker image for production, I encounter an error which stop the build process.
The error is :
(short version imo:)

npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - executable path is "/usr/bin/python"
npm ERR! gyp ERR! find Python - version is "2.7.16"
npm ERR! gyp ERR! find Python - version is 2.7.16 - should be >=3.6.0
npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python 

(long step-full version:)

Step 9/17 : RUN npm install
 ---> Running in b8c49f065714
npm notice 
npm notice New minor version of npm available! 8.3.1 -> 8.5.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.5.2>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
npm ERR! code 1
npm ERR! path /opt/app/node_modules/@sapphire/type
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28/type.node --module_name=type --module_path=/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | linux | x64
npm ERR! node-pre-gyp info check checked for "/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28/type.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/sapphiredev/type/releases/download/v2.1.2/type-v2.1.2-node-v93-linux-x64-glibc-2.28.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/sapphiredev/type/releases/download/v2.1.2/type-v2.1.2-node-v93-linux-x64-glibc-2.28.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @sapphire/[email protected] and [email protected] (node-v93 ABI, glibc) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/sapphiredev/type/releases/download/v2.1.2/type-v2.1.2-node-v93-linux-x64-glibc-2.28.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - executable path is "/usr/bin/python"
npm ERR! gyp ERR! find Python - version is "2.7.16"
npm ERR! gyp ERR! find Python - version is 2.7.16 - should be >=3.6.0
npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:266:16)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:297:7)
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:390:7)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! gyp ERR! System Linux 5.13.0-30-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28/type.node" "--module_name=type" "--module_path=/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
npm ERR! gyp ERR! cwd /opt/app/node_modules/@sapphire/type
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28/type.node --module_name=type --module_path=/opt/app/node_modules/@sapphire/type/prebuild/type-node-v93-linux-x64-glibc-2.28 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/app/node_modules/@discordjs/node-pre-gyp/lib/util/compile.js:85:20)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Linux 5.13.0-30-generic
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/opt/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /opt/app/node_modules/@sapphire/type
npm ERR! node-pre-gyp ERR! node -v v16.14.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.4.2
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-02-27T22_25_03_690Z-debug-0.log
The command '/bin/sh -c npm install' returned a non-zero code: 1

Steps To Reproduce

  1. Run sapphire new
  2. Choose the docker setup
  3. Choose yarn
  4. Deal with the .env file (even if I don't think it's necessary for the repro)
  5. (if #59 is not fixed yet) Run npm install
  6. Run the docker build . -t sapphire-sample-bot
  7. See the error at the end

Expected behavior

Image should build

Screenshots

No response

Additional context

as far as I know, this bug is not linked to the other one I opened today (#59)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.