Skip to content

Commit 00cefa5

Browse files
committed
feat(icongenie): move over to core repo
1 parent c689338 commit 00cefa5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2612
-0
lines changed

icongenie/.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

icongenie/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
.Thumbs.db
3+
node_modules/
4+
npm-debug.log
5+
yarn-error*
6+
*.sublime*
7+
yarn.lock
8+
package-lock.json

icongenie/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018-present Razvan Stoenescu
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

icongenie/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
![Icon Genie logo](https://cdn.quasar.dev/img/iconfactory.png)
2+
3+
# Icon Genie CLI (Global)
4+
5+
> A Quasar tool for generating all your Quasar App's icons and splashscreens
6+
7+
<img src="https://img.shields.io/npm/v/%40quasar/icongenie.svg?label=@quasar/icongenie">
8+
9+
[![Join the chat at https://chat.quasar.dev](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://chat.quasar.dev)
10+
<a href="https://forum.quasar.dev" target="_blank"><img src="https://img.shields.io/badge/community-forum-brightgreen.svg"></a>
11+
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
12+
13+
Please submit a PR to https://github.com/quasarframework/quasar-awesome with your website/app/Quasar tutorial/video etc. Thank you!
14+
15+
## What is Icon Genie
16+
17+
You love the default Quasar logo, probably as much as the team does, but you just spent what feels like a lifetime making your own pixel-perfect representation of the soul of your application and now you want to replace that logo with your own!
18+
19+
There are many different situations where your icon might be seen: in the browser tab, on the desktop, on the home screen of a mobile phone and even in an app store. Then there are splashscreens to create in all the various device sizes and orientations.
20+
21+
This means you need your logo in about 100+ different sizes with representative names, arcane formats, placed in the correct folders and probably some proper `<xml>` declarations for Cordova too. Even if you know exactly what you’re doing, this is a tedious and error-prone task. To make your life easy and care-free, we’ve built the Icon Genie CLI tool to make this exhausting process dead simple.
22+
23+
## Installation of Icon Genie
24+
25+
Node.js >=10 is required.
26+
27+
```
28+
$ yarn global add @quasar/icongenie
29+
# or
30+
$ npm install -g @quasar/icongenie
31+
```
32+
33+
## Usage
34+
35+
Please visit [https://quasar.dev/icongenie].
36+
37+
## Supporting Quasar
38+
Quasar Framework is an MIT-licensed open source project. Its ongoing development is made possible thanks to the support by these awesome [backers](https://github.com/rstoenescu/quasar-framework/blob/dev/backers.md).
39+
40+
**Please read our manifest on [Why donations are important](https://quasar.dev/why-donate)**. If you'd like to become a donator, check out [Quasar Framework's Donator campaign](https://donate.quasar.dev).
41+
42+
## Documentation
43+
44+
Head on to the Quasar Framework official website: [https://quasar.dev](https://quasar.dev)
45+
46+
## Stay in Touch
47+
48+
For latest releases and announcements, follow on Twitter: [@quasarframework](https://twitter.com/quasarframework)
49+
50+
## Chat Support
51+
52+
Ask questions at the official community Discord server: [https://chat.quasar.dev](https://chat.quasar.dev)
53+
54+
## Community Forum
55+
56+
Ask questions at the official community forum: [https://forum.quasar.dev](https://forum.quasar.dev)
57+
58+
## Contributing
59+
60+
I'm excited if you want to contribute to Quasar under any form (report bugs, write a plugin, fix an issue, write a new feature). Please read the [Contributing Guide](../CONTRIBUTING.md).
61+
62+
## Semver
63+
Quasar is following [Semantic Versioning 2.0](https://semver.org/).
64+
65+
## License
66+
67+
Copyright (c) 2018-present Razvan Stoenescu
68+
69+
[MIT License](http://en.wikipedia.org/wiki/MIT_License)

icongenie/bin/icongenie

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env node
2+
3+
require('../lib/utils/node-version-check')
4+
5+
const updateNotifier = require('update-notifier')
6+
const pkg = require('../package.json')
7+
8+
updateNotifier({ pkg }).notify()
9+
10+
const commands = [
11+
'generate',
12+
'verify',
13+
'profile',
14+
'help'
15+
]
16+
17+
let cmd = process.argv[2]
18+
19+
if (cmd && cmd.length === 1) {
20+
const mapToCmd = {
21+
g: 'generate',
22+
v: 'verify',
23+
p: 'profile',
24+
h: 'help'
25+
}
26+
cmd = mapToCmd[cmd]
27+
}
28+
29+
if (cmd) {
30+
if (commands.includes(cmd)) {
31+
process.argv.splice(2, 1)
32+
}
33+
else {
34+
if (cmd === '-v' || cmd === '--version') {
35+
console.log(require('../package.json').version)
36+
process.exit(0)
37+
}
38+
39+
const { warn } = require('../lib/utils/logger')
40+
41+
if (cmd === '-h' || cmd === '--help') {
42+
cmd = 'help'
43+
}
44+
else if (cmd.indexOf('-') === 0) {
45+
warn()
46+
warn(`Command must come before the options`)
47+
cmd = 'help'
48+
}
49+
else {
50+
warn()
51+
warn(`Unknown command specified: "${cmd}"`)
52+
cmd = 'help'
53+
}
54+
}
55+
}
56+
else {
57+
cmd = 'help'
58+
}
59+
60+
console.log()
61+
require(`./icongenie-${cmd}`)

icongenie/bin/icongenie-generate

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
#!/usr/bin/env node
2+
3+
const parseArgs = require('minimist')
4+
5+
const argv = parseArgs(process.argv.slice(2), {
6+
alias: {
7+
p: 'profile', // config file
8+
i: 'icon',
9+
b: 'background',
10+
m: 'mode',
11+
f: 'filter',
12+
q: 'quality',
13+
h: 'help'
14+
},
15+
boolean: [ 'h' ],
16+
string: [
17+
'p', 'i', 'b', 'm', 'f', 'q',
18+
'theme-color',
19+
'png-color',
20+
'splashscreen-color',
21+
'svg-color',
22+
'splashscreen-icon-ratio'
23+
]
24+
})
25+
26+
const { green } = require('chalk')
27+
28+
if (argv.help) {
29+
const modes = Object.keys(require('../lib/modes')).join('|')
30+
const generators = Object.keys(require('../lib/generators')).join('|')
31+
const defaultParams = require('../lib/utils/default-params')
32+
33+
console.log(`
34+
Description
35+
Generate App icons & splashscreens
36+
37+
Usage
38+
$ icongenie generate [options]
39+
40+
# generate icons for all installed Quasar modes
41+
$ icongenie generate -i /path/to/icon.png
42+
$ icongenie g -i /path/to/icon.png
43+
44+
# generate for (as example) PWA mode only
45+
$ icongenie generate -m pwa --icon /path/to/icon.png
46+
47+
# generate for (as example) Cordova & Capacitor mode only
48+
$ icongenie g -m cordova,capacitor -i
49+
/path/to/icon.png -b /path/to/background.png
50+
51+
# generate by using a profile file
52+
$ icongenie generate -p ./icongenie-profile.json
53+
54+
# generate by using batch of profile files
55+
$ icongenie generate -p ./folder-containing-profile-files
56+
57+
Options
58+
--icon, -i ${green('Required')};
59+
Path to source file for icon; must be:
60+
- a .png file
61+
- min resolution: 64x64 px (the higher the better!!)
62+
- with transparency
63+
Path can be absolute, or relative to the root of the
64+
Quasar project folder
65+
Recommended min size: 1024x1024 px
66+
67+
--background, -b Path to optional background source file (for splashscreens);
68+
must be:
69+
- a .png file
70+
- min resolution: 128x128 px (the higher the better!!)
71+
- transparency is optional
72+
Path can be absolute, or relative to the root of the
73+
Quasar project folder
74+
Recommended min size: 1024x1024 px
75+
76+
--mode, -m For which Quasar mode(s) to generate the assets;
77+
Default: all
78+
[all|${modes}]
79+
Multiple can be specified, separated by ",":
80+
spa,cordova
81+
82+
--filter, -f Filter the available generators; when used, it can
83+
generate only one type of asset instead of all
84+
[${generators}]
85+
86+
--quality Quality of the files [1 - 12] (default: ${defaultParams.quality})
87+
- higher quality --> bigger filesize, slower
88+
- lower quality --> smaller filesize, faster
89+
90+
--theme-color Theme color to use for all generators requiring a color;
91+
It gets overriden if any generator color is also specified;
92+
The color must be in hex format (NOT hexa) without the leading
93+
'#' character. Transparency not allowed.
94+
Examples: 1976D2, eee
95+
96+
--svg-color Color to use for the generated monochrome svgs
97+
Default (if no theme-color is specified): ${defaultParams.svgColor.slice(1)}
98+
The color must be in hex format (NOT hexa) without the leading
99+
'#' character. Transparency not allowed.
100+
Examples: 1976D2, eee
101+
102+
--png-color Background color to use for the png generator, when
103+
"background: true" in the asset definition (like for
104+
the cordova/capacitor iOS icons);
105+
Default (if no theme-color is specified): ${defaultParams.pngColor.slice(1)}
106+
The color must be in hex format (NOT hexa) without the leading
107+
'#' character. Transparency not allowed.
108+
Examples: 1976D2, eee
109+
110+
--splashscreen-color Background color to use for the splashscreen generator;
111+
Default (if no theme-color is specified): ${defaultParams.splashscreenColor.slice(1)}
112+
The color must be in hex format (NOT hexa) without the leading
113+
'#' character. Transparency not allowed.
114+
Examples: 1976D2, eee
115+
116+
--splashscreen-icon-ratio Ratio of icon size in respect to the width or height
117+
(whichever is smaller) of the resulting splashscreen;
118+
Represents percentages; Valid values: 0 - 100
119+
If 0 then it doesn't adds any icon of top of background
120+
Default: ${defaultParams.splashscreenIconRatio}
121+
122+
--profile, -p Use JSON profile file(s):
123+
- path to folder (absolute or relative to current folder)
124+
that contains JSON profile files (icongenie-*.json)
125+
- path to a single *.json profile file (absolute or relative
126+
to current folder)
127+
Structure of a JSON profile file:
128+
{
129+
"params": {
130+
"include": [ ... ], /* optional */
131+
...
132+
},
133+
"assets": [ /* list of custom assets */ ]
134+
}
135+
136+
--help, -h Displays this message
137+
`)
138+
process.exit(0)
139+
}
140+
141+
const parseArgv = require('../lib/utils/parse-argv')
142+
const generate = require('../lib/cmd/generate')
143+
const getProfileFiles = require('../lib/utils/get-profile-files')
144+
const filterArgvParams = require('../lib/utils/filter-argv-params')
145+
const { log } = require('../lib/utils/logger')
146+
147+
async function runProfiles (params, profileFiles) {
148+
for (let i = 0; i < profileFiles.length; i++) {
149+
const profile = profileFiles[i]
150+
151+
console.log(`\n`)
152+
log(`---------------------`)
153+
log(`Generating by profile: ${profile}`)
154+
log(`---------------------`)
155+
console.log(`\n`)
156+
157+
await generate({ ...params, profile })
158+
}
159+
}
160+
161+
const params = filterArgvParams(argv)
162+
163+
if (params.profile) {
164+
parseArgv(params, [ 'profile' ])
165+
runProfiles(params, getProfileFiles(params.profile))
166+
}
167+
else {
168+
generate(params)
169+
}

icongenie/bin/icongenie-help

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env node
2+
3+
console.log(' Running @quasar/icongenie v' + require('../package.json').version)
4+
5+
console.log(`
6+
Example usage
7+
$ icongenie <command> <options>
8+
9+
Help for a command
10+
$ icongenie <command> --help
11+
$ icongenie <command> -h
12+
13+
Options
14+
--version, -v Print Quasar Icon Genie CLI version
15+
16+
Commands
17+
generate, g Generate App icons & splashscreens
18+
verify, v Verifies your Quasar App's icons &
19+
splashscreens
20+
profile, p Creates Icon Genie profile files
21+
help, h Displays this message
22+
`)

0 commit comments

Comments
 (0)