import { ModuleRef } from '@nestjs/core';import { assignAllProductsToChannel, assignCustomersToChannel, assignOrdersToChannel,} from '@pinelab/vendure-scripts';import { ChannelService, Injector, bootstrap } from '@vendure/core';import { getSuperadminContext } from '@vendure/testing/lib/utils/get-superadmin-context';// Load env before configrequire('dotenv').config({ path: process.env.ENV_FILE });import('../src/vendure-config').then(async ({ config }) => { // Bootstrap Vendure const app = await bootstrap(config); const sourceChannel = await app.get(ChannelService).getDefaultChannel(); const targetChannel = await app .get(ChannelService) .getChannelFromToken('your-channel-token'); const injector = new Injector(app.get(ModuleRef)); const ctx = await getSuperadminContext(app); // Assign all products from Source to Target channel await assignAllProductsToChannel( sourceChannel.id, targetChannel.id, injector, ctx ); // Assign all Customers from Source to Target channel await assignCustomersToChannel(defaultChannelId, newChannelId, injector, ctx); // Assign all orders from Source to Target channel await assignOrdersToChannel(defaultChannelId, newChannelId, injector, ctx); await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait for any background tasks or jobs process.exit(0);});