@nuvler/cli 0.3.0 → 0.3.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/commands/theme/create.js +1 -1
- package/dist/index.js +1 -1
- package/dist/nuvler.js +13 -10
- package/dist/nuvler.js.map +1 -1
- package/dist/preview/launcher.js +8 -8
- package/dist/preview/launcher.js.map +1 -1
- package/dist/templates/nuvler-atelier/package.json +1 -1
- package/dist/templates/starter/package.json +1 -1
- package/package.json +1 -1
- package/preview-host/vite.config.ts +1 -0
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
const THEME_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
6
6
|
const NEW_THEME_VERSION = "0.1.0";
|
|
7
|
-
const CLI_VERSION_RANGE = "^0.3.
|
|
7
|
+
const CLI_VERSION_RANGE = "^0.3.1";
|
|
8
8
|
const SDK_VERSION_RANGE = "^1.1.0";
|
|
9
9
|
export const THEME_TEMPLATES = [
|
|
10
10
|
{
|
package/dist/index.js
CHANGED
package/dist/nuvler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
|
-
import { access, chmod, cp, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm,
|
|
4
|
+
import { access, chmod, cp, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -28,7 +28,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
28
28
|
//#region src/commands/theme/create.ts
|
|
29
29
|
var THEME_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
30
30
|
var NEW_THEME_VERSION = "0.1.0";
|
|
31
|
-
var CLI_VERSION_RANGE = "^0.3.
|
|
31
|
+
var CLI_VERSION_RANGE = "^0.3.1";
|
|
32
32
|
var SDK_VERSION_RANGE = "^1.1.0";
|
|
33
33
|
var THEME_TEMPLATES = [
|
|
34
34
|
{
|
|
@@ -7171,17 +7171,15 @@ async function resolvePreviewHost() {
|
|
|
7171
7171
|
} catch {}
|
|
7172
7172
|
throw new Error("Preview host não encontrado no package da CLI nem no monorepo. Reinstale @nuvler/cli ou defina NUVLER_PREVIEW_HOST_DIR.");
|
|
7173
7173
|
}
|
|
7174
|
-
async function
|
|
7175
|
-
await unlink(file).catch(() => void 0);
|
|
7176
|
-
await rmdir(directory).catch(() => void 0);
|
|
7177
|
-
}
|
|
7178
|
-
async function runLocalPreview(contextFile, project, apiUrl, store, port) {
|
|
7174
|
+
async function runLocalPreview(contextFile, cacheDirectory, project, apiUrl, store, port) {
|
|
7179
7175
|
const previewHost = await resolvePreviewHost();
|
|
7180
7176
|
return new Promise((resolve, reject) => {
|
|
7181
7177
|
const child = spawn("npm", [
|
|
7182
7178
|
"run",
|
|
7183
7179
|
"dev",
|
|
7184
7180
|
"--",
|
|
7181
|
+
"--configLoader",
|
|
7182
|
+
"runner",
|
|
7185
7183
|
"--host",
|
|
7186
7184
|
"127.0.0.1",
|
|
7187
7185
|
"--port",
|
|
@@ -7194,6 +7192,7 @@ async function runLocalPreview(contextFile, project, apiUrl, store, port) {
|
|
|
7194
7192
|
env: {
|
|
7195
7193
|
...process.env,
|
|
7196
7194
|
NUVLER_THEME_CONTEXT_FILE: contextFile,
|
|
7195
|
+
NUVLER_PREVIEW_CACHE_DIR: cacheDirectory,
|
|
7197
7196
|
NUVLER_THEME_DIRECTORY: project.directory,
|
|
7198
7197
|
NUVLER_THEME_ENTRY: project.entryPath,
|
|
7199
7198
|
NUVLER_THEME_STYLES: JSON.stringify(project.stylePaths),
|
|
@@ -7231,14 +7230,18 @@ async function runLocalPreview(contextFile, project, apiUrl, store, port) {
|
|
|
7231
7230
|
async function launchPreview(context, project, options) {
|
|
7232
7231
|
const directory = await mkdtemp(path.join(tmpdir(), "nuvler-theme-"));
|
|
7233
7232
|
const contextFile = path.join(directory, "theme-context.json");
|
|
7233
|
+
const cacheDirectory = path.join(directory, "vite-cache");
|
|
7234
7234
|
try {
|
|
7235
7235
|
await writeFile(contextFile, JSON.stringify(context, null, 2), {
|
|
7236
7236
|
encoding: "utf8",
|
|
7237
7237
|
mode: 384
|
|
7238
7238
|
});
|
|
7239
|
-
await runLocalPreview(contextFile, project, options.apiUrl, options.store, options.port);
|
|
7239
|
+
await runLocalPreview(contextFile, cacheDirectory, project, options.apiUrl, options.store, options.port);
|
|
7240
7240
|
} finally {
|
|
7241
|
-
await
|
|
7241
|
+
await rm(directory, {
|
|
7242
|
+
recursive: true,
|
|
7243
|
+
force: true
|
|
7244
|
+
});
|
|
7242
7245
|
}
|
|
7243
7246
|
}
|
|
7244
7247
|
//#endregion
|
|
@@ -7875,7 +7878,7 @@ async function authLogout() {
|
|
|
7875
7878
|
//#endregion
|
|
7876
7879
|
//#region src/index.ts
|
|
7877
7880
|
var program = new Command();
|
|
7878
|
-
program.name("nuvler").description("Nuvler Theme Development CLI").version("0.3.
|
|
7881
|
+
program.name("nuvler").description("Nuvler Theme Development CLI").version("0.3.1");
|
|
7879
7882
|
var theme = program.command("theme").description("Manage Nuvler themes");
|
|
7880
7883
|
var auth = program.command("auth").description("Manage developer authentication");
|
|
7881
7884
|
auth.command("login").requiredOption("--token <token>", "Developer token").option("--api-url <url>", "Nuvler API base URL (or use NUVLER_API_URL)").action(async (options) => {
|