@easy-cms/admin-build 1.51.0 → 1.52.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/index.d.ts +2 -2
- package/dist/index.js +16 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type Framework = 'vue' | 'react' | 'svelte';
|
|
2
2
|
/** Where components are looked for, and the module they make, without entries. */
|
|
3
|
-
declare const DEFAULT_DIR
|
|
4
|
-
declare const DEFAULT_OUT
|
|
3
|
+
declare const DEFAULT_DIR = "admin/components";
|
|
4
|
+
declare const DEFAULT_OUT = "admin/dist/components.js";
|
|
5
5
|
declare class AdminBuildError extends Error {
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -171,8 +171,8 @@ var NEEDS = {
|
|
|
171
171
|
react: { package: "react", min: [18, 0], plugin: "@vitejs/plugin-react" },
|
|
172
172
|
svelte: { package: "svelte", min: [5, 0], plugin: "@sveltejs/vite-plugin-svelte" }
|
|
173
173
|
};
|
|
174
|
-
var DEFAULT_DIR =
|
|
175
|
-
var DEFAULT_OUT =
|
|
174
|
+
var DEFAULT_DIR = "admin/components";
|
|
175
|
+
var DEFAULT_OUT = "admin/dist/components.js";
|
|
176
176
|
var AdminBuildError = class extends Error {
|
|
177
177
|
name = "AdminBuildError";
|
|
178
178
|
};
|
|
@@ -190,7 +190,7 @@ async function buildAdmin(options) {
|
|
|
190
190
|
for (const framework of frameworks) checkVersion(require2, framework);
|
|
191
191
|
const plugins = await Promise.all(frameworks.map((f) => frameworkPlugin(require2, f)));
|
|
192
192
|
const entry = await writeEntry(cwd, group.out, group.components);
|
|
193
|
-
await build
|
|
193
|
+
await viteBuild(build, {
|
|
194
194
|
root: cwd,
|
|
195
195
|
configFile: false,
|
|
196
196
|
logLevel: "warn",
|
|
@@ -214,13 +214,25 @@ async function buildAdmin(options) {
|
|
|
214
214
|
}
|
|
215
215
|
return built;
|
|
216
216
|
}
|
|
217
|
+
async function viteBuild(build, config) {
|
|
218
|
+
try {
|
|
219
|
+
await build(config);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
const message = error.message ?? "";
|
|
222
|
+
const missing = /Failed to load tsconfig '([^']+)'/.exec(message)?.[1];
|
|
223
|
+
if (!missing) throw error;
|
|
224
|
+
throw new AdminBuildError(
|
|
225
|
+
`TypeScript components need the project's tsconfig.json, which names ${missing}, not there yet.${missing.includes(".nuxt") ? ' Run `nuxi prepare` first (e.g. "build": "nuxi prepare && easy-cms build:admin && nuxi build").' : ""}`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
217
229
|
function plan(cwd, options) {
|
|
218
230
|
if (!options.entries || options.entries.length === 0) {
|
|
219
231
|
const dir2 = join(cwd, DEFAULT_DIR);
|
|
220
232
|
const files = existsSync(dir2) ? readdirSync(dir2).filter((f) => extname(f) in EXTENSIONS).sort().map((f) => join(dir2, f)) : [];
|
|
221
233
|
if (files.length === 0)
|
|
222
234
|
throw new AdminBuildError(
|
|
223
|
-
`No components in ${DEFAULT_DIR}/: add one, e.g. ${
|
|
235
|
+
`No components in ${DEFAULT_DIR}/: add one, e.g. ${DEFAULT_DIR}/acme-color-picker.vue (the file name is the tag), or name the files to build.`
|
|
224
236
|
);
|
|
225
237
|
return [{ out: resolve(cwd, options.out ?? DEFAULT_OUT), components: files.map(component) }];
|
|
226
238
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/admin-build",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.52.0",
|
|
4
4
|
"description": "Builds Easy CMS admin components written in Vue, React or Svelte into the admin's custom-element modules (easy-cms build:admin)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"svelte": "^5.57.3",
|
|
61
61
|
"typescript": "~6.0.3",
|
|
62
62
|
"vue": "^3.5.43",
|
|
63
|
-
"@easy-cms/core": "^1.
|
|
63
|
+
"@easy-cms/core": "^1.52.0"
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=22.12"
|