Skip to content

Commit

Permalink
[prettier] Links prettier-plugin-move to pnpm workspace (#20345)
Browse files Browse the repository at this point in the history
## Description 

- adds `@mysten/prettier-plugin-move` to pnpm workspace
- resets versioning for publishing, starting with 0.1.0
- changeset

## Test plan 

- CIs must pass

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
damirka authored Nov 20, 2024
1 parent 6460e45 commit 9521492
Show file tree
Hide file tree
Showing 9 changed files with 551 additions and 131 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-stingrays-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/prettier-plugin-move': minor
---

Initial version of the prettier-plugin-move
2 changes: 1 addition & 1 deletion external-crates/move/tooling/prettier-move/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
tests
.vscode
scripts
14 changes: 14 additions & 0 deletions external-crates/move/tooling/prettier-move/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

If you decide to contribute to this project, please choose the scope of your contribution (e.g.,
implement formatting for structs) and file an issue in the Sui
[repository](https://github.com/MystenLabs/sui) describing the work you plan to do, and wait for a
response from a core team member so that we can avoid duplication of efforts.

Please make sure that the code you add is well documented and that you add relevant tests - please
use existing code as guidance.

## Changeset

Make sure to run `pnpm changeset` with appropriate version for the changes made. Commit the change,
so that it is picked up by CI.
24 changes: 4 additions & 20 deletions external-crates/move/tooling/prettier-move/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,18 @@ certain changes to the parser may break the plugin (e.g., if parse tree node typ

## Prerequisites

Currently, in order to use the plugin, you need to install `npm` command (`brew install npm` on a
In order to use the plugin, you need to install `npm` command (`brew install npm` on a
Mac). You can use the plugin to format Move files (`.move` extension) both on the command line and
using Prettier's VSCode
[extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode). When the
plugin is complete, we will make it available directly from Move's VSCode extension.

## Installation

Currently, you need to install plugin from sources (when the plugin is complete, we will submit it
to the NPM package [registry](https://www.npmjs.com/) for direct download).
The plugin can be installed via npm:

Clone Sui repository into `$SUI` directory:

```bash
git clone https://github.com/MystenLabs/sui.git "$SUI"
```

Go to `"$SUI"/external-crates/move/crates/move-analyzer/prettier-plugin` and run the following
command:

```bash
npm run build
npm i @mysten/prettier-plugin-move
```

## Usage
Expand Down Expand Up @@ -79,10 +69,4 @@ be able to format them by choosing `Format Code` command from VSCode's command p

## Contribute

If you decide to contribute to this project, please choose the scope of your contribution (e.g.,
implement formatting for structs) and file an issue in the Sui
[repository](https://github.com/MystenLabs/sui) describing the work you plan to do, and wait for a
response from a core team member so that we can avoid duplication of efforts.

Please make sure that the code you add is well documented and that you add relevant tests - please
use existing code as guidance.
See [CONTRIBUTING](./CONTRIBUTING.md).
52 changes: 26 additions & 26 deletions external-crates/move/tooling/prettier-move/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "prettier-plugin-move",
"version": "0.0.55",
"license": "Apache-2.0",
"keywords": [
"prettier",
"move",
"plugin"
],
"main": "./out/index.js",
"scripts": {
"build": "tsc -p .",
"watch": "tsc -p . -w",
"test": "npm run build && vitest run",
"prettier": "npm run build && prettier --plugin out/index.js"
},
"dependencies": {
"prettier": "^3.3.3",
"web-tree-sitter": "^0.20.8"
},
"devDependencies": {
"@types/diff": "^5.2.1",
"@types/node": "^20.10.6",
"diff": "^5.2.0",
"typescript": "^5.5.4",
"vitest": "^1.6.0"
}
"name": "@mysten/prettier-plugin-move",
"version": "0.0.0",
"license": "Apache-2.0",
"keywords": [
"prettier",
"move",
"plugin"
],
"main": "./out/index.js",
"scripts": {
"build": "tsc -p .",
"watch": "tsc -p . -w",
"test": "npm run build && vitest run",
"prettier": "npm run build && prettier --plugin out/index.js"
},
"dependencies": {
"prettier": "^3.3.2",
"web-tree-sitter": "^0.20.8"
},
"devDependencies": {
"@types/diff": "^5.2.1",
"@types/node": "^20.14.10",
"diff": "^5.2.0",
"typescript": "^5.5.3",
"vitest": "^2.0.1"
}
}
53 changes: 24 additions & 29 deletions external-crates/move/tooling/prettier-move/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
{
"compilerOptions": {
"module": "CommonJS",
"target": "es2021",
"outDir": "out",
"lib": ["es2021"],
"sourceMap": true,
"rootDir": "src",
"newLine": "LF",
"strict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
},
"exclude": [
"node_modules",
"out"
],
"include": [
"src"
]
"compilerOptions": {
"module": "CommonJS",
"target": "es2021",
"outDir": "out",
"lib": ["es2021"],
"sourceMap": true,
"rootDir": "src",
"newLine": "LF",
"strict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": false,
"noUnusedParameters": false
},
"exclude": ["node_modules", "out"],
"include": ["src"]
}
Loading

0 comments on commit 9521492

Please sign in to comment.