@unocss/cli 0.27.5 → 0.28.1
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 +2 -2
- package/dist/chunks/index.cjs +8 -5
- package/dist/chunks/index.mjs +9 -6
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -77,8 +77,8 @@ import { defineConfig } from 'unocss'
|
|
|
77
77
|
|
|
78
78
|
export default defineConfig({
|
|
79
79
|
shortcuts: [
|
|
80
|
-
{
|
|
81
|
-
]
|
|
80
|
+
{ box: 'max-w-7xl mx-auto bg-gray-100 rounded-md shadow-sm p-4' },
|
|
81
|
+
],
|
|
82
82
|
})
|
|
83
83
|
```
|
|
84
84
|
|
package/dist/chunks/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const fs = require('fs');
|
|
4
4
|
const pathe = require('pathe');
|
|
5
5
|
const fg = require('fast-glob');
|
|
6
6
|
const consola = require('consola');
|
|
@@ -15,7 +15,7 @@ const fg__default = /*#__PURE__*/_interopDefaultLegacy(fg);
|
|
|
15
15
|
const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
|
|
16
16
|
const presetUno__default = /*#__PURE__*/_interopDefaultLegacy(presetUno);
|
|
17
17
|
|
|
18
|
-
const version = "0.
|
|
18
|
+
const version = "0.28.1";
|
|
19
19
|
|
|
20
20
|
class PrettyError extends Error {
|
|
21
21
|
constructor(message) {
|
|
@@ -71,7 +71,10 @@ const fileCache = /* @__PURE__ */ new Map();
|
|
|
71
71
|
async function generate(options) {
|
|
72
72
|
const outFile = options.outFile ?? pathe.resolve(process.cwd(), "uno.css");
|
|
73
73
|
const { css, matched } = await uno.generate([...fileCache].join("\n"));
|
|
74
|
-
|
|
74
|
+
const dir = pathe.dirname(outFile);
|
|
75
|
+
if (!fs.existsSync(dir))
|
|
76
|
+
await fs.promises.mkdir(dir, { recursive: true });
|
|
77
|
+
await fs.promises.writeFile(outFile, css, "utf-8");
|
|
75
78
|
if (!options.watch) {
|
|
76
79
|
consola__default.success(`${[...matched].length} utilities generated to ${colorette.cyan(pathe.relative(process.cwd(), outFile))}
|
|
77
80
|
`);
|
|
@@ -90,7 +93,7 @@ async function build(_options) {
|
|
|
90
93
|
uno = core.createGenerator(config$1, defaultConfig);
|
|
91
94
|
const files = await fg__default(options.patterns);
|
|
92
95
|
await Promise.all(files.map(async (file) => {
|
|
93
|
-
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
96
|
+
fileCache.set(file, await fs.promises.readFile(file, "utf8"));
|
|
94
97
|
}));
|
|
95
98
|
consola__default.log(colorette.green(`${name} v${version}`));
|
|
96
99
|
consola__default.start(`UnoCSS ${options.watch ? "in watch mode..." : "for production..."}`);
|
|
@@ -120,7 +123,7 @@ async function build(_options) {
|
|
|
120
123
|
if (type.startsWith("unlink"))
|
|
121
124
|
fileCache.delete(file);
|
|
122
125
|
else
|
|
123
|
-
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
126
|
+
fileCache.set(file, await fs.promises.readFile(file, "utf8"));
|
|
124
127
|
}
|
|
125
128
|
debouncedBuild();
|
|
126
129
|
});
|
package/dist/chunks/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolve, relative, basename } from 'pathe';
|
|
1
|
+
import { existsSync, promises } from 'fs';
|
|
2
|
+
import { resolve, dirname, relative, basename } from 'pathe';
|
|
3
3
|
import fg from 'fast-glob';
|
|
4
4
|
import consola from 'consola';
|
|
5
5
|
import { cyan, green, dim } from 'colorette';
|
|
@@ -7,7 +7,7 @@ import { createGenerator, toArray } from '@unocss/core';
|
|
|
7
7
|
import { createConfigLoader } from '@unocss/config';
|
|
8
8
|
import presetUno from '@unocss/preset-uno';
|
|
9
9
|
|
|
10
|
-
const version = "0.
|
|
10
|
+
const version = "0.28.1";
|
|
11
11
|
|
|
12
12
|
class PrettyError extends Error {
|
|
13
13
|
constructor(message) {
|
|
@@ -63,7 +63,10 @@ const fileCache = /* @__PURE__ */ new Map();
|
|
|
63
63
|
async function generate(options) {
|
|
64
64
|
const outFile = options.outFile ?? resolve(process.cwd(), "uno.css");
|
|
65
65
|
const { css, matched } = await uno.generate([...fileCache].join("\n"));
|
|
66
|
-
|
|
66
|
+
const dir = dirname(outFile);
|
|
67
|
+
if (!existsSync(dir))
|
|
68
|
+
await promises.mkdir(dir, { recursive: true });
|
|
69
|
+
await promises.writeFile(outFile, css, "utf-8");
|
|
67
70
|
if (!options.watch) {
|
|
68
71
|
consola.success(`${[...matched].length} utilities generated to ${cyan(relative(process.cwd(), outFile))}
|
|
69
72
|
`);
|
|
@@ -82,7 +85,7 @@ async function build(_options) {
|
|
|
82
85
|
uno = createGenerator(config, defaultConfig);
|
|
83
86
|
const files = await fg(options.patterns);
|
|
84
87
|
await Promise.all(files.map(async (file) => {
|
|
85
|
-
fileCache.set(file, await readFile(file, "utf8"));
|
|
88
|
+
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
86
89
|
}));
|
|
87
90
|
consola.log(green(`${name} v${version}`));
|
|
88
91
|
consola.start(`UnoCSS ${options.watch ? "in watch mode..." : "for production..."}`);
|
|
@@ -112,7 +115,7 @@ async function build(_options) {
|
|
|
112
115
|
if (type.startsWith("unlink"))
|
|
113
116
|
fileCache.delete(file);
|
|
114
117
|
else
|
|
115
|
-
fileCache.set(file, await readFile(file, "utf8"));
|
|
118
|
+
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
116
119
|
}
|
|
117
120
|
debouncedBuild();
|
|
118
121
|
});
|
package/dist/cli.cjs
CHANGED
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "CLI for UnoCSS",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/unocss/unocss/tree/main/packages/cli#readme",
|
|
@@ -8,34 +8,34 @@
|
|
|
8
8
|
"url": "https://github.com/unocss/unocss/issues"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Johann Schopplich",
|
|
13
|
+
"email": "pkg@johannschopplich.com",
|
|
14
|
+
"url": "https://johannschopplich.com"
|
|
15
|
+
},
|
|
11
16
|
"repository": {
|
|
12
17
|
"type": "git",
|
|
13
18
|
"url": "git+https://github.com/unocss/unocss.git",
|
|
14
19
|
"directory": "packages/cli"
|
|
15
20
|
},
|
|
16
21
|
"funding": "https://github.com/sponsors/antfu",
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"url": "https://johannschopplich.com"
|
|
21
|
-
},
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": "./dist/index.cjs",
|
|
22
25
|
"files": [
|
|
23
26
|
"bin",
|
|
24
27
|
"dist"
|
|
25
28
|
],
|
|
26
|
-
"exports": "./dist/index.cjs",
|
|
27
|
-
"main": "./dist/index.cjs",
|
|
28
29
|
"bin": {
|
|
29
30
|
"unocss": "./bin/unocss.cjs"
|
|
30
31
|
},
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=14"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/config": "0.
|
|
37
|
-
"@unocss/core": "0.
|
|
38
|
-
"@unocss/preset-uno": "0.
|
|
36
|
+
"@unocss/config": "0.28.1",
|
|
37
|
+
"@unocss/core": "0.28.1",
|
|
38
|
+
"@unocss/preset-uno": "0.28.1",
|
|
39
39
|
"cac": "^6.7.12",
|
|
40
40
|
"chokidar": "^3.5.3",
|
|
41
41
|
"colorette": "^2.0.16",
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|
|
48
48
|
"stub": "unbuild --stub"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"readme": "# @unocss/cli\n\nThe CLI for UnoCSS. A perfect fit for traditional backends.\n\n## Key Features\n\n- 🍱 Suited for traditional backends like Laravel or Kirby\n- 👀 [Watch mode](#watch) included\n- 🔌 Supports custom configurations via [`unocss.config.js`](#unocssconfigjs-support)\n\n## Requirements\n\n- Node 14+ (Node 16 recommended)\n\n## Installation\n\nThis package is shipped with the `unocss` package:\n\n```bash\nnpm i -D unocss\n```\n\nYou can also install it standalone:\n\n```bash\nnpm i -D @unocss/cli\n```\n\n## Usage\n\nYou can also pass multiple glob patterns to `@unocss/cli`:\n\n```bash\nunocss \"site/snippets/**/*.php\" \"site/templates/**/*.php\"\n```\n\nExample package configuration:\n\n> ℹ️ Make sure to add escaped quotes to your npm script glob patterns.\n\n```json\n{\n \"scripts\": {\n \"dev\": \"unocss \\\"site/{snippets,templates}/**/*.php\\\" --watch\",\n \"build\": \"unocss \\\"site/{snippets,templates}/**/*.php\\\"\"\n },\n \"devDependencies\": {\n \"@unocss/cli\": \"latest\"\n }\n}\n```\n\n### Development\n\nAdd the `--watch` (or `-w`) flag to enable watching for file changes:\n\n```bash\nunocss \"site/{snippets,templates}/**/*.php\" --watch\n```\n\n### Production\n\n```bash\nunocss \"site/{snippets,templates}/**/*.php\"\n```\n\nThe final `uno.css` will be generated to the current directory by default.\n\n## Built-in Features\n\n### Configurations\n\nCreate a `unocss.config.js` or `unocss.config.ts` configuration file the root-level of your project to customize UnoCSS.\n\n```js\nimport { defineConfig } from 'unocss'\n\nexport default defineConfig({\n shortcuts: [\n { box: 'max-w-7xl mx-auto bg-gray-100 rounded-md shadow-sm p-4' },\n ],\n})\n```\n\nFor a list of options, head over to the [UnoCSS configurations](https://github.com/unocss/unocss#configurations) docs.\n\n## CLI Options\n\n> Inspect all available options with `unocss --help`.\n\n### `--out-file`\n\nThe output filename for the generated UnoCSS file. Defaults to `uno.css` in the current working directory.\n\n### `--watch`\n\nIndicates if the files found by the glob pattern should be watched.\n\n## License\n\nMIT License © 2021-PRESENT [Anthony Fu](https://github.com/antfu)\n\nMIT License © 2021-PRESENT [Johann Schopplich](https://github.com/johannschopplich)\n"
|
|
50
51
|
}
|