2023-03-31 17:22:37 +02:00
import { spawn } from 'node:child_process'
import { resolve , relative } from 'node:path'
const rootDir = process . cwd ( )
2023-07-26 11:15:48 +02:00
2023-03-31 17:22:37 +02:00
const packages = [
'orama' ,
'plugin-astro' ,
'plugin-data-persistence' ,
'plugin-docusaurus' ,
2023-11-16 21:01:16 +01:00
'plugin-docusaurus-v3' ,
2023-12-06 22:08:02 +01:00
'plugin-vitepress' ,
2023-03-31 17:22:37 +02:00
'plugin-match-highlight' ,
2023-07-26 11:15:48 +02:00
'plugin-nextra' ,
2023-03-31 17:22:37 +02:00
'plugin-parsedoc' ,
2024-03-08 13:35:10 -08:00
'plugin-analytics' ,
2024-01-16 17:08:05 +01:00
'plugin-secure-proxy' ,
2023-07-26 11:15:48 +02:00
'stemmers' ,
2024-02-13 16:15:05 +01:00
'stopwords' ,
'tokenizers'
2023-03-31 17:22:37 +02:00
]
function step ( message ) {
console . log ( ` \x 1b[1m \x 1b[32m--- ${ message } \x 1b[0m ` )
}
async function execute ( command , args , cwd ) {
if ( ! Array . isArray ( args ) ) {
args = [ args ]
}
let success , fail
const promise = new Promise ( ( resolve , reject ) => {
success = resolve
fail = reject
} )
if ( cwd ) {
step ( ` Executing: ${ command } ${ args . join ( ' ' ) } (from folder ${ relative ( rootDir , cwd ) } ) ... ` )
} else {
step ( ` Executing: ${ command } ${ args . join ( ' ' ) } ... ` )
}
const childProcess = spawn ( command , args , { cwd , stdio : 'inherit' } )
childProcess . on ( 'close' , code => {
if ( code !== 0 ) {
fail ( new Error ( ` Process failed with status code ${ code } . ` ) )
}
success ( )
} )
return promise
}
async function main ( ) {
2024-03-12 09:58:48 -07:00
process . env . BUILD _TOKENIZERS = '1'
2023-07-26 11:21:10 +02:00
await execute ( 'pnpm' , 'build' )
2023-12-04 17:08:09 +01:00
// await execute('pnpm', 'test')
2023-03-31 17:22:37 +02:00
for ( const pkg of packages ) {
const cwd = resolve ( rootDir , 'packages' , pkg )
await execute ( 'pnpm' , [ 'publish' ] , cwd )
}
}
await main ( )