Skip to content
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

ARROW-12239: [JS] Switch to yarn #9918

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/js.yml
Expand Up @@ -113,7 +113,7 @@ jobs:
# node-version: ${{ matrix.node }}
# - name: Install Platform Dependencies
# shell: bash
# run: npm install -g cross-env
# run: yarn add -g cross-env
# - name: Build
# shell: bash
# run: ci/scripts/js_build.sh $(pwd)
Expand Down
1 change: 1 addition & 0 deletions ci/docker/conda-integration.dockerfile
Expand Up @@ -34,6 +34,7 @@ RUN conda install -q \
compilers \
maven=${maven} \
nodejs=${node} \
yarn \
openjdk=${jdk} && \
conda clean --all --force-pkgs-dirs

Expand Down
3 changes: 2 additions & 1 deletion ci/docker/linux-apt-docs.dockerfile
Expand Up @@ -69,7 +69,8 @@ ARG node=14
RUN wget -q -O - https://deb.nodesource.com/setup_${node}.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
npm install -g yarn

# Sphinx is pinned because of ARROW-9693
RUN pip install \
Expand Down
4 changes: 2 additions & 2 deletions ci/scripts/cpp_build.sh
Expand Up @@ -109,8 +109,8 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-DBUILD_WARNING_LEVEL=${BUILD_WARNING_LEVEL:-CHECKIN} \
-Dc-ares_SOURCE=${cares_SOURCE:-} \
-DCMAKE_BUILD_TYPE=${ARROW_BUILD_TYPE:-debug} \
-DCMAKE_C_FLAGS=${CFLAGS:-} \
-DCMAKE_CXX_FLAGS=${CXXFLAGS:-} \
-DCMAKE_C_FLAGS="${CFLAGS:-}" \
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-}" \
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR:-lib} \
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}} \
-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:-OFF} \
Expand Down
9 changes: 4 additions & 5 deletions ci/scripts/js_build.sh
Expand Up @@ -24,14 +24,13 @@ with_docs=${2:-false}

pushd ${source_dir}

npm install
yarn --frozen-lockfile
# TODO(kszucs): linting should be moved to archery
npm run lint:ci
npm run build
yarn lint:ci
yarn build

if [ "${with_docs}" == "true" ]; then
npm install typedoc
npm run doc
yarn doc
fi

popd
4 changes: 2 additions & 2 deletions ci/scripts/js_test.sh
Expand Up @@ -23,7 +23,7 @@ source_dir=${1}/js

pushd ${source_dir}

npm run lint
npm run test
yarn lint
yarn test

popd
1 change: 1 addition & 0 deletions dev/release/rat_exclude_files.txt
Expand Up @@ -128,6 +128,7 @@ go/parquet/go.sum
js/.npmignore
js/closure-compiler-scripts/*
js/src/fb/*.ts
js/yarn.lock
python/cmake_modules
python/cmake_modules/FindPythonLibsNew.cmake
python/cmake_modules/SnappyCMakeLists.txt
Expand Down
8 changes: 4 additions & 4 deletions dev/release/verify-release-candidate.sh
Expand Up @@ -412,12 +412,12 @@ test_js() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

nvm install --lts
npm install -g yarn
fi

npm install
# clean, lint, and build JS source
npx run-s clean:all lint build
npm run test
yarn --frozen-lockfile
yarn run-s clean:all lint build
yarn test
popd
}

Expand Down
2 changes: 1 addition & 1 deletion js/.gitignore
Expand Up @@ -61,7 +61,7 @@ jspm_packages/
.npm

# JS package manager files
yarn.lock
package-lock.json

# Optional eslint cache
.eslintcache
Expand Down
34 changes: 18 additions & 16 deletions js/DEVELOP.md
Expand Up @@ -22,14 +22,14 @@
Even if you do not plan to contribute to Apache Arrow itself or Arrow
integrations in other projects, we'd be happy to have you involved:

* Join the mailing list: send an email to
[dev-subscribe@arrow.apache.org][1]. Share your ideas and use cases for the
project.
* Join the mailing list: send an email to [dev-subscribe@arrow.apache.org][1].
Share your ideas and use cases for the project.
* [Follow our activity on JIRA][3]
* [Learn the format][2]
* Contribute code to one of the reference implementations

We prefer to receive contributions in the form of GitHub pull requests. Please send pull requests against the [github.com/apache/arrow][4] repository.
We prefer to receive contributions in the form of GitHub pull requests.
Please send pull requests against the [github.com/apache/arrow][4] repository.

If you are looking for some ideas on what to contribute, check out the [JIRA
issues][3] for the Apache Arrow project. Comment on the issue and/or contact
Expand All @@ -40,28 +40,30 @@ If you’d like to report a bug but don’t have time to fix it, you can still p
it on JIRA, or email the mailing list
[dev@arrow.apache.org](http://mail-archives.apache.org/mod_mbox/arrow-dev/)

# The npm scripts
# The package.json scripts

* `npm run clean` - cleans targets
* `npm run build` - cleans and compiles all targets
* `npm test` - executes tests against built targets
We use [yarn](https://yarnpkg.com/) to install dependencies and run scrips.

These npm scripts accept argument lists of targets × modules:
* `yarn clean` - cleans targets
* `yarn build` - cleans and compiles all targets
* `yarn test` - executes tests against built targets

These scripts accept argument lists of targets × modules:

* Available `targets` are `es5`, `es2015`, `esnext`, and `all` (default: `all`)
* Available `modules` are `cjs`, `esm`, `umd`, and `all` (default: `all`)

Examples:

* `npm run build` -- builds all ES targets in all module formats
* `npm run build -- -t es5 -m all` -- builds the ES5 target in all module formats
* `npm run build -- -t all -m cjs` -- builds all ES targets in the CommonJS module format
* `npm run build -- --targets es5 es2015 -m all` -- builds the ES5 and ES2015 targets in all module formats
* `npm run build -- -t es5 --modules cjs esm` -- builds the ES5 target in CommonJS and ESModules module formats
* `yarn build` -- builds all ES targets in all module formats
* `yarn build -t es5 -m all` -- builds the ES5 target in all module formats
* `yarn build -t all -m cjs` -- builds all ES targets in the CommonJS module format
* `yarn build --targets es5 es2015 -m all` -- builds the ES5 and ES2015 targets in all module formats
* `yarn build -t es5 --modules cjs esm` -- builds the ES5 target in CommonJS and ESModules module formats

This argument configuration also applies to `clean` and `test` scripts.

* `npm run deploy`
* `yarn deploy`

Uses [lerna](https://github.com/lerna/lerna) to publish each build target to npm with [conventional](https://conventionalcommits.org/) [changelogs](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli).

Expand Down Expand Up @@ -103,7 +105,7 @@ Uses [lerna](https://github.com/lerna/lerna) to publish each build target to npm
mv File{_generated,}.ts && mv Schema{_generated,}.ts && mv Message{_generated,}.ts
```

2. Execute `npm run lint` from the `js` directory to fix the linting errors
2. Execute `yarn lint` from the `js` directory to fix the linting errors

[1]: mailto:dev-subscribe@arrow.apache.org
[2]: https://github.com/apache/arrow/tree/master/format
Expand Down
6 changes: 3 additions & 3 deletions js/npm-release.sh
Expand Up @@ -19,8 +19,8 @@
set -e

# validate the targets pass all tests before publishing
npm install
npx gulp
yarn --frozen-lockfile
yarn gulp

# publish the JS target modules to npm
npx lerna exec --no-bail -- npm publish
yarn lerna exec --no-bail -- npm publish