Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,465 changes: 751 additions & 714 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,39 @@
// // "includeEmailInChangeFile": true
// },
//
// {
// /**
// * (Required) Indicates the kind of version policy being defined ("lockStepVersion" or "individualVersion").
// *
// * The "individualVersion" mode specifies that the projects will use "individual versioning".
// * This is the typical NPM model where each package has an independent version number
// * and CHANGELOG.md file. Although a single CI definition is responsible for publishing the
// * packages, they otherwise don't have any special relationship. The version bumping will
// * depend on how developers answer the "rush change" questions for each package that
// * is changed.
// */
// "definitionName": "individualVersion",
//
// "policyName": "MyRandomLibraries",
//
// /**
// * (Optional) This can be used to enforce that all packages in the set must share a common
// * major version number, e.g. because they are from the same major release branch.
// * It can also be used to discourage people from accidentally making "MAJOR" SemVer changes
// * inappropriately. The minor/patch version parts will be bumped independently according
// * to the types of changes made to each project, according to the "rush change" command.
// */
// "lockedMajor": 3,
//
// /**
// * (Optional) When publishing is managed by Rush, by default the "rush change" command will
// * request changes for any projects that are modified by a pull request. These change entries
// * will produce a CHANGELOG.md file. If you author your CHANGELOG.md manually or announce updates
// * in some other way, set "exemptFromRushChange" to true to tell "rush change" to ignore the projects
// * belonging to this version policy.
// */
// "exemptFromRushChange": false,
//
// // "includeEmailInChangeFile": true
// }
{
/**
* (Required) Indicates the kind of version policy being defined ("lockStepVersion" or "individualVersion").
*
* The "individualVersion" mode specifies that the projects will use "individual versioning".
* This is the typical NPM model where each package has an independent version number
* and CHANGELOG.md file. Although a single CI definition is responsible for publishing the
* packages, they otherwise don't have any special relationship. The version bumping will
* depend on how developers answer the "rush change" questions for each package that
* is changed.
*/
"definitionName": "individualVersion",

"policyName": "MyRandomLibraries",

/**
* (Optional) This can be used to enforce that all packages in the set must share a common
* major version number, e.g. because they are from the same major release branch.
* It can also be used to discourage people from accidentally making "MAJOR" SemVer changes
* inappropriately. The minor/patch version parts will be bumped independently according
* to the types of changes made to each project, according to the "rush change" command.
*/
"lockedMajor": 3,

/**
* (Optional) When publishing is managed by Rush, by default the "rush change" command will
* request changes for any projects that are modified by a pull request. These change entries
* will produce a CHANGELOG.md file. If you author your CHANGELOG.md manually or announce updates
* in some other way, set "exemptFromRushChange" to true to tell "rush change" to ignore the projects
* belonging to this version policy.
*/
"exemptFromRushChange": false

// "includeEmailInChangeFile": true
}
]
3 changes: 2 additions & 1 deletion common/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@hcengineering/scripts",
"version": "0.7.0",
"scripts": {
"format": "echo \"No format specified\""
"format": "echo \"No format specified\"",
"safe-publish": "node safe-publish.js"
},
"devDependencies": {
"esbuild": "^0.25.9",
Expand Down
158 changes: 158 additions & 0 deletions common/scripts/safe-publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#!/usr/bin/env node

/**
* Safe publish script that skips packages that are already published
* Usage: node safe-publish.js [--include <package-name>]
*/

const { execSync, spawnSync } = require('child_process')
const https = require('https')
const http = require('http')

/**
* Check if a package version exists on npm registry
*/
function checkPackageExists(packageName, version) {
return new Promise((resolve) => {
const registryUrl = process.env.NPM_REGISTRY || 'https://registry.npmjs.org'
const url = `${registryUrl}/${encodeURIComponent(packageName)}/${version}`

const client = url.startsWith('https:') ? https : http

const req = client.get(url, (res) => {
if (res.statusCode === 200) {
resolve(true) // Package version exists
} else {
resolve(false) // Package version doesn't exist
}
})

req.on('error', () => {
resolve(false) // Assume doesn't exist on error
})

req.setTimeout(5000, () => {
req.destroy()
resolve(false)
})
})
}

/**
* Get list of packages that should be published from rush
*/
function getPublishablePackages(includePattern) {
try {
const output = execSync('rush list -p --json', { encoding: 'utf-8' })
const config = JSON.parse(output)

return config.projects.filter((project) => {
// Check if package should be published according to rush.json
const shouldPublish = project.shouldPublish === true

// Skip if no package name
if (!project.name) {
return false
}

// If includePattern is specified, filter by it
if (includePattern && !project.name.includes(includePattern)) {
return false
}

return shouldPublish && project.name.startsWith('@hcengineering')
})
} catch (err) {
console.error('Error getting package list:', err.message)
return []
}
}

/**
* Publish a single package
*/
function publishPackage(packagePath, packageName) {
try {
console.log(`Publishing ${packageName}...`)
execSync('npm publish', {
cwd: packagePath,
stdio: 'inherit',
encoding: 'utf-8'
})
console.log(`✓ Successfully published ${packageName}`)
return true
} catch (err) {
console.error(`✗ Failed to publish ${packageName}:`, err.message)
return false
}
}

/**
* Main function
*/
async function main() {
const args = process.argv.slice(2)
let includePattern = null

// Parse arguments
for (let i = 0; i < args.length; i++) {
if (args[i] === '--include' && i + 1 < args.length) {
includePattern = args[i + 1]
i++
}
}

console.log('Fetching publishable packages...')
const packages = getPublishablePackages(includePattern)

if (packages.length === 0) {
console.log('No packages found to publish')
return
}

console.log(`Found ${packages.length} package(s) to check`)
console.log('='.repeat(80))

let published = 0
let skipped = 0
let failed = 0

for (const pkg of packages) {
const packageName = pkg.name
const version = pkg.version
const packagePath = pkg.fullPath

console.log(`\nChecking ${packageName}@${version}...`)

const exists = await checkPackageExists(packageName, version)

if (exists) {
console.log(`⊘ Skipping ${packageName}@${version} (already published)`)
skipped++
} else {
console.log(`→ ${packageName}@${version} not published, publishing now...`)
const success = publishPackage(packagePath, packageName)
if (success) {
published++
} else {
failed++
}
}
}

console.log('\n' + '='.repeat(80))
console.log('Summary:')
console.log(` Published: ${published}`)
console.log(` Skipped: ${skipped}`)
console.log(` Failed: ${failed}`)
console.log('='.repeat(80))

if (failed > 0) {
process.exit(1)
}
}

main().catch((err) => {
console.error('Error:', err)
process.exit(1)
})
4 changes: 4 additions & 0 deletions plugins/guest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@
"@hcengineering/core": "^0.7.3",
"@hcengineering/platform": "^0.7.3",
"@hcengineering/ui": "^0.7.0"
},
"repository": "https://github.com/hcengineering/platform",
"publishConfig": {
"access": "public"
}
}
2 changes: 1 addition & 1 deletion pods/fulltext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@hcengineering/server-indexer": "^0.7.0",
"@hcengineering/elastic": "^0.7.0",
"@hcengineering/server-collaboration": "^0.7.0",
"@hcengineering/middleware": "^0.7.0",
"@hcengineering/middleware": "^0.7.1",
"@hcengineering/server-client": "^0.7.0",
"@hcengineering/server-storage": "^0.7.0",
"@hcengineering/postgres": "^0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion pods/fulltext/src/__tests__/indexing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { dbConfig, dbUrl, elasticIndexName, model, prepare, preparePipeline } fr
prepare()
jest.mock('franc-min', () => ({ franc: () => 'en' }), { virtual: true })

