@mintlify/previewing 4.0.528 → 4.0.530

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ vi.mock('../util.js', () => ({
30
30
  stopAndPersist: vi.fn(),
31
31
  }),
32
32
  restoreMintlifyLast: vi.fn().mockReturnValue(undefined),
33
+ getTarUrl: vi.fn().mockReturnValue('https://asdfghjkl.cloudfront.net/mint-1.0.1.tar.gz'),
33
34
  }));
34
35
  vi.mock('node:stream/promises', () => ({
35
36
  pipeline: vi.fn(),
@@ -55,7 +56,7 @@ vi.mock('tar', () => {
55
56
  const buildLoggerMock = vi.mocked(utils.buildLogger);
56
57
  const restoreMintlifyLastMock = vi.mocked(utils.restoreMintlifyLast);
57
58
  const pipelineMock = vi.mocked(pipeline);
58
- const GET_TAR_URL_SPY = vi.spyOn(constants, 'GET_TAR_URL');
59
+ const getTarUrlMock = vi.mocked(utils.getTarUrl);
59
60
  const writeFileSyncMock = vi.mocked(fse.writeFileSync);
60
61
  const tarMock = vi.mocked(tar);
61
62
  const existsSyncMock = vi.mocked(fse.existsSync);
@@ -83,7 +84,7 @@ describe('downloadTargetMint', () => {
83
84
  });
84
85
  expect(fse.ensureDirSync).toHaveBeenCalledWith(constants.DOT_MINTLIFY);
85
86
  // Verify download and extraction
86
- expect(GET_TAR_URL_SPY).toHaveBeenCalledWith(targetMintVersion);
87
+ expect(getTarUrlMock).toHaveBeenCalledWith(targetMintVersion);
87
88
  expect(pipelineMock).toHaveBeenCalled();
88
89
  expect(tarMock.x).toHaveBeenCalled();
89
90
  expect(logger.text).toBe('Extracting Mintlify framework...');
@@ -111,7 +112,7 @@ describe('downloadTargetMint', () => {
111
112
  });
112
113
  expect(fse.ensureDirSync).toHaveBeenCalledWith(constants.DOT_MINTLIFY);
113
114
  // Verify download and extraction
114
- expect(GET_TAR_URL_SPY).toHaveBeenCalledWith(clientVersion);
115
+ expect(getTarUrlMock).toHaveBeenCalledWith(clientVersion);
115
116
  expect(pipelineMock).toHaveBeenCalled();
116
117
  expect(tarMock.x).toHaveBeenCalled();
117
118
  expect(logger.text).toBe('Extracting Mintlify framework...');
@@ -10,8 +10,8 @@ export declare const NEXT_ROUTER_SERVER_PATH: string;
10
10
  export declare const NEXT_CONFIG_PATH: string;
11
11
  export declare const NEXT_PUBLIC_PATH: string;
12
12
  export declare const NEXT_PROPS_PATH: string;
13
- export declare const TARGET_MINT_VERSION_URL = "https://mint-releases.b-cdn.net/mint-version.txt";
14
- export declare const GET_TAR_URL: (version: string) => string;
13
+ export declare const MINT_CLIENT_RELEASES_CLOUDFRONT_URL = "https://d1ctpt7j8wusba.cloudfront.net";
14
+ export declare const TARGET_MINT_VERSION_URL = "https://d1ctpt7j8wusba.cloudfront.net/mint-version.txt";
15
15
  export declare const TAR_PATH: string;
16
16
  export declare const CMD_EXEC_PATH: string;
17
17
  export declare const SUPPORTED_MEDIA_EXTENSIONS: string[];
package/dist/constants.js CHANGED
@@ -15,8 +15,8 @@ export const NEXT_ROUTER_SERVER_PATH = path.join(NEXT_DIST_SERVER_PATH, 'lib', '
15
15
  export const NEXT_CONFIG_PATH = path.join(CLIENT_PATH, '.next', 'required-server-files.json');
16
16
  export const NEXT_PUBLIC_PATH = path.join(CLIENT_PATH, 'public');
17
17
  export const NEXT_PROPS_PATH = path.join(CLIENT_PATH, 'src', '_props');
18
- export const TARGET_MINT_VERSION_URL = 'https://mint-releases.b-cdn.net/mint-version.txt';
19
- export const GET_TAR_URL = (version) => `https://mint-releases.b-cdn.net/mint-${version}.tar.gz`;
18
+ export const MINT_CLIENT_RELEASES_CLOUDFRONT_URL = 'https://d1ctpt7j8wusba.cloudfront.net';
19
+ export const TARGET_MINT_VERSION_URL = `${MINT_CLIENT_RELEASES_CLOUDFRONT_URL}/mint-version.txt`;
20
20
  export const TAR_PATH = path.join(DOT_MINTLIFY, `mint.tar.gz`);
21
21
  // command execution location
22
22
  export const CMD_EXEC_PATH = process.cwd();
@@ -3,8 +3,8 @@ import got from 'got';
3
3
  import isOnline from 'is-online';
4
4
  import { pipeline } from 'node:stream/promises';
5
5
  import tar from 'tar';
6
- import { DOT_MINTLIFY, DOT_MINTLIFY_LAST, VERSION_PATH, TAR_PATH, TARGET_MINT_VERSION_URL, GET_TAR_URL, } from '../constants.js';
7
- import { restoreMintlifyLast } from '../util.js';
6
+ import { DOT_MINTLIFY, DOT_MINTLIFY_LAST, VERSION_PATH, TAR_PATH, TARGET_MINT_VERSION_URL, } from '../constants.js';
7
+ import { restoreMintlifyLast, getTarUrl } from '../util.js';
8
8
  export const getTargetMintVersion = async (logger) => {
9
9
  const hasInternet = await isOnline();
10
10
  if (!hasInternet) {
@@ -25,7 +25,7 @@ export const downloadTargetMint = async ({ logger, targetVersion, existingVersio
25
25
  }
26
26
  fse.ensureDirSync(DOT_MINTLIFY);
27
27
  logger.text = 'Downloading Mintlify framework...';
28
- const tarUrl = GET_TAR_URL(targetVersion);
28
+ const tarUrl = getTarUrl(targetVersion);
29
29
  let currentVersion = targetVersion.trim();
30
30
  try {
31
31
  await pipeline(got.stream(tarUrl), fse.createWriteStream(TAR_PATH));