这是indexloc提供的服务,不要输入任何密码
Skip to content

Add script to init git before husky init #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ A [Block based](https://developer.wordpress.org/block-editor/how-to-guides/theme

### Method 1 (Recommended)
```
composer create-project rtcamp/elementary . --stability="dev"
composer create-project rtcamp/elementary [folder_name]
```
This command is equivalant of cloning the repository and running `composer install && npm install`

Expand Down
11 changes: 11 additions & 0 deletions bin/git-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# check if git is initialized already
if [ -d .git ]; then
echo "Git is already initialized"
exit 0
fi

git init
git add --all .
git commit -m "Initialize project using rtCamp/theme-elementary"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"lint:php:fix": "./bin/phpcbf.sh",
"lint:package-json": "wp-scripts lint-pkg-json --ignorePath .gitignore",
"lint:staged": "lint-staged",
"prepare": "husky install && npm run init",
"prepare": "npm run init && ./bin/git-init.sh && husky install",
"start": "wp-scripts start",
"test": "npm-run-all --parallel test:*",
"test:js": "wp-scripts test-unit-js --config=tests/js/jest.config.js --passWithNoTests",
Expand Down