Skip to content
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

chore(infra): only lint staged files #153

Merged
merged 6 commits into from
Apr 28, 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
70 changes: 35 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: build

on:
schedule:
- cron: "50 3 * * *" # runs every day at 03:50 UTC to avoid high loads
push:
branches: [main]
workflow_dispatch:
schedule:
- cron: "50 3 * * *" # runs every day at 03:50 UTC to avoid high loads
push:
branches: [main]
workflow_dispatch:

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js LTS (16.x)
uses: actions/setup-node@v2
with:
node-version: "16"
- name: install yarn
run: |
npm install yarn --global
- name: yarn
run: |
yarn
- name: crawl data
run: |
yarn workspace crawler fetch
- run: |
yarn workspace ui build
- name: Commit/Push build to docs branch
run: |
git config --global user.name 'marianfoo'
git config --global user.email '[email protected]'
git add docs -f
git add packages/ui/src/model/data.json
git add packages/ui/src/model/versions.json
git commit -m "chore: build"
git push origin HEAD:docs --force
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js LTS (16.x)
uses: actions/setup-node@v2
with:
node-version: "16"
- name: install yarn
run: |
npm install yarn --global
- name: yarn
run: |
yarn
- name: crawl data
run: |
yarn workspace crawler build
- run: |
yarn workspace ui build
- name: Commit/Push build to docs branch
run: |
git config --global user.name 'marianfoo'
git config --global user.email '[email protected]'
git add docs -f
git add packages/ui/src/model/data.json
git add packages/ui/src/model/versions.json
git commit -m "chore: build"
git push origin HEAD:docs --force
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/
webapp
dist
docs

# Logs
logs
*.log
Expand Down
16 changes: 11 additions & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
build
docs
*.html
*.properties
packages/ui/src/resources/font-awesome
# Ignore specific files
_config.yml

# Ignore files by extension
/**/*.md
/**/*.svg

# Ignore folders
/docs/**
/packages/ui/src/font-awesome/**
/packages/ui/webapp/**
17 changes: 0 additions & 17 deletions .prettierrc

This file was deleted.

25 changes: 25 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"singleQuote": false,
"printWidth": 200,
"endOfLine": "lf",
"tabWidth": 4,
"useTabs": true,
"overrides": [
{
"files": ["*.yaml", "*.yml", "*.md", "*.json", "*.xml"],
"options": {
"useTabs": false,
"tabWidth": 2,
"xmlWhitespaceSensitivity": "ignore"
}
},
{
"files": ["*.properties"],
"options": {
"useTabs": false,
"tabWidth": 2,
"keySeparator": "="
}
}
]
}
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ui5community.github.io",
"name": "bestofui5-website",
"version": "0.15.0",
"description": "ui5community.github.io mono repo",
"description": "bestofui5-website monorepo",
"private": true,
"author": "Marian Zeis",
"license": "Apache-2.0",
Expand All @@ -12,20 +12,17 @@
"scripts": {
"prepare": "husky install",
"clean": "rm -rf docs",
"build": "npm-run-all --sequential build:ui build:data",
"build:data": "yarn workspace crawler fetch",
"build:ui": "yarn workspace ui build",
"build": "yarn workspaces run build",
"start": "yarn workspace ui start",
"start:dist": "yarn workspace ui start:dist",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"prettier": "npm-run-all --sequential prettier:ui prettier:crawler",
"prettier:crawler": "yarn workspace crawler prettier",
"prettier:ui": "yarn workspace ui prettier",
"lint:commit": "commitlint -e",
"lint:crawler": "yarn workspace crawler lint",
"lint:ui": "yarn workspace ui lint",
"hooks:pre-commit": "pretty-quick --staged",
"hooks:pre-push": "npm-run-all --sequential lint:ui lint:crawler lint:commit"
"lint": "yarn workspaces run lint",
"lint:staged": "yarn workspaces run lint:staged",
"prettier": "prettier --write .",
"prettier:staged": "pretty-quick --staged --verbose",
"hooks:pre-commit": "npm-run-all --sequential prettier:staged lint:staged",
"hooks:pre-push": "npm-run-all --sequential lint:commit"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will run pretty-quick --staged for all workspaces
it seems this is not divided by workspace and will just prettier all files, not just for ui/crawler
so the command with the same result is then executed twice here
the previous command was already ok
image

},
"devDependencies": {
"@commitlint/cli": "^16.2.3",
Expand All @@ -36,6 +33,7 @@
"husky": "^7.0.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"prettier-plugin-properties": "^0.1.0",
"pretty-quick": "^3.1.3"
},
"config": {
Expand Down
3 changes: 3 additions & 0 deletions packages/crawler/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"src/**/*": "eslint"
}
Empty file removed packages/crawler/.prettierignore
Empty file.
16 changes: 10 additions & 6 deletions packages/crawler/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
{
"name": "crawler",
"version": "0.0.1",
"description": "POC",
"description": "GitHub Crawler: bestofui5-website",
"private": "true",
"scripts": {
"fetch": "ts-node src/index.ts",
"build": "ts-node src/index.ts",
"watch": "tsc -w",
"compile": "tsc",
"lint": "eslint src",
"prettier": "prettier --write src"
"lint:staged": "lint-staged"
},
"author": "Marian Zeis",
"license": "Apache-2.0",
"devDependencies": {
"@prettier/plugin-xml": "^2.0.1",
"@types/glob": "^7.2.0",
"@types/js-yaml": "^4.0.5",
"@types/jsdoc-to-markdown": "^7.0.3",
"@types/node": "^17.0.25",
"prettier": "2.6.2",
"eslint": "^8.13.0",
"lint-staged": "^12.4.0",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"ts-node": "^10.7.0",
"tsc": "^2.0.4",
"typescript": "^4.6.3"
Expand All @@ -25,10 +31,8 @@
"@octokit/core": "^3.6.0",
"@octokit/plugin-throttling": "^3.6.2",
"@octokit/rest": "^18.12.0",
"@types/jsdoc-to-markdown": "^7.0.3",
"axios": "^0.26.1",
"dotenv": "^16.0.0",
"@types/js-yaml": "^4.0.5",
"js-yaml": "^4.1.0",
"jsdoc-to-markdown": "^7.1.1"
}
Expand Down
2 changes: 2 additions & 0 deletions packages/crawler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import GitHubRepositoriesProvider from "./gh-repos";
import NPMProvider from "./npm";
import { IPackage, Source, Tags, DataJson } from "./types";

// TEST

(async () => {
const dataJson: DataJson = {
packages: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"project": ["./tsconfig.json", "./packages/ui/tsconfig.json"],
"sourceType": "module"
},
"ignorePatterns": ["src/font-awesome/*.js"],
"ignorePatterns": ["*.xml", "*.properties", "src/font-awesome/**"],
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-unsafe-assignment": "warn",
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"src/**/*": "eslint"
}
4 changes: 0 additions & 4 deletions packages/ui/.prettierignore

This file was deleted.

13 changes: 7 additions & 6 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ui",
"version": "1.0.0",
"description": "UI5 Application: ui5community.github.io",
"description": "UI5 Application: bestofui5-website",
"private": "true",
"author": "Marian Zeis",
"license": "Apache-2.0",
Expand All @@ -18,22 +18,23 @@
"start:dist": "ui5 serve --port 8080 -o index.html --config ui5-dist.yaml",
"ts-typecheck": "tsc --noEmit",
"lint": "eslint src",
"prettier": "prettier --write src"
"lint:staged": "lint-staged"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.9",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@openui5/ts-types-esm": "1.101.0",
"@types/jquery": "3.5.14",
"@types/chart.js": "2.9.36",
"@types/jquery": "3.5.14",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@ui5/cli": "^2.14.8",
"@ui5/ts-interface-generator": "^0.4.2",
"babel-preset-transform-ui5": "^7.0.5",
"eslint": "^8.13.0",
"lint-staged": "^12.4.0",
"npm-run-all": "^4.1.5",
"typescript": "^4.6.3",
"ui5-middleware-livereload": "^0.5.11"
Expand All @@ -46,9 +47,9 @@
]
},
"dependencies": {
"ui5-tooling-modules": "^0.3.0",
"chart.js": "^3.7.1",
"ui5-cc-md": "^0.0.6",
"xml-formatter": "^2.6.1",
"chart.js": "^3.7.1"
"ui5-tooling-modules": "^0.3.0",
"xml-formatter": "^2.6.1"
}
}
2 changes: 2 additions & 0 deletions packages/ui/src/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import "sap/ui/core/ComponentSupport";
import "sap/ui/core/date/Gregorian";
import "sap/ui/model/type/Date";

