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

style: add linting and formatting #50

Merged
merged 7 commits into from
Dec 27, 2024
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_style = space
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Validate commit messages - last push commit
if: github.event_name == 'push'
run: npx commitlint --last --verbose
- name: Validate commit messages - PR's commits
if: github.event_name == 'pull_request'
run: npx commitlint --from "${{ github.event.pull_request.base.sha }}" --to "${{ github.event.pull_request.head.sha }}" --verbose
- name: Run code checks
run: npm run check
- name: Build
shell: bash
run: |
Expand Down
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,mjs,ts}": "npm run lint:open",
"*": "npm run format:open"
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock.json
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"useTabs": true
}
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
![Penpot Desktop](https://europe1.discourse-cdn.com/standard20/uploads/penpot/original/2X/b/bc6c290e4566bc12f8afa162bae80ffb20a7c7f5.jpeg)

# Penpot Desktop

Penpot Desktop is an unofficial desktop application for the open-source design tool, Penpot.

It delivers a desktop-like experience for Penpot users with the addition of integrated tabs to conveniently traverse back and forth between projects. Offline support is available through the "select your own instance" option, and theme settings can be applied to either the entire desktop app or just the Penpot dashboard.

## Quick Links

- [Penpot](https://penpot.app/) - The official website for Penpot.
- [Documentation](https://github.com/author-more/penpot-desktop/wiki) - The Penpot Desktop knowledge base
- [Installation instruction](https://github.com/author-more/penpot-desktop/wiki/Installation)
Expand All @@ -14,19 +16,20 @@ It delivers a desktop-like experience for Penpot users with the addition of inte
## Development and Building

1. Ensure the environment meets the following requirements:
- Supported OS:
- Windows 10 or newer
- macOS
- Linux
- [NodeJS](https://nodejs.org/) v20
- [Python](https://www.python.org/)
- [Git](https://git-scm.com/) (optional)
- Supported OS:
- Windows 10 or newer
- macOS
- Linux
- [NodeJS](https://nodejs.org/) v20
- [Python](https://www.python.org/)
- [Git](https://git-scm.com/) (optional)
1. Clone the repository or download the source code.
1. Navigate to the project's directory.
1. Run `npm ci` to install packages.
*Other package managers such as Yarn, PNPM, or Bun should work as well.*
1. Run `npm ci` to install packages.
_Other package managers such as Yarn, PNPM, or Bun should work as well._
1. (Optional) Run `npm run setup` to prepare development environment.
1. (Optional) Run `npm run dev` to start the application in development mode. This will open a new window with the application running.

> Note: Penpot Desktop is using ES Modules. Make sure to read the [ES Modules (ESM) in Electron guide](https://www.electronjs.org/docs/latest/tutorial/esm).

1. Run `npm run build` to build the application. By default, it will build for the current OS and architecture, but you can pass flags to build for other platforms. See the [Electron Builder documentation](https://www.electron.build/cli) for more information.
> Note: Penpot Desktop is using ES Modules. Make sure to read the [ES Modules (ESM) in Electron guide](https://www.electronjs.org/docs/latest/tutorial/esm).

1. Run `npm run build` to build the application. By default, it will build for the current OS and architecture, but you can pass flags to build for other platforms. See the [Electron Builder documentation](https://www.electron.build/cli) for more information.
6 changes: 6 additions & 0 deletions bin/setupGitHooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

HOOKS_PATH="./githooks"

echo "Set local hooks path to $HOOKS_PATH"
git config --local core.hooksPath $HOOKS_PATH
3 changes: 1 addition & 2 deletions build/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ linux:
# - pacman # For Arch
- AppImage # Universal
# - snap # Snapcraft Store - Can't build arm version on amd64 machines(comment Snap out if you plan to)

# snap:
# allowNativeWayland: true
# confinement: "strict"
# confinement: "strict"
6 changes: 3 additions & 3 deletions build/flatpak/com.authormore.penpotdesktop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
app-id: com.authormore.penpotdesktop
runtime: org.freedesktop.Platform
runtime-version: '24.08'
runtime-version: "24.08"
sdk: org.freedesktop.Sdk
base: org.electronjs.Electron2.BaseApp
base-version: '24.08'
base-version: "24.08"
sdk-extensions:
- org.freedesktop.Sdk.Extension.node20
command: run.sh
Expand Down Expand Up @@ -32,7 +32,7 @@ modules:
env:
XDG_CACHE_HOME: /run/build/penpot-desktop/flatpak-node/cache
npm_config_cache: /run/build/penpot-desktop/flatpak-node/npm-cache
npm_config_offline: 'true'
npm_config_offline: "true"
subdir: main
build-commands:
# Install npm dependencies
Expand Down
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ["@commitlint/config-conventional"] };
28 changes: 28 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{
files: ["src/base/**/*.{js,mjs,cjs,ts}"],
languageOptions: { globals: globals.browser },
},
{
files: ["src/process/**/*.{js,mjs,cjs,ts}"],
languageOptions: { globals: globals.node },
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
caughtErrors: "none",
},
],
},
},
];
3 changes: 3 additions & 0 deletions githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx --no -- commitlint --edit
3 changes: 3 additions & 0 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx --no -- lint-staged
Loading
Loading