Skip to content

Added remark-cli and pnpm lock file resolution logic #48

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 8 additions & 11 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:

permissions:
contents: read
pull-requests: write
pull-requests: write

on:
push:
Expand All @@ -22,14 +22,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install pixi
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Either of them works, we can use any. Please let me know.

Copy link
Member

Choose a reason for hiding this comment

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

Let's use the action provided by the pixi devs. Fewer things for us to maintain later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good !

run: curl -fsSL https://pixi.sh/install.sh | bash

- name: remark-lint
uses: reviewdog/action-remark-lint@v5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
fail_level: "warning"
level: "warning"
remark_args: "--use=remark-preset-lint-recommended --use=remark-mdx"
- name: Set up pixi in $PATH
run: echo "$HOME/.pixi/bin" >> $GITHUB_PATH

- name: Run linting check
run: pixi run lint
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git-branch-lockfile=true
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,71 @@
# Research Technology Services @ NYU

## For development locally

Please make sure to install [`pixi shell`](https://pixi.sh/latest/#installation), to install on Linux/MacOS run:

```
curl -fsSL https://pixi.sh/install.sh | bash
```

Verify pixi installation by running:

```
pixi help
```

To Create a local pixi `shell` then to install `pnpm` and `nodejs` run:

```
pixi install
```

> You may check the `pixi.toml` file for information on pnpm version and pixi scripts.

Activate the `shell` by running:

```
pixi shell
```

Install `npm packages` using `pnpm` within this shell:

```
pnpm install
```

Build `docusaurus site` by running:

```
pnpm build
```

Serve the site with:

```
pnpm serve
```

To conduct a `linting` check with `remark-cli` run:

```
pnpm lint
```

To remove all node packages for downloading and building from scratch, exit pixi shell by running `exit`, then dry run `git clean`:

```
git clean -nXd
```

Check which files and directories will be removed, then to actually remove these files run:

```
git clean -fXd
```

Once done, you may begin from the start with `pixi install`.

## Deploy locally:
On Linux/Macos run:
```
Expand Down
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"typecheck": "tsc",
"lint": "remark --frail ."
},
"remarkConfig": {
"plugins": [
"remark-preset-lint-recommended",
"remark-mdx",
["remark-lint-list-item-indent", false]
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep remark-lint-list-item-indent. We've been following it for newer files lately and it's better to have one consistent standard on list item indentation than mix multiple styles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, We could configure remark to check for newly changed files only with our lint.yaml actions file.

Copy link
Contributor Author

@th-blitz th-blitz Feb 13, 2025

Choose a reason for hiding this comment

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

remark supports auto-formatting options as described here https://github.com/remarkjs/remark-lint?tab=readme-ov-file#example-check-and-format-markdown-on-the-cli

We can use --output option to automatically format markdown files based on indents and escape characters for uniformity like :

"format": "remark . --output --frail"

Running pnpm format will format all the markdown files for us.

]
},
"dependencies": {
"@docusaurus/core": "^3.7.0",
Expand All @@ -27,6 +35,11 @@
"@docusaurus/module-type-aliases": "^3.7.0",
"@docusaurus/tsconfig": "^3.7.0",
"@docusaurus/types": "^3.7.0",
"remark-cli": "^12.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@th-blitz th-blitz Feb 13, 2025

Choose a reason for hiding this comment

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

Yes. We can use --save-exact option with pnpm add as specified here https://pnpm.io/cli/add#--save-exact--e . For example remove :

pnpm remove remark-cli remark-mdx remark-preset-lint-recommended

and then re-add with --save-exact:

pnpm add --save-dev --save-exact remark-cli remark-mdx remark-preset-lint-recommended

This will add fixed packages to packages.json like :

  "devDependencies": {
    "@docusaurus/module-type-aliases": "^3.7.0",
    "@docusaurus/tsconfig": "^3.7.0",
    "@docusaurus/types": "^3.7.0",
    "remark-cli": "12.0.1",
    "remark-mdx": "3.1.0",
    "remark-preset-lint-recommended": "7.0.1",
    "typescript": "~5.7.3"
  },

"remark-lint-list-item-indent": "^4.0.1",
"remark-mdx": "^3.1.0",
"remark-preset-lint-consistent": "^6.0.1",
"remark-preset-lint-recommended": "^7.0.1",
"typescript": "~5.7.3"
},
"browserslist": {
Expand Down
1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version = "0.1.0"
install = { cmd = ["pnpm", "install"] }
build = { cmd = ["pnpm", "build"], depends-on = ["install"] }
serve = { cmd = ["pnpm", "serve"], depends-on = ["build"] }
lint = { cmd = ["pnpm", "lint"], depends-on = ["install"] }

[dependencies]
nodejs = ">=22.12.0,<22.14"
Expand Down
Loading