Skip to content

Commit

Permalink
ci: add formatting job (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Nov 28, 2023
1 parent 5354ad0 commit 0595e35
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 121 deletions.
4 changes: 1 addition & 3 deletions .config/tsconfig.base.json
@@ -1,7 +1,5 @@
{
"exclude": [
"../node_modules"
],
"exclude": ["../node_modules"],
"compilerOptions": {
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Expand Up @@ -21,14 +21,14 @@ body:
attributes:
label: Version
description: What version of `@react-native-async-storage/async-storage` are you using?
placeholder: 'Example: 1.15.9'
placeholder: "Example: 1.15.9"
validations:
required: true
- type: checkboxes
id: platforms
attributes:
label: What platforms are you seeing this issue on?
description: 'Select all that apply:'
description: "Select all that apply:"
options:
- label: Android
- label: iOS
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -5,6 +5,23 @@ on:
- main
pull_request:
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
- name: Install JS dependencies
run: yarn
- name: Format
run: |
yarn format
git diff --exit-code
review:
name: Review
runs-on: ubuntu-latest
Expand Down Expand Up @@ -150,7 +167,7 @@ jobs:

release:
name: Release
needs: [review, android, ios, macos, windows]
needs: [format, review, android, ios, macos, windows]
if: github.event_name == 'push'
runs-on: ubuntu-22.04
steps:
Expand All @@ -170,7 +187,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
GIT_AUTHOR_NAME : ${{ secrets.GH_BOT_NAME }}
GIT_AUTHOR_NAME: ${{ secrets.GH_BOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GH_BOT_NAME }}
NPM_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/stale.yml
@@ -1,7 +1,7 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: '30 1 * * *'
- cron: "30 1 * * *"
jobs:
stale:
runs-on: ubuntu-latest
Expand All @@ -12,7 +12,7 @@ jobs:
- uses: actions/stale@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.'
stale-pr-message: 'This PR has been marked as stale due to inactivity. Please address any comments within 7 days or it will be closed.'
exempt-issue-labels: 'help wanted :octocat:'
exempt-pr-labels: 'WIP'
stale-issue-message: "This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed."
stale-pr-message: "This PR has been marked as stale due to inactivity. Please address any comments within 7 days or it will be closed."
exempt-issue-labels: "help wanted :octocat:"
exempt-pr-labels: "WIP"
2 changes: 1 addition & 1 deletion .github/workflows/website-deployment.yml
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths:
- 'packages/website/**'
- "packages/website/**"

jobs:
deploy:
Expand Down
6 changes: 6 additions & 0 deletions package.json
Expand Up @@ -5,7 +5,13 @@
"packages/*"
],
"packageManager": "yarn@3.4.1",
"scripts": {
"format": "concurrently 'yarn:format:*'",
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm') --style file:.config/.clang-format",
"format:js": "prettier --write --loglevel error $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')"
},
"devDependencies": {
"concurrently": "^8.2.2",
"eslint": "^8.54.0",
"prettier": "^2.8.8",
"typescript": "^5.3.0"
Expand Down
4 changes: 3 additions & 1 deletion packages/api/example/ExampleStorage.ts
Expand Up @@ -8,7 +8,9 @@ type MyModel = StorageModel<{
likes: boolean[];
}>;

export class ExampleStorage implements AsyncStorage<MyModel, MyExampleExtension> {
export class ExampleStorage
implements AsyncStorage<MyModel, MyExampleExtension>
{
private storage: MyModel = {
age: null,
name: null,
Expand Down
4 changes: 2 additions & 2 deletions packages/api/jest.config.js
@@ -1,5 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
preset: "ts-jest",
testEnvironment: "node",
};
5 changes: 1 addition & 4 deletions packages/default-storage/package.json
Expand Up @@ -38,9 +38,6 @@
"directory": "packages/default-storage-backend"
},
"scripts": {
"format": "concurrently 'yarn:format:*'",
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm') --style file:../../.config/.clang-format",
"format:js": "prettier --write $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')",
"prepare": "bob build",
"start": "react-native start",
"start:android": "react-native run-android",
Expand Down Expand Up @@ -86,7 +83,7 @@
"appium": "2.2.2",
"appium-uiautomator2-driver": "^2.34.1",
"appium-xcuitest-driver": "^5.9.1",
"concurrently": "^6.4.0",
"concurrently": "^8.2.2",
"eslint": "^8.54.0",
"expo": "^48.0.0",
"lodash": "^4.17.21",
Expand Down
72 changes: 36 additions & 36 deletions packages/website/docusaurus.config.js
@@ -1,68 +1,68 @@
module.exports = {
title: 'Async Storage',
tagline: 'Data storage system for React Native.',
url: 'https://react-native-async-storage.github.io',
baseUrl: '/async-storage/',
favicon: 'img/favicon.ico',
organizationName: 'react-native-async-storage',
projectName: 'async-storage',
title: "Async Storage",
tagline: "Data storage system for React Native.",
url: "https://react-native-async-storage.github.io",
baseUrl: "/async-storage/",
favicon: "img/favicon.ico",
organizationName: "react-native-async-storage",
projectName: "async-storage",
themeConfig: {
prism: {
theme: require('prism-react-renderer/themes/vsDark'),
darkTheme: require('prism-react-renderer/themes/vsDark'),
lightTheme: require('prism-react-renderer/themes/vsLight'),
theme: require("prism-react-renderer/themes/vsDark"),
darkTheme: require("prism-react-renderer/themes/vsDark"),
lightTheme: require("prism-react-renderer/themes/vsLight"),
},
navbar: {
title: 'Async Storage',
title: "Async Storage",
logo: {
alt: 'Async Storage Logo',
src: 'img/logo.svg',
alt: "Async Storage Logo",
src: "img/logo.svg",
},
items: [
{
label: 'Docs',
to: 'docs/install',
activeBasePath: '/docs',
position: 'right',
label: "Docs",
to: "docs/install",
activeBasePath: "/docs",
position: "right",
},
{
href: 'https://github.com/react-native-async-storage/async-storage',
label: 'GitHub',
position: 'right',
href: "https://github.com/react-native-async-storage/async-storage",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: 'dark',
style: "dark",
links: [
{
title: 'Documentation',
title: "Documentation",
items: [
{
label: 'Installation',
to: 'docs/install',
label: "Installation",
to: "docs/install",
},
{
label: 'API reference',
to: 'docs/api',
label: "API reference",
to: "docs/api",
},
],
},
{
title: 'Community',
title: "Community",
items: [
{
label: 'Discord',
href: 'https://discord.gg/PycDts2',
label: "Discord",
href: "https://discord.gg/PycDts2",
},
],
},
{
title: 'More',
title: "More",
items: [
{
label: 'GitHub',
href: 'https://github.com/react-native-async-storage/async-storage',
label: "GitHub",
href: "https://github.com/react-native-async-storage/async-storage",
},
],
},
Expand All @@ -72,15 +72,15 @@ module.exports = {
},
presets: [
[
'@docusaurus/preset-classic',
"@docusaurus/preset-classic",
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarPath: require.resolve("./sidebars.js"),
editUrl:
'https://github.com/react-native-async-storage/async-storage/edit/main/website/',
"https://github.com/react-native-async-storage/async-storage/edit/main/website/",
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
customCss: require.resolve("./src/css/custom.css"),
},
},
],
Expand Down
16 changes: 12 additions & 4 deletions packages/website/sidebars.js
@@ -1,8 +1,16 @@
module.exports = {
docs: {
'Getting started': ['install', 'usage', 'api', 'limits'],
Advanced: ['advanced/next', 'advanced/jest', 'advanced/brownfield', 'advanced/backup', 'advanced/executor', 'advanced/db_size','advanced/where_data_stored'],
Debugging: ['debugging/communityPackages'],
Help: ['help/troubleshooting'],
"Getting started": ["install", "usage", "api", "limits"],
Advanced: [
"advanced/next",
"advanced/jest",
"advanced/brownfield",
"advanced/backup",
"advanced/executor",
"advanced/db_size",
"advanced/where_data_stored",
],
Debugging: ["debugging/communityPackages"],
Help: ["help/troubleshooting"],
},
};
2 changes: 1 addition & 1 deletion packages/website/src/components/Platform.js
Expand Up @@ -6,7 +6,7 @@ const PlatformSupport = ({ platformIcon, title }) => (
display: "flex",
margin: "10px 20px",
alignItems: "center",
flexDirection: "row"
flexDirection: "row",
}}
>
<img
Expand Down

0 comments on commit 0595e35

Please sign in to comment.