Skip to content

Commit

Permalink
BREAKING: v2 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts authored Apr 17, 2021
1 parent e12c19a commit 811c1dc
Show file tree
Hide file tree
Showing 82 changed files with 15,491 additions and 2,416 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[core]
autocrlf = false

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
35 changes: 35 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
typings.d.ts
index.d.ts
lib
cypress/e2e/build
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pids
*.pid
*.seed
*.pid.lock
lib-cov
coverage
node_modules
jspm_packages
typings/
.npm
.env
.env.*
.cache
public
.idea
.vscode
.DS_Store
*.png
*.jpg
*.ico
*.md
*.mdx
*.json
LICENSE
*.txt
*.toml
68 changes: 0 additions & 68 deletions .eslintrc

This file was deleted.

114 changes: 114 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
module.exports = {
parser: `@typescript-eslint/parser`, // Specifies the ESLint parser
extends: [`airbnb`, `plugin:import/typescript`, `plugin:prettier/recommended`],
plugins: [`@typescript-eslint`, `prettier`, `react-hooks`],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: `module`, // Allows for the use of imports
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
jest: true,
node: true,
},
globals: {
__PATH_PREFIX__: true,
graphql: false,
},
rules: {
"@typescript-eslint/no-unused-vars": [
1,
{
argsIgnorePattern: `res|next|stage|^err|on|config|e|_`,
},
],
"arrow-body-style": [2, `as-needed`],
"no-param-reassign": [
2,
{
props: false,
},
],
"no-unused-expressions": [
1,
{
allowTaggedTemplates: true,
},
],
quotes: `off`,
"@typescript-eslint/quotes": [
2,
`backtick`,
{
avoidEscape: true,
},
],
"@typescript-eslint/prefer-interface": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/ban-ts-comment": 0,
"no-console": [`warn`, { allow: [`warn`] }],
"spaced-comment": [2, `always`, { exceptions: [`-`, `+`], markers: [`/`] }],
"no-use-before-define": 0,
"no-plusplus": 0,
"no-continue": 0,
"linebreak-style": 0,
"consistent-return": 0,
import: 0,
camelcase: 1,
"import/no-unresolved": 0,
"func-names": 0,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
"import/no-cycle": 0,
"space-before-function-paren": 0,
"import/extensions": 0,
"import/no-anonymous-default-export": 2,
"react/jsx-one-expression-per-line": 0,
"react/no-danger": 0,
"react/display-name": 0,
"react/react-in-jsx-scope": 0,
"react/jsx-uses-react": 1,
"react/require-default-props": 0,
"react/forbid-prop-types": 0,
"react/no-unescaped-entities": 0,
"react/prop-types": 0,
"react/jsx-props-no-spreading": 0,
"react/jsx-fragments": 0,
"react/jsx-curly-brace-presence": 0,
"react/jsx-pascal-case": 0,
"react/jsx-filename-extension": [
1,
{
extensions: [`.js`, `.jsx`, `.tsx`],
},
],
"react-hooks/rules-of-hooks": `error`,
"react-hooks/exhaustive-deps": `warn`,
indent: [`error`, 2, { SwitchCase: 1 }],
"prettier/prettier": [
`error`,
{
trailingComma: `es5`,
semi: false,
singleQuote: false,
printWidth: 120,
},
],
"jsx-a11y/href-no-hash": `off`,
"jsx-a11y/anchor-is-valid": [
`warn`,
{
aspects: [`invalidHref`],
},
],
},
}
8 changes: 8 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These are supported funding model platforms

github: [LekoArts]
patreon: lekoarts
open_collective: # Replace with a single Open Collective username
ko_fi: lekoarts
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL
14 changes: 14 additions & 0 deletions .github/actions/publish-starter/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:12-slim

LABEL com.github.actions.name="Publish starter"
LABEL com.github.actions.description="Automatically push subdirectories in a monorepo to their own repositories"
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="purple"

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git && \
apt-get install -y jq

COPY "entrypoint.sh" "/entrypoint.sh"
ENTRYPOINT ["/entrypoint.sh"]
48 changes: 48 additions & 0 deletions .github/actions/publish-starter/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -e

FOLDER=$1
GITHUB_USERNAME=$2
STARTER_NAME="${3:-name}"
BRANCH_NAME="${4:-main}"
BASE=$(pwd)

git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_USERNAME"

echo "Cloning $FOLDER and pushing to $GITHUB_USERNAME"
echo "Using $STARTER_NAME as the package.json key"

cd $BASE

NAME=$(cat $FOLDER/package.json | jq --arg name "$STARTER_NAME" -r '.[$name]')
echo " Name: $NAME"
IS_WORKSPACE=$(cat $FOLDER/package.json | jq -r '.workspaces')
CLONE_DIR="__${NAME}__clone__"
echo " Clone dir: $CLONE_DIR"

# clone, delete files in the clone, and copy (new) files over
# this handles file deletions, additions, and changes seamlessly
git clone --depth 1 https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$NAME.git $CLONE_DIR &> /dev/null
cd $CLONE_DIR
find . | grep -v ".git" | grep -v "^\.*$" | xargs rm -rf # delete all files (to handle deletions in monorepo)
cp -r $BASE/$FOLDER/. .

# generate a new yarn.lock file based on package-lock.json unless you're in a workspace
if [ "$IS_WORKSPACE" = null ]; then
echo " Regenerating yarn.lock"
rm -rf yarn.lock
yarn
fi

# Commit if there is anything to
if [ -n "$(git status --porcelain)" ]; then
echo " Committing $NAME to $GITHUB_REPOSITORY"
git add .
git commit --message "Update $NAME from $GITHUB_REPOSITORY"
git push origin $BRANCH_NAME
echo " Completed $NAME"
else
echo " No changes, skipping $NAME"
fi
20 changes: 20 additions & 0 deletions .github/workflows/publish-starter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish Starter
on:
workflow_dispatch:
jobs:
publish-starter:
name: Publish Starter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Publish Starter
uses: ./.github/actions/publish-starter
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: example LekoArts starter-name main
15 changes: 15 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Testing
on: pull_request
jobs:
testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-12.x-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install
- name: Run Jest
run: yarn test:ci
Loading

0 comments on commit 811c1dc

Please sign in to comment.