mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-10 11:47:42 +02:00
Merge branch 'develop' of https://github.com/hcengineering/platform into win-support
This commit is contained in:
+46
-16
@@ -1,35 +1,51 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const execSync = require('child_process').execSync
|
||||
const repo = '@hcengineering'
|
||||
|
||||
const packages = {}
|
||||
const pathes = {}
|
||||
const jsons = {}
|
||||
const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim()
|
||||
|
||||
function fillPackages (config) {
|
||||
for (const package of config.projects) {
|
||||
if (!package.name.startsWith(repo)) continue
|
||||
for (const project of config.projects) {
|
||||
const packageName = project.name ?? project.packageName
|
||||
if (typeof packageName !== 'string' || !packageName.startsWith(repo)) continue
|
||||
const projectPath = project.path ?? project.projectFolder ?? path.relative(repoRoot, project.fullPath ?? '')
|
||||
if (typeof projectPath !== 'string' || projectPath.length === 0) continue
|
||||
const fullProjectPath = path.resolve(repoRoot, projectPath)
|
||||
|
||||
packages[package.name] = {
|
||||
version: package.version,
|
||||
path: package.path
|
||||
packages[packageName] = {
|
||||
version: project.version,
|
||||
path: fullProjectPath
|
||||
}
|
||||
pathes[package.path] = package.name
|
||||
pathes[fullProjectPath] = packageName
|
||||
|
||||
const file = package.path + '/package.json'
|
||||
const raw = fs.readFileSync(file)
|
||||
jsons[package.name] = JSON.parse(raw)
|
||||
const file = path.join(fullProjectPath, 'package.json')
|
||||
if (!fs.existsSync(file)) {
|
||||
console.log('skip, package.json not found:', file)
|
||||
continue
|
||||
}
|
||||
|
||||
const raw = fs.readFileSync(file)
|
||||
jsons[packageName] = JSON.parse(raw)
|
||||
}
|
||||
}
|
||||
|
||||
function bumpPackage (name, newVersion) {
|
||||
const json = jsons[name]
|
||||
|
||||
if (json === undefined) return
|
||||
json.version = newVersion
|
||||
if (typeof json.dependencies === 'object') {
|
||||
for (const [dependency] of Object.entries(json.dependencies)) {
|
||||
const depTypes = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']
|
||||
for (const depType of depTypes) {
|
||||
if (typeof json[depType] !== 'object') continue
|
||||
for (const [dependency, currentVersion] of Object.entries(json[depType])) {
|
||||
if (packages[dependency] !== undefined) {
|
||||
json.dependencies[dependency] = `^${newVersion}`
|
||||
json[depType][dependency] = String(currentVersion).startsWith('workspace:')
|
||||
? `workspace:^${newVersion}`
|
||||
: `^${newVersion}`
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +60,7 @@ function publish (name) {
|
||||
const package = packages[name]
|
||||
try {
|
||||
console.log('publishing', name)
|
||||
execSync(`cd ${package.path} && npm publish && cd ../..`, { encoding: 'utf-8' })
|
||||
execSync('npm publish', { encoding: 'utf-8', cwd: package.path })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
@@ -54,7 +70,7 @@ function fix (name) {
|
||||
const package = packages[name]
|
||||
try {
|
||||
console.log('fixing', name)
|
||||
execSync(`cd ${package.path} && npm pkg fix && cd ../..`, { encoding: 'utf-8' })
|
||||
execSync('npm pkg fix', { encoding: 'utf-8', cwd: package.path })
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
@@ -78,7 +94,20 @@ function main () {
|
||||
|
||||
console.log('bump version ...', version)
|
||||
|
||||
const config = JSON.parse(execSync('rush list -p --json', { encoding: 'utf-8' }))
|
||||
const output = execSync('node common/scripts/install-run-rush.js list -p --json', { encoding: 'utf-8', cwd: repoRoot })
|
||||
const lines = output.split('\n')
|
||||
let jsonStart = -1
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].trim().startsWith('{')) {
|
||||
jsonStart = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (jsonStart === -1) {
|
||||
console.error('Could not find JSON output from rush list')
|
||||
process.exit(1)
|
||||
}
|
||||
const config = JSON.parse(lines.slice(jsonStart).join('\n'))
|
||||
|
||||
fillPackages(config)
|
||||
|
||||
@@ -89,7 +118,8 @@ function main () {
|
||||
|
||||
for (const packageName of packageNames) {
|
||||
const package = packages[packageName]
|
||||
const file = package.path + '/package.json'
|
||||
if (jsons[packageName] === undefined) continue
|
||||
const file = path.join(package.path, 'package.json')
|
||||
const res = JSON.stringify(jsons[packageName], undefined, 2)
|
||||
fs.writeFileSync(file, res + '\n')
|
||||
}
|
||||
|
||||
+62
-31
@@ -1,31 +1,62 @@
|
||||
rush docker:build -p 20 \
|
||||
--to @hcengineering/pod-server \
|
||||
--to @hcengineering/pod-front \
|
||||
--to @hcengineering/prod \
|
||||
--to @hcengineering/pod-account \
|
||||
--to @hcengineering/pod-workspace \
|
||||
--to @hcengineering/pod-collaborator \
|
||||
--to @hcengineering/tool \
|
||||
--to @hcengineering/pod-print \
|
||||
--to @hcengineering/pod-sign \
|
||||
--to @hcengineering/pod-analytics-collector \
|
||||
--to @hcengineering/rekoni-service \
|
||||
--to @hcengineering/pod-ai-bot \
|
||||
--to @hcengineering/import-tool \
|
||||
--to @hcengineering/pod-stats \
|
||||
--to @hcengineering/pod-fulltext \
|
||||
--to @hcengineering/pod-love \
|
||||
--to @hcengineering/pod-mail \
|
||||
--to @hcengineering/pod-datalake \
|
||||
--to @hcengineering/pod-mail-worker \
|
||||
--to @hcengineering/pod-export \
|
||||
--to @hcengineering/pod-media \
|
||||
--to @hcengineering/pod-preview \
|
||||
--to @hcengineering/pod-link-preview \
|
||||
--to @hcengineering/pod-external \
|
||||
--to @hcengineering/pod-backup \
|
||||
--to @hcengineering/backup-api-pod \
|
||||
--to @hcengineering/pod-billing \
|
||||
--to @hcengineering/pod-process \
|
||||
--to @hcengineering/pod-rating \
|
||||
--to @hcengineering/pod-payment
|
||||
#!/bin/bash
|
||||
# Supports minified mode for resource-constrained dev machines:
|
||||
# rush docker --minified or rush docker:min
|
||||
|
||||
MINIFIED=false
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "--minified" ]; then
|
||||
MINIFIED=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$MINIFIED" = true ]; then
|
||||
echo "Building minified docker images (excluding optional services)..."
|
||||
rush docker:build -p 20 \
|
||||
--to @hcengineering/pod-server \
|
||||
--to @hcengineering/pod-front \
|
||||
--to @hcengineering/prod \
|
||||
--to @hcengineering/pod-account \
|
||||
--to @hcengineering/pod-workspace \
|
||||
--to @hcengineering/pod-collaborator \
|
||||
--to @hcengineering/tool \
|
||||
--to @hcengineering/pod-analytics-collector \
|
||||
--to @hcengineering/rekoni-service \
|
||||
--to @hcengineering/pod-datalake \
|
||||
--to @hcengineering/pod-export \
|
||||
--to @hcengineering/pod-media \
|
||||
--to @hcengineering/pod-external
|
||||
else
|
||||
rush docker:build -p 20 \
|
||||
--to @hcengineering/pod-server \
|
||||
--to @hcengineering/pod-front \
|
||||
--to @hcengineering/prod \
|
||||
--to @hcengineering/pod-account \
|
||||
--to @hcengineering/pod-workspace \
|
||||
--to @hcengineering/pod-collaborator \
|
||||
--to @hcengineering/tool \
|
||||
--to @hcengineering/pod-print \
|
||||
--to @hcengineering/pod-sign \
|
||||
--to @hcengineering/pod-analytics-collector \
|
||||
--to @hcengineering/rekoni-service \
|
||||
--to @hcengineering/pod-ai-bot \
|
||||
--to @hcengineering/import-tool \
|
||||
--to @hcengineering/pod-stats \
|
||||
--to @hcengineering/pod-fulltext \
|
||||
--to @hcengineering/pod-love \
|
||||
--to @hcengineering/pod-mail \
|
||||
--to @hcengineering/pod-datalake \
|
||||
--to @hcengineering/pod-mail-worker \
|
||||
--to @hcengineering/pod-export \
|
||||
--to @hcengineering/pod-media \
|
||||
--to @hcengineering/pod-preview \
|
||||
--to @hcengineering/pod-link-preview \
|
||||
--to @hcengineering/pod-external \
|
||||
--to @hcengineering/pod-backup \
|
||||
--to @hcengineering/backup-api-pod \
|
||||
--to @hcengineering/pod-billing \
|
||||
--to @hcengineering/pod-process \
|
||||
--to @hcengineering/pod-rating \
|
||||
--to @hcengineering/pod-payment \
|
||||
--to @hcengineering/pod-worker
|
||||
fi
|
||||
|
||||
@@ -43,8 +43,24 @@ function checkPackageExists(packageName, version) {
|
||||
*/
|
||||
function getPublishablePackages(includePattern) {
|
||||
try {
|
||||
const output = execSync('rush list -p --json', { encoding: 'utf-8' })
|
||||
const config = JSON.parse(output)
|
||||
const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim()
|
||||
const output = execSync('node common/scripts/install-run-rush.js list -p --json', {
|
||||
encoding: 'utf-8',
|
||||
cwd: repoRoot
|
||||
})
|
||||
const lines = output.split('\n')
|
||||
let jsonStart = -1
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].trim().startsWith('{')) {
|
||||
jsonStart = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if (jsonStart === -1) {
|
||||
console.error('Could not find JSON output from rush list')
|
||||
return []
|
||||
}
|
||||
const config = JSON.parse(lines.slice(jsonStart).join('\n'))
|
||||
|
||||
return config.projects.filter((project) => {
|
||||
// Check if package should be published according to rush.json
|
||||
|
||||
Reference in New Issue
Block a user