Giter Club home page Giter Club logo

cli'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!

cli's People

Contributors

allcontributors[bot] avatar allianaab2m avatar boingtheboeing avatar dependabot[bot] avatar depfu[bot] avatar enxg avatar favna avatar harryallen1 avatar instant-segfault avatar isimplydonotexist avatar megatank58 avatar mrdgh2821 avatar renovate-bot avatar renovate[bot] avatar sawa-ko avatar shahoob avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

cli's Issues

bug: Generated command comportnent code has error in import statement when using TypeScript

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When I generate a command component using the CLI, the type prefix is missing from the import statement, causing an error.
The other components (listener, arguments, precondition), this error did not occur.

Steps To Reproduce

sapphire generate command [commandName]

Expected behavior

It should generate code like this.

import { ApplyOptions } from '@sapphire/decorators';
import { SubCommandPluginCommand, SubCommandPluginCommandOptions } from '@sapphire/plugin-subcommands';
import type { Message } from 'discord.js';

@ApplyOptions<SubCommandPluginCommandOptions>({
	description: 'A basic command'
})
export class UserCommand extends SubCommandPluginCommand {
	public async messageRun(message: Message) {
		return message.channel.send('Hello world!');
	}
}

Screenshots

No response

Additional context

This is the first time for me to make an issue, and I used machine translation,
so I really apologize if there are any confusing parts.

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 dependency @types/node to ^20.14.13

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/auto-deprecate.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/continuous-delivery.yml
  • actions/checkout v4
  • actions/setup-node v4
.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
.github/workflows/publish.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/release-crosspost.yml
  • kludge-cs/gitcord-release-changelogger v3.0.0
npm
package.json
  • @favware/colorette-spinner ^1.0.1
  • @sapphire/node-utilities ^1.0.2
  • @sapphire/result ^2.6.6
  • colorette ^2.0.20
  • commander ^12.1.0
  • execa ^9.3.0
  • find-up ^5.0.0
  • js-yaml ^4.1.0
  • prompts ^2.4.2
  • tslib ^2.6.3
  • @commitlint/cli ^19.3.0
  • @commitlint/config-conventional ^19.2.2
  • @favware/cliff-jumper ^4.0.3
  • @favware/npm-deprecate ^1.0.7
  • @sapphire/decorators *
  • @sapphire/eslint-config ^5.0.5
  • @sapphire/framework *
  • @sapphire/plugin-api *
  • @sapphire/prettier-config ^2.0.0
  • @sapphire/ts-config ^5.0.1
  • @types/js-yaml ^4.0.9
  • @types/node ^20.14.12
  • @types/prompts ^2.4.9
  • cz-conventional-changelog ^3.3.0
  • discord.js *
  • eslint ^8.57.0
  • eslint-config-prettier ^9.1.0
  • eslint-plugin-prettier ^5.2.1
  • globby ^14.0.2
  • lint-staged ^15.2.7
  • prettier ^3.3.3
  • ts-node ^10.9.2
  • ansi-regex ^5.0.1
  • minimist ^1.2.8
  • yarn 4.3.1

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

bug: setup with yarn is broken

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

tried creating a new project with the cli

with yarn it failed, but it worked with npm

image

Steps To Reproduce

see screenshot

Expected behavior

setup via cli should work

Screenshots

image

➜  coco-bot git:(main) ✗ ls -la
total 16
drwxr-xr-x   9 dc  staff   288 May 27 00:25 ??coco-bot
drwxr-xr-x  11 dc  staff   352 May 27 00:26 ?coco-bot
drwxr-xr-x   7 dc  staff   224 May 27 00:26 .
drwxr-xr-x  67 dc  staff  2144 May 27 00:24 ..
drwxr-xr-x  12 dc  staff   384 May 27 00:28 .git
-rw-r--r--   1 dc  staff  2047 May 27 00:24 .gitignore
-rw-r--r--   1 dc  staff    10 May 27 00:24 README.md

Additional context

left with files that have illegal characters in
the ?? do not display in vscode so IDK what they are.

request: add dev dependencies

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

Add sapphire and discord modules to the dev dependencies.

Desired solution

This modification would bring auto-completion at the time of the writing or the modification of the examples what will avoid many problem of typing that one can make without this one.

