@piedata/pieui 2.0.8 → 2.0.9
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.js
CHANGED
|
@@ -193033,7 +193033,7 @@ var parseArgs = (argv) => {
|
|
|
193033
193033
|
const srcDirIndex = argv.findIndex((arg) => arg === "--src-dir" || arg === "-s");
|
|
193034
193034
|
const appendFlag = argv.includes("--append");
|
|
193035
193035
|
let outDir = command === "postbuild" ? "public" : ".";
|
|
193036
|
-
let srcDir = "
|
|
193036
|
+
let srcDir = ".";
|
|
193037
193037
|
let componentType;
|
|
193038
193038
|
let componentName;
|
|
193039
193039
|
let eventName;
|
|
@@ -193075,7 +193075,7 @@ var parseArgs = (argv) => {
|
|
|
193075
193075
|
componentName = argv[1];
|
|
193076
193076
|
eventName = argv[2];
|
|
193077
193077
|
}
|
|
193078
|
-
if ((command === "pull" || command === "push") && argv[1]) {
|
|
193078
|
+
if ((command === "pull" || command === "push" || command === "remote-remove") && argv[1]) {
|
|
193079
193079
|
componentName = argv[1];
|
|
193080
193080
|
}
|
|
193081
193081
|
if (outDirFlag) {
|
|
@@ -193108,6 +193108,7 @@ var printUsage = () => {
|
|
|
193108
193108
|
console.log(" add [type] <ComponentName> Create a new component in piecomponents directory");
|
|
193109
193109
|
console.log(" push <ComponentName> Archive piecomponents/<ComponentName> and upload to PieUI server");
|
|
193110
193110
|
console.log(" pull <ComponentName> Download archive from PieUI server and extract into piecomponents/<ComponentName>");
|
|
193111
|
+
console.log(" remote-remove <ComponentName> Remove remote component from PieUI server");
|
|
193111
193112
|
console.log(' list-events <ComponentName> List registered methods keys for <PieCard card="ComponentName" ... methods={...} />');
|
|
193112
193113
|
console.log(' add-event <ComponentName> <event> Add a new methods key with a default handler to <PieCard card="ComponentName" ... methods={...} />');
|
|
193113
193114
|
console.log(" remove <ComponentName> Remove a component from piecomponents directory");
|
|
@@ -193133,10 +193134,10 @@ var printUsage = () => {
|
|
|
193133
193134
|
console.log(" --src-dir <dir>, -s <dir> Source directory (default: src)");
|
|
193134
193135
|
console.log("");
|
|
193135
193136
|
console.log("Options for list-events:");
|
|
193136
|
-
console.log(" --src-dir <dir>, -s <dir> Source directory to scan (default:
|
|
193137
|
+
console.log(" --src-dir <dir>, -s <dir> Source directory to scan (default: .)");
|
|
193137
193138
|
console.log("");
|
|
193138
193139
|
console.log("Options for add-event:");
|
|
193139
|
-
console.log(" --src-dir <dir>, -s <dir> Source directory to modify (default:
|
|
193140
|
+
console.log(" --src-dir <dir>, -s <dir> Source directory to modify (default: .)");
|
|
193140
193141
|
console.log("");
|
|
193141
193142
|
console.log("Filters for list:");
|
|
193142
193143
|
console.log(" all All components (default)");
|
|
@@ -193159,6 +193160,7 @@ var printUsage = () => {
|
|
|
193159
193160
|
console.log(" pieui add-event ExchangeAlertsCard alert # Add methods.alert with default handler");
|
|
193160
193161
|
console.log(" pieui push ExchangeAlertsCard # Upload component folder as zip");
|
|
193161
193162
|
console.log(" pieui pull ExchangeAlertsCard # Download & extract component folder");
|
|
193163
|
+
console.log(" pieui remote-remove ExchangeAlertsCard # Delete remote component (and remove from Feed)");
|
|
193162
193164
|
};
|
|
193163
193165
|
|
|
193164
193166
|
// src/code/commands/init.ts
|
|
@@ -197307,7 +197309,7 @@ var resolveIdentifierToObjectLiteral = (expr, checker) => {
|
|
|
197307
197309
|
};
|
|
197308
197310
|
var listEventsCommand = (srcDir, componentName) => {
|
|
197309
197311
|
console.log(`[pieui] Scanning PieCard methods for: ${componentName}`);
|
|
197310
|
-
const files = Ze.sync(`${srcDir}/**/*.{ts,tsx}`, {
|
|
197312
|
+
const files = Ze.sync(`${srcDir}/**/*.{ts,tsx,js,jsx}`, {
|
|
197311
197313
|
ignore: [
|
|
197312
197314
|
"**/*.d.ts",
|
|
197313
197315
|
"**/dist/**",
|
|
@@ -197517,7 +197519,7 @@ var addEventCommand = (srcDir, componentName, eventName) => {
|
|
|
197517
197519
|
process.exit(1);
|
|
197518
197520
|
}
|
|
197519
197521
|
console.log(`[pieui] Adding methods.${eventName} to PieCard(card="${componentName}")`);
|
|
197520
|
-
const files = Ze.sync(`${srcDir}/**/*.{ts,tsx}`, {
|
|
197522
|
+
const files = Ze.sync(`${srcDir}/**/*.{ts,tsx,js,jsx}`, {
|
|
197521
197523
|
ignore: [
|
|
197522
197524
|
"**/*.d.ts",
|
|
197523
197525
|
"**/dist/**",
|
|
@@ -197884,6 +197886,25 @@ var import_path10 = __toESM(require("path"));
|
|
|
197884
197886
|
var import_jszip = __toESM(require_lib4());
|
|
197885
197887
|
var PUSH_URL = "https://api-pieui.swarm.ing/external/push";
|
|
197886
197888
|
var API_KEY_ENV = "PIEUI_EXTERNAL_API_KEY";
|
|
197889
|
+
var toProjectSlug = (raw) => {
|
|
197890
|
+
const base = raw.trim().replace(/^@/, "").replaceAll("/", "-");
|
|
197891
|
+
const cleaned = base.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
197892
|
+
return cleaned || "project";
|
|
197893
|
+
};
|
|
197894
|
+
var getProjectName = () => {
|
|
197895
|
+
const pkgPath = import_path10.default.join(process.cwd(), "package.json");
|
|
197896
|
+
try {
|
|
197897
|
+
if (import_fs8.default.existsSync(pkgPath)) {
|
|
197898
|
+
const pkg = JSON.parse(import_fs8.default.readFileSync(pkgPath, "utf8"));
|
|
197899
|
+
if (pkg.name) {
|
|
197900
|
+
const name = pkg.name.includes("/") ? pkg.name.split("/").pop() || pkg.name : pkg.name;
|
|
197901
|
+
return toProjectSlug(name);
|
|
197902
|
+
}
|
|
197903
|
+
}
|
|
197904
|
+
} catch {
|
|
197905
|
+
}
|
|
197906
|
+
return toProjectSlug(import_path10.default.basename(process.cwd()));
|
|
197907
|
+
};
|
|
197887
197908
|
var walkFiles = (rootDir, dir) => {
|
|
197888
197909
|
const entries = import_fs8.default.readdirSync(dir, { withFileTypes: true });
|
|
197889
197910
|
const out = [];
|
|
@@ -197903,6 +197924,7 @@ var walkFiles = (rootDir, dir) => {
|
|
|
197903
197924
|
var pushCommand = async (componentName) => {
|
|
197904
197925
|
const pieComponentsDir = import_path10.default.join(process.cwd(), "piecomponents");
|
|
197905
197926
|
const componentDir = import_path10.default.join(pieComponentsDir, componentName);
|
|
197927
|
+
const remoteName = `${getProjectName()}/${componentName}`;
|
|
197906
197928
|
if (!import_fs8.default.existsSync(pieComponentsDir)) {
|
|
197907
197929
|
console.error('[pieui] Error: piecomponents directory not found. Run "pieui init" first.');
|
|
197908
197930
|
process.exit(1);
|
|
@@ -197923,7 +197945,7 @@ var pushCommand = async (componentName) => {
|
|
|
197923
197945
|
compressionOptions: { level: 6 }
|
|
197924
197946
|
});
|
|
197925
197947
|
const form = new FormData;
|
|
197926
|
-
form.set("component",
|
|
197948
|
+
form.set("component", remoteName);
|
|
197927
197949
|
const zipArrayBuffer = new ArrayBuffer(zipBytes.byteLength);
|
|
197928
197950
|
new Uint8Array(zipArrayBuffer).set(zipBytes);
|
|
197929
197951
|
const file = new File([zipArrayBuffer], `${componentName}.zip`, {
|
|
@@ -197936,6 +197958,7 @@ var pushCommand = async (componentName) => {
|
|
|
197936
197958
|
headers["x-api-key"] = apiKey;
|
|
197937
197959
|
}
|
|
197938
197960
|
console.log(`[pieui] Uploading to: ${PUSH_URL}`);
|
|
197961
|
+
console.log(`[pieui] Remote component name: ${remoteName}`);
|
|
197939
197962
|
const res = await fetch(PUSH_URL, {
|
|
197940
197963
|
method: "POST",
|
|
197941
197964
|
body: form,
|
|
@@ -197947,7 +197970,7 @@ var pushCommand = async (componentName) => {
|
|
|
197947
197970
|
${text2}` : ""}`);
|
|
197948
197971
|
}
|
|
197949
197972
|
const text = await res.text().catch(() => "");
|
|
197950
|
-
console.log(`[pieui] Push completed: ${
|
|
197973
|
+
console.log(`[pieui] Push completed: ${remoteName}${text ? `
|
|
197951
197974
|
[pieui] ${text}` : ""}`);
|
|
197952
197975
|
};
|
|
197953
197976
|
|
|
@@ -197957,6 +197980,25 @@ var import_path11 = __toESM(require("path"));
|
|
|
197957
197980
|
var import_jszip2 = __toESM(require_lib4());
|
|
197958
197981
|
var PULL_URL = "https://api-pieui.swarm.ing/external/pull";
|
|
197959
197982
|
var API_KEY_ENV2 = "PIEUI_EXTERNAL_API_KEY";
|
|
197983
|
+
var toProjectSlug2 = (raw) => {
|
|
197984
|
+
const base = raw.trim().replace(/^@/, "").replaceAll("/", "-");
|
|
197985
|
+
const cleaned = base.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
197986
|
+
return cleaned || "project";
|
|
197987
|
+
};
|
|
197988
|
+
var getProjectName2 = () => {
|
|
197989
|
+
const pkgPath = import_path11.default.join(process.cwd(), "package.json");
|
|
197990
|
+
try {
|
|
197991
|
+
if (import_fs9.default.existsSync(pkgPath)) {
|
|
197992
|
+
const pkg = JSON.parse(import_fs9.default.readFileSync(pkgPath, "utf8"));
|
|
197993
|
+
if (pkg.name) {
|
|
197994
|
+
const name = pkg.name.includes("/") ? pkg.name.split("/").pop() || pkg.name : pkg.name;
|
|
197995
|
+
return toProjectSlug2(name);
|
|
197996
|
+
}
|
|
197997
|
+
}
|
|
197998
|
+
} catch {
|
|
197999
|
+
}
|
|
198000
|
+
return toProjectSlug2(import_path11.default.basename(process.cwd()));
|
|
198001
|
+
};
|
|
197960
198002
|
var ensureDir = (dir) => {
|
|
197961
198003
|
import_fs9.default.mkdirSync(dir, { recursive: true });
|
|
197962
198004
|
};
|
|
@@ -197972,6 +198014,7 @@ var safeJoin = (baseDir, relPath) => {
|
|
|
197972
198014
|
var pullCommand = async (componentName) => {
|
|
197973
198015
|
const pieComponentsDir = import_path11.default.join(process.cwd(), "piecomponents");
|
|
197974
198016
|
const componentDir = import_path11.default.join(pieComponentsDir, componentName);
|
|
198017
|
+
const remoteName = `${getProjectName2()}/${componentName}`;
|
|
197975
198018
|
if (!import_fs9.default.existsSync(pieComponentsDir)) {
|
|
197976
198019
|
console.error('[pieui] Error: piecomponents directory not found. Run "pieui init" first.');
|
|
197977
198020
|
process.exit(1);
|
|
@@ -197981,7 +198024,7 @@ var pullCommand = async (componentName) => {
|
|
|
197981
198024
|
if (apiKey) {
|
|
197982
198025
|
headers["x-api-key"] = apiKey;
|
|
197983
198026
|
}
|
|
197984
|
-
const url = `${PULL_URL}?component=${encodeURIComponent(
|
|
198027
|
+
const url = `${PULL_URL}?component=${encodeURIComponent(remoteName)}`;
|
|
197985
198028
|
console.log(`[pieui] Downloading from: ${url}`);
|
|
197986
198029
|
const res = await fetch(url, { method: "GET", headers });
|
|
197987
198030
|
if (!res.ok) {
|
|
@@ -198010,7 +198053,51 @@ ${text}` : ""}`);
|
|
|
198010
198053
|
const buf = await entry.async("uint8array");
|
|
198011
198054
|
import_fs9.default.writeFileSync(outPath, buf);
|
|
198012
198055
|
}
|
|
198013
|
-
console.log(`[pieui] Pull completed: ${
|
|
198056
|
+
console.log(`[pieui] Pull completed: ${remoteName}`);
|
|
198057
|
+
};
|
|
198058
|
+
|
|
198059
|
+
// src/code/commands/remoteRemove.ts
|
|
198060
|
+
var import_fs10 = __toESM(require("fs"));
|
|
198061
|
+
var import_path12 = __toESM(require("path"));
|
|
198062
|
+
var REMOVE_URL = "https://api-pieui.swarm.ing/external/remove";
|
|
198063
|
+
var API_KEY_ENV3 = "PIEUI_EXTERNAL_API_KEY";
|
|
198064
|
+
var toProjectSlug3 = (raw) => {
|
|
198065
|
+
const base = raw.trim().replace(/^@/, "").replaceAll("/", "-");
|
|
198066
|
+
const cleaned = base.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
198067
|
+
return cleaned || "project";
|
|
198068
|
+
};
|
|
198069
|
+
var getProjectName3 = () => {
|
|
198070
|
+
const pkgPath = import_path12.default.join(process.cwd(), "package.json");
|
|
198071
|
+
try {
|
|
198072
|
+
if (import_fs10.default.existsSync(pkgPath)) {
|
|
198073
|
+
const pkg = JSON.parse(import_fs10.default.readFileSync(pkgPath, "utf8"));
|
|
198074
|
+
if (pkg.name) {
|
|
198075
|
+
const name = pkg.name.includes("/") ? pkg.name.split("/").pop() || pkg.name : pkg.name;
|
|
198076
|
+
return toProjectSlug3(name);
|
|
198077
|
+
}
|
|
198078
|
+
}
|
|
198079
|
+
} catch {
|
|
198080
|
+
}
|
|
198081
|
+
return toProjectSlug3(import_path12.default.basename(process.cwd()));
|
|
198082
|
+
};
|
|
198083
|
+
var remoteRemoveCommand = async (componentName) => {
|
|
198084
|
+
const remoteName = `${getProjectName3()}/${componentName}`;
|
|
198085
|
+
const headers = {};
|
|
198086
|
+
const apiKey = process.env[API_KEY_ENV3];
|
|
198087
|
+
if (apiKey) {
|
|
198088
|
+
headers["x-api-key"] = apiKey;
|
|
198089
|
+
}
|
|
198090
|
+
const url = `${REMOVE_URL}?component=${encodeURIComponent(remoteName)}`;
|
|
198091
|
+
console.log(`[pieui] Removing from: ${url}`);
|
|
198092
|
+
const res = await fetch(url, { method: "DELETE", headers });
|
|
198093
|
+
if (!res.ok) {
|
|
198094
|
+
const text2 = await res.text().catch(() => "");
|
|
198095
|
+
throw new Error(`remote-remove failed: ${res.status} ${res.statusText}${text2 ? `
|
|
198096
|
+
${text2}` : ""}`);
|
|
198097
|
+
}
|
|
198098
|
+
const text = await res.text().catch(() => "");
|
|
198099
|
+
console.log(`[pieui] Remote remove completed: ${remoteName}${text ? `
|
|
198100
|
+
[pieui] ${text}` : ""}`);
|
|
198014
198101
|
};
|
|
198015
198102
|
|
|
198016
198103
|
// src/cli.ts
|
|
@@ -198066,6 +198153,14 @@ var main = async () => {
|
|
|
198066
198153
|
}
|
|
198067
198154
|
await pullCommand(componentName);
|
|
198068
198155
|
return;
|
|
198156
|
+
case "remote-remove":
|
|
198157
|
+
if (!componentName) {
|
|
198158
|
+
console.error("[pieui] Error: Component name is required for remote-remove command");
|
|
198159
|
+
printUsage();
|
|
198160
|
+
process.exit(1);
|
|
198161
|
+
}
|
|
198162
|
+
await remoteRemoveCommand(componentName);
|
|
198163
|
+
return;
|
|
198069
198164
|
case "list-events":
|
|
198070
198165
|
if (!componentName) {
|
|
198071
198166
|
console.error("[pieui] Error: Component name is required for list-events command");
|
package/dist/code/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/code/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6B,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpE,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/code/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6B,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpE,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,UAiG1C,CAAA;AAED,eAAO,MAAM,UAAU,YA6HtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/code/commands/pull.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/code/commands/pull.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,WAAW,GAAU,eAAe,MAAM,kBAwDtD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/code/commands/push.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/code/commands/push.ts"],"names":[],"mappings":"AA0DA,eAAO,MAAM,WAAW,GAAU,eAAe,MAAM,kBA0EtD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteRemove.d.ts","sourceRoot":"","sources":["../../../src/code/commands/remoteRemove.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,mBAAmB,GAAU,eAAe,MAAM,kBAwB9D,CAAA"}
|