@svgicons-com/cli 0.1.0-alpha.1 → 0.1.0-alpha.3
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.
- package/README.md +10 -6
- package/RELEASE_NOTES.md +9 -1
- package/package.json +1 -1
- package/src/cli.js +24 -4
package/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Svg/icons CLI Alpha
|
|
2
2
|
|
|
3
|
-
The Svg/icons CLI
|
|
3
|
+
The Svg/icons CLI connects your terminal to [svgicons.com](https://svgicons.com), a growing search engine of 312K+ open-source SVG icons and icon sets for developer projects. It is designed for frontend developers, product engineers, and teams who want to find the right icon faster and move it into a real codebase without breaking their workflow.
|
|
4
|
+
|
|
5
|
+
With the CLI, you can search icons, inspect metadata, download SVG files, scan an existing project for icon needs, ask for icon recommendations from a UI brief, create Icon Collections, add icons to collections, queue framework-ready exports, build a local icon folder, and generate license/provenance reports.
|
|
6
|
+
|
|
7
|
+
Public icon search works without changing the default endpoint. Pro workflows require a Svg/icons Pro Plan API token, including raw SVG access, Icon Collections, exports, recommendations that create collections, and project synchronization. These features are built to speed up icon selection for both new interfaces and existing projects by keeping discovery, selection, export, and license checks in one repeatable developer workflow.
|
|
4
8
|
|
|
5
9
|
The scanner is read-only by default. It never edits project files unless a future command explicitly adds that behavior.
|
|
6
10
|
|
|
7
|
-
Current package version: `0.1.0-alpha.
|
|
11
|
+
Current package version: `0.1.0-alpha.3`.
|
|
8
12
|
|
|
9
13
|
## Requirements
|
|
10
14
|
|
|
@@ -14,18 +18,18 @@ Current package version: `0.1.0-alpha.1`.
|
|
|
14
18
|
## Login
|
|
15
19
|
|
|
16
20
|
```bash
|
|
17
|
-
svgicons login --token YOUR_PRO_API_TOKEN
|
|
21
|
+
svgicons login --token "YOUR_PRO_API_TOKEN"
|
|
18
22
|
```
|
|
19
23
|
|
|
20
24
|
The explicit auth namespace is also supported:
|
|
21
25
|
|
|
22
26
|
```bash
|
|
23
|
-
svgicons auth login --token YOUR_PRO_API_TOKEN
|
|
27
|
+
svgicons auth login --token "YOUR_PRO_API_TOKEN"
|
|
24
28
|
svgicons auth status
|
|
25
29
|
svgicons doctor
|
|
26
30
|
```
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
Pro API tokens may start with a numeric prefix and a pipe character, such as `10|...`. Keep the full token and wrap it in quotes when using a shell command.
|
|
29
33
|
|
|
30
34
|
You can also avoid writing a config file by setting `SVGICONS_TOKEN` or `SVGICONS_API_TOKEN`.
|
|
31
35
|
|
|
@@ -41,7 +45,7 @@ svgicons config set baseUrl https://svgicons.com
|
|
|
41
45
|
|
|
42
46
|
```bash
|
|
43
47
|
svgicons version
|
|
44
|
-
svgicons auth login --token YOUR_PRO_API_TOKEN
|
|
48
|
+
svgicons auth login --token "YOUR_PRO_API_TOKEN"
|
|
45
49
|
svgicons auth status --json
|
|
46
50
|
svgicons config list --json
|
|
47
51
|
svgicons doctor --json
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
# Svg/icons CLI 0.1.0-alpha.
|
|
1
|
+
# Svg/icons CLI 0.1.0-alpha.3
|
|
2
|
+
|
|
3
|
+
This alpha refresh improves token setup safety. `login` now rejects obviously truncated numeric tokens, which commonly happens when a shell command is run without quoting a Sanctum-style token containing `|`.
|
|
4
|
+
|
|
5
|
+
## 0.1.0-alpha.2
|
|
6
|
+
|
|
7
|
+
This alpha refresh removes local-development wording from the public npm README. Runtime behavior is unchanged from `0.1.0-alpha.1`.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.1
|
|
2
10
|
|
|
3
11
|
This alpha release prepares the CLI for real Pro Plan workflows against the svgicons.com Laravel backend.
|
|
4
12
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -181,11 +181,9 @@ export async function run(argv) {
|
|
|
181
181
|
|
|
182
182
|
async function login(args, globalOptions = {}) {
|
|
183
183
|
const options = parseOptions(args);
|
|
184
|
-
const
|
|
184
|
+
const rawToken = options.token || globalOptions.token || process.env.SVGICONS_TOKEN || process.env.SVGICONS_API_TOKEN;
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
throw new Error('Missing token. Use: svgicons login --token <token>');
|
|
188
|
-
}
|
|
186
|
+
const token = normalizeLoginToken(rawToken);
|
|
189
187
|
|
|
190
188
|
const baseUrl = normalizeBaseUrl(options['base-url'] || globalOptions['base-url'] || defaultBaseUrl());
|
|
191
189
|
await writeConfig({
|
|
@@ -197,6 +195,28 @@ async function login(args, globalOptions = {}) {
|
|
|
197
195
|
console.log(`Svg/icons CLI token saved for ${baseUrl}.`);
|
|
198
196
|
}
|
|
199
197
|
|
|
198
|
+
function normalizeLoginToken(token) {
|
|
199
|
+
if (!token) {
|
|
200
|
+
throw usageError('Missing token. Use: svgicons login --token "<token>"');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const value = String(token).trim();
|
|
204
|
+
|
|
205
|
+
if (value === '') {
|
|
206
|
+
throw usageError('Missing token. Use: svgicons login --token "<token>"');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (/^\d+$/.test(value)) {
|
|
210
|
+
throw usageError('The token looks truncated. Svg/icons Pro API tokens can start with an id prefix like "10|". Wrap the full token in quotes: svgicons auth login --token "10|..."');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (value.length < 20) {
|
|
214
|
+
throw usageError('The token value is too short. Copy the full Pro API token from your account page and wrap it in quotes when it contains "|".');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
|
|
200
220
|
async function logout() {
|
|
201
221
|
await clearConfig();
|
|
202
222
|
console.log('Svg/icons CLI credentials removed.');
|