// TEST

/**
* @namespace org.openui5.bestofui5
*/
Expand Down
36 changes: 18 additions & 18 deletions packages/ui/src/control/PackageListItemContent.control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@
renderMode="Narrow"
colorScheme="6"
displayOnly="false"
text="{= ${i18n>listItemTagUpdated}.replace('{0}', ${
text="{= ${i18n>list_item_tag_updated}.replace('{0}', ${
path: '$this>updatedAt',
type: 'sap.ui.model.type.Date',
formatOptions: {
source : {
pattern: 'yyyy-MM-ddTHH:mm:ss.SSSZ'
type: 'sap.ui.model.type.Date',
formatOptions: {
source : {
pattern: 'yyyy-MM-ddTHH:mm:ss.SSSZ'
},
relative: true,
relativeScale: 'auto',
relativeStyle: 'wide'
}
}
}) }"
visible="{= !!${$this>updatedAt} }"
/>
Expand All @@ -93,17 +93,17 @@
renderMode="Narrow"
colorScheme="6"
displayOnly="false"
text="{= ${i18n>addedToBestOfUI5}.replace('{0}', ${
text="{= ${i18n>added_to_best_of_ui5}.replace('{0}', ${
path: '$this>addedToBoUI5',
type: 'sap.ui.model.type.Date',
formatOptions: {
source : {
pattern: 'yyyy-MM-ddTHH:mm:ss.SSSZ'
type: 'sap.ui.model.type.Date',
formatOptions: {
source : {
pattern: 'yyyy-MM-ddTHH:mm:ss.SSSZ'
},
relative: true,
relativeScale: 'auto',
relativeStyle: 'wide'
}
}
}) }"
visible="{= !!${$this>addedToBoUI5} }"
/>
Expand All @@ -114,17 +114,17 @@
renderMode="Narrow"
colorScheme="6"
displayOnly="false"
text="{= ${i18n>listItemTagCreated}.replace('{0}', ${
text="{= ${i18n>list_item_tag_created}.replace('{0}', ${
path: '$this>createdAt',
type:'sap.ui.model.type.Date',
formatOptions: {
source : {
pattern: 'yyyy-MM-ddTHH:mm:ss X'
type:'sap.ui.model.type.Date',
formatOptions: {
source : {
pattern: 'yyyy-MM-ddTHH:mm:ss X'
},
relative: true,
relativeScale: 'auto',
relativeStyle: 'wide'
}
}
}) }"
visible="{= !!${$this>createdAt} }"
/>
Expand Down
Loading