From 56d76acc104c4088a4eb489b2eec8f3a1048a138 Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Sat, 6 Feb 2021 09:05:14 -0800 Subject: [PATCH 1/2] added formatter Added Prettier package as a development dependecy in the project that will auto-format the entire project. During development, use `npm run dev`, which will run prettier on the project then run nodemon to run the project for development. During deployment, use `npm run dep`, which will run prettier on the project then run pm2 to run a background process of the project for deployment. To stop the nodejs server during deployment, use `npm run stop` to stop the pm2 background process of the project. --- .github/ISSUE_TEMPLATE/bug_report.md | 24 ++++---- .github/ISSUE_TEMPLATE/feature_request.md | 7 +-- .github/workflows/codeql-analysis.yml | 67 ----------------------- .github/workflows/formatting.yml | 23 ++++++++ package.json | 11 +++- 5 files changed, 47 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/formatting.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea7..2537f25 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,10 +1,9 @@ --- name: Bug report about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - +title: "" +labels: "" +assignees: "" --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 01b32c2..9c43985 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,10 +1,9 @@ --- name: Feature request about: Suggest an idea for this project -title: 'Implementing Commands' -labels: 'enhancement' -assignees: '' - +title: "Implementing Commands" +labels: "enhancement" +assignees: "" --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 9ea7d13..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,67 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '40 0 * * 0' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml new file mode 100644 index 0000000..3aec707 --- /dev/null +++ b/.github/workflows/formatting.yml @@ -0,0 +1,23 @@ +name: Format +on: + pull_request: + branches: [main] +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - uses: actions/setup-node@v1 + with: + node-version: "12.x" + - name: Format + run: | + npm ci + npm run format + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4.1.2 + with: + commit_message: Apply formatting changes + branch: ${{ github.head_ref }} diff --git a/package.json b/package.json index 3d8932c..ad0b306 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,15 @@ "description": "", "main": "index.js", "scripts": { - "start": "node index.js", - "test": "echo \"Error: no test specified\" && exit 1" + "dev": "prettier --write . --tab-width 4; nodemon index.js", + "dep": "prettier --write . --tab-width 4; pm2 start index.js", + "stop": "pm2 stop index.js" }, "author": "", "license": "ISC", "dependencies": { "@discordjs/opus": "^0.3.3", - "bitly": "^7.1.0", + "bitly": "^7.1.2", "discord.js": "^12.3.1", "ffmpeg-static": "^4.2.7", "m3u8stream": "^0.8.3", @@ -20,5 +21,9 @@ "sqlite3": "^5.0.1", "util": "^0.12.3", "ytdl-core": "^4.4.5" + }, + "devDependencies": { + "nodemon": "^2.0.7", + "prettier": "^2.2.1" } } From b0ed0d9594e73f7a09af2701e300097a8fa70c9a Mon Sep 17 00:00:00 2001 From: Mazen Alotaibi Date: Sat, 6 Feb 2021 11:03:26 -0800 Subject: [PATCH 2/2] updated package.json Per @grepaziz's review, I needed to update package.json in order to work across different machines. He tried to run `npm run dev` but couldn't due to the command was special for unix/linux environments. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ad0b306..9b5e208 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "dev": "prettier --write . --tab-width 4; nodemon index.js", - "dep": "prettier --write . --tab-width 4; pm2 start index.js", + "dev": "prettier --write . --tab-width 4 && nodemon index.js", + "dep": "prettier --write . --tab-width 4 && pm2 start index.js", "stop": "pm2 stop index.js" }, "author": "",