Skip to content

Commit

Permalink
chore: remove yarn in favour of npm
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed May 7, 2021
1 parent 117c9ea commit 2fd8d6d
Show file tree
Hide file tree
Showing 12 changed files with 1,316 additions and 9,969 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ node_modules
tsc-out
external
*.
yarn-error.log
**/*.log
etc
temp
tsdoc-metadata.json
Expand Down
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint
yarn buildifier-check
yarn prettier-check
npm run lint
npm run bazel:lint
npm run prettier-check
13 changes: 5 additions & 8 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# Setting up the environment

## Setting up the environment

> NOTE: This repo is currently in the transition to the `bazel` build system. Only `bazel` developer information is documented here.
The repo uses `bazel` for building. Best way to run `bazel` is with [`bazelisk`](https://github.com/bazelbuild/bazelisk) which will automatically download and execute the right version of `bazel`.

_preferred way_
Expand All @@ -16,14 +20,7 @@ or
npm install -g @bazel/bazelisk
```

> NOTE: `Bazel` will invoke `npm install` so there is no need to do it manually.
1. `npm` (or `yarn`) to install NPM dependencies.
2. Recomended: alias `bazel` and `ibazel`
```
alias bazel=./node_modules/.bin/bazel
alias ibazel=./node_modules/.bin/ibazel
```
`Bazel` will invoke `NPM` and manage all dependencies.

## `bazel` vs `ibazel`

Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ http_archive(
# Check the rules_nodejs version and download npm dependencies
# Note: bazel (version 2 and after) will check the .bazelversion file so we don't need to
# assert on that.
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "yarn_install")
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "npm_install")

check_rules_nodejs_version(minimum_version_string = "2.2.0")

Expand All @@ -25,10 +25,10 @@ node_repositories(
package_json = ["//:package.json"],
)

yarn_install(
npm_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
package_lock_json = "//:package-lock.json",
)

load("@npm//@bazel/cypress:index.bzl", "cypress_repository")
Expand Down
2 changes: 1 addition & 1 deletion client/testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ts_project(
deps = [
"//client",
"@npm//@types/source-map-support",
"@npm//@types/jsdom",
"@npm//domino",
"@npm//source-map-support",
],
)
Expand Down
12 changes: 6 additions & 6 deletions client/testing/node_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { default as global } from '../util/global.js';
import { default as jsdom } from 'jsdom';
import domino from 'domino';
import srcMap from 'source-map-support';
srcMap.install();

Expand Down Expand Up @@ -37,9 +37,7 @@ export function createGlobal(baseUri: string) {
* Create emulated `Document` in node environment.
*/
export function createDocument(baseUri: string): Document {
const window = new jsdom.JSDOM('', {
url: baseUri,
}).window;
const document = domino.createDocument();
// TODO(misko): Needs test
const requestAnimationFrame: MockRequestAnimationFrame = function requestAnimationFrame(
callback: FrameRequestCallback
Expand All @@ -59,8 +57,10 @@ export function createDocument(baseUri: string): Document {
}
}
};
window.requestAnimationFrame = requestAnimationFrame;
return window.document;
const window = { requestAnimationFrame };
Object.defineProperty(document, 'baseURI', { value: baseUri });
Object.defineProperty(document, 'defaultView', { value: window });
return document;
}

class MockCustomEvent {
Expand Down
4 changes: 0 additions & 4 deletions cypress/integration/todo_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ describe('todo', () => {

it('should edit an item', function () {
cy.get('.todo-list>li:first-child').dblclick();
<<<<<<< HEAD
cy.wait(20);
=======
cy.wait(50);
>>>>>>> 650dd63 (revert: Revert jsdom due to performance regression.)
cy.get('.todo-list>li:first-child input.edit').type('123{enter}');
cy.get('.todo-list>li:first-child').should((item: any) =>
expect(item).to.have.text('Read Qoot docs123')
Expand Down
Loading

0 comments on commit 2fd8d6d

Please sign in to comment.