Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions guides/esm-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ When migrating some of these projects away from the `ts-node` entry [see `@packa
- [ ] packages/example
- [ ] packages/extension
- [ ] packages/frontend-shared **PARTIAL** - entry point is JS
- [ ] packages/https-proxy - higher priority
- [x] packages/electron ✅ **COMPLETED**
- [ ] packages/https-proxy **PARTIAL** - entry point is JS
- [ ] packages/https-proxy - higher priority
- [x] packages/icons ✅ **COMPLETED**
- [x] packages/launcher ✅ **COMPLETED**
- [x] packages/launchpad ✅ **COMPLETED**
Expand Down Expand Up @@ -98,8 +97,7 @@ When migrating some of these projects away from the `ts-node` entry [see `@packa
- [ ] packages/extension
- [ ] packages/https-proxy
- [x] packages/electron ✅ **COMPLETED**
- [ ] packages/https-proxy
- [ ] packages/icons
- [x] packages/icons ✅ **COMPLETED**
- [ ] packages/launcher
- [ ] packages/net-stubbing
- [x] packages/network ✅ **COMPLETED**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src,__snapshots__,patches --exclude cypress-tests.ts,*only.cy.js",
"stop-only-all": "yarn stop-only --folder packages",
"pretest": "yarn ensure-deps",
"test": "yarn lerna exec yarn test --scope=cypress --scope=@packages/{config,data-context,driver,electron,errors,extension,https-proxy,launcher,net-stubbing,network,packherd-require,proxy,rewriter,scaffold-config,socket,v8-snapshot-require,telemetry,stderr-filtering,types} --scope=@tooling/{electron-mksnapshot,v8-snapshot}",
"test": "yarn lerna exec yarn test --scope=cypress --scope=@packages/{config,data-context,driver,electron,errors,extension,https-proxy,icons,launcher,net-stubbing,network,packherd-require,proxy,rewriter,scaffold-config,socket,v8-snapshot-require,telemetry,stderr-filtering,types} --scope=@tooling/{electron-mksnapshot,v8-snapshot}",
"test-debug": "lerna exec yarn test-debug --ignore=@packages/{driver,root,static,web-config}",
"test-integration": "lerna exec yarn test-integration --ignore=@packages/{driver,root,static,web-config}",
"test-mocha": "mocha --reporter spec scripts/spec.js",
Expand Down
3 changes: 3 additions & 0 deletions packages/icons/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
**/dist
index.js
index.mjs
**/*.d.ts
**/*.d.mts
**/package-lock.json
**/tsconfig.json
**/cypress/fixtures
5 changes: 5 additions & 0 deletions packages/icons/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/dist
index.js
index.mjs
index.d.ts
index.d.mts
1 change: 0 additions & 1 deletion packages/icons/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/icons/index.js

This file was deleted.

19 changes: 19 additions & 0 deletions packages/icons/index.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import path from 'path'

const dist = [import.meta.dirname, 'dist']

function distPath (...args: string[]) {
return path.join.apply(path, dist.concat([...args]))
}

export const getPathToFavicon = (filename: string) => {
return distPath('favicon', filename)
}

export const getPathToIcon = (filename: string) => {
return distPath('icons', filename)
}

export const getPathToLogo = (filename: string) => {
return distPath('logo', filename)
}
2 changes: 1 addition & 1 deletion packages/icons/src/icons.ts → packages/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path'

const dist = [__dirname, '..', 'dist']
const dist = [__dirname, 'dist']

function distPath (...args: string[]) {
return path.join.apply(path, dist.concat([...args]))
Expand Down
18 changes: 12 additions & 6 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@
"private": true,
"main": "index.js",
"scripts": {
"build": "ts-node ./scripts/build.ts && ts-node ./scripts/ico.ts",
"check-ts": "tsc --noEmit && yarn -s tslint",
"build": "yarn build-assets && yarn build:cjs && yarn build:esm",
"build-assets": "tsx ./scripts/build.ts && tsx ./scripts/ico.ts",
"build-prod": "yarn build",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"check-ts": "tsc -p tsconfig.cjs.json --noEmit && yarn -s tslint -p tsconfig.cjs.json",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .",
"test": "yarn test-unit",
"test-unit": "NODE_ENV=test mocha -r @packages/ts/register test/*.ts",
"test-unit": "vitest run",
"tslint": "tslint --config ../ts/tslint.json --project ."
},
"devDependencies": {
"@types/mocha": "^8.0.3",
"@types/to-ico": "^1.1.1",
"chai": "^4.2.0",
"fs-extra": "9.1.0",
"mocha": "^8.1.3",
"to-ico": "^1.1.5"
"to-ico": "^1.1.5",
"tsx": "^4.20.5",
"vitest": "^3.2.4"
},
"files": [
"dist",
"index.js",
"index.d.ts"
],
"types": "index.d.ts",
"license": "MIT",
"module": "index.mjs",
"nx": {}
}
22 changes: 22 additions & 0 deletions packages/icons/test/icons.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { describe, it, expect } from 'vitest'
import * as iconsESM from '../index.mjs'
import * as iconsCjs from '../index.js'

const cwd = process.cwd()

describe('Cypress Icons', function () {
it('returns path to favicon', function () {
expect(iconsESM.getPathToFavicon('favicon-red.ico')).toEqual(`${cwd }/dist/favicon/favicon-red.ico`)
expect(iconsCjs.getPathToFavicon('favicon-red.ico')).toEqual(`${cwd }/dist/favicon/favicon-red.ico`)
})

it('returns path to icon', function () {
expect(iconsESM.getPathToIcon('cypress.icns')).toEqual(`${cwd }/dist/icons/cypress.icns`)
expect(iconsCjs.getPathToIcon('cypress.icns')).toEqual(`${cwd }/dist/icons/cypress.icns`)
})

it('returns path to logo', function () {
expect(iconsESM.getPathToLogo('cypress-bw.png')).toEqual(`${cwd }/dist/logo/cypress-bw.png`)
expect(iconsCjs.getPathToLogo('cypress-bw.png')).toEqual(`${cwd }/dist/logo/cypress-bw.png`)
})
})
18 changes: 0 additions & 18 deletions packages/icons/test/icons_spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"extends": "../ts/tsconfig.json",
"compilerOptions": {
"allowJs": false,
"noImplicitAny": true,
"noUncheckedIndexedAccess": true,
"outDir": "dist",
},
"skipLibCheck": true,
"esModuleInterop": true,
"declaration": true
}
}
6 changes: 0 additions & 6 deletions packages/icons/tsconfig.build.json

