Skip to content

Commit

Permalink
Switch from Yarn to npm and update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep committed Jul 18, 2023
1 parent 63a97be commit 14b851a
Show file tree
Hide file tree
Showing 20 changed files with 2,738 additions and 1,460 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
*.tgz
*.vsix
/.cargo/
/packages/vscode/*.png
/packages/wasm/wbg/
/target/
bindings/
dist/
Expand Down
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{ "plugins": ["prettier-plugin-organize-imports"] }
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Make sure to have these tools installed:
- [Make][]
- [Rust][]
- [Node.js][] v16-v18
- [Yarn][] v1.x

## Setup

Expand Down Expand Up @@ -72,15 +71,15 @@ an Internet connection.
To develop the website locally:

```
make site-deps && yarn workspace @rose-lang/site dev
make site-deps && npm run --workspace=@rose-lang/site dev
```

Then open http://localhost:5173/ in your browser.

Or, if you want to host on your local network, e.g. to test on your phone:

```
make site-deps && yarn workspace @rose-lang/site dev --host
make site-deps && npm run --workspace=@rose-lang/site dev -- --host
```

Then open http://192.168.0.12:5173/ on your phone.
Expand All @@ -102,4 +101,3 @@ Code by right-clicking it and clicking the **Install Extension VSIX** button.
[make]: https://en.wikipedia.org/wiki/Make_(software)
[node.js]: https://nodejs.org/en/download
[rust]: https://www.rust-lang.org/tools/install
[yarn]: https://classic.yarnpkg.com/lang/en/docs/install
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ test-rust:
### JavaScript

# fetch JavaScript dependencies
yarn:
yarn
npm:
npm i

# check Prettier formatting
prettier: yarn
prettier: npm
npx prettier --check .

# build `packages/`
Expand All @@ -56,19 +56,19 @@ test-js: test-core
## `packages/core`

# build
core: yarn wasm
yarn workspace rose build
core: npm wasm
npm run --workspace=rose build

# test
test-core: yarn wasm
yarn workspace rose test run --no-threads
test-core: npm wasm
npm run --workspace=rose test -- run --no-threads

## `packages/site`

site-deps: yarn core
site-deps: npm core

site: site-deps
yarn workspace @rose-lang/site build
npm run --workspace=@rose-lang/site build

## `packages/vscode`

Expand All @@ -81,12 +81,12 @@ packages/vscode/plain-rose.png:
curl -O --output-dir packages/vscode https://github.com/rose-lang/rose-icons/raw/efcc218832d65970a47bed597ee11cecd3d1cc3c/png/plain-rose.png

# build
vscode: yarn packages/vscode/encircled-rose.png packages/vscode/plain-rose.png
yarn workspace rose-vscode build
vscode: npm packages/vscode/encircled-rose.png packages/vscode/plain-rose.png
npm run --workspace=rose-vscode build

## `packages/wasm`

# build
wasm: yarn bindings wbg
yarn workspace @rose-lang/wasm build
wasm: npm bindings wbg
npm run --workspace=@rose-lang/wasm build
node bindings.js
4 changes: 2 additions & 2 deletions bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for (const crate of crates) {

// Read all .ts files in the bindings directory
const files = (await fs.readdir(bindings_dir)).filter((f) =>
f.endsWith(".ts")
f.endsWith(".ts"),
);
for (const file of files) {
const tsfile = path.join(bindings_dir, file);
Expand All @@ -38,7 +38,7 @@ for (const crate of crates) {
// Write the updated content to the new location with .d.ts extension
await fs.writeFile(
path.join(dest_folder, `${base_name}.d.ts`),
prettier.format(updated_content, { parser: "typescript" })
await prettier.format(updated_content, { parser: "typescript" }),
);
}
}
Loading

0 comments on commit 14b851a

Please sign in to comment.