jest.setTimeout(500000)
jest.setTimeout(30000)

class TestWorkspaceManager extends WorkspaceManager {
public async getWorkspaceInfo (ctx: MeasureContext, token?: string): Promise<WorkspaceInfoWithStatus | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions pods/fulltext/src/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/unbound-method */
import { Api as CommunicationApi } from '@hcengineering/communication-server'
import core, {
type Class,
type Doc,
Expand All @@ -15,6 +16,7 @@ import core, {
WorkspaceEvent,
type WorkspaceIds
} from '@hcengineering/core'
import { type HulylakeClient } from '@hcengineering/hulylake-client'
import {
ContextNameMiddleware,
DBAdapterInitMiddleware,
Expand All @@ -38,8 +40,6 @@ import {
import { FullTextIndexPipeline } from '@hcengineering/server-indexer'
import { getConfig } from '@hcengineering/server-pipeline'
import { generateToken } from '@hcengineering/server-token'
import { Api as CommunicationApi } from '@hcengineering/communication-server'
import { type HulylakeClient } from '@hcengineering/hulylake-client'

import { fulltextModelFilter } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion pods/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@hcengineering/contact": "^0.7.0",
"@hcengineering/core": "^0.7.3",
"@hcengineering/kafka": "^0.7.0",
"@hcengineering/middleware": "^0.7.0",
"@hcengineering/middleware": "^0.7.1",
"@hcengineering/minio": "^0.7.0",
"@hcengineering/mongo": "^0.7.0",
"@hcengineering/notification": "^0.7.0",
Expand Down
Loading