mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 08:02:09 +03:00
chore: change bump-blocksuite script to js (#5763)
`./scripts/bump-blocksuite.js`
This commit is contained in:
parent
799fa9cfa6
commit
61677b2ac4
3
scripts/bump-blocksuite.js
Executable file
3
scripts/bump-blocksuite.js
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import('@affine/bump-blocksuite');
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
LATEST_NIGHTLY=$(npm view @blocksuite/presets@nightly version | cut -d ':' -f 2 | tr -d '[:space:]')
|
||||
echo "Bump to latest BlockSuite nightly version: $LATEST_NIGHTLY"
|
||||
|
||||
yarn up \
|
||||
"@blocksuite/store@${LATEST_NIGHTLY}" \
|
||||
"@blocksuite/blocks@${LATEST_NIGHTLY}" \
|
||||
"@blocksuite/presets@${LATEST_NIGHTLY}" \
|
||||
"@blocksuite/global@${LATEST_NIGHTLY}" \
|
||||
"@blocksuite/block-std@${LATEST_NIGHTLY}" \
|
||||
"@blocksuite/lit@${LATEST_NIGHTLY}" \
|
||||
"@blocksuite/inline@${LATEST_NIGHTLY}"
|
@ -3,7 +3,14 @@ import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { Clipboard } from '@napi-rs/clipboard';
|
||||
import { Repository, Sort } from '@napi-rs/simple-git';
|
||||
import {
|
||||
FetchOptions,
|
||||
ProxyOptions,
|
||||
RemoteCallbacks,
|
||||
Repository,
|
||||
Sort,
|
||||
} from '@napi-rs/simple-git';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import corePackage from '../../packages/frontend/core/package.json' assert { type: 'json' };
|
||||
|
||||
@ -20,6 +27,11 @@ const info = await fetch(
|
||||
const latestVersion = info['dist-tags'].nightly;
|
||||
const latestHash = latestVersion.split('-').pop();
|
||||
|
||||
if (oldHash === latestHash) {
|
||||
console.info(chalk.greenBright('Already updated'));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.info(`Upgrade blocksuite from ${oldHash} -> ${latestHash}`);
|
||||
|
||||
const blockSuiteDeps = execSync(`yarn info -A --name-only --json`, {
|
||||
@ -38,7 +50,7 @@ const blocksuiteDepsList = blockSuiteDeps
|
||||
|
||||
for (const pkg of blocksuiteDepsList) {
|
||||
const command = `yarn up ${pkg}@${latestVersion}`;
|
||||
console.info(`Executing ${command}`);
|
||||
console.info(chalk.bgCyan(`Executing ${command}`));
|
||||
execSync(command, {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
@ -50,16 +62,25 @@ const repo = new Repository(
|
||||
join(fileURLToPath(import.meta.url), '..', '..', '..', '..', 'BlockSuite')
|
||||
);
|
||||
|
||||
repo.remote('origin').fetch(['master'], progress => {
|
||||
if (progress.totalDeltas && progress.totalObjects) {
|
||||
console.log(
|
||||
`${(
|
||||
(progress.receivedObjects / progress.totalObjects) * 50 +
|
||||
(progress.indexedDeltas / progress.totalDeltas) * 50
|
||||
).toFixed(2)}%`
|
||||
);
|
||||
}
|
||||
});
|
||||
const remote = repo.remoteAnonymous(
|
||||
'https://github.com/toeverything/BlockSuite.git'
|
||||
);
|
||||
|
||||
remote.fetch(
|
||||
['master'],
|
||||
new FetchOptions().proxyOptions(new ProxyOptions().auto()).remoteCallback(
|
||||
new RemoteCallbacks().transferProgress(progress => {
|
||||
if (progress.totalDeltas && progress.totalObjects) {
|
||||
console.log(
|
||||
`${(
|
||||
(progress.receivedObjects / progress.totalObjects) * 50 +
|
||||
(progress.indexedDeltas / progress.totalDeltas) * 50
|
||||
).toFixed(2)}%`
|
||||
);
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const latest = repo.findCommit(latestHash);
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
"description": "Generate changelog from blocksuite version change",
|
||||
"dependencies": {
|
||||
"@napi-rs/clipboard": "^1.1.1",
|
||||
"@napi-rs/simple-git": "^0.1.11"
|
||||
"@napi-rs/simple-git": "^0.1.16",
|
||||
"chalk": "^5.3.0"
|
||||
}
|
||||
}
|
||||
|
99
yarn.lock
99
yarn.lock
@ -154,7 +154,8 @@ __metadata:
|
||||
resolution: "@affine/bump-blocksuite@workspace:tools/bump-blocksuite"
|
||||
dependencies:
|
||||
"@napi-rs/clipboard": "npm:^1.1.1"
|
||||
"@napi-rs/simple-git": "npm:^0.1.11"
|
||||
"@napi-rs/simple-git": "npm:^0.1.16"
|
||||
chalk: "npm:^5.3.0"
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -7133,98 +7134,98 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-android-arm-eabi@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-android-arm-eabi@npm:0.1.11"
|
||||
"@napi-rs/simple-git-android-arm-eabi@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-android-arm-eabi@npm:0.1.16"
|
||||
conditions: os=android & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-android-arm64@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-android-arm64@npm:0.1.11"
|
||||
"@napi-rs/simple-git-android-arm64@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-android-arm64@npm:0.1.16"
|
||||
conditions: os=android & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-darwin-arm64@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-darwin-arm64@npm:0.1.11"
|
||||
"@napi-rs/simple-git-darwin-arm64@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-darwin-arm64@npm:0.1.16"
|
||||
conditions: os=darwin & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-darwin-x64@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-darwin-x64@npm:0.1.11"
|
||||
"@napi-rs/simple-git-darwin-x64@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-darwin-x64@npm:0.1.16"
|
||||
conditions: os=darwin & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-linux-arm-gnueabihf@npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-linux-arm-gnueabihf@npm:0.1.16"
|
||||
conditions: os=linux & cpu=arm
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-linux-arm64-gnu@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-linux-arm64-gnu@npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-arm64-gnu@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-linux-arm64-gnu@npm:0.1.16"
|
||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-linux-arm64-musl@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-linux-arm64-musl@npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-arm64-musl@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-linux-arm64-musl@npm:0.1.16"
|
||||
conditions: os=linux & cpu=arm64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-linux-x64-gnu@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-linux-x64-gnu@npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-x64-gnu@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-linux-x64-gnu@npm:0.1.16"
|
||||
conditions: os=linux & cpu=x64 & libc=glibc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-linux-x64-musl@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-linux-x64-musl@npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-x64-musl@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-linux-x64-musl@npm:0.1.16"
|
||||
conditions: os=linux & cpu=x64 & libc=musl
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-win32-arm64-msvc@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-win32-arm64-msvc@npm:0.1.11"
|
||||
"@napi-rs/simple-git-win32-arm64-msvc@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-win32-arm64-msvc@npm:0.1.16"
|
||||
conditions: os=win32 & cpu=arm64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git-win32-x64-msvc@npm:0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git-win32-x64-msvc@npm:0.1.11"
|
||||
"@napi-rs/simple-git-win32-x64-msvc@npm:0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git-win32-x64-msvc@npm:0.1.16"
|
||||
conditions: os=win32 & cpu=x64
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@napi-rs/simple-git@npm:^0.1.11":
|
||||
version: 0.1.11
|
||||
resolution: "@napi-rs/simple-git@npm:0.1.11"
|
||||
"@napi-rs/simple-git@npm:^0.1.16":
|
||||
version: 0.1.16
|
||||
resolution: "@napi-rs/simple-git@npm:0.1.16"
|
||||
dependencies:
|
||||
"@napi-rs/simple-git-android-arm-eabi": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-android-arm64": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-darwin-arm64": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-darwin-x64": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-arm64-gnu": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-arm64-musl": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-x64-gnu": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-linux-x64-musl": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-win32-arm64-msvc": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-win32-x64-msvc": "npm:0.1.11"
|
||||
"@napi-rs/simple-git-android-arm-eabi": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-android-arm64": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-darwin-arm64": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-darwin-x64": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-linux-arm-gnueabihf": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-linux-arm64-gnu": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-linux-arm64-musl": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-linux-x64-gnu": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-linux-x64-musl": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-win32-arm64-msvc": "npm:0.1.16"
|
||||
"@napi-rs/simple-git-win32-x64-msvc": "npm:0.1.16"
|
||||
dependenciesMeta:
|
||||
"@napi-rs/simple-git-android-arm-eabi":
|
||||
optional: true
|
||||
@ -7248,7 +7249,7 @@ __metadata:
|
||||
optional: true
|
||||
"@napi-rs/simple-git-win32-x64-msvc":
|
||||
optional: true
|
||||
checksum: 5802a96fb4152d3fd6cc28ebea56fd363d7055bb7a185289dab33954980d7114ee174290b8d12f4b5630a97dc4a443d24e5873417a3f9aa6877a5d3ec2f62165
|
||||
checksum: c847f5797dffad09115b2925a4e1964a9e61ae2ddca4e30f6bcc6fb8432a634625be71fcd79bb66379660b31171058969a61ad58e794197e143e7437db1fd852
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user