-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update icons with new design #20338
Changes from 152 commits
b198e4b
d76adb5
351884b
146df43
58a7919
3d79c52
72b3540
5d02cea
2388544
0b1707b
dfb4216
900b8fa
8a3b5ef
d80cddd
8c51fdd
8bbb1de
c658dbe
5739e32
6f88f18
da535c2
f60f8d3
7114ed7
2430620
667b4bf
e74c2a0
fa2601d
dea7b91
a0f16a4
7ce3e69
ede210a
74b7146
b3f7eb5
17a44d6
3c27e9f
221d00b
0703ee6
41ce647
edcdb43
bfecd77
677bc0e
3f63cd4
41afe65
1fb0eda
e7c6a9b
4bf00e1
b846503
50ddbc7
3e83975
0aa9375
82adec0
1fbdf61
de60dd5
acd9fa7
5cb9e19
50e1b61
6a14929
8bbcb49
0f67dad
128d7d7
046f18c
7518d30
2376122
57fe53b
0a83650
5e5c5f8
d815b67
8496130
e02e315
eab911a
847f899
d23ffd1
b090ee5
a2e7512
ebb248d
3c4177e
ccab2f8
042e877
595aafe
fbe0915
42c58c7
5ffb86f
ee83d26
a9953c9
7d0d8c5
0b38cc4
a347267
10c0c1e
40a4c46
96758ce
e783c1a
21c2147
fc6a7c1
b9c6bde
0ef0d57
7a5a597
a0783ba
91842b5
1bfc6d1
6744bcd
d74bfab
de4df77
6a8ecb9
edad2d2
b9d0af3
9e0bade
5132870
33d61d8
db774f9
823d673
0f92069
0c19a80
cdaee66
64b6a8c
b756f6d
bdadb8c
3f4df48
9fb36f0
282f2e7
597d92c
234b74b
b36d7da
b50047c
4317ec8
eb694fe
c64eda4
107cd32
d26dfab
86081dc
b38beb6
1352c93
011fd0b
9664bbc
4ad2fff
f3aab61
a3bb776
0bb2453
f4e796a
e226f6d
c8277ab
712a319
87304bc
3b254cf
bdc5743
4555cfd
a304f80
192632b
e4b5e9b
26fde67
e1444ed
85bccc1
7493ade
7a89f70
50dbf3f
de2f06e
bb899fe
4fd7e45
eee29e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './dist/icons' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/icons') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@packages/icons", | ||
"version": "0.0.0-development", | ||
"description": "Cypress Icons", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "scripts/build.sh", | ||
"postbuild": "ts-node ./src/ico.ts", | ||
"test": "NODE_ENV=test mocha", | ||
"test-watch": "NODE_ENV=test mocha --watch", | ||
"prepublish": "npm run build", | ||
"release": "releaser" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^9.1.0", | ||
elevatebart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"@types/to-ico": "^1.1.1", | ||
"chai": "^4.2.0", | ||
"mocha": "^8.1.3", | ||
"to-ico": "^1.1.5" | ||
}, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cypress-io/cypress-icons.git" | ||
}, | ||
"homepage": "https://github.com/cypress-io/cypress-icons#readme", | ||
"author": "Brian Mann", | ||
"bugs": { | ||
"url": "https://github.com/cypress-io/cypress-icons/issues" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Cypress Icons | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @elevatebart These readme instructions are out of date considering this is an internal package. Can you update the Readme to accurately reflect it's usage? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed the readme, would appreciate a proof read. |
||
|
||
The latest versions of the icons. | ||
The public API will always reference these files. | ||
|
||
`./dist` is not checked into source control. | ||
|
||
## API | ||
|
||
```js | ||
icons = require("@cypress/icons") | ||
elevatebart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// get the absolute path to default favicon | ||
icons.getPathToFavicon("favicon-blue.ico") | ||
// => /Users/.../dist/favicon/favicon-blue.ico | ||
|
||
// get the absolute path to icon | ||
icons.getPathToIcon("icon_32x32@2x.png") | ||
// => /Users/.../dist/icons/icon_32x32@2x.png | ||
``` | ||
|
||
## Architecture detail | ||
|
||
To build the MacOS icons you have to use the `iconutil` command line tool installed. | ||
This command line tool is only installed on MacOS. | ||
|
||
If you are not on MacOS, the building of this icon will simply be skipped. | ||
Good news the macos is only needed to develop on MacOS. | ||
elevatebart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Developing | ||
|
||
All the icons are in the assets directory. | ||
|
||
```bash | ||
## run build to dump to ./dist | ||
npm run build | ||
elevatebart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
## Testing | ||
|
||
```bash | ||
npm test | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -e | ||
rm -rf dist && mkdir dist && mkdir dist/icons | ||
yarn tsc -p ./tsconfig.build.json | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
iconutil -c icns assets/cypress.iconset -o dist/icons/cypress.icns | ||
fi | ||
cp -r assets/* dist | ||
mv dist/cypress.iconset/* dist/icons | ||
rm -r dist/cypress.iconset |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import fs from 'fs' | ||
import toIco from 'to-ico' | ||
|
||
const files = [ | ||
fs.readFileSync('./assets/icons/icon_16x16.png'), | ||
fs.readFileSync('./assets/icons/icon_24x24.png'), | ||
fs.readFileSync('./assets/icons/icon_32x32.png'), | ||
fs.readFileSync('./assets/icons/icon_48x48.png'), | ||
fs.readFileSync('./assets/icons/icon_64x64.png'), | ||
fs.readFileSync('./assets/icons/icon_128x128.png'), | ||
fs.readFileSync('./assets/icons/icon_256x256.png'), | ||
] | ||
|
||
toIco(files).then((buf) => { | ||
fs.writeFileSync('./dist/icons/cypress.ico', buf) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import path from 'path' | ||
|
||
const dist = [__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) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { expect } from 'chai' | ||
import * as icons from '../src/icons' | ||
|
||
const cwd = process.cwd() | ||
|
||
describe('Cypress Icons', function () { | ||
it('returns path to favicon', function () { | ||
expect(icons.getPathToFavicon('favicon-red.ico')).to.eq(`${cwd }/dist/favicon/favicon-red.ico`) | ||
}) | ||
|
||
it('returns path to icon', function () { | ||
expect(icons.getPathToIcon('cypress.icns')).to.eq(`${cwd }/dist/icons/cypress.icns`) | ||
}) | ||
|
||
it('returns path to logo', function () { | ||
expect(icons.getPathToLogo('cypress-bw.png')).to.eq(`${cwd }/dist/logo/cypress-bw.png`) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"files": [ | ||
"./src/icons.ts" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../ts/tsconfig.json", | ||
"compilerOptions": { | ||
"strict": true, | ||
"allowJs": false, | ||
"noImplicitAny": true, | ||
"noUnusedLocals": false, | ||
"resolveJsonModule": true, | ||
"experimentalDecorators": true, | ||
"noUncheckedIndexedAccess": true, | ||
"importsNotUsedAsValues": "error", | ||
"outDir": "dist", | ||
"declaration": true | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to update this? I see we are doing something with caching but why is this necessary just to change some icons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On local, electron app is recompiled only if electron version changes or if the app is completely absent.
If icon is updated, no contributor will see the new icons unless they delete the
dist
directory manually.I compare the icon in dist with the one in the icons package and if different, force the re-build as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a lot of code that has to be maintained for something that just requires devs to
git clean -xfd
once to bypass. I get why you added this, I think, but it's going to be dead code for 99.99% of runs and additional maintenance overhead, I think we could do without thesecheckIconVersion
changes.