From ed11c375a002741521592fbd99955f9ba10c1dda Mon Sep 17 00:00:00 2001 From: SharkSV Date: Tue, 21 Dec 2021 20:13:44 +0200 Subject: [PATCH 1/2] Code Refactoring | Multi-Template Support --- Template/.prettierrc.json => .prettierrc | 2 +- Bin/index.js | 14 ++- Lib/Cli.js | 6 -- Lib/Info.js | 6 +- Lib/Init/Prompt.js | 94 ++++++++++--------- Lib/Init/cProject.js | 92 +++++++++--------- Lib/Init/index.js | 12 --- Lib/Utils/{Log.js => Print.js} | 8 +- README.md | 3 +- {Template => Templates/Javascript}/.gitignore | 0 .../Javascript/.prettierrc.json | 0 .../Javascript}/.travis.yml | 0 .../Javascript}/CHANGELOG.md | 0 .../Javascript}/Docs/CODE_OF_CONDUCT.md | 0 .../Javascript}/Docs/CONTRIBUTING.md | 0 .../Javascript}/Docs/SECURITY.md | 0 {Template => Templates/Javascript}/README.md | 0 .../Javascript}/Src/index.js | 0 .../Javascript}/package.json | 0 Templates/Typescript/.prettierrc | 12 +++ Templates/Typescript/Src/Main.ts | 2 + Templates/Typescript/tsconfig.json | 27 ++++++ package.json | 2 +- 23 files changed, 163 insertions(+), 117 deletions(-) rename Template/.prettierrc.json => .prettierrc (82%) delete mode 100644 Lib/Init/index.js rename Lib/Utils/{Log.js => Print.js} (75%) rename {Template => Templates/Javascript}/.gitignore (100%) rename .prettierrc.json => Templates/Javascript/.prettierrc.json (100%) rename {Template => Templates/Javascript}/.travis.yml (100%) rename {Template => Templates/Javascript}/CHANGELOG.md (100%) rename {Template => Templates/Javascript}/Docs/CODE_OF_CONDUCT.md (100%) rename {Template => Templates/Javascript}/Docs/CONTRIBUTING.md (100%) rename {Template => Templates/Javascript}/Docs/SECURITY.md (100%) rename {Template => Templates/Javascript}/README.md (100%) rename {Template => Templates/Javascript}/Src/index.js (100%) rename {Template => Templates/Javascript}/package.json (100%) create mode 100644 Templates/Typescript/.prettierrc create mode 100644 Templates/Typescript/Src/Main.ts create mode 100644 Templates/Typescript/tsconfig.json diff --git a/Template/.prettierrc.json b/.prettierrc similarity index 82% rename from Template/.prettierrc.json rename to .prettierrc index 6e86936..af8f109 100644 --- a/Template/.prettierrc.json +++ b/.prettierrc @@ -1,6 +1,6 @@ { "trailingComma": "none", - "arrowParens": "avoid", + "arrowParens": "always", "singleQuote": true, "printWidth": 80, "useTabs": true, diff --git a/Bin/index.js b/Bin/index.js index de01e83..b52d4ed 100644 --- a/Bin/index.js +++ b/Bin/index.js @@ -9,18 +9,22 @@ const info = require('../Lib/Info.js'); const cli = require('../Lib/Cli'); -const Init = require('../Lib/Init'); -const Log = require('../Lib/Utils/Log'); +const cProject = require('../Lib/Init/cProject'); +const Prompt = require('../Lib/Init/Prompt'); const input = cli.input; const flags = cli.flags; -const { clear, debug } = flags; +const { clear } = flags; + +Init = async () => { + options = await Prompt(); + info(); + await cProject(options); +}; (async () => { info({ clear }); // Commands input.includes(`help`) && cli.showHelp(0); input.includes(`init`) && Init(); - // Flags - debug && Log('warning', 'You Sneaky!') & console.table(flags); })(); diff --git a/Lib/Cli.js b/Lib/Cli.js index 712d702..32e3a80 100644 --- a/Lib/Cli.js +++ b/Lib/Cli.js @@ -8,12 +8,6 @@ const flags = { alias: `c`, desc: `Clear the console` }, - debug: { - type: `boolean`, - default: false, - alias: `d`, - desc: `Print debug info` - }, version: { type: `boolean`, alias: `v`, diff --git a/Lib/Info.js b/Lib/Info.js index ca1c67a..8310d06 100644 --- a/Lib/Info.js +++ b/Lib/Info.js @@ -2,7 +2,7 @@ const welcome = require('cli-welcome'); const pkg = require('../package.json'); const unhandled = require('cli-handle-unhandled'); -module.exports = ({ clear = true }) => { +Info = () => { unhandled(); welcome({ title: `Hyper`, @@ -12,6 +12,8 @@ module.exports = ({ clear = true }) => { bgColor: '#36BB09', color: '#000000', bold: true, - clear + clear: true }); }; + +module.exports = Info; diff --git a/Lib/Init/Prompt.js b/Lib/Init/Prompt.js index 8c89b36..c6cc684 100644 --- a/Lib/Init/Prompt.js +++ b/Lib/Init/Prompt.js @@ -1,53 +1,61 @@ const inquirer = require('inquirer'); -module.exports = PFO = async options => { - // Options: +Prompt = async (options) => { + // Placeholders: const _Name = 'Author'; const _Email = 'me@Example.com'; - const questions = []; - - if (!options.name) { - questions.push({ - type: 'input', - name: 'name', - message: "Author's Name", - default: _Name - }); - } - - if (!options.email) { - questions.push({ - type: 'input', - name: 'email', - message: 'Public Email', - default: _Email - }); - } - - if (!options.git) { - questions.push({ - type: 'confirm', - name: 'git', - message: 'Initilize Git?', - default: true - }); - } - - if (!options.license) { - questions.push({ - type: 'confirm', - name: 'license', - message: 'Create a License?', - default: true - }); - } + const _Template = 'Javascript'; + // Questions + let Template, Name, Email, Git, License; + + Template = { + type: 'list', + name: 'template', + message: 'Project Template:', + choices: ['Javascript', 'Typescript'], + default: _Template + }; + + Name = { + type: 'input', + name: 'name', + message: "Author's Name:", + default: _Name + }; + + Email = { + type: 'input', + name: 'email', + message: 'Public Email:', + default: _Email + }; + + Git = { + type: 'confirm', + name: 'git', + message: 'Initilize Git?', + default: true + }; + + License = { + type: 'confirm', + name: 'license', + message: 'Create a License?', + default: true + }; + + const questions = [Template, Name, Email, Git, License]; const answers = await inquirer.prompt(questions); + return { ...options, - name: options.name || answers.name, - email: options.email || answers.email, - git: options.git || answers.git, - license: options.license || answers.license + Template: answers.template, + Name: answers.name, + Email: answers.email, + Git: answers.git, + License: answers.license }; }; + +module.exports = Prompt; diff --git a/Lib/Init/cProject.js b/Lib/Init/cProject.js index 6ba5c52..8dac1d8 100644 --- a/Lib/Init/cProject.js +++ b/Lib/Init/cProject.js @@ -9,30 +9,30 @@ const { promisify } = require('util'); const { projectInstall } = require('pkg-install'); // Imports: -const Log = require('../Utils/Log'); +const Print = require('../Utils/Print'); const cli = require('../Cli'); -const flags = cli.flags; -const { runInstall } = flags; const copy = promisify(ncp); const writeFile = promisify(fs.writeFile); -// Options: -const templateDir = path.join(__dirname, '../../Template'); +// Global variables: const currentDir = process.cwd(); -// Methods: +// Functions: copyTemplateFiles = async () => { + const { Template } = options; + const templateDir = path.join(__dirname, '../../Templates', Template); return copy(templateDir, currentDir, { clobber: true }); }; -createLicense = async options => { +createLicense = async () => { + const { Name, Email } = options; const targetPath = path.join(currentDir, 'LICENSE'); const licenseContent = mitLicense.licenseText .replace('', new Date().getFullYear()) - .replace('', `${options.name} (${options.email})`); + .replace('', `${Name} (${Email})`); return writeFile(targetPath, licenseContent, 'utf8'); }; @@ -45,41 +45,49 @@ initGit = async () => { : Promise.resolve(); }; -module.exports = createProject = async options => { - const Tasks = new Listr( - [ - { - title: 'Copy project files', - task: () => copyTemplateFiles() - }, - { - title: 'Initialize git', - task: () => initGit(), - enabled: () => options.git - }, - { - title: 'Create a license', - task: () => createLicense(options), - enabled: () => options.license - }, - { - title: 'Install dependencies', - task: () => - projectInstall({ - cwd: currentDir - }), - skip: () => - !runInstall - ? 'Pass -i to automatically install dependencies' - : undefined - } - ], +createProject = async (options) => { + const { Git, License } = options; + const flags = cli.flags; + const { runInstall } = flags; + + const Todo = [ + { + title: 'Copy project files', + task: () => copyTemplateFiles(options) + }, + { + title: 'Initialize git', + task: () => initGit(), + enabled: () => Git + }, + { + title: 'Create a license', + task: () => createLicense(options), + enabled: () => License + }, { - exitOnError: false + title: 'Install dependencies', + task: () => + projectInstall({ + cwd: currentDir + }), + skip: () => + !runInstall + ? 'Pass -i to automatically install dependencies' + : undefined } - ); + ]; - await Tasks.run(); - Log('success', 'Project initilized successfully!'); - return true; + const Tasks = new Listr(Todo, { + exitOnError: false + }); + + try { + await Tasks.run(); + Print('success', 'Project initilized successfully!'); + } catch (error) { + Print('error', 'An error occured while initializing the project.'); + } }; + +module.exports = createProject; diff --git a/Lib/Init/index.js b/Lib/Init/index.js deleted file mode 100644 index a1192d5..0000000 --- a/Lib/Init/index.js +++ /dev/null @@ -1,12 +0,0 @@ -const cProject = require('./cProject'); -const Prompt = require('./Prompt'); -const info = require('../Info.js'); -const cli = require('../Cli.js'); -const flags = cli.flags; -const { clear } = flags; - -module.exports = Init = async () => { - options = await Prompt(''); - info({ clear }); - await cProject(options); -}; diff --git a/Lib/Utils/Log.js b/Lib/Utils/Print.js similarity index 75% rename from Lib/Utils/Log.js rename to Lib/Utils/Print.js index 63030e1..93cfb36 100644 --- a/Lib/Utils/Log.js +++ b/Lib/Utils/Print.js @@ -1,7 +1,7 @@ const alert = require('cli-alerts'); -module.exports = (funcType, info) => { - let name = ''; +Print = (funcType, info) => { + let name; switch (funcType) { case 'success': @@ -11,7 +11,7 @@ module.exports = (funcType, info) => { name = 'Fail'; break; case 'warning': - name = 'Log'; + name = 'Attention'; break; default: name = 'Info'; @@ -23,3 +23,5 @@ module.exports = (funcType, info) => { msg: info }); }; + +module.exports = Print; diff --git a/README.md b/README.md index 1d064ca..9c1af06 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ A CLI to bootstrap new projects! ```bash npm install -g @sharksv/hyper - -# alternatively through github registry +# or npm install -g @itzsharksv/hyper ``` diff --git a/Template/.gitignore b/Templates/Javascript/.gitignore similarity index 100% rename from Template/.gitignore rename to Templates/Javascript/.gitignore diff --git a/.prettierrc.json b/Templates/Javascript/.prettierrc.json similarity index 100% rename from .prettierrc.json rename to Templates/Javascript/.prettierrc.json diff --git a/Template/.travis.yml b/Templates/Javascript/.travis.yml similarity index 100% rename from Template/.travis.yml rename to Templates/Javascript/.travis.yml diff --git a/Template/CHANGELOG.md b/Templates/Javascript/CHANGELOG.md similarity index 100% rename from Template/CHANGELOG.md rename to Templates/Javascript/CHANGELOG.md diff --git a/Template/Docs/CODE_OF_CONDUCT.md b/Templates/Javascript/Docs/CODE_OF_CONDUCT.md similarity index 100% rename from Template/Docs/CODE_OF_CONDUCT.md rename to Templates/Javascript/Docs/CODE_OF_CONDUCT.md diff --git a/Template/Docs/CONTRIBUTING.md b/Templates/Javascript/Docs/CONTRIBUTING.md similarity index 100% rename from Template/Docs/CONTRIBUTING.md rename to Templates/Javascript/Docs/CONTRIBUTING.md diff --git a/Template/Docs/SECURITY.md b/Templates/Javascript/Docs/SECURITY.md similarity index 100% rename from Template/Docs/SECURITY.md rename to Templates/Javascript/Docs/SECURITY.md diff --git a/Template/README.md b/Templates/Javascript/README.md similarity index 100% rename from Template/README.md rename to Templates/Javascript/README.md diff --git a/Template/Src/index.js b/Templates/Javascript/Src/index.js similarity index 100% rename from Template/Src/index.js rename to Templates/Javascript/Src/index.js diff --git a/Template/package.json b/Templates/Javascript/package.json similarity index 100% rename from Template/package.json rename to Templates/Javascript/package.json diff --git a/Templates/Typescript/.prettierrc b/Templates/Typescript/.prettierrc new file mode 100644 index 0000000..2f42223 --- /dev/null +++ b/Templates/Typescript/.prettierrc @@ -0,0 +1,12 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "overrides": [ + { + "files": "*.ts", + "options": { + "parser": "typescript" + } + } + ] +} diff --git a/Templates/Typescript/Src/Main.ts b/Templates/Typescript/Src/Main.ts new file mode 100644 index 0000000..1ad6055 --- /dev/null +++ b/Templates/Typescript/Src/Main.ts @@ -0,0 +1,2 @@ +let message: string = 'Heyo!'; +console.log(message); \ No newline at end of file diff --git a/Templates/Typescript/tsconfig.json b/Templates/Typescript/tsconfig.json new file mode 100644 index 0000000..4b9760d --- /dev/null +++ b/Templates/Typescript/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "allowJs": true, + "importHelpers": true, + "jsx": "react", + "alwaysStrict": true, + "sourceMap": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "removeComments": true, + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false, + "rootDir": "Src", + "outDir": "Build", + }, + "exclude": [ + "node_modules" + ] +} diff --git a/package.json b/package.json index bd7fdb0..d05623f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@itzsharksv/hyper", "description": "A CLI to bootstrap new projects!", - "version": "1.0.0", + "version": "1.2.0", "license": "MIT", "main": "Bin/index.js", "bin": { From 25afc5a988d97e0d1cf4d68b31d2111d10e32b7d Mon Sep 17 00:00:00 2001 From: SharkSV Date: Tue, 21 Dec 2021 22:33:51 +0200 Subject: [PATCH 2/2] Minor Tweaks | Addons --- .github/FUNDING.yml | 1 + .github/PULL_REQUEST_TEMPLATE.md | 9 +-- .github/workflows/Release.yml | 19 +++++ Docs/CODE_OF_CONDUCT.md | 2 +- Docs/CONTRIBUTING.md | 2 +- Docs/SECURITY.md | 2 +- Templates/Javascript/.github/Funding.yml | 12 +++ .../.github/ISSUE_TEMPLATE/BUG_REPORT.md | 30 +++++++ .../.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 16 ++++ .../.github/PULL_REQUEST_TEMPLATE.md | 34 ++++++++ .../Javascript/.github/workflows/CodeQL.yml | 38 +++++++++ .../{.prettierrc.json => .prettierrc} | 2 +- Templates/Javascript/Src/index.js | 3 + Templates/Typescript/.github/Funding.yml | 12 +++ .../.github/ISSUE_TEMPLATE/BUG_REPORT.md | 30 +++++++ .../.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 16 ++++ .../.github/PULL_REQUEST_TEMPLATE.md | 34 ++++++++ .../Typescript/.github/workflows/CodeQL.yml | 38 +++++++++ Templates/Typescript/.gitignore | 72 +++++++++++++++++ Templates/Typescript/.prettierrc | 5 ++ Templates/Typescript/.travis.yml | 23 ++++++ Templates/Typescript/CHANGELOG.md | 11 +++ Templates/Typescript/Docs/CODE_OF_CONDUCT.md | 45 +++++++++++ Templates/Typescript/Docs/CONTRIBUTING.md | 81 +++++++++++++++++++ Templates/Typescript/Docs/SECURITY.md | 15 ++++ Templates/Typescript/README.md | 78 ++++++++++++++++++ Templates/Typescript/package.json | 25 ++++++ Templates/Typescript/tsconfig.json | 6 +- 28 files changed, 648 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/Release.yml create mode 100644 Templates/Javascript/.github/Funding.yml create mode 100644 Templates/Javascript/.github/ISSUE_TEMPLATE/BUG_REPORT.md create mode 100644 Templates/Javascript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md create mode 100644 Templates/Javascript/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 Templates/Javascript/.github/workflows/CodeQL.yml rename Templates/Javascript/{.prettierrc.json => .prettierrc} (82%) create mode 100644 Templates/Typescript/.github/Funding.yml create mode 100644 Templates/Typescript/.github/ISSUE_TEMPLATE/BUG_REPORT.md create mode 100644 Templates/Typescript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md create mode 100644 Templates/Typescript/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 Templates/Typescript/.github/workflows/CodeQL.yml create mode 100644 Templates/Typescript/.gitignore create mode 100644 Templates/Typescript/.travis.yml create mode 100644 Templates/Typescript/CHANGELOG.md create mode 100644 Templates/Typescript/Docs/CODE_OF_CONDUCT.md create mode 100644 Templates/Typescript/Docs/CONTRIBUTING.md create mode 100644 Templates/Typescript/Docs/SECURITY.md create mode 100644 Templates/Typescript/README.md create mode 100644 Templates/Typescript/package.json diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 86d0bc0..7d33c20 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,3 @@ +github: [iTzSharkSV] patreon: SharkSV ko_fi: SharkSV diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 08100cc..4edf136 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -13,11 +13,10 @@ -- [ ] My code follows the code style of this project. -- [ ] My change requires a change to the documentation. -- [ ] I have updated the documentation accordingly. -- [ ] I have added tests to cover my changes. -- [ ] All new and existing tests passed. +- [ ] My code follows the code style of this project. +- [ ] I have updated the documentation accordingly. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. ## Featured changes diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 0000000..7f7b2de --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,19 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://npm.pkg.github.com/ + - run: yarn install + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/Docs/CODE_OF_CONDUCT.md b/Docs/CODE_OF_CONDUCT.md index 1126684..da4ad62 100644 --- a/Docs/CODE_OF_CONDUCT.md +++ b/Docs/CODE_OF_CONDUCT.md @@ -34,7 +34,7 @@ This Code of Conduct applies within all project spaces, and it also applies when ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer [SharkSV](mailto:support@SharkSV.engineer). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer [Shorky](mailto:SharkSV@outlook.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/Docs/CONTRIBUTING.md b/Docs/CONTRIBUTING.md index 2e59cfd..890da86 100644 --- a/Docs/CONTRIBUTING.md +++ b/Docs/CONTRIBUTING.md @@ -22,4 +22,4 @@ These guidelines will ensure the pull request process is easy and traceable for 1. Increase the version number in package.json and create new entry at the beginning of [CHANGELOG](../CHANGELOG.md). Entries in the changelog file should be quick bullet points of the items changed, not just commit messages. The versioning scheme we use is [SemVer](http://semver.org/). 2. Submit the pull request. A maintainer will review the changes contact you with any followup actions. -#### Contact [SharkSV](mailto:support@SharkSV.engineer) with any questions +#### Contact [Shorky](mailto:SharkSV@outlook.com) with any questions diff --git a/Docs/SECURITY.md b/Docs/SECURITY.md index 48dbf54..a86ceb4 100644 --- a/Docs/SECURITY.md +++ b/Docs/SECURITY.md @@ -4,7 +4,7 @@ If there are any vulnerability in this project, don't hesitate to _report them_. -1. Contact project maintainer [SharkSV](mailto:support@SharkSV.engineer). +1. Contact project maintainer [Shorky](mailto:SharkSV@outlook.com). 2. Describe the vulnerability. - If you have a fix, explain or attach it. diff --git a/Templates/Javascript/.github/Funding.yml b/Templates/Javascript/.github/Funding.yml new file mode 100644 index 0000000..5d7fc79 --- /dev/null +++ b/Templates/Javascript/.github/Funding.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [] # Replace with github username +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/Templates/Javascript/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/Templates/Javascript/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 0000000..551b85c --- /dev/null +++ b/Templates/Javascript/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,30 @@ +--- +name: Bug report +about: Create a report to help us improve +--- + +**Describe the bug** +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 '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional information (please complete the following information):** + +- OS: [e.g. Mac High Sierra, Ubuntu 18.04, Windows 10] +- rVersion [e.g. Project 1.0.1] + +**Additional context** +Add any other context about the problem here. +Terms diff --git a/Templates/Javascript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/Templates/Javascript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 0000000..a09db44 --- /dev/null +++ b/Templates/Javascript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,16 @@ +--- +name: Feature request +about: Suggest an idea for this project +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/Templates/Javascript/.github/PULL_REQUEST_TEMPLATE.md b/Templates/Javascript/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4edf136 --- /dev/null +++ b/Templates/Javascript/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +## Types of changes + + + +```diff +- Bug fix +- New feature +- Breaking change (fix or feature that would cause existing functionality to change) +- Updated docs +``` + +## Qualification checks + + + +- [ ] My code follows the code style of this project. +- [ ] I have updated the documentation accordingly. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. + +## Featured changes + + + +--- + + + + + +✅ By sending this pull request, I agree to the `Contributor License Agreement` of this project. diff --git a/Templates/Javascript/.github/workflows/CodeQL.yml b/Templates/Javascript/.github/workflows/CodeQL.yml new file mode 100644 index 0000000..ccb30d7 --- /dev/null +++ b/Templates/Javascript/.github/workflows/CodeQL.yml @@ -0,0 +1,38 @@ +name: 'CodeQL' + +on: + push: + branches: Main + pull_request: + branches: Main + schedule: + - cron: '0 0 1 * *' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ['javascript'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/Templates/Javascript/.prettierrc.json b/Templates/Javascript/.prettierrc similarity index 82% rename from Templates/Javascript/.prettierrc.json rename to Templates/Javascript/.prettierrc index 6e86936..af8f109 100644 --- a/Templates/Javascript/.prettierrc.json +++ b/Templates/Javascript/.prettierrc @@ -1,6 +1,6 @@ { "trailingComma": "none", - "arrowParens": "avoid", + "arrowParens": "always", "singleQuote": true, "printWidth": 80, "useTabs": true, diff --git a/Templates/Javascript/Src/index.js b/Templates/Javascript/Src/index.js index 21ba52c..10188f6 100644 --- a/Templates/Javascript/Src/index.js +++ b/Templates/Javascript/Src/index.js @@ -1 +1,4 @@ // Hallo! +'use strict'; +let message = 'Heyo!'; +console.log(message); diff --git a/Templates/Typescript/.github/Funding.yml b/Templates/Typescript/.github/Funding.yml new file mode 100644 index 0000000..5d7fc79 --- /dev/null +++ b/Templates/Typescript/.github/Funding.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [] # Replace with github username +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/Templates/Typescript/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/Templates/Typescript/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 0000000..551b85c --- /dev/null +++ b/Templates/Typescript/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,30 @@ +--- +name: Bug report +about: Create a report to help us improve +--- + +**Describe the bug** +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 '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional information (please complete the following information):** + +- OS: [e.g. Mac High Sierra, Ubuntu 18.04, Windows 10] +- rVersion [e.g. Project 1.0.1] + +**Additional context** +Add any other context about the problem here. +Terms diff --git a/Templates/Typescript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/Templates/Typescript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 0000000..a09db44 --- /dev/null +++ b/Templates/Typescript/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,16 @@ +--- +name: Feature request +about: Suggest an idea for this project +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/Templates/Typescript/.github/PULL_REQUEST_TEMPLATE.md b/Templates/Typescript/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4edf136 --- /dev/null +++ b/Templates/Typescript/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +## Types of changes + + + +```diff +- Bug fix +- New feature +- Breaking change (fix or feature that would cause existing functionality to change) +- Updated docs +``` + +## Qualification checks + + + +- [ ] My code follows the code style of this project. +- [ ] I have updated the documentation accordingly. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. + +## Featured changes + + + +--- + + + + + +✅ By sending this pull request, I agree to the `Contributor License Agreement` of this project. diff --git a/Templates/Typescript/.github/workflows/CodeQL.yml b/Templates/Typescript/.github/workflows/CodeQL.yml new file mode 100644 index 0000000..584b52a --- /dev/null +++ b/Templates/Typescript/.github/workflows/CodeQL.yml @@ -0,0 +1,38 @@ +name: 'CodeQL' + +on: + push: + branches: Main + pull_request: + branches: Main + schedule: + - cron: '0 0 1 * *' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ['typescript'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/Templates/Typescript/.gitignore b/Templates/Typescript/.gitignore new file mode 100644 index 0000000..f9e6dde --- /dev/null +++ b/Templates/Typescript/.gitignore @@ -0,0 +1,72 @@ +# NPM # +########## +# Ignore all directories called node_modules in current folder and any subfolders. +node_modules/ +/node_modules/ + +# Packages # +############ +*.7z +*.dmg +*.gz +*.bz2 +*.iso +*.jar +*.rar +*.tar +*.zip +*.tgz +*.map + +# Logs and databases # +###################### +*.log +*.sql +*.env + +# OS generated files # +###################### +**.DS_Store* +ehthumbs.db +Icon? +Thumbs.db +._* +**settings.dat* + +# Vim generated files # +###################### +*.un~ + +# SASS # +########## +**/.sass-cache +**/.sass-cache/* +**/.map + +# Composer # +########## +!assets/js/vendor/ +wpcs/ +/vendor/ + +# Bower # +########## +assets/bower_components/* + +# Codekit # +########## +/codekit-config.json +*.codekit +**.codekit-cache/* + +# Compiled Files and Build Dirs # +########## +/README.html + +# PhpStrom Project Files # +.idea/ +library/vendors/composer +assets/img/.DS_Store + +# VSCode related files # +# .vscode diff --git a/Templates/Typescript/.prettierrc b/Templates/Typescript/.prettierrc index 2f42223..b5d9eae 100644 --- a/Templates/Typescript/.prettierrc +++ b/Templates/Typescript/.prettierrc @@ -1,6 +1,11 @@ { "singleQuote": true, "trailingComma": "all", + "arrowParens": "always", + "printWidth": 80, + "useTabs": true, + "tabWidth": 4, + "semi": true, "overrides": [ { "files": "*.ts", diff --git a/Templates/Typescript/.travis.yml b/Templates/Typescript/.travis.yml new file mode 100644 index 0000000..ef0d23c --- /dev/null +++ b/Templates/Typescript/.travis.yml @@ -0,0 +1,23 @@ +language: javascript + +before_install: + - echo "#" + - echo "#" + - echo "TravisCI is unbelively powerful, but you need to do your research first." + - echo "#" + - echo "#" + +script: + - echo "#" + - echo "#" + - echo "Please take a look https://docs.travis-ci.com/user/tutorial/ for you options." + - echo "#" + - echo "#" + + +after_success: + - echo "#" + - echo "#" + - echo "Don't forget to enable it in the GitHub repository also.." + - echo "#" + - echo "#" diff --git a/Templates/Typescript/CHANGELOG.md b/Templates/Typescript/CHANGELOG.md new file mode 100644 index 0000000..f8cdbda --- /dev/null +++ b/Templates/Typescript/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [Unreleased] + +## [1.0.0] - yyyy-mm-dd + +### Added + +- Added a changelog diff --git a/Templates/Typescript/Docs/CODE_OF_CONDUCT.md b/Templates/Typescript/Docs/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..313a821 --- /dev/null +++ b/Templates/Typescript/Docs/CODE_OF_CONDUCT.md @@ -0,0 +1,45 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer using any of the [Contact adresses](https://github.com/Organization/). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at + +For answers to common questions about this code of conduct, see diff --git a/Templates/Typescript/Docs/CONTRIBUTING.md b/Templates/Typescript/Docs/CONTRIBUTING.md new file mode 100644 index 0000000..73574a0 --- /dev/null +++ b/Templates/Typescript/Docs/CONTRIBUTING.md @@ -0,0 +1,81 @@ +# Contributing to this project + +Welcome, and thank you for your interest in contributing to [Project name]! + +There are many ways in which you can contribute, beyond writing code. The goal of this document is to provide a high-level overview of how you can get involved. + +## Questions & Feedback + +Have a question? The active community will be eager to assist you. Your well-worded question will serve as a resource to others searching for help. + +Your comments and feedback are welcome, and the development team is available via a handful of different channels. + +## Reporting Issues + +Have you identified a reproducible problem in the project? Have a feature request? We want to hear about it! Here's how you can make reporting your issue as effective as possible. + +### Identify where to Report + +Can you recreate the issue even after disabling all your personal extensions? If you find the issue is caused by an extension you have installed, please file an issue on the extension's repo directly. + +### Look for an Existing Issue + +Before you create a new issue, please do a search in [open issues](https://github.com/Organization/Project-name/issues) to see if the issue or feature request has already been filed. + +Be sure to scan through the most popular feature requests. + +If you find your issue already exists, make relevant comments and add your reaction. Use a reaction in place of a "+1" comment: + +- 👍 - upvote +- 👎 - downvote + +If you cannot find an existing issue that describes your bug or feature, create a new issue using the guidelines below. + +### Writing Good Bug Reports and Feature Requests + +File a single issue per problem and feature request. Do not enumerate multiple bugs or feature requests in the same issue. + +Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes. + +The more information you can provide, the more likely someone will be successful at reproducing the issue and finding a fix. + +Please include the following with each issue: + +- Version of Product + +- Your operating system + +- List of extensions/packages that you have installed + +- Reproducible steps (1... 2... 3...) that cause the issue + +- What you expected to see, versus what you actually saw + +- Images, animations, or a link to a video showing the issue occurring + +- A code snippet that demonstrates the issue or a link to a code repository the developers can easily pull down to recreate the issue locally + +### Final Checklist + +Please remember to do the following: + +- [ ] Search the issue repository to ensure your report is a new issue + +- [ ] Recreate the issue after disabling all extensions + +- [ ] Simplify your code around the issue to better isolate the problem + +Don't feel bad if the developers can't reproduce the issue right away. They will simply ask for more information! + +### Follow Your Issue + +Once submitted, your report will go into the issue tracking workflow. Be sure to understand what will happen next, so you know what to expect, and how to continue to assist throughout the process. + +## Contributing Fixes + +If you are interested in writing code to fix issues, +please submit a pull request. + +# Thank You! + +Your contributions to open source, large or small, make great projects like this possible. Thank you for taking the time to contribute. diff --git a/Templates/Typescript/Docs/SECURITY.md b/Templates/Typescript/Docs/SECURITY.md new file mode 100644 index 0000000..a02e6f5 --- /dev/null +++ b/Templates/Typescript/Docs/SECURITY.md @@ -0,0 +1,15 @@ +# Security Policy + +## Reporting a Vulnerability + +If there are any vulnerability in this project, don't hesitate to _report them_. + +1. Use any of the [Support adresses](https://github.com/Organization/). +2. Describe the vulnerability. + +- If you have a fix, explain or attach it. +- In the near time, expect a reply with the required steps. Also, there may be a demand for a pull request which include the fixes. + +> You should not disclose the vulnerability publicly if you haven't received an answer in some weeks. +> If the vulnerability is rejected, you may post it publicly within some hour of rejection, unless the rejection is withdrawn within that time period. +> After the vulnerability has been fixed, you may disclose the vulnerability details publicly over some days. diff --git a/Templates/Typescript/README.md b/Templates/Typescript/README.md new file mode 100644 index 0000000..34a17b6 --- /dev/null +++ b/Templates/Typescript/README.md @@ -0,0 +1,78 @@ +# JumpStart + +A template for new ambitious projects! + +## Project Table + +This repository contains some example best practices for open source repositories: + +- [LICENSE](LICENSE) +- [README.md](README.md) +- [CONTRIBUTING.md](./Docs/CONTRIBUTING.md) +- [CHANGELOG.md](CHANGELOG.md) +- [Travis.yml](.travis.yml) - This is a example `.travis.yml`, please take a look https://docs.travis-ci.com/user/tutorial/ for more details. + +## Run Locally + +`Clone the project` + +```bash +git clone https://github.com//.git +// or +gh repo clone / +``` + +`Go to the project directory` + +```bash +cd +``` + +## Usage/Examples + +`Basic commands` + +```js +class Example extends Something { + constructor() { + super({ + name: 'example', + description: 'Example command' + }); + } + + async exec(interaction) { + return interaction.reply({ + ephemeral: true, + content: 'Hallo!' + }); + } +} + +module.exports = Example; +``` + +## Project Tree + +```Txt +📦 +├─ Docs +│  ├─ CODE_OF_CONDUCT.md +│  ├─ CONTRIBUTING.md +│  └─ SECURITY.md +├─ .gitignore +├─ .prettierrc +├─ .travis.yml +├─ CHANGELOG.md +├─ README.md +└─ LICENSE +``` + +## License + +```text +# +# Copyright - All rights reserved +# License Identifier: MIT +# +``` diff --git a/Templates/Typescript/package.json b/Templates/Typescript/package.json new file mode 100644 index 0000000..03b15dc --- /dev/null +++ b/Templates/Typescript/package.json @@ -0,0 +1,25 @@ +{ + "name": "@owner/project", + "description": "Brief description!", + "version": "1.0.0", + "license": "MIT", + "main": "Src/index", + "author": { + "name": "author-name", + "email": "me@example.com", + "url": "https://example.com" + }, + "keywords": [ + "Cli", + "Example" + ], + "scripts": { + "test": "exit 0", + "format": "prettier --write \"./**/*.{js,json}\"" + }, + "devDependencies": { + "prettier": "^2.4.1", + "typescript": "^4.5.4", + "@types/node": "~16.11.6" + } +} diff --git a/Templates/Typescript/tsconfig.json b/Templates/Typescript/tsconfig.json index 4b9760d..3f2da3f 100644 --- a/Templates/Typescript/tsconfig.json +++ b/Templates/Typescript/tsconfig.json @@ -19,9 +19,7 @@ "noImplicitThis": false, "strictNullChecks": false, "rootDir": "Src", - "outDir": "Build", + "outDir": "Build" }, - "exclude": [ - "node_modules" - ] + "exclude": ["node_modules"] }