Skip to content

Commit

Permalink
Revert "feat(packaging): migrate yarn cmds to npm"
Browse files Browse the repository at this point in the history
This reverts commit 600dc12.
  • Loading branch information
JMounier committed Dec 1, 2023
1 parent b94a875 commit b3ae279
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 62 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
with:
node-version: "18"
- name: install packages
run: npm install
run: yarn install
- name: Tests on ${{ matrix.browser }}
run: npm run karma --browsers ${{ matrix.browser }}
run: yarn karma --browsers ${{ matrix.browser }}
# You can allow a job to pass when this step fails (e.g. temporarily if Browserstack tests
# are too flaky), by uncommenting the following line:
# continue-on-error: true
Expand Down Expand Up @@ -61,11 +61,11 @@ jobs:
with:
node-version: "18"
- name: install packages
run: npm install
run: yarn install
- name: build TypeScript
run: npm run build
run: yarn build
- name: Tests on Node 18
run: npm run coverage
run: yarn coverage
env:
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ __pycache__
.cache
functional_test_list.json

yarn.lock
package-lock.json
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ audit:
- .rules/nightly
stage: check
script:
- npm install
- npm audit --omit dev
- yarn
- yarn audit --groups "dependencies optionalDependencies"
tags: !reference [.tags/linux, tags]

deploy:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ To build the JavaScript SDKs yourself, please follow the steps below.

### Prerequisites

