stera-ui 0.4.0 → 0.5.0
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/{chunk-67ILD3JO.js → chunk-F4NT3JC6.js} +17 -1
- package/dist/cli.js +41 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +3 -1
- package/package.json +1 -1
|
@@ -105,7 +105,8 @@ function resolveOutputPath(config, projectRoot, file) {
|
|
|
105
105
|
// src/utils/resolve-config.ts
|
|
106
106
|
import fs from "fs";
|
|
107
107
|
import path2 from "path";
|
|
108
|
-
var CONFIG_FILE = "
|
|
108
|
+
var CONFIG_FILE = "stera.config.json";
|
|
109
|
+
var LEGACY_CONFIG_FILE = "components.json";
|
|
109
110
|
function migrateConfig(raw) {
|
|
110
111
|
if (!("version" in raw) && "tailwind" in raw) {
|
|
111
112
|
const legacy = raw;
|
|
@@ -117,11 +118,22 @@ function migrateConfig(raw) {
|
|
|
117
118
|
}
|
|
118
119
|
return raw;
|
|
119
120
|
}
|
|
121
|
+
var warnedLegacyFilename = false;
|
|
122
|
+
function warnLegacyFilenameOnce(legacyPath) {
|
|
123
|
+
if (warnedLegacyFilename) return;
|
|
124
|
+
warnedLegacyFilename = true;
|
|
125
|
+
console.warn(
|
|
126
|
+
` \u26A0 Found ${LEGACY_CONFIG_FILE}. Rename to ${CONFIG_FILE} \u2014 legacy filename support will be removed in a future release.
|
|
127
|
+
(${legacyPath})`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
120
130
|
function findConfigPath(cwd) {
|
|
121
131
|
let dir = path2.resolve(cwd);
|
|
122
132
|
while (true) {
|
|
123
133
|
const configPath = path2.join(dir, CONFIG_FILE);
|
|
124
134
|
if (fs.existsSync(configPath)) return configPath;
|
|
135
|
+
const legacyPath = path2.join(dir, LEGACY_CONFIG_FILE);
|
|
136
|
+
if (fs.existsSync(legacyPath)) return legacyPath;
|
|
125
137
|
const parent = path2.dirname(dir);
|
|
126
138
|
if (parent === dir) return null;
|
|
127
139
|
dir = parent;
|
|
@@ -130,6 +142,9 @@ function findConfigPath(cwd) {
|
|
|
130
142
|
function loadConfig2(cwd) {
|
|
131
143
|
const configPath = findConfigPath(cwd);
|
|
132
144
|
if (!configPath) return null;
|
|
145
|
+
if (path2.basename(configPath) === LEGACY_CONFIG_FILE) {
|
|
146
|
+
warnLegacyFilenameOnce(configPath);
|
|
147
|
+
}
|
|
133
148
|
try {
|
|
134
149
|
const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
135
150
|
return migrateConfig(raw);
|
|
@@ -752,6 +767,7 @@ export {
|
|
|
752
767
|
transformImports,
|
|
753
768
|
resolveOutputPath,
|
|
754
769
|
CONFIG_FILE,
|
|
770
|
+
LEGACY_CONFIG_FILE,
|
|
755
771
|
findConfigPath,
|
|
756
772
|
loadConfig2 as loadConfig,
|
|
757
773
|
detectProject,
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,8 @@ import path6 from "path";
|
|
|
9
9
|
// src/utils/resolve-config.ts
|
|
10
10
|
import fs from "fs";
|
|
11
11
|
import path from "path";
|
|
12
|
-
var CONFIG_FILE = "
|
|
12
|
+
var CONFIG_FILE = "stera.config.json";
|
|
13
|
+
var LEGACY_CONFIG_FILE = "components.json";
|
|
13
14
|
function migrateConfig(raw) {
|
|
14
15
|
if (!("version" in raw) && "tailwind" in raw) {
|
|
15
16
|
const legacy = raw;
|
|
@@ -21,11 +22,22 @@ function migrateConfig(raw) {
|
|
|
21
22
|
}
|
|
22
23
|
return raw;
|
|
23
24
|
}
|
|
25
|
+
var warnedLegacyFilename = false;
|
|
26
|
+
function warnLegacyFilenameOnce(legacyPath) {
|
|
27
|
+
if (warnedLegacyFilename) return;
|
|
28
|
+
warnedLegacyFilename = true;
|
|
29
|
+
console.warn(
|
|
30
|
+
` \u26A0 Found ${LEGACY_CONFIG_FILE}. Rename to ${CONFIG_FILE} \u2014 legacy filename support will be removed in a future release.
|
|
31
|
+
(${legacyPath})`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
24
34
|
function findConfigPath(cwd) {
|
|
25
35
|
let dir = path.resolve(cwd);
|
|
26
36
|
while (true) {
|
|
27
37
|
const configPath = path.join(dir, CONFIG_FILE);
|
|
28
38
|
if (fs.existsSync(configPath)) return configPath;
|
|
39
|
+
const legacyPath = path.join(dir, LEGACY_CONFIG_FILE);
|
|
40
|
+
if (fs.existsSync(legacyPath)) return legacyPath;
|
|
29
41
|
const parent = path.dirname(dir);
|
|
30
42
|
if (parent === dir) return null;
|
|
31
43
|
dir = parent;
|
|
@@ -34,6 +46,9 @@ function findConfigPath(cwd) {
|
|
|
34
46
|
function loadConfig(cwd) {
|
|
35
47
|
const configPath = findConfigPath(cwd);
|
|
36
48
|
if (!configPath) return null;
|
|
49
|
+
if (path.basename(configPath) === LEGACY_CONFIG_FILE) {
|
|
50
|
+
warnLegacyFilenameOnce(configPath);
|
|
51
|
+
}
|
|
37
52
|
try {
|
|
38
53
|
const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
39
54
|
return migrateConfig(raw);
|
|
@@ -509,7 +524,7 @@ async function add(components, options) {
|
|
|
509
524
|
import fs10 from "fs";
|
|
510
525
|
import fsp from "fs/promises";
|
|
511
526
|
import path10 from "path";
|
|
512
|
-
import { select } from "@inquirer/prompts";
|
|
527
|
+
import { confirm, select } from "@inquirer/prompts";
|
|
513
528
|
|
|
514
529
|
// src/utils/detect-project.ts
|
|
515
530
|
import fs5 from "fs";
|
|
@@ -1170,7 +1185,29 @@ async function init(options) {
|
|
|
1170
1185
|
`);
|
|
1171
1186
|
const existing = findConfigPath(cwd);
|
|
1172
1187
|
if (existing) {
|
|
1173
|
-
|
|
1188
|
+
const existingName = path10.basename(existing);
|
|
1189
|
+
if (existingName === LEGACY_CONFIG_FILE) {
|
|
1190
|
+
console.log(
|
|
1191
|
+
` Found legacy ${LEGACY_CONFIG_FILE} at ${existing}`
|
|
1192
|
+
);
|
|
1193
|
+
const shouldRename = options.yes ? true : await confirm({
|
|
1194
|
+
message: `Rename it to ${CONFIG_FILE}?`,
|
|
1195
|
+
default: true
|
|
1196
|
+
});
|
|
1197
|
+
if (shouldRename) {
|
|
1198
|
+
const renamed = path10.join(path10.dirname(existing), CONFIG_FILE);
|
|
1199
|
+
fs10.renameSync(existing, renamed);
|
|
1200
|
+
console.log(` ${CHECK} Renamed to ${CONFIG_FILE}`);
|
|
1201
|
+
console.log(' Run "stera-ui add <component>" to add components.\n');
|
|
1202
|
+
} else {
|
|
1203
|
+
console.log(
|
|
1204
|
+
` Keeping ${LEGACY_CONFIG_FILE} for now. Legacy filename support will be removed in a future release.
|
|
1205
|
+
`
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
console.log(` ${CONFIG_FILE} already exists at ${existing}`);
|
|
1174
1211
|
console.log(' Run "stera-ui add <component>" to add components.\n');
|
|
1175
1212
|
return;
|
|
1176
1213
|
}
|
|
@@ -1215,7 +1252,7 @@ async function init(options) {
|
|
|
1215
1252
|
JSON.stringify(config, null, 2) + "\n",
|
|
1216
1253
|
"utf-8"
|
|
1217
1254
|
);
|
|
1218
|
-
console.log(` ${CHECK} Created
|
|
1255
|
+
console.log(` ${CHECK} Created ${CONFIG_FILE}`);
|
|
1219
1256
|
const fetchSpinner = createSpinner("Fetching base styles");
|
|
1220
1257
|
let steraCssResult;
|
|
1221
1258
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { fetchRegistryIndex, fetchRegistryItem, getAllComponents, getComponent, resolveDependencies } from './registry/index.js';
|
|
2
2
|
export { RegistryFontItem, RegistryIndex, RegistryItem, RegistryItemFile, RegistryItemFont, RegistryItemType, SteraConfig, configSchema, registryIndexSchema, registryItemFileSchema, registryItemFontSchema, registryItemSchema, registryItemTypeSchema } from './schema/index.js';
|
|
3
|
-
export { CHECK, CONFIG_FILE, CROSS, LOGO, ProjectInfo, TransformContext, TransformFn, WARN, WriteOptions, WriteResult, WriteSteraCssResult, applyTransforms, brand, createSpinner, detectAliasPrefix, detectPackageManager, detectProject, dim, findConfigPath, insertImportLine, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles, writeSteraUiCss } from './utils/index.js';
|
|
3
|
+
export { CHECK, CONFIG_FILE, CROSS, LEGACY_CONFIG_FILE, LOGO, ProjectInfo, TransformContext, TransformFn, WARN, WriteOptions, WriteResult, WriteSteraCssResult, applyTransforms, brand, createSpinner, detectAliasPrefix, detectPackageManager, detectProject, dim, findConfigPath, insertImportLine, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles, writeSteraUiCss } from './utils/index.js';
|
|
4
4
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
CHECK,
|
|
11
11
|
CONFIG_FILE,
|
|
12
12
|
CROSS,
|
|
13
|
+
LEGACY_CONFIG_FILE,
|
|
13
14
|
LOGO,
|
|
14
15
|
WARN,
|
|
15
16
|
applyTransforms,
|
|
@@ -29,7 +30,7 @@ import {
|
|
|
29
30
|
updateFonts,
|
|
30
31
|
writeComponentFiles,
|
|
31
32
|
writeSteraUiCss
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-F4NT3JC6.js";
|
|
33
34
|
import {
|
|
34
35
|
fetchRegistryIndex,
|
|
35
36
|
fetchRegistryItem,
|
|
@@ -41,6 +42,7 @@ export {
|
|
|
41
42
|
CHECK,
|
|
42
43
|
CONFIG_FILE,
|
|
43
44
|
CROSS,
|
|
45
|
+
LEGACY_CONFIG_FILE,
|
|
44
46
|
LOGO,
|
|
45
47
|
WARN,
|
|
46
48
|
applyTransforms,
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ interface SteraConfig {
|
|
|
17
17
|
nextFont?: boolean;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
declare const CONFIG_FILE = "
|
|
20
|
+
declare const CONFIG_FILE = "stera.config.json";
|
|
21
|
+
declare const LEGACY_CONFIG_FILE = "components.json";
|
|
21
22
|
declare function findConfigPath(cwd: string): string | null;
|
|
22
23
|
declare function loadConfig(cwd: string): SteraConfig | null;
|
|
23
24
|
|
|
@@ -166,4 +167,4 @@ declare function updateFonts(fonts: RegistryFontItem[], project: ProjectInfo, cw
|
|
|
166
167
|
silent?: boolean;
|
|
167
168
|
}): Promise<void>;
|
|
168
169
|
|
|
169
|
-
export { CHECK, CONFIG_FILE, CROSS, LOGO, type ProjectInfo, type TransformContext, type TransformFn, WARN, type WriteOptions, type WriteResult, type WriteSteraCssResult, applyTransforms, brand, createSpinner, detectAliasPrefix, detectPackageManager, detectProject, dim, findConfigPath, insertImportLine, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles, writeSteraUiCss };
|
|
170
|
+
export { CHECK, CONFIG_FILE, CROSS, LEGACY_CONFIG_FILE, LOGO, type ProjectInfo, type TransformContext, type TransformFn, WARN, type WriteOptions, type WriteResult, type WriteSteraCssResult, applyTransforms, brand, createSpinner, detectAliasPrefix, detectPackageManager, detectProject, dim, findConfigPath, insertImportLine, installDependencies, loadConfig, massageTreeForFonts, resolveOutputPath, transformImports, updateFonts, writeComponentFiles, writeSteraUiCss };
|
package/dist/utils/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
CHECK,
|
|
3
3
|
CONFIG_FILE,
|
|
4
4
|
CROSS,
|
|
5
|
+
LEGACY_CONFIG_FILE,
|
|
5
6
|
LOGO,
|
|
6
7
|
WARN,
|
|
7
8
|
applyTransforms,
|
|
@@ -21,12 +22,13 @@ import {
|
|
|
21
22
|
updateFonts,
|
|
22
23
|
writeComponentFiles,
|
|
23
24
|
writeSteraUiCss
|
|
24
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-F4NT3JC6.js";
|
|
25
26
|
import "../chunk-T3QWOVJR.js";
|
|
26
27
|
export {
|
|
27
28
|
CHECK,
|
|
28
29
|
CONFIG_FILE,
|
|
29
30
|
CROSS,
|
|
31
|
+
LEGACY_CONFIG_FILE,
|
|
30
32
|
LOGO,
|
|
31
33
|
WARN,
|
|
32
34
|
applyTransforms,
|