mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-04-22 02:08:01 +00:00
Initial rebrand: @polkadot -> @pezkuwi (3 packages)
- Package namespace: @polkadot/dev -> @pezkuwi/dev - Repository: polkadot-js/dev -> pezkuwichain/pezkuwi-dev - Author: Pezkuwi Team <team@pezkuwichain.io> Packages: - @pezkuwi/dev (build tools, linting, CI scripts) - @pezkuwi/dev-test (test runner) - @pezkuwi/dev-ts (TypeScript build) Upstream: polkadot-js/dev v0.83.3
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2017-2025 @polkadot/dev authors & contributors
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# This scripts updates and aligns the version of yarn berry used. It follows
|
||||
# the following approach -
|
||||
#
|
||||
# 1. Updates the version of yarn berry in the dev project
|
||||
# 2. Performs an install in dev to upgrade the locks/plugins
|
||||
# 3. Loops through each of the polkadot-js projects, copying the
|
||||
# config from dev
|
||||
|
||||
DIRECTORIES=( "wasm" "common" "api" "docs" "ui" "phishing" "extension" "tools" "apps" )
|
||||
|
||||
# update to latest inside dev
|
||||
cd dev
|
||||
echo "*** Updating yarn in dev"
|
||||
git pull
|
||||
yarn set version latest
|
||||
yarn
|
||||
cd ..
|
||||
|
||||
# update all our existing polkadot-js projects
|
||||
for PKG in "${DIRECTORIES[@]}"; do
|
||||
echo "*** Updating yarn in $PKG"
|
||||
cd $PKG
|
||||
git pull
|
||||
rm -rf .yarn/plugins .yarn/releases
|
||||
cp -R ../dev/.yarn/plugins .yarn
|
||||
cp -R ../dev/.yarn/releases .yarn
|
||||
cat ../dev/.yarnrc.yml > .yarnrc.yml
|
||||
yarn
|
||||
cd ..
|
||||
done
|
||||
@@ -0,0 +1,184 @@
|
||||
#!/usr/bin/env node
|
||||
// Copyright 2017-2025 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
/** @typedef {{ dependencies: Record<string, string>; devDependencies: Record<string, string>; peerDependencies: Record<string, string>; optionalDependencies: Record<string, string>; resolutions: Record<string, string>; name: string; version: string; versions: { git: string; npm: string; } }} PkgJson */
|
||||
|
||||
// The keys to look for in package.json
|
||||
const PKG_PATHS = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies', 'resolutions'];
|
||||
|
||||
const versions = {};
|
||||
const paths = [];
|
||||
let updated = 0;
|
||||
|
||||
/**
|
||||
* Returns the path of the package.json inside the supplied directory
|
||||
*
|
||||
* @param {string} dir
|
||||
* @returns {string}
|
||||
*/
|
||||
function packageJsonPath (dir) {
|
||||
return path.join(dir, 'package.json');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the supplied dependency map with the latest (version map) versions
|
||||
*
|
||||
* @param {string} dir
|
||||
* @param {boolean} hasDirLogged
|
||||
* @param {string} key
|
||||
* @param {Record<string, string>} dependencies
|
||||
* @returns {[number, Record<string, string>]}
|
||||
*/
|
||||
function updateDependencies (dir, hasDirLogged, key, dependencies) {
|
||||
let count = 0;
|
||||
const adjusted = Object
|
||||
.keys(dependencies)
|
||||
.sort()
|
||||
.reduce((result, name) => {
|
||||
const current = dependencies[name];
|
||||
const version = !current.startsWith('^') || current.endsWith('-x')
|
||||
? current
|
||||
: versions[name] || current;
|
||||
|
||||
if (version !== current) {
|
||||
if (count === 0) {
|
||||
if (!hasDirLogged) {
|
||||
console.log('\t', dir);
|
||||
}
|
||||
|
||||
console.log('\t\t', key);
|
||||
}
|
||||
|
||||
console.log('\t\t\t', name.padStart(30), '\t', current.padStart(8), '->', version);
|
||||
count++;
|
||||
updated++;
|
||||
}
|
||||
|
||||
result[name] = version;
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
return [count, adjusted];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a parsed package.json
|
||||
*
|
||||
* @param {string} dir
|
||||
* @returns {PkgJson}
|
||||
*/
|
||||
function parsePackage (dir) {
|
||||
return JSON.parse(
|
||||
fs.readFileSync(packageJsonPath(dir), 'utf-8')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the supplied package.json
|
||||
*
|
||||
* @param {string} dir
|
||||
* @param {Record<string, unknown>} json
|
||||
*/
|
||||
function writePackage (dir, json) {
|
||||
fs.writeFileSync(packageJsonPath(dir), `${JSON.stringify(json, null, 2)}\n`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rerite the package.json with updated dependecies
|
||||
*
|
||||
* @param {string} dir
|
||||
*/
|
||||
function updatePackage (dir) {
|
||||
const json = parsePackage(dir);
|
||||
let hasDirLogged = false;
|
||||
|
||||
writePackage(dir, Object
|
||||
.keys(json)
|
||||
.reduce((result, key) => {
|
||||
if (PKG_PATHS.includes(key)) {
|
||||
const [count, adjusted] = updateDependencies(dir, hasDirLogged, key, json[key]);
|
||||
|
||||
result[key] = adjusted;
|
||||
|
||||
if (count) {
|
||||
hasDirLogged = true;
|
||||
}
|
||||
} else {
|
||||
result[key] = json[key];
|
||||
}
|
||||
|
||||
return result;
|
||||
}, {})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop through package/*, extracting the package names and their versions
|
||||
*
|
||||
* @param {string} dir
|
||||
*/
|
||||
function findPackages (dir) {
|
||||
const pkgsDir = path.join(dir, 'packages');
|
||||
|
||||
paths.push(dir);
|
||||
|
||||
if (!fs.existsSync(pkgsDir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { versions: { npm: lastVersion } } = parsePackage(dir);
|
||||
|
||||
fs
|
||||
.readdirSync(pkgsDir)
|
||||
.filter((entry) => {
|
||||
const full = path.join(pkgsDir, entry);
|
||||
|
||||
return !['.', '..'].includes(entry) &&
|
||||
fs.lstatSync(full).isDirectory() &&
|
||||
fs.existsSync(path.join(full, 'package.json'));
|
||||
})
|
||||
.forEach((dir) => {
|
||||
const full = path.join(pkgsDir, dir);
|
||||
const pkgJson = parsePackage(full);
|
||||
|
||||
paths.push(full);
|
||||
versions[pkgJson.name] = `^${lastVersion}`;
|
||||
|
||||
// for dev we want to pull through the additionals, i.e. we want to
|
||||
// align deps found in dev/others with those in dev as master
|
||||
if (pkgJson.name === '@polkadot/dev') {
|
||||
PKG_PATHS.forEach((depPath) => {
|
||||
Object
|
||||
.entries(pkgJson[depPath] || {})
|
||||
.filter(([, version]) => version.startsWith('^'))
|
||||
.forEach(([pkg, version]) => {
|
||||
versions[pkg] ??= version;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Extracting ...');
|
||||
|
||||
fs
|
||||
.readdirSync('.')
|
||||
.filter((name) =>
|
||||
!['.', '..'].includes(name) &&
|
||||
fs.existsSync(packageJsonPath(name))
|
||||
)
|
||||
.sort()
|
||||
.forEach(findPackages);
|
||||
|
||||
console.log('\t', Object.keys(versions).length, 'packages found');
|
||||
|
||||
console.log('Updating ...');
|
||||
|
||||
paths.forEach(updatePackage);
|
||||
|
||||
console.log('\t', updated, 'versions adjusted');
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2017-2025 @polkadot/dev authors & contributors
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# This scripts updates all the inter polkadot-js dependencies. To do so it
|
||||
# creates a list of all the packages available and then loops through the
|
||||
# package.json files in the various repos, upgrading the dependecies as found.
|
||||
#
|
||||
# In this upgrading step is uses the local all-deps.js script
|
||||
#
|
||||
# In addition it also cleans old stale local branches, and performs an overall
|
||||
# dedupe - all maintenence operations.
|
||||
|
||||
DIRECTORIES=( "dev" "wasm" "common" "api" "docs" "ui" "phishing" "extension" "tools" "apps" )
|
||||
|
||||
for REPO in "${DIRECTORIES[@]}"; do
|
||||
if [ "$REPO" != "" ] && [ -d "./$REPO/.git" ]; then
|
||||
echo ""
|
||||
echo "*** Removing branches in $REPO"
|
||||
|
||||
cd $REPO
|
||||
|
||||
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
||||
BRANCHES=( $(git branch | awk -F ' +' '! /\(no branch\)/ {print $2}') )
|
||||
|
||||
if [ "$CURRENT" = "master" ]; then
|
||||
git fetch
|
||||
git pull
|
||||
else
|
||||
echo "$CURRENT !== master"
|
||||
fi
|
||||
|
||||
for BRANCH in "${BRANCHES[@]}"; do
|
||||
if [ "$BRANCH" != "$CURRENT" ] && [ "$BRANCH" != "master" ]; then
|
||||
git branch -d -f $BRANCH
|
||||
fi
|
||||
done
|
||||
|
||||
git prune
|
||||
git gc
|
||||
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "*** Updating inter-package-deps"
|
||||
|
||||
./dev/scripts/all-deps.js
|
||||
|
||||
echo ""
|
||||
echo "*** Installing updated packages"
|
||||
|
||||
for REPO in "${DIRECTORIES[@]}"; do
|
||||
if [ "$REPO" != "" ] && [ -d "./$REPO/.git" ]; then
|
||||
echo ""
|
||||
cd $REPO
|
||||
|
||||
DETACHED=$(git status | grep "HEAD detached")
|
||||
|
||||
if [ "$DETACHED" != "" ]; then
|
||||
echo "*** Resetting $REPO"
|
||||
|
||||
git reset --hard
|
||||
else
|
||||
echo "*** Installing $REPO"
|
||||
|
||||
yarn install
|
||||
yarn dedupe
|
||||
fi
|
||||
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Pezkuwi Dev Rebrand Script
|
||||
# Converts @polkadot/* packages to @pezkuwi/*
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔄 Starting Pezkuwi Dev rebrand..."
|
||||
|
||||
# 1. Update all package.json files
|
||||
echo "📦 Updating package.json files..."
|
||||
find . -type f -name "package.json" -not -path "*/node_modules/*" -exec sed -i 's/@polkadot/@pezkuwi/g' {} +
|
||||
find . -type f -name "package.json" -not -path "*/node_modules/*" -exec sed -i 's/polkadot-js\/common/pezkuwichain\/pezkuwi-dev/g' {} +
|
||||
find . -type f -name "package.json" -not -path "*/node_modules/*" -exec sed -i 's/polkadot-js/pezkuwi/g' {} +
|
||||
|
||||
# 2. Update TypeScript imports
|
||||
echo "📝 Updating TypeScript imports..."
|
||||
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -not -path "*/node_modules/*" -not -path "*/build/*" -exec sed -i 's/from "@polkadot/from "@pezkuwi/g' {} +
|
||||
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -not -path "*/node_modules/*" -not -path "*/build/*" -exec sed -i "s/from '@polkadot/from '@pezkuwi/g" {} +
|
||||
find . -type f \( -name "*.ts" -o -name "*.tsx" \) -not -path "*/node_modules/*" -not -path "*/build/*" -exec sed -i 's/import("@polkadot/import("@pezkuwi/g' {} +
|
||||
|
||||
# 3. Update JavaScript files
|
||||
echo "📜 Updating JavaScript files..."
|
||||
find . -type f \( -name "*.js" -o -name "*.cjs" -o -name "*.mjs" \) -not -path "*/node_modules/*" -not -path "*/build/*" -exec sed -i 's/from "@polkadot/from "@pezkuwi/g' {} +
|
||||
find . -type f \( -name "*.js" -o -name "*.cjs" -o -name "*.mjs" \) -not -path "*/node_modules/*" -not -path "*/build/*" -exec sed -i "s/from '@polkadot/from '@pezkuwi/g" {} +
|
||||
|
||||
# 4. Update README and docs
|
||||
echo "📚 Updating documentation..."
|
||||
find . -type f -name "*.md" -not -path "*/node_modules/*" -exec sed -i 's/@polkadot/@pezkuwi/g' {} +
|
||||
find . -type f -name "*.md" -not -path "*/node_modules/*" -exec sed -i 's/polkadot-js\/common/pezkuwichain\/pezkuwi-dev/g' {} +
|
||||
find . -type f -name "*.md" -not -path "*/node_modules/*" -exec sed -i 's/polkadot\.js/pezkuwi.js/g' {} +
|
||||
find . -type f -name "*.md" -not -path "*/node_modules/*" -exec sed -i 's/Polkadot\.js/Pezkuwi.js/g' {} +
|
||||
find . -type f -name "*.md" -not -path "*/node_modules/*" -exec sed -i 's/Polkadot/Pezkuwi/g' {} +
|
||||
|
||||
# 5. Update config files
|
||||
echo "⚙️ Updating config files..."
|
||||
sed -i 's/@polkadot/@pezkuwi/g' tsconfig*.json 2>/dev/null || true
|
||||
sed -i 's/@polkadot/@pezkuwi/g' eslint.config.js 2>/dev/null || true
|
||||
sed -i 's/@polkadot/@pezkuwi/g' rollup.config.js 2>/dev/null || true
|
||||
|
||||
# 6. Update GitHub workflows
|
||||
echo "🔧 Updating GitHub workflows..."
|
||||
find .github -type f -name "*.yml" -exec sed -i 's/polkadot-js\/common/pezkuwichain\/pezkuwi-dev/g' {} + 2>/dev/null || true
|
||||
|
||||
# 7. Update author info
|
||||
echo "👤 Updating author info..."
|
||||
sed -i 's/"author": "Jaco Greeff.*"/"author": "Pezkuwi Team <team@pezkuwichain.io>"/g' package.json
|
||||
sed -i 's/"homepage":.*/"homepage": "https:\/\/github.com\/pezkuwichain\/pezkuwi-dev#readme",/g' package.json
|
||||
|
||||
echo "✅ Rebrand complete!"
|
||||
echo ""
|
||||
echo "📊 Summary:"
|
||||
echo " - Package namespace: @polkadot → @pezkuwi"
|
||||
echo " - Repository: polkadot-js/common → pezkuwichain/pezkuwi-dev"
|
||||
echo " - Packages: 3 (util, util-crypto, keyring, networks, + 10 helpers)"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Review: git diff"
|
||||
echo " 2. Commit: git add . && git commit -m 'Rebrand to Pezkuwi Dev'"
|
||||
echo " 3. Create GitHub repo and push"
|
||||
Reference in New Issue
Block a user