Alternatives considered

An alternative solution is that each contributor adds them himself but it's honestly not that great to add them to have the auto-completion directly.

Additional context

No response

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 templates to match

Desired solution

Templates should be updated

Alternatives considered

N.A.

Additional context

N.A.

bug: 404 trying to download types + cannot find module 'code-point-at' (and

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

I was having some issues with a project I created a few months ago, so I tried to create a new one just to check. I used the Sapphire CLI using npx (but also tried installing it globally, same result) but during the npm install it runs at the end, I am getting some errors with downloading a specific version of the types library (which indeed doesn't exist in the GitHub releases). Tried generating one for plain JS instead of TypeScript, but it still tries to download this package.

And there's another error from node-gyp, which I honestly just don't really understand. It's related to a 'code-point-at' package, which is apparently now deprecated in favor the builtin String.codePointAt method. I don't see this dependency anywhere in this project though, so it could be an issue in node-gyp itself, or something with my setup?

Versions:
node: 17.3.0
npm: 8.3.1

❯ npx @sapphire/cli new --verbose
✔ What's the name of your project? … yeet
✔ Choose a language for your project › TypeScript (Recommended)
✔ Choose a template for your project › Default template (Recommended)
✔ What format do you want your config file to be in? › JSON
✔ What package manager do you want to use? › npm
✔ Do you want to create a git repository for this project? … no
⠋ Cloning the repositoryCloning into 'yeet/ghr'...
⠧ Cloning the repositoryremote: Enumerating objects: 986, done.
remote: Counting objects: 100% (986/986), done.
remote: Compressing objects: 100% (634/634), done.
remote: Total 986 (delta 577), reused 630 (delta 279), pack-reused 0
Receiving objects: 100% (986/986), 1.70 MiB | 6.37 MiB/s, done.
Resolving deltas: 100% (577/577), done.s:  92% (531/577)
✔ Cloning the repository
✔ Setting up the project
npm ERR! code 1
npm ERR! path /home/julia/yeet/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/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (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 "/home/julia/yeet/node_modules/@sapphire/type/prebuild/type-node-v102-linux-x64-glibc-2.33/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-v102-linux-x64-glibc-2.33.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-v102-linux-x64-glibc-2.33.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @sapphire/[email protected] and [email protected] (node-v102 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-v102-linux-x64-glibc-2.33.tar.gz 
npm ERR! node:internal/modules/cjs/loader:936
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module 'code-point-at'
npm ERR! Require stack:
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/string-width/index.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/wide-truncate.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/plumbing.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/index.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/npmlog/log.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:999:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR!     at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/string-width/index.js:3:19)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1097:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:975:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:999:19) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: [
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/string-width/index.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/wide-truncate.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/plumbing.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/index.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/npmlog/log.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
npm ERR!   ]
npm ERR! }
npm ERR! 
npm ERR! Node.js v17.3.0
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/julia/yeet/node_modules/@discordjs/node-pre-gyp/lib/util/compile.js:85:20)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1062:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Linux 5.16.1-zen1-1-zen
npm ERR! node-pre-gyp ERR! command "/usr/bin/node" "/home/julia/yeet/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/julia/yeet/node_modules/@sapphire/type
npm ERR! node-pre-gyp ERR! node -v v17.3.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!     /home/julia/.npm/_logs/2022-01-17T15_16_00_970Z-debug-0.log
✖ An unknown error occured while installing the dependencies. Try running Sapphire CLI with "--verbose" flag.
Error: An unknown error occured while installing the dependencies. Try running Sapphire CLI with "--verbose" flag.

Steps To Reproduce

Trying to generate a project using the Sapphire CLI

npx @sapphire/cli new --verbose

Or

sudo npm i -g @sapphire/cli
sapphire new --verbose

Expected behavior

Generating a new project template and running npm install successfully

Screenshots

No response

Additional context

No response

bug: Minor Issue

Describe the bug
It appears that cp doesn't exist in fs/promises anymore.

To Reproduce

  1. Install the CLI first obviously.
  2. Run sapphire init or any command really.

Expected behavior
Node should shout at your console with the stack trace that cp doesn't exist in fs/promises anymore.

Screenshots
image

Additional context

  • used node v16.6.1
  • used npm v8.1.3

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.