Hey! Anyone here knows what’s the url used by the CLI to link apps?
I was having a look over the project in GitHub, but it’s kinda confusing, and I wasn’t able to find the final url, I will link some urls, and prints to help, or use as a hint for anyone that knows about!
import Configstore from 'configstore'
import { dirname } from 'path'
import { name as pkgName } from '../../package.json'
const conf = new Configstore(pkgName)
export const configDir = dirname(conf.path)
export enum Environment {
Production = 'prod',
}
export const CLUSTER_DEFAULT_VALUE = ''
export const ENV_DEFAULT_VALUE = Environment.Production
export const saveEnvironment = (env: Environment) => conf.set('env', env)
export const saveStickyHost = (appName: string, stickyHost: string) =>
This file has been truncated. show original
Configs
import { flags as oclifFlags } from '@oclif/command'
import { CustomCommand } from '../api/oclif/CustomCommand'
import { appLink } from '../modules/apps/link'
import { ColorifyConstants } from '../api/constants/Colors'
export default class Link extends CustomCommand {
static description = `Syncs the app in the current directory with the ${ColorifyConstants.ID(
'development workspace'
)} in use.`
static examples = [`${ColorifyConstants.COMMAND_OR_VTEX_REF('vtex link')} -a youraccount -w yourworkspace`]
static flags = {
...CustomCommand.globalFlags,
account: oclifFlags.string({
char: 'a',
description: `Starts a development session in the specified ${ColorifyConstants.ID(
'account'
This file has been truncated. show original
Link command
import { Builder } from '../../api/clients/IOClients/apps/Builder'
import {
ChangeSizeLimitError,
ChangeToSend,
ProjectSizeLimitError,
ProjectUploader,
} from '../../api/modules/apps/ProjectUploader'
import {
checkBuilderHubMessage,
showBuilderHubMessage,
continueAfterReactTermsAndConditions,
validateAppAction,
} from '../../api/modules/utils'
import { createFlowIssueError } from '../../api/error/utils'
import { concat, isEmpty, map, pipe, prop } from 'ramda'
import { createInterface } from 'readline'
import { createPathToFileObject } from '../../api/files/ProjectFilesManager'
import { default as setup } from '../setup'
import { fixPinnedDependencies, PinnedDeps } from '../../api/pinnedDependencies'
import { formatNano, runYarnIfPathExists } from '../utils'
This file has been truncated. show original
Link App
import { Builder, RequestParams } from '../../clients/IOClients/apps/Builder'
import { getSavedOrMostAvailableHost } from '../../../host'
import { Readable } from 'stream'
import { ZlibOptions } from 'zlib'
import archiver from 'archiver'
import chalk from 'chalk'
import getStream from 'get-stream'
import logger from '../../logger'
const MB = 1000000
export interface FileToSend {
path: string
content: string | Readable | Buffer | NodeJS.ReadableStream
byteSize: number
}
export type ChangeToSend = FileToSend
interface PrepareRequest {
This file has been truncated. show original
Uploader
And finally:
public testApp = (
app: string,
zipFile: Buffer,
stickyOptions: StickyOptions = { sticky: true },
params: RequestParams = {}
) => {
return this.sendZipFile(routes.test(app), app, zipFile, stickyOptions, params)
}
public linkApp = (
app: string,
linkID: string,
zipFile: Buffer,
stickyOptions: StickyOptions = { sticky: true },
params: RequestParams = {}
) => {
return this.sendZipFile(routes.link(app), app, zipFile, stickyOptions, params, { [Headers.VTEX_LINK_ID]: linkID })
}
public relinkApp = async (app: string, changes: ChangeToSend[], linkID: string, params: RequestParams = {}) => {
linkApp function