Skip to content

Commit

Permalink
Removed yarn from the code (#299)
Browse files Browse the repository at this point in the history
* Removed yarn from the code

* Convert to es6
  • Loading branch information
HarelM authored Sep 3, 2021
1 parent 8141e0b commit cdd4471
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 137 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
name: dist
path: before
repo: maplibre/maplibre-gl-js
- run: yarn source-map-explorer before/maplibre-gl.js --gzip --json before.json
- run: yarn source-map-explorer after/maplibre-gl.js --gzip --json after.json
- run: npx source-map-explorer before/maplibre-gl.js --gzip --json before.json
- run: npx source-map-explorer after/maplibre-gl.js --gzip --json after.json
- name: Build bundle size report
run: node build/check-bundle-size.js > comment-body.txt
- name: Dump bundle size report
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,8 @@ jobs:
run: |
rm -f ${{ steps.prepare_release.outputs.release_notes }}
- name: Update NPM Package Version
run: |
yarn version --non-interactive --no-git-tag-version --new-version ${{ steps.prepare_release.outputs.version }}
- name: Publish NPM package
run: |
yarn publish --non-interactive
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
24 changes: 7 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ Install [node.js](https://nodejs.org/) version ^10.15 ( Minimum 10.15 while stic
```bash
brew install node
```
Install [yarn](https://yarnpkg.com/en/)
```bash
brew install yarn
```

Clone the repository
```bash
Expand All @@ -30,7 +26,7 @@ git clone [email protected]:maplibre/maplibre-gl-js.git
Install node module dependencies
```bash
cd maplibre-gl-js &&
yarn install
npm install
```

### Linux
Expand All @@ -51,12 +47,6 @@ Install [Node.js](https://nodejs.org/) ^10.15
nvm install 10.24.1 # latest v10 version that will run the test suite
```

Install [yarn](https://yarnpkg.com/en/docs/install#linux-tab)
```bash
curl -o- -L https://yarnpkg.com/install.sh | bash
```
(It is also possible to install yarn from Debian/Ubuntu packages. See [yarn's install instructions](https://yarnpkg.com/en/docs/install#linux-tab)).

Clone the repository
```bash
git clone [email protected]:maplibre/maplibre-gl-js.git
Expand All @@ -65,12 +55,12 @@ git clone [email protected]:maplibre/maplibre-gl-js.git
Install node module dependencies
```bash
cd maplibre-gl-js &&
yarn install
npm install
```

### Windows

Install [git](https://git-scm.com/), [node.js](https://nodejs.org/) (version ^10.15), [yarn](https://yarnpkg.com/en/docs/install#windows-tab), [npm and node-gyp](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules).
Install [git](https://git-scm.com/), [node.js](https://nodejs.org/) (version ^10.15), [npm and node-gyp](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules).

Clone the repository
```bash
Expand All @@ -81,7 +71,7 @@ git clone [email protected]:maplibre/maplibre-gl-js.git
Install node module dependencies
```bash
cd maplibre-gl-js
yarn install
npm install
```

Install headless-gl dependencies https://github.com/stackgl/headless-gl#windows
Expand All @@ -94,7 +84,7 @@ copy node_modules/headless-gl/deps/windows/dll/x64/*.dll c:\windows\system32
Start the debug server

```bash
MAPBOX_ACCESS_TOKEN={YOUR MAPBOX ACCESS TOKEN} yarn run start-debug
MAPBOX_ACCESS_TOKEN={YOUR MAPBOX ACCESS TOKEN} npm run start-debug
```

Open the debug page at [http://localhost:9966/debug](http://localhost:9966/debug)
Expand All @@ -105,8 +95,8 @@ A standalone build allows you to turn the contents of this repository into `mapb

To create a standalone build, run
```bash
yarn run build-prod-min
yarn run build-css
npm run build-prod-min
npm run build-css
```

Once those commands finish, you will have a standalone build at `dist/mapbox-gl.js` and `dist/mapbox-gl.css`
Expand Down
8 changes: 3 additions & 5 deletions build/check-bundle-size.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env node

/* eslint-disable */

const fs = require("fs");
const zlib = require("zlib");
const prettyBytes = require("pretty-bytes");
import fs from "fs";
import zlib from "zlib";
import prettyBytes from "pretty-bytes";
const beforeSourcemap = JSON.parse(fs.readFileSync('./before.json').toString());
const afterSourcemap = JSON.parse(fs.readFileSync('./after.json').toString());

Expand Down
2 changes: 1 addition & 1 deletion build/generate-struct-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ createStructArrayLayoutType(createLayout([{
const layouts = Object.keys(layoutCache).map(k => layoutCache[k]);

fs.writeFileSync('src/data/array_types.js',
`// This file is generated. Edit build/generate-struct-arrays.js, then run \`yarn run codegen\`.
`// This file is generated. Edit build/generate-struct-arrays.js, then run \`npm run codegen\`.
// @flow
import assert from 'assert';
Expand Down
37 changes: 0 additions & 37 deletions build/maplibre-gl-js.dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions build/maplibre-gl.js.flow

This file was deleted.

50 changes: 0 additions & 50 deletions build/publish-release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This folder contains developer documentation for MapLibre GL. Put any diagrams you reference in the [diagrams](./diagrams) folder. If you use PlantUML, put the source code in `diagrams/*.plantuml` files and run `yarn build-diagrams` to generate SVG versions of them. There is also a [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml) for previewing them while you edit.
This folder contains developer documentation for MapLibre GL. Put any diagrams you reference in the [diagrams](./diagrams) folder. If you use PlantUML, put the source code in `diagrams/*.plantuml` files and run `npm run build-diagrams` to generate SVG versions of them. There is also a [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml) for previewing them while you edit.
2 changes: 1 addition & 1 deletion src/style/style_layer/layer_properties.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const layoutProperties = locals.layoutProperties;
const paintProperties = locals.paintProperties;
-%>
// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.
// This file is generated. Edit build/generate-style-code.js, then run `npm run codegen`.
// @flow
/* eslint-disable */

Expand Down
8 changes: 4 additions & 4 deletions test/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ To run Webdriver, you'll have to install the driver for every browser you want t

## Running

- Run browser tests with `yarn run test-browser`.
- The tests default to Chrome, but it's possible to use a different browser by setting the `SELENIUM_BROWSER` environment variable, e.g. like this: `SELENIUM_BROWSER=firefox yarn run test-browser`.
- To run on iOS Safari, use `SELENIUM_BROWSER=safari::ios yarn run test-browser`. Make sure that the iOS device is in the same local Wifi network as your computer.
- To run on Android Chrome, use `SELENIUM_BROWSER=chrome::android yarn run test-browser`. Make sure that the Android device is in the same local Wifi network as your computer.
- Run browser tests with `npm run test-browser`.
- The tests default to Chrome, but it's possible to use a different browser by setting the `SELENIUM_BROWSER` environment variable, e.g. like this: `SELENIUM_BROWSER=firefox npm run test-browser`.
- To run on iOS Safari, use `SELENIUM_BROWSER=safari::ios npm run test-browser`. Make sure that the iOS device is in the same local Wifi network as your computer.
- To run on Android Chrome, use `SELENIUM_BROWSER=chrome::android npm run test-browser`. Make sure that the Android device is in the same local Wifi network as your computer.
- To run individual tests instead of the entire test suite, you can execute a test file with the TAP runner, e.g. by typing `build/run-tap test/browser/zoom.test.js`.
22 changes: 11 additions & 11 deletions test/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ The contents of vector tile fixtures can be read using the [`vt2geojson`](https:

To run the entire integration test suite (both render or query tests), from within the `mapbox-gl-js` directory run the command:
```
yarn run test-suite
npm run test-suite
```

To run only the render/query tests:

```
yarn run test-render
npm run test-render
```
or
```
yarn run test-query-node
npm run test-query-node
```

To run only the expression tests:

```
yarn run test-expressions
npm run test-expressions
```

### Running specific tests

To run a subset of tests or an individual test, you can pass a specific subdirectory to the `test-render` script. For example, to run all the tests for a given property, e.g. `circle-radius`:
```
$ yarn run test-render circle-radius
$ npm run test-render circle-radius
...
* passed circle-radius/antimeridian
* passed circle-radius/default
Expand All @@ -56,7 +56,7 @@ Done in 2.71s.
```
Or to run a single test:
```
$ yarn run test-render circle-radius/literal
$ npm run test-render circle-radius/literal
...
* passed circle-radius/literal
1 passed (100.0%)
Expand All @@ -82,16 +82,16 @@ open ./test/integration/query-tests/index.html

Query tests can be run in the browser, the server for serving up the test page and test fixtures starts when you run
```
yarn run start
npm run start
```
OR
```
yarn run start-debug
npm run start-debug
```

If you want to run only the test server run:
```
yarn run watch-query
npm run watch-query
```

Then open the following url in the browser of your choice to start running the tests.
Expand Down Expand Up @@ -128,11 +128,11 @@ To add a new render test:

3. Generate an `expected.png` image from the given style by running the new test with the `UPDATE` flag enabled:
```
$ UPDATE=1 yarn run test-render <property-name>/<new-test-name>
$ UPDATE=1 npm run test-render <property-name>/<new-test-name>
```
The test will appear to fail, but you'll now see a new `expected.png` in the test directory.

4. Manually inspect `expected.png` to verify it looks as expected, and optionally run the test again without the update flag (`yarn run test-render <property-name>/<new-test-name>`) to watch it pass (enjoy that dopamine kick!)
4. Manually inspect `expected.png` to verify it looks as expected, and optionally run the test again without the update flag (`npm run test-render <property-name>/<new-test-name>`) to watch it pass (enjoy that dopamine kick!)

5. Commit the new `style.json` and `expected.png` :rocket:

Expand Down

0 comments on commit cdd4471

Please sign in to comment.