This file was deleted.

11 changes: 11 additions & 0 deletions packages/icons/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.base.json",
"include": [
"index.ts"
],
"compilerOptions": {
"target": "ES2022",
"module": "CommonJS",
"moduleResolution": "node"
}
}
12 changes: 12 additions & 0 deletions packages/icons/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.base.json",
"include": [
"index.mts"
],
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "node",
"noEmit": true
}
}
9 changes: 9 additions & 0 deletions packages/icons/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
include: ['test/**/*.spec.ts'],
globals: true,
environment: 'node',
},
})
12 changes: 11 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24031,7 +24031,7 @@ [email protected], mocha@^7.1.0:
yargs-parser "13.1.2"
yargs-unparser "1.6.0"

mocha@^8.1.1, mocha@^8.1.3:
mocha@^8.1.1:
version "8.3.1"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.3.1.tgz#b9eda6da1eb8cb8d29860a9c2205de5b8a076560"
integrity sha512-5SBMxANWqOv5bw3Hx+HVgaWlcWcFEQDUdaUAr1AUU+qwtx6cowhn7gEDT/DwQP7uYxnvShdUOVLbTYAHOEGfDQ==
Expand Down Expand Up @@ -31953,6 +31953,16 @@ [email protected]:
optionalDependencies:
fsevents "~2.3.3"

tsx@^4.20.5:
version "4.20.6"
resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.20.6.tgz#8fb803fd9c1f70e8ccc93b5d7c5e03c3979ccb2e"
integrity sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==
dependencies:
esbuild "~0.25.0"
get-tsconfig "^4.7.5"
optionalDependencies:
fsevents "~2.3.3"

tuf-js@^2.2.1:
version "2.2.1"
resolved "https://registry.npmjs.org/tuf-js/-/tuf-js-2.2.1.tgz#fdd8794b644af1a75c7aaa2b197ddffeb2911b56"
Expand Down
Loading