Install the lastest version of [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
Install [Yarn](https://yarnpkg.com/en/docs/install) version 1.0 or higher.

Use this command to check the npm version installed on your system:
Use this command to check the Yarn version installed on your system:
```bash
npm --version
yarn -v
```

### Install dependencies
Expand All @@ -132,7 +132,7 @@ git clone https://github.com/TankerHQ/sdk-js.git

Install dependencies:
```bash
cd sdk-js && npm install
cd sdk-js && yarn
```

### Test and lint
Expand All @@ -142,7 +142,7 @@ Our codebase uses the following ES6 features: `async` / `await`, `import` / `exp
To check that the code is correct and to launch the tests in Node.js, use:

```bash
npm run proof
yarn proof
```

### Submit your pull request
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"build": "tsc --build --verbose packages",
"clean": "rimraf packages/*/dist packages/*/*/dist packages/**/.cache",
"build:all": "npm run build:test-utils && npm run build:global-this && npm run build:errors && npm run build:file-ponyfill && npm run build:file-reader && npm run build:http-utils && npm run build:types && npm run build:streams && npm run build:crypto && npm run build:datastores && npm run build:core && npm run build:client-browser && npm run build:client-node && npm run build:functional-tests",
"build:all": "yarn build:test-utils && yarn build:global-this && yarn build:errors && yarn build:file-ponyfill && yarn build:file-reader && yarn build:http-utils && yarn build:types && yarn build:streams && yarn build:crypto && yarn build:datastores && yarn build:core && yarn build:client-browser && yarn build:client-node && yarn build:functional-tests",
"build:client-browser": "rimraf packages/client-browser/dist packages/client-browser/config/.cache && tsc --build packages/client-browser/config",
"build:client-node": "rimraf packages/client-node/dist packages/client-node/config/.cache && tsc --build packages/client-node/config",
"build:core": "rimraf packages/core/dist packages/core/config/.cache && tsc --build packages/core/config",
Expand All @@ -20,31 +20,31 @@
"build:test-utils": "rimraf packages/test-utils/dist packages/test-utils/config/.cache && tsc --build packages/test-utils/config",
"build:types": "rimraf packages/types/dist packages/types/config/.cache && tsc --build packages/types/config",
"build:functional-tests": "rimraf packages/functional-tests/dist packages/functional-tests/config/.cache && tsc --build packages/functional-tests/config",
"lint:js": "eslint \"config/**/*.js\"",
"lint:ts": "eslint \"packages/**/*.ts\"",
"lint:compat": "eslint --no-ignore --no-eslintrc --config .eslintrc.compat.yml",
"lint:compat:all": "npm run lint:compat \"packages/**/dist/**/*.js\"",
"lint:js": "yarn eslint \"config/**/*.js\"",
"lint:ts": "yarn eslint \"packages/**/*.ts\"",
"lint:compat": "yarn eslint --no-ignore --no-eslintrc --config .eslintrc.compat.yml",
"lint:compat:all": "yarn lint:compat \"packages/**/dist/**/*.js\"",
"_test": "mocha --exit --require ts-node/register --require tsconfig-paths/register --recursive --full-trace --trace-warnings --reporter=spec",
"test": "npm run _test \"packages/**/src/**/*.spec{,.node}.ts\"",
"test:core": "npm run _test \"packages/core/src/**/*.spec{,.node}.ts\"",
"test:crypto": "npm run _test \"packages/crypto/src/**/*.spec{,.node}.ts\"",
"test:datastore-base": "npm run _test \"packages/datastore/base/src/**/*.spec{,.node}.ts\"",
"test:datastore-pouchdb-memory": "npm run _test \"packages/datastore/pouchdb-memory/src/**/*.spec{,.node}.ts\"",
"test:datastore-pouchdb-node": "npm run _test \"packages/datastore/pouchdb-node/src/**/*.spec{,.node}.ts\"",
"test:errors": "npm run _test \"packages/errors/src/**/*.spec{,.node}.ts\"",
"test:global-this": "npm run _test \"packages/global-this/**/src/**/*.spec{,.node}.ts\"",
"test:http-utils": "npm run _test \"packages/http-utils/**/src/**/*.spec{,.node}.ts\"",
"test:streams": "npm run _test \"packages/stream/**/src/**/*.spec{,.node}.ts\"",
"test:types": "npm run _test \"packages/types/src/**/*.spec{,.node}.ts\"",
"test-matcher:export-test-names": "npm run test --reporter ./config/mocha/name-exporter.js --dry-run --grep 'functional-tests'",
"test": "yarn _test \"packages/**/src/**/*.spec{,.node}.ts\"",
"test:core": "yarn _test \"packages/core/src/**/*.spec{,.node}.ts\"",
"test:crypto": "yarn _test \"packages/crypto/src/**/*.spec{,.node}.ts\"",
"test:datastore-base": "yarn _test \"packages/datastore/base/src/**/*.spec{,.node}.ts\"",
"test:datastore-pouchdb-memory": "yarn _test \"packages/datastore/pouchdb-memory/src/**/*.spec{,.node}.ts\"",
"test:datastore-pouchdb-node": "yarn _test \"packages/datastore/pouchdb-node/src/**/*.spec{,.node}.ts\"",
"test:errors": "yarn _test \"packages/errors/src/**/*.spec{,.node}.ts\"",
"test:global-this": "yarn _test \"packages/global-this/**/src/**/*.spec{,.node}.ts\"",
"test:http-utils": "yarn _test \"packages/http-utils/**/src/**/*.spec{,.node}.ts\"",
"test:streams": "yarn _test \"packages/stream/**/src/**/*.spec{,.node}.ts\"",
"test:types": "yarn _test \"packages/types/src/**/*.spec{,.node}.ts\"",
"test-matcher:export-test-names": "yarn test --reporter ./config/mocha/name-exporter.js --dry-run --grep 'functional-tests'",
"karma": "karma start config/karma/karma.config.ci.js",
"debug": "karma start config/karma/karma.config.debug.js",
"debug:core": "karma start packages/core/config/karma.config.debug.js",
"debug:crypto": "karma start packages/crypto/config/karma.config.debug.js",
"debug:errors": "karma start packages/errors/config/karma.config.debug.js",
"debug:streams": "karma start packages/stream/config/karma.config.debug.js",
"proof": "poetry install && poetry run python run-ci.py lint && npm run test",
"coverage": "nyc npm run test"
"proof": "poetry install && poetry run python run-ci.py lint && yarn test",
"coverage": "nyc yarn test"
},
"devDependencies": {
"@types/chai": "^4.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"LICENSE"
],
"scripts": {
"test": "cd ../..; npm run test:core"
"test": "cd ../..; yarn test:core"
},
"dependencies": {
"@tanker/crypto": "0.0.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"LICENSE"
],
"scripts": {
"build": "cd ../..; npm run build:crypto",
"test": "cd ../..; npm run test:crypto",
"start:test": "cd ../..; npm run start:test-crypto"
"build": "cd ../..; yarn build:crypto",
"test": "cd ../..; yarn test:crypto",
"start:test": "cd ../..; yarn start:test-crypto"
},
"dependencies": {
"@tanker/errors": "0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"LICENSE"
],
"scripts": {
"test": "cd ../..; npm run test:errors"
"test": "cd ../..; yarn test:errors"
},
"dependencies": {
"tslib": "^2.3.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/global-this/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"LICENSE"
],
"scripts": {
"test": "cd ../..; npm run test:global-this"
"test": "cd ../..; yarn test:global-this"
},
"dependencies": {
"tslib": "^2.3.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/http-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"LICENSE"
],
"scripts": {
"test": "cd ../..; npm run test:http-utils"
"test": "cd ../..; yarn test:http-utils"
},
"dependencies": {
"@tanker/errors": "0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"LICENSE"
],
"scripts": {
"test": "cd ../..; npm run test:types"
"test": "cd ../..; yarn test:types"
},
"dependencies": {
"@tanker/errors": "0.0.1",
Expand Down
42 changes: 20 additions & 22 deletions run-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def run_tests_in_browser_ten_times(*, runner: str) -> None:

def run_tests_in_browser(*, runner: str) -> None:
if runner == "linux":
tankerci.js.npm("run", "karma", "--", "--browsers", "ChromeInDocker")
tankerci.js.run_yarn("karma", "--browsers", "ChromeInDocker")
elif runner == "macos":
tankerci.js.npm("run", "karma", "--", "--browsers", "Safari")
tankerci.js.run_yarn("karma", "--browsers", "Safari")
elif runner == "windows-edge":
kill_windows_processes()
tankerci.js.npm("run", "karma", "--", "--browsers", "EdgeHeadless")
tankerci.js.run_yarn("karma", "--browsers", "EdgeHeadless")


def get_package_path(package_name: str) -> Path:
Expand Down Expand Up @@ -155,21 +155,21 @@ def publish_npm_package(package_name: str, version: str) -> None:


def run_tests_in_node() -> None:
tankerci.js.npx("node", "--version")
tankerci.js.npm("run", "build")
tankerci.js.npm("run", "coverage")
tankerci.js.run_yarn("exec", "--", "node", "--version")
tankerci.js.run_yarn("build")
tankerci.js.run_yarn("coverage")


def lint() -> None:
tankerci.js.npm("install")
tankerci.js.npm("run", "build")
tankerci.js.npm("run", "lint:js")
tankerci.js.npm("run", "lint:ts")
tankerci.js.npm("run", "lint:compat:all")
tankerci.js.yarn_install_deps()
tankerci.js.run_yarn("build")
tankerci.js.run_yarn("lint:js")
tankerci.js.run_yarn("lint:ts")
tankerci.js.run_yarn("lint:compat:all")


def check(*, runner: str, nightly: bool) -> None:
tankerci.js.npm("install")
tankerci.js.yarn_install_deps()
if nightly:
run_tests_in_browser_ten_times(runner=runner)
elif runner == "node":
Expand All @@ -179,11 +179,9 @@ def check(*, runner: str, nightly: bool) -> None:


def test_matcher() -> None:
tankerci.js.npm("install")
tankerci.js.npm(
"run",
tankerci.js.yarn_install_deps()
tankerci.js.run_yarn(
"test-matcher:export-test-names",
"--",
"--reporter-options",
"'outputFile=functional_test_list.json'",
)
Expand All @@ -210,19 +208,19 @@ def e2e(*, use_local_sources: bool) -> None:
)
tankerci.run("poetry", "run", "python", "run-ci.py", "build")
with tankerci.working_directory(base_path / "sdk-js"):
tankerci.js.npm("install")
tankerci.js.npm("run", "build")
tankerci.js.yarn_install()
tankerci.js.run_yarn("build")
with tankerci.working_directory(base_path / "qa-python-js"):
tankerci.run("poetry", "install")
tankerci.run("poetry", "run", "pytest", "--verbose", "--capture=no")


def deploy_sdk(*, version: str) -> None:
tankerci.js.npm("install")
tankerci.js.yarn_install_deps()
tankerci.bump.bump_files(version)

for config in configs:
tankerci.js.npm_build(delivery=config["build"])
tankerci.js.yarn_build(delivery=config["build"], env="prod")
for package_name in config["publish"]:
publish_npm_package(package_name, version)

Expand All @@ -231,8 +229,8 @@ def test_deploy(*, version: str) -> None:
test_dir = Path("test")
index_file = test_dir / "index.js"
test_dir.mkdir()
tankerci.js.npm("init", "--yes", cwd=test_dir)
tankerci.js.npm("add", f"@tanker/client-browser@{version}", cwd=test_dir)
tankerci.js.run_yarn("init", "--yes", cwd=test_dir)
tankerci.js.run_yarn("add", f"@tanker/client-browser@{version}", cwd=test_dir)
index_file.write_text('require("@tanker/client-browser");')
tankerci.run("node", "index.js", cwd=test_dir)

Expand Down

0 comments on commit b3ae279

Please sign in to comment.