Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wangshijun committed Apr 14, 2022
0 parents commit 590fec7
Show file tree
Hide file tree
Showing 110 changed files with 14,531 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GENERATE_SOURCEMAP=false
APP_PORT=3030
REACT_APP_TITLE=tiny-linktree
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public
dist
build

.blocklet
node_modules
.github
.husky
*.d.ts
package.json
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
parser: 'babel-eslint',
extends: '@arcblock/eslint-config',
rules: {
'unicorn/filename-case': 'off',
'import/prefer-default-export': 'off',
},
env: {
es6: true,
browser: true,
node: true,
mocha: true,
jest: true,
},
globals: {
logger: true,
},
};
34 changes: 34 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy

on:
push:
branches:
- master

jobs:
Deploy:
runs-on: ubuntu-latest

if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set yarn cache
uses: c-hive/gha-yarn-cache@v2

- name: Install dependencies
run: yarn

- name: Blocklet workflow
uses: blocklet/action-workflow@v1
with:
skip-bundle: false
skip-upload: false
skip-deploy: true
skip-release: true
bundle-command: yarn bundle
store-endpoint: ${{ secrets.STORE_ENDPOINT_PROD }}
store-access-token: ${{ secrets.STORE_ACCESS_TOKEN_PROD }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/.pnp
.pnp.js
.DS_Store
node_modules

# testing
/coverage

# production
/build
/dist
.blocklet

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
5 changes: 5 additions & 0 deletions .makefiles/bump_blocklet_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

NEW_VERSION=$(cat version)
blocklet version $NEW_VERSION
git add blocklet.yml
9 changes: 9 additions & 0 deletions .makefiles/bump_node_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

cur_ver=$(cat package.json | grep '"version":' | awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
new_ver=$(cat version)
ver_pattern="\"version\": \"$cur_ver\"" # strict match to avoid accidently change dependency version
ver_replacement="\"version\": \"$new_ver\""
cat package.json | sed "s/$ver_pattern/$ver_replacement/g" > package.json.tmp
mv package.json.tmp package.json
git add package.json
51 changes: 51 additions & 0 deletions .makefiles/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

NOW="$(date +'%B %d, %Y')"
# RED="\033[1;31m"
# GREEN="\033[0;32m"
# YELLOW="\033[1;33m"
# BLUE="\033[1;34m"
# PURPLE="\033[1;35m"
# CYAN="\033[1;36m"
# WHITE="\033[1;37m"
# RESET="\033[0m"

LATEST_HASH=$(git log --pretty=format:'%h' -n 1)

# QUESTION_FLAG="${GREEN}?"
# WARNING_FLAG="${YELLOW}!"
# NOTICE_FLAG="${CYAN}❯"

VERSION=version

ADJUSTMENTS_MSG="${QUESTION_FLAG} ${CYAN}Now you can make adjustments to ${WHITE}CHANGELOG.md${CYAN}. Then press enter to continue."

if [ -f $VERSION ]; then
BASE_STRING=$(cat $VERSION)
BASE_LIST=($(echo $BASE_STRING | tr '.' ' '))
V_MAJOR=${BASE_LIST[0]}
V_MINOR=${BASE_LIST[1]}
V_PATCH=${BASE_LIST[2]}
echo -e "${NOTICE_FLAG} Current version: ${WHITE}$BASE_STRING"
echo -e "${NOTICE_FLAG} Latest commit hash: ${WHITE}$LATEST_HASH"
V_MINOR=$((V_MINOR + 1))
V_PATCH=0
SUGGESTED_VERSION="$V_MAJOR.$V_MINOR.$V_PATCH"
echo -ne "${QUESTION_FLAG} ${CYAN}Enter a version number [${WHITE}$SUGGESTED_VERSION${CYAN}]: "
read INPUT_STRING
if [ "$INPUT_STRING" = "" ]; then
INPUT_STRING=$SUGGESTED_VERSION
fi
echo -e "${NOTICE_FLAG} Will set new version to be ${WHITE}$INPUT_STRING"
echo $INPUT_STRING >$VERSION

echo "## $INPUT_STRING ($NOW)\n" >tmpfile
git log --pretty=format:"- %s" "$BASE_STRING"...HEAD >>tmpfile
echo "" >>tmpfile
echo "" >>tmpfile
cat CHANGELOG.md >>tmpfile
mv tmpfile CHANGELOG.md
echo -e "$ADJUSTMENTS_MSG"
read
git add CHANGELOG.md $VERSION
fi
31 changes: 31 additions & 0 deletions .makefiles/release.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

RELEASE_VERSION=v$(VERSION)
GIT_BRANCH=$(strip $(shell git symbolic-ref --short HEAD))
GIT_VERSION="$(strip $(shell git rev-parse --short HEAD))"

release:
@git config --local user.name "bot"
@git config --local user.email "[email protected]"
@git tag -a $(RELEASE_VERSION) -m "Release $(RELEASE_VERSION). Revision is: $(GIT_VERSION)" | true
@git push origin $(RELEASE_VERSION) | true

delete-release:
@echo "Delete a release on $(RELEASE_VERSION)"
@git tag -d $(RELEASE_VERSION) | true
@git push -f -d origin $(RELEASE_VERSION) | true

bump-version:
@echo "Bump version..."
@.makefiles/bump_version.sh
@test -f "package.json" && .makefiles/bump_node_version.sh
@test -f "blocklet.yml" && .makefiles/bump_blocklet_version.sh

create-pr:
@echo "Creating pull request..."
@make bump-version || true
@git add .;git commit -a -m "bump version";git push origin $(GIT_BRANCH)
@hub pull-request

browse-pr:
@hub browse -- pulls
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## force pnpm to hoist
shamefully-hoist = true
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 120,
"useTabs": false,
"tabWidth": 2,
"trailingComma": "es5",
"jsxBracketSameLine": true,
"semi": true,
"singleQuote": true
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.2 (April 11, 2022)

- chore: initial release
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2018-2020 ArcBlock

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

dep:
@echo "Install dependencies required for this repo..."
@npm install
@npm install -g @blocklet/cli

test:
@echo "Running test suites..."

build:
@echo "Building the software..."

bundle:
@echo "Bundling the software..."
@npm run bundle

github-init:
@make dep

include .makefiles/*.mk
Loading

0 comments on commit 590fec7

Please sign in to comment.