Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Seroxdesign committed Jun 24, 2024
1 parent 4a7f4e5 commit e191940
Show file tree
Hide file tree
Showing 67 changed files with 86 additions and 278 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BrowserContext, Page } from '@playwright/test'
import { MetaMask } from '@synthetixio/synpress'
import { defineWalletSetup } from '@synthetixio/synpress-utils'
import { defineWalletSetup } from '@synthetixio/synpress'

const SEED_PHRASE = 'test test test test test test test test test test test junk'
const PASSWORD = 'SynpressIsAwesomeNow!!!'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BrowserContext, Page } from '@playwright/test'
import { MetaMask, getExtensionId } from '@synthetixio/synpress'
import { defineWalletSetup } from '@synthetixio/synpress-utils'
import { defineWalletSetup } from '@synthetixio/synpress'

const SEED_PHRASE = process.env.SEED_PHRASE
const PASSWORD = process.env.WALLET_PASSWORD
Expand Down
2 changes: 0 additions & 2 deletions packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"types:check": "tsc --noEmit"
},
"dependencies": {
"@synthetixio/synpress-utils": "workspace:*",
"axios": "1.6.7",
"chalk": "5.3.0",
"commander": "12.0.0",
Expand All @@ -44,7 +43,6 @@
},
"devDependencies": {
"@synthetixio/synpress-tsconfig": "0.0.1-alpha.7",
"@synthetixio/synpress-utils": "workspace:*",
"@types/archiver": "6.0.2",
"@types/fs-extra": "11.0.4",
"@types/gradient-string": "1.1.5",
Expand Down
10 changes: 3 additions & 7 deletions packages/cache/src/cli/cliEntrypoint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os from 'node:os'
import path from 'node:path'
import { WALLET_SETUP_DIR_NAME } from '@synthetixio/synpress-utils'
import { prepareExtension } from '@synthetixio/synpress-utils'
import { WALLET_SETUP_DIR_NAME } from '../constants'
import { prepareExtension } from '../prepareExtension'
import chalk from 'chalk'
import { Command } from 'commander'
import { rimraf } from 'rimraf'
Expand Down Expand Up @@ -44,13 +44,9 @@ export const cliEntrypoint = async () => {

const flags: CliFlags = program.opts()

if (flags.headless) {
process.env.HEADLESS = true
}

if (flags.debug) {
console.log('[DEBUG] Running with the following options:')
console.log({ cacheDir: walletSetupDir, ...flags, headless: Boolean(process.env.HEADLESS) ?? false }, '\n')
console.log({ cacheDir: walletSetupDir, ...flags, headless: flags.headless ?? false }, '\n')
}

const extensionsToSetup = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/cli/compileWalletSetupFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path'
import { ensureCacheDirExists } from '@synthetixio/synpress-utils'
import { ensureCacheDirExists } from '../ensureCacheDirExists'
import { glob } from 'glob'
import { build } from 'tsup'
import { FIXES_BANNER } from './compilationFixes'
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/cache/src/createCache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getUniqueWalletSetupFunctions } from '@synthetixio/synpress-utils'
import { triggerCacheCreation } from '@synthetixio/synpress-utils'
import { getUniqueWalletSetupFunctions } from './utils/getUniqueWalletSetupFunctions'
import { triggerCacheCreation } from './utils/triggerCacheCreation'

//@TODO: Make it so createCache can handle only one wallet setup function
export async function createCache(walletSetupDirPath: string, downloadExtension: () => Promise<string>, force = false) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path'
import fs from 'fs-extra'
import { CACHE_DIR_NAME } from './constants'
import { CACHE_DIR_NAME } from '../../cache/src/constants'

export function ensureCacheDirExists() {
const cacheDirPath = path.join(process.cwd(), CACHE_DIR_NAME)
Expand Down
18 changes: 18 additions & 0 deletions packages/cache/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
export * from './createCache'
export * from './cli/cliEntrypoint'
export * from '../../cache/src/constants'
export * from './downloadFile'
export * from '../../cache/src/unzipArchive'
export * from './ensureCacheDirExists'
export * from './defineWalletSetup'
export * from '../../cache/src/prepareExtension'
export * from './prepareExtension'
export * from './utils/bytesToMegabytes'
export * from './utils/createCacheForWalletSetupFunction'
export * from './utils/createTempContextDir'
export * from './utils/getUniqueWalletSetupFunctions'
export * from './utils/getWalletSetupFiles'
export * from './utils/getWalletSetupFuncHash'
export * from './utils/importWalletSetupFile'
export * from './utils/isDirEmpty'
export * from './utils/onDownloadProgress'
export * from './utils/triggerCacheCreation'
export * from './utils/removeTempContextDir'
File renamed without changes.
1 change: 0 additions & 1 deletion packages/cache/src/synpress-utils.d.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/cache/test/createCache.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'

import path from 'node:path'
import * as GetUniqueWalletSetupFunctions from '@synthetixio/synpress-utils'
import * as TriggerCacheCreation from '@synthetixio/synpress-utils'
import * as GetUniqueWalletSetupFunctions from '@synthetixio/synpress-cache'
import * as TriggerCacheCreation from '@synthetixio/synpress-cache'
import type { BrowserContext, Page } from 'playwright-core'
import { createCache } from '../src/createCache'

Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/defineWalletSetup.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineWalletSetup } from '@synthetixio/synpress-utils'
import { defineWalletSetup } from "../src"
import { describe, expect, it } from 'vitest'

const PASSWORD = 'Quack Quack! 🦆'
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/downloadFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path'
import { downloadFile } from '@synthetixio/synpress-utils'
import { downloadFile } from '@synthetixio/synpress-cache'
import axios from 'axios'
import { fs, vol } from 'memfs'
import { http, HttpResponse } from 'msw'
Expand Down
4 changes: 2 additions & 2 deletions packages/cache/test/ensureCacheDirExists.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path'
import { CACHE_DIR_NAME } from '@synthetixio/synpress-utils'
import { ensureCacheDirExists } from '@synthetixio/synpress-utils'
import { CACHE_DIR_NAME } from '@synthetixio/synpress-cache'
import { ensureCacheDirExists } from '@synthetixio/synpress-cache'
import fs from 'fs-extra'
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/unzipArchive.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path'
import { unzipArchive } from '@synthetixio/synpress-utils'
import { unzipArchive } from '@synthetixio/synpress-cache'
import { fs, vol } from 'memfs'
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/bytesToMegabytes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bytesToMegabytes } from '@synthetixio/synpress-utils'
import { bytesToMegabytes } from '@synthetixio/synpress-cache'
import { describe, expect, it } from 'vitest'

