@diskette/palette 0.23.0 → 0.23.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/dist/cli/cli.js +1 -1
- package/dist/cli/output.d.ts +0 -1
- package/dist/cli/output.js +12 -8
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -25,7 +25,7 @@ const grayOptions = grayColors.map((c) => {
|
|
|
25
25
|
return { value: c, label: `${swatch}${capitalize(c)}` };
|
|
26
26
|
});
|
|
27
27
|
async function main() {
|
|
28
|
-
p.intro(`palette v0.23.
|
|
28
|
+
p.intro(`palette v0.23.1`);
|
|
29
29
|
const results = await p.group({
|
|
30
30
|
colors: () => p.groupMultiselect({
|
|
31
31
|
message: 'Select accent colors',
|
package/dist/cli/output.d.ts
CHANGED
package/dist/cli/output.js
CHANGED
|
@@ -10,11 +10,15 @@ function isAlphaColor(name) {
|
|
|
10
10
|
}
|
|
11
11
|
function alphaColorFile(name, outputPath) {
|
|
12
12
|
const fileName = name === 'blackAlpha' ? 'black-alpha' : 'white-alpha';
|
|
13
|
+
const path = `${outputPath}/${fileName}.css`;
|
|
14
|
+
// Alpha files are silently skipped if they exist
|
|
15
|
+
if (existsSync(path)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
13
18
|
return {
|
|
14
|
-
path
|
|
19
|
+
path,
|
|
15
20
|
displayName: capitalize(fileName.replace('-', ' ')),
|
|
16
21
|
content: () => css.alpha(palette[name]),
|
|
17
|
-
skipIfExists: true,
|
|
18
22
|
};
|
|
19
23
|
}
|
|
20
24
|
function paletteColorFiles(name, outputPath) {
|
|
@@ -51,7 +55,9 @@ export function buildOutputFiles(config) {
|
|
|
51
55
|
const files = [];
|
|
52
56
|
for (const name of colors) {
|
|
53
57
|
if (isAlphaColor(name)) {
|
|
54
|
-
|
|
58
|
+
const file = alphaColorFile(name, outputPath);
|
|
59
|
+
if (file)
|
|
60
|
+
files.push(file);
|
|
55
61
|
}
|
|
56
62
|
else {
|
|
57
63
|
files.push(...paletteColorFiles(name, outputPath));
|
|
@@ -71,14 +77,12 @@ export async function confirmOverwrites(files) {
|
|
|
71
77
|
const cwd = process.cwd();
|
|
72
78
|
const newFiles = files.filter((f) => !existsSync(f.path));
|
|
73
79
|
const existing = files.filter((f) => existsSync(f.path));
|
|
74
|
-
|
|
75
|
-
const promptable = existing.filter((f) => !f.skipIfExists);
|
|
76
|
-
if (promptable.length === 0) {
|
|
80
|
+
if (existing.length === 0) {
|
|
77
81
|
return newFiles;
|
|
78
82
|
}
|
|
79
83
|
const selected = await p.multiselect({
|
|
80
84
|
message: 'These files already exist. Select to overwrite:',
|
|
81
|
-
options:
|
|
85
|
+
options: existing.map((f) => ({
|
|
82
86
|
value: f.path,
|
|
83
87
|
label: f.displayName,
|
|
84
88
|
hint: relative(cwd, f.path),
|
|
@@ -90,7 +94,7 @@ export async function confirmOverwrites(files) {
|
|
|
90
94
|
process.exit(0);
|
|
91
95
|
}
|
|
92
96
|
const selectedSet = new Set(selected);
|
|
93
|
-
const toOverwrite =
|
|
97
|
+
const toOverwrite = existing.filter((f) => selectedSet.has(f.path));
|
|
94
98
|
return [...newFiles, ...toOverwrite];
|
|
95
99
|
}
|
|
96
100
|
export function writeOutputFiles(files) {
|