mirror of
https://github.com/Wessel/boilerplate.git
synced 2026-06-08 14:18:44 +02:00
feat: Modernize boilerplate
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
dist/
|
|
||||||
66
.eslintrc
66
.eslintrc
@@ -1,66 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"es6": true,
|
|
||||||
"amd": true,
|
|
||||||
"jest": true,
|
|
||||||
"node": true,
|
|
||||||
"mongo": true,
|
|
||||||
"jquery": true,
|
|
||||||
"browser": true,
|
|
||||||
"commonjs": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 9,
|
|
||||||
"sourceType": "module",
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"jsx": true,
|
|
||||||
"forOf": true,
|
|
||||||
"spread": true,
|
|
||||||
"modules": true,
|
|
||||||
"classes": true,
|
|
||||||
"generators": true,
|
|
||||||
"restParams": true,
|
|
||||||
"regexUFlag": true,
|
|
||||||
"regexYFlag": true,
|
|
||||||
"globalReturn": true,
|
|
||||||
"destructuring": true,
|
|
||||||
"impliedStrict": true,
|
|
||||||
"blockBindings": true,
|
|
||||||
"defaultParams": true,
|
|
||||||
"octalLiterals": true,
|
|
||||||
"arrowFunctions": true,
|
|
||||||
"binaryLiterals": true,
|
|
||||||
"templateStrings": true,
|
|
||||||
"superInFunctions": true,
|
|
||||||
"unicodeCodePointEscapes": true,
|
|
||||||
"experimentalObjectRestSpread": true,
|
|
||||||
"objectLiteralShorthandMethods": true,
|
|
||||||
"objectLiteralComputedProperties": true,
|
|
||||||
"objectLiteralDuplicateProperties": true,
|
|
||||||
"objectLiteralShorthandProperties": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plugins": [],
|
|
||||||
"rules": {
|
|
||||||
"semi": "warn",
|
|
||||||
"indent": [ "off", "error" ],
|
|
||||||
"strict": "off",
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"no-var": "warn",
|
|
||||||
"no-undef": "warn",
|
|
||||||
"valid-jsdoc": "warn",
|
|
||||||
"comma-dangle": "warn",
|
|
||||||
"no-dupe-args": "warn",
|
|
||||||
"no-dupe-keys": "warn",
|
|
||||||
"require-await": "warn",
|
|
||||||
"spaced-comment": "error",
|
|
||||||
"space-in-parens": "error",
|
|
||||||
"no-global-assign": "warn",
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
"no-dupe-class-members": "error"
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"_config": false,
|
|
||||||
"console": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -1 +1 @@
|
|||||||
* @Wessel
|
* @{{project.master}}
|
||||||
|
|||||||
25
.github/CONTRIBUTING.md
vendored
25
.github/CONTRIBUTING.md
vendored
@@ -1,38 +1,13 @@
|
|||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
<!---
|
|
||||||
Used linters:
|
|
||||||
[ESLint](https://eslint.org/)
|
|
||||||
[EditorConfig](https://editorconfig.org)
|
|
||||||
--->
|
|
||||||
|
|
||||||
If you wish to contribute to {{project.name}}, feel free to fork the repository and submit a pull request.
|
If you wish to contribute to {{project.name}}, feel free to fork the repository and submit a pull request.
|
||||||
{{project.linter}} is enforced to correct most typo's you make and keep the code style the same throughout the whole project,
|
{{project.linter}} is enforced to correct most typo's you make and keep the code style the same throughout the whole project,
|
||||||
so it would be much appreciated if you installed {{project.linter}} to your editor of choice
|
so it would be much appreciated if you installed {{project.linter}} to your editor of choice
|
||||||
|
|
||||||
<!---
|
|
||||||
Prerequisites for Node.JS:
|
|
||||||
|
|
||||||
* [Node.JS V18.14.0](https://nodejs.org/en/)
|
|
||||||
* [Docker](https://www.docker.com)
|
|
||||||
* [ESLint](https://eslint.org)
|
|
||||||
* [(OPTIONAL) Yarn](https://yarnpkg.com)
|
|
||||||
--->
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
The following prerequisites must be met before installing {{project.name}}:
|
The following prerequisites must be met before installing {{project.name}}:
|
||||||
{{setup.prerequisites}}
|
{{setup.prerequisites}}
|
||||||
|
|
||||||
<!---
|
|
||||||
Install commands:
|
|
||||||
JavaScript/TypeScript: `yarn --dev` or `npm install --dev`
|
|
||||||
Rust: `cargo run`
|
|
||||||
C: `make clean install`
|
|
||||||
|
|
||||||
Run commands:
|
|
||||||
JavaScript/TypeScript: `yarn test` or `npm run test`
|
|
||||||
Rust: `cargo run`
|
|
||||||
C: `make clean dev`
|
|
||||||
--->
|
|
||||||
## Setup
|
## Setup
|
||||||
To get ready to work on the codebase, please do the following:
|
To get ready to work on the codebase, please do the following:
|
||||||
|
|
||||||
|
|||||||
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
@@ -1,2 +1 @@
|
|||||||
github: wessel
|
{{project.funding}}
|
||||||
ko_fi: wessel
|
|
||||||
|
|||||||
8
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
8
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -1,18 +1,12 @@
|
|||||||
# Adapted from https://github.com/discordjs/discord.js/blob/main/.github/ISSUE_TEMPLATE/bug_report.yml
|
|
||||||
name: Bug report
|
name: Bug report
|
||||||
description: Report incorrect or unexpected behavior of a package
|
description: Report incorrect or unexpected behavior of a package
|
||||||
labels: [bug, need repro]
|
labels: [bug, need repro]
|
||||||
body:
|
body:
|
||||||
# - type: markdown
|
|
||||||
# attributes:
|
|
||||||
# value: |
|
|
||||||
# Use Discord for questions: https://discord.gg/djs
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: package
|
id: package
|
||||||
attributes:
|
attributes:
|
||||||
label: Which part is this bug report for?
|
label: Which part is this bug report for?
|
||||||
options:
|
options: {{tree.parts}}
|
||||||
- {{tree.parts}}
|
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
7
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +1,2 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
# Example entry:
|
{{project.contact}}
|
||||||
# name:
|
|
||||||
# url:
|
|
||||||
# about:
|
|
||||||
contact_links:
|
|
||||||
- {{project.contact}}
|
|
||||||
|
|||||||
4
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
4
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -1,4 +1,3 @@
|
|||||||
# Adapted from https://github.com/discordjs/discord.js/blob/main/.github/ISSUE_TEMPLATE/feature_request.yml
|
|
||||||
name: Feature request
|
name: Feature request
|
||||||
description: Request a new feature
|
description: Request a new feature
|
||||||
labels: [feature request]
|
labels: [feature request]
|
||||||
@@ -11,8 +10,7 @@ body:
|
|||||||
id: package
|
id: package
|
||||||
attributes:
|
attributes:
|
||||||
label: Which part is this feature request for?
|
label: Which part is this feature request for?
|
||||||
options:
|
options: {{tree.parts}}
|
||||||
- {{tree.parts}}
|
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
|||||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -3,8 +3,6 @@ name: Pull Request
|
|||||||
about: Propose changes to {{project.name}}
|
about: Propose changes to {{project.name}}
|
||||||
title: "[PR] Your changes"
|
title: "[PR] Your changes"
|
||||||
labels: pullrequest
|
labels: pullrequest
|
||||||
assignees: Wessel
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Please describe the changes this PR makes and why it should be merged:**
|
**Please describe the changes this PR makes and why it should be merged:**
|
||||||
|
|||||||
3
.github/auto_assign.yml
vendored
3
.github/auto_assign.yml
vendored
@@ -1,5 +1,4 @@
|
|||||||
addReviewers: true
|
addReviewers: true
|
||||||
reviewers:
|
reviewers: {{project.reviewers}}
|
||||||
- {{project.reviewers}}
|
|
||||||
numberOfReviewers: 0
|
numberOfReviewers: 0
|
||||||
runOnDraft: true
|
runOnDraft: true
|
||||||
2
LICENSE
2
LICENSE
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2023 Wessel T <discord@go2it.eu> (https://wessel.gg/)
|
Copyright (c) {{project.license}}
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
30
README.md
30
README.md
@@ -1,40 +1,12 @@
|
|||||||
<!---
|
|
||||||
To update:
|
|
||||||
project.
|
|
||||||
master - The master org or user of the repo
|
|
||||||
linter - The linter used for the project
|
|
||||||
name - Project name
|
|
||||||
lang - The (primary) programming language used
|
|
||||||
logo - Project logo
|
|
||||||
contact - All ways to contact for any inqueries
|
|
||||||
reviewers - A list of users to auto-assign to issues and features
|
|
||||||
info.
|
|
||||||
toc - Table of Contents of README
|
|
||||||
desc - Small project description
|
|
||||||
badges - Any extra badges
|
|
||||||
setup.
|
|
||||||
prerequisites - The prerequisites needed to run the project
|
|
||||||
install - Command for initial installation
|
|
||||||
test - Command for running tests
|
|
||||||
tree.
|
|
||||||
parts - All individual parts of the project
|
|
||||||
--->
|
|
||||||
<img src="{{project.logo}}" align="left" width="192px" height="192px"/>
|
<img src="{{project.logo}}" align="left" width="192px" height="192px"/>
|
||||||
<img align="left" width="0" height="192px" hspace="10"/>
|
<img align="left" width="0" height="192px" hspace="10"/>
|
||||||
|
|
||||||
> {{project.name}}
|
> {{project.name}}
|
||||||
|
|
||||||
[](/LICENSE) {{info.badges}}
|
[](/LICENSE)
|
||||||
|
|
||||||
{{info.desc}}
|
{{info.desc}}
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
<!---
|
|
||||||
Example table of contents:
|
|
||||||
* header
|
|
||||||
* sub header
|
|
||||||
--->
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
{{info.toc}}
|
|
||||||
|
|
||||||
|
|||||||
86
init_repo.py
Normal file
86
init_repo.py
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import os
|
||||||
|
import yaml
|
||||||
|
import re
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
file_types = ['LICENSE', 'CODEOWNERS', '.md', '.yml']
|
||||||
|
script_name = os.path.basename(__file__)
|
||||||
|
|
||||||
|
def replace_placeholders(file_path, replacements):
|
||||||
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
for placeholder, replacement in replacements.items():
|
||||||
|
content = re.sub(re.escape(placeholder), replacement, content)
|
||||||
|
|
||||||
|
with open(file_path, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
|
def initialize_repository(directory, replacements):
|
||||||
|
for root, _, files in os.walk(directory):
|
||||||
|
for file in files:
|
||||||
|
if file == script_name:
|
||||||
|
continue
|
||||||
|
if any(file.endswith(file_type) for file_type in file_types):
|
||||||
|
file_path = os.path.join(root, file)
|
||||||
|
replace_placeholders(file_path, replacements)
|
||||||
|
|
||||||
|
def parse_input(prompt):
|
||||||
|
return [item.strip() for item in input(prompt).split(',')]
|
||||||
|
|
||||||
|
def parse_contact(prompt):
|
||||||
|
contacts = []
|
||||||
|
while True:
|
||||||
|
print(prompt)
|
||||||
|
name = input(f"\tName\t\t").strip()
|
||||||
|
if not name:
|
||||||
|
break
|
||||||
|
url = input(f"\tURL\t\t").strip()
|
||||||
|
about = input(f"\tAbout\t\t").strip()
|
||||||
|
contacts.append({'name': name, 'url': url, 'about': about})
|
||||||
|
return {'contact_links': contacts}
|
||||||
|
|
||||||
|
def parse_funding(prompt):
|
||||||
|
funding = {}
|
||||||
|
while True:
|
||||||
|
print(prompt)
|
||||||
|
key = input(f"\tKey\t\t").strip()
|
||||||
|
if not key:
|
||||||
|
break
|
||||||
|
value = input(f"\tValue\t\t").strip()
|
||||||
|
funding[key] = value
|
||||||
|
|
||||||
|
return funding
|
||||||
|
|
||||||
|
def main():
|
||||||
|
current_year = str(datetime.datetime.now().year)
|
||||||
|
|
||||||
|
replacements = {
|
||||||
|
"{{project.name}}": input("Project name\t\t"),
|
||||||
|
"{{info.desc}}": input("Project Description\t"),
|
||||||
|
"{{project.master}}": input("Master of the repo\t"),
|
||||||
|
"{{project.license}}": f"{current_year} " + input('License holder\t\t'),
|
||||||
|
|
||||||
|
"{{tree.parts}}": yaml.dump(parse_input("Parts of the repo\t"), default_flow_style=True),
|
||||||
|
"{{project.lang}}": input("Language used\t\t"),
|
||||||
|
"{{project.linter}}": input("Linter used\t\t"),
|
||||||
|
|
||||||
|
"{{setup.prerequisites}}": input("Prerequisites\t\t"),
|
||||||
|
"{{setup.install}}": input("Install command\t\t"),
|
||||||
|
"{{setup.test}}": input("Test command\t\t"),
|
||||||
|
|
||||||
|
"{{project.logo}}": input("Project logo URL\t"),
|
||||||
|
"{{project.funding}}": yaml.dump(parse_funding("Funding methods\t\t"), default_flow_style=True),
|
||||||
|
"{{project.contact}}": yaml.dump(parse_contact("Contact information\t"), default_flow_style=False),
|
||||||
|
"{{project.reviewers}}": yaml.dump(parse_input("Auto-assign users (x,y)\t"), default_flow_style=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
directory = input("Initialize directory\t") or '.'
|
||||||
|
initialize_repository(directory, replacements)
|
||||||
|
|
||||||
|
delete = input("Delete this script? (Y/n)\t") or "y"
|
||||||
|
if delete.lower() == "y":
|
||||||
|
os.remove(__file__)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user