describe('bytesToMegabytes', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createCacheForWalletSetupFunction } from '@synthetixio/synpress-utils'
import * as WaitForExtensionOnLoadPage from '@synthetixio/synpress-utils'
import { createCacheForWalletSetupFunction } from '@synthetixio/synpress-cache'
import * as WaitForExtensionOnLoadPage from '@synthetixio/synpress-cache'
import { chromium } from 'playwright-core'
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/createTempContextDir.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os from 'node:os'
import path from 'node:path'
import { createTempContextDir } from '@synthetixio/synpress-utils'
import { createTempContextDir } from '@synthetixio/synpress-cache'
import { fs, vol } from 'memfs'
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getUniqueWalletSetupFunctions } from '@synthetixio/synpress-utils'
import { getUniqueWalletSetupFunctions } from '@synthetixio/synpress-cache'
import { afterAll, describe, expect, it, vi } from 'vitest'

vi.mock('../../src/utils/getWalletSetupFiles', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/getWalletSetupFiles.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path'
import { getWalletSetupFiles } from '@synthetixio/synpress-utils'
import { getWalletSetupFiles } from '@synthetixio/synpress-cache'
import { fs, vol } from 'memfs'
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/getWalletSetupFuncHash.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WALLET_SETUP_FUNC_HASH_LENGTH, getWalletSetupFuncHash } from '@synthetixio/synpress-utils'
import { WALLET_SETUP_FUNC_HASH_LENGTH, getWalletSetupFuncHash } from '@synthetixio/synpress-cache'
import { describe, expect, it } from 'vitest'

const EXPECTED_HASH = 'b940c886be3c1a041ddd'
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/importWalletSetupFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { importWalletSetupFile } from '@synthetixio/synpress-utils'
import { importWalletSetupFile } from '@synthetixio/synpress-cache'
import { afterAll, describe, expect, it, vi } from 'vitest'

vi.mock('../../src/ensureCacheDirExists', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/isDirEmpty.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path'
import { isDirEmpty } from '@synthetixio/synpress-utils'
import { isDirEmpty } from '@synthetixio/synpress-cache'
import { fs, vol } from 'memfs'
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion packages/cache/test/utils/removeTempContextDir.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { removeTempContextDir } from '@synthetixio/synpress-utils'
import { removeTempContextDir } from '@synthetixio/synpress-cache'
import { afterAll, describe, expect, it, vi } from 'vitest'

const PATH = 'Happy Quack Path'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { waitForExtensionOnLoadPage } from '@synthetixio/synpress-utils'
import { waitForExtensionOnLoadPage } from '@synthetixio/synpress-cache'
import { errors as playwrightErrors } from 'playwright-core'
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'

Expand Down
10 changes: 0 additions & 10 deletions packages/utils/environment.d.ts

This file was deleted.

59 changes: 0 additions & 59 deletions packages/utils/package.json

This file was deleted.

20 changes: 0 additions & 20 deletions packages/utils/src/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/utils/tsconfig.build.json

This file was deleted.

14 changes: 0 additions & 14 deletions packages/utils/tsconfig.json

This file was deleted.

12 changes: 0 additions & 12 deletions packages/utils/tsup.config.ts

This file was deleted.

Loading

0 comments on commit e191940

Please sign in to comment.