Skip to content

Commit

Permalink
[core] Replace execa with zx
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Nov 19, 2024
1 parent 81fd5a7 commit 6166177
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 107 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
"fs-extra": "^11.2.0",
"gh-pages": "^6.2.0",
Expand Down Expand Up @@ -193,7 +192,8 @@
"version-next": "^1.0.2",
"webpack": "^5.96.1",
"wrangler": "^3.84.1",
"yargs": "^17.7.2"
"yargs": "^17.7.2",
"zx": "^8.2.2"
},
"resolutions": {
"prosemirror-model": "1.18.1",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build/generate-dts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import path from 'node:path';
import { execa } from 'execa';
import fs from 'fs-extra';
import { $ } from 'zx';

export async function generateDts(packagePath: string) {
await execa('yarn', ['tsc', '--project', path.join(packagePath, 'tsconfig.build.json')]);
await $`yarn tsc --project ${path.join(packagePath, 'tsconfig.build.json')}`;

// Duplicate the type definitions for ESM
await fs.copy(
Expand Down
4 changes: 2 additions & 2 deletions scripts/plop/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'node:path';
import chalk from 'chalk';
import { execa } from 'execa';
import fs from 'fs-extra';
import { argv } from 'yargs';
import { $ } from 'zx';
import { getPath } from '../utils/get-path';
import { createLogger } from '../utils/signale';

Expand Down Expand Up @@ -54,4 +54,4 @@ fs.writeFileSync(path.join(packagePath, 'tsconfig.build.json'), replacePlacehold

logger.success(`Package ${chalk.cyan(packageName)} has been created`);

execa('yarn');
$`yarn`;
6 changes: 2 additions & 4 deletions scripts/publish/publish-package.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from 'chalk';
import { execa } from 'execa';
import { $ } from 'zx';
import { createLogger } from '../utils/signale';

const logger = createLogger('publish-package');
Expand All @@ -12,9 +12,7 @@ interface PublishPackage {

export async function publishPackage({ packagePath, name, tag }: PublishPackage) {
try {
await execa('npm', ['publish', '--access', 'public', '--tag', tag], {
cwd: packagePath,
});
$`cd ${packagePath} && npm publish --access public --tag ${tag}`;
logger.success(`Package ${chalk.cyan(name)} has been published`);
} catch (error: any) {
logger.error(`Failed to publish package ${chalk.red(name)}`);
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import chalk from 'chalk';
import { execa } from 'execa';
import simpleGit from 'simple-git';
import { getNextVersion } from 'version-next';
import { hideBin } from 'yargs/helpers';
import yargs from 'yargs/yargs';
import { $ } from 'zx';
import packageJson from '../../package.json';
import { buildAllPackages } from '../build/build-all-packages';
import { getMantinePackagesList } from '../packages/get-packages-list';
Expand Down Expand Up @@ -65,7 +65,7 @@ async function release() {

logger.success('All packages have been published successfully');

await execa('yarn');
await $`yarn`;
await git.add([
getPath('packages'),
getPath('package.json'),
Expand Down
123 changes: 28 additions & 95 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6191,7 +6191,7 @@ __metadata:
languageName: node
linkType: hard

"@types/fs-extra@npm:^11.0.4":
"@types/fs-extra@npm:>=11, @types/fs-extra@npm:^11.0.4":
version: 11.0.4
resolution: "@types/fs-extra@npm:11.0.4"
dependencies:
Expand Down Expand Up @@ -6473,6 +6473,15 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:>=20, @types/node@npm:^22.0.0":
version: 22.9.0
resolution: "@types/node@npm:22.9.0"
dependencies:
undici-types: "npm:~6.19.8"
checksum: 10c0/3f46cbe0a49bab4ba30494025e4c8a6e699b98ac922857aa1f0209ce11a1313ee46e6808b8f13fe5b8b960a9d7796b77c8d542ad4e9810e85ef897d5593b5d51
languageName: node
linkType: hard

"@types/node@npm:^20.9.0":
version: 20.9.0
resolution: "@types/node@npm:20.9.0"
Expand All @@ -6482,15 +6491,6 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^22.0.0":
version: 22.9.0
resolution: "@types/node@npm:22.9.0"
dependencies:
undici-types: "npm:~6.19.8"
checksum: 10c0/3f46cbe0a49bab4ba30494025e4c8a6e699b98ac922857aa1f0209ce11a1313ee46e6808b8f13fe5b8b960a9d7796b77c8d542ad4e9810e85ef897d5593b5d51
languageName: node
linkType: hard

"@types/parse-json@npm:^4.0.0":
version: 4.0.0
resolution: "@types/parse-json@npm:4.0.0"
Expand Down Expand Up @@ -11533,23 +11533,6 @@ __metadata:
languageName: node
linkType: hard

"execa@npm:^8.0.1":
version: 8.0.1
resolution: "execa@npm:8.0.1"
dependencies:
cross-spawn: "npm:^7.0.3"
get-stream: "npm:^8.0.1"
human-signals: "npm:^5.0.0"
is-stream: "npm:^3.0.0"
merge-stream: "npm:^2.0.0"
npm-run-path: "npm:^5.1.0"
onetime: "npm:^6.0.0"
signal-exit: "npm:^4.1.0"
strip-final-newline: "npm:^3.0.0"
checksum: 10c0/2c52d8775f5bf103ce8eec9c7ab3059909ba350a5164744e9947ed14a53f51687c040a250bda833f906d1283aa8803975b84e6c8f7a7c42f99dc8ef80250d1af
languageName: node
linkType: hard

"exit-hook@npm:^2.2.1":
version: 2.2.1
resolution: "exit-hook@npm:2.2.1"
Expand Down Expand Up @@ -12312,13 +12295,6 @@ __metadata:
languageName: node
linkType: hard

"get-stream@npm:^8.0.1":
version: 8.0.1
resolution: "get-stream@npm:8.0.1"
checksum: 10c0/5c2181e98202b9dae0bb4a849979291043e5892eb40312b47f0c22b9414fc9b28a3b6063d2375705eb24abc41ecf97894d9a51f64ff021511b504477b27b4290
languageName: node
linkType: hard

"get-symbol-description@npm:^1.0.0":
version: 1.0.0
resolution: "get-symbol-description@npm:1.0.0"
Expand Down Expand Up @@ -13116,13 +13092,6 @@ __metadata:
languageName: node
linkType: hard

"human-signals@npm:^5.0.0":
version: 5.0.0
resolution: "human-signals@npm:5.0.0"
checksum: 10c0/5a9359073fe17a8b58e5a085e9a39a950366d9f00217c4ff5878bd312e09d80f460536ea6a3f260b5943a01fe55c158d1cea3fc7bee3d0520aeef04f6d915c82
languageName: node
linkType: hard

"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2":
version: 0.6.3
resolution: "iconv-lite@npm:0.6.3"
Expand Down Expand Up @@ -13863,13 +13832,6 @@ __metadata:
languageName: node
linkType: hard

"is-stream@npm:^3.0.0":
version: 3.0.0
resolution: "is-stream@npm:3.0.0"
checksum: 10c0/eb2f7127af02ee9aa2a0237b730e47ac2de0d4e76a4a905a50a11557f2339df5765eaea4ceb8029f1efa978586abe776908720bfcb1900c20c6ec5145f6f29d8
languageName: node
linkType: hard

"is-string@npm:^1.0.5":
version: 1.0.6
resolution: "is-string@npm:1.0.6"
Expand Down Expand Up @@ -15559,7 +15521,6 @@ __metadata:
eslint-plugin-jest: "npm:^28.9.0"
eslint-plugin-jsx-a11y: "npm:^6.10.2"
eslint-plugin-react: "npm:^7.37.2"
execa: "npm:^8.0.1"
fast-deep-equal: "npm:^3.1.3"
fast-glob: "npm:^3.3.2"
fs-extra: "npm:^11.2.0"
Expand Down Expand Up @@ -15617,6 +15578,7 @@ __metadata:
webpack: "npm:^5.96.1"
wrangler: "npm:^3.84.1"
yargs: "npm:^17.7.2"
zx: "npm:^8.2.2"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -16349,13 +16311,6 @@ __metadata:
languageName: node
linkType: hard

"mimic-fn@npm:^4.0.0":
version: 4.0.0
resolution: "mimic-fn@npm:4.0.0"
checksum: 10c0/de9cc32be9996fd941e512248338e43407f63f6d497abe8441fa33447d922e927de54d4cc3c1a3c6d652857acd770389d5a3823f311a744132760ce2be15ccbf
languageName: node
linkType: hard

"min-indent@npm:^1.0.0, min-indent@npm:^1.0.1":
version: 1.0.1
resolution: "min-indent@npm:1.0.1"
Expand Down Expand Up @@ -16949,15 +16904,6 @@ __metadata:
languageName: node
linkType: hard

"npm-run-path@npm:^5.1.0":
version: 5.1.0
resolution: "npm-run-path@npm:5.1.0"
dependencies:
path-key: "npm:^4.0.0"
checksum: 10c0/ff6d77514489f47fa1c3b1311d09cd4b6d09a874cc1866260f9dea12cbaabda0436ed7f8c2ee44d147bf99a3af29307c6f63b0f83d242b0b6b0ab25dff2629e3
languageName: node
linkType: hard

"nth-check@npm:^2.0.1":
version: 2.1.1
resolution: "nth-check@npm:2.1.1"
Expand Down Expand Up @@ -17161,15 +17107,6 @@ __metadata:
languageName: node
linkType: hard

"onetime@npm:^6.0.0":
version: 6.0.0
resolution: "onetime@npm:6.0.0"
dependencies:
mimic-fn: "npm:^4.0.0"
checksum: 10c0/4eef7c6abfef697dd4479345a4100c382d73c149d2d56170a54a07418c50816937ad09500e1ed1e79d235989d073a9bade8557122aee24f0576ecde0f392bb6c
languageName: node
linkType: hard

"open@npm:^10.1.0":
version: 10.1.0
resolution: "open@npm:10.1.0"
Expand Down Expand Up @@ -17533,13 +17470,6 @@ __metadata:
languageName: node
linkType: hard

"path-key@npm:^4.0.0":
version: 4.0.0
resolution: "path-key@npm:4.0.0"
checksum: 10c0/794efeef32863a65ac312f3c0b0a99f921f3e827ff63afa5cb09a377e202c262b671f7b3832a4e64731003fa94af0263713962d317b9887bd1e0c48a342efba3
languageName: node
linkType: hard

"path-parse@npm:^1.0.6, path-parse@npm:^1.0.7":
version: 1.0.7
resolution: "path-parse@npm:1.0.7"
Expand Down Expand Up @@ -20508,13 +20438,6 @@ __metadata:
languageName: node
linkType: hard

"signal-exit@npm:^4.1.0":
version: 4.1.0
resolution: "signal-exit@npm:4.1.0"
checksum: 10c0/41602dce540e46d599edba9d9860193398d135f7ff72cab629db5171516cfae628d21e7bfccde1bbfdf11c48726bc2a6d1a8fb8701125852fbfda7cf19c6aa83
languageName: node
linkType: hard

"signale@npm:^1.4.0":
version: 1.4.0
resolution: "signale@npm:1.4.0"
Expand Down Expand Up @@ -21149,13 +21072,6 @@ __metadata:
languageName: node
linkType: hard

"strip-final-newline@npm:^3.0.0":
version: 3.0.0
resolution: "strip-final-newline@npm:3.0.0"
checksum: 10c0/a771a17901427bac6293fd416db7577e2bc1c34a19d38351e9d5478c3c415f523f391003b42ed475f27e33a78233035df183525395f731d3bfb8cdcbd4da08ce
languageName: node
linkType: hard

"strip-indent@npm:^3.0.0":
version: 3.0.0
resolution: "strip-indent@npm:3.0.0"
Expand Down Expand Up @@ -23449,3 +23365,20 @@ __metadata:
checksum: 10c0/3c7830cdd3378667e058ffdb4cf2bb78ac5711214e2725900873accb23f3dfe5f9e7e5a06dcdc5f29605da976fc45c26d9a13ca334d6eea2245a15e77b8fc06e
languageName: node
linkType: hard

"zx@npm:^8.2.2":
version: 8.2.2
resolution: "zx@npm:8.2.2"
dependencies:
"@types/fs-extra": "npm:>=11"
"@types/node": "npm:>=20"
dependenciesMeta:
"@types/fs-extra":
optional: true
"@types/node":
optional: true
bin:
zx: build/cli.js
checksum: 10c0/68c2fd54cd10e2c3b32ae7db62cc0004808b7ece6aad2c87838e354174bd9868918cc1a6e067d6a7647cfb1180253e6a362f8b57aabb4b2895c8f6c0e92a62cd
languageName: node
linkType: hard

0 comments on commit 6166177

Please sign in to comment.