@kenkaiiii/gg-pixel 4.3.84 → 4.3.85
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 +24 -16
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +24 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -491,8 +491,8 @@ async function install(opts = {}) {
|
|
|
491
491
|
const existingKey = readEnvKey(envFilePath, "GG_PIXEL_KEY");
|
|
492
492
|
let created;
|
|
493
493
|
let reused = false;
|
|
494
|
-
if (existing && existingKey) {
|
|
495
|
-
created = { id: existing.id, key: existingKey };
|
|
494
|
+
if (existing && existing.secret && existingKey) {
|
|
495
|
+
created = { id: existing.id, key: existingKey, secret: existing.secret };
|
|
496
496
|
reused = true;
|
|
497
497
|
} else {
|
|
498
498
|
created = await createProject(fetchFn, ingestUrl, projectName);
|
|
@@ -509,10 +509,11 @@ async function install(opts = {}) {
|
|
|
509
509
|
if (kind !== "browser" && kind !== "tauri") {
|
|
510
510
|
writeEnvKey(envFilePath, "GG_PIXEL_KEY", created.key);
|
|
511
511
|
}
|
|
512
|
-
writeProjectsMapping(projectsJsonPath, created.id, projectName, nodeRoot);
|
|
512
|
+
writeProjectsMapping(projectsJsonPath, created.id, projectName, nodeRoot, created.secret);
|
|
513
513
|
return {
|
|
514
514
|
projectId: created.id,
|
|
515
515
|
projectKey: created.key,
|
|
516
|
+
projectSecret: created.secret,
|
|
516
517
|
projectName,
|
|
517
518
|
projectKind: kind,
|
|
518
519
|
initFilePath: wired.primaryInitPath,
|
|
@@ -569,8 +570,10 @@ async function createProject(fetchFn, ingestUrl, name) {
|
|
|
569
570
|
throw new Error(`POST /api/projects failed: ${res.status} ${await safeText(res)}`);
|
|
570
571
|
}
|
|
571
572
|
const body = await res.json();
|
|
572
|
-
if (!body.id || !body.key
|
|
573
|
-
|
|
573
|
+
if (!body.id || !body.key || !body.secret) {
|
|
574
|
+
throw new Error("response missing id/key/secret");
|
|
575
|
+
}
|
|
576
|
+
return { id: body.id, key: body.key, secret: body.secret };
|
|
574
577
|
}
|
|
575
578
|
async function safeText(r) {
|
|
576
579
|
try {
|
|
@@ -1476,8 +1479,8 @@ async function installGo(ctx) {
|
|
|
1476
1479
|
const existingKey = readEnvKey(envFilePath, "GG_PIXEL_KEY");
|
|
1477
1480
|
let created;
|
|
1478
1481
|
let reused = false;
|
|
1479
|
-
if (existing && existingKey) {
|
|
1480
|
-
created = { id: existing.id, key: existingKey };
|
|
1482
|
+
if (existing && existing.secret && existingKey) {
|
|
1483
|
+
created = { id: existing.id, key: existingKey, secret: existing.secret };
|
|
1481
1484
|
reused = true;
|
|
1482
1485
|
} else {
|
|
1483
1486
|
created = await createProject(fetchFn, ingestUrl, projectName);
|
|
@@ -1505,10 +1508,11 @@ func init() {
|
|
|
1505
1508
|
"utf8"
|
|
1506
1509
|
);
|
|
1507
1510
|
writeEnvKey(envFilePath, "GG_PIXEL_KEY", created.key);
|
|
1508
|
-
writeProjectsMapping(projectsJsonPath, created.id, projectName, projectRoot);
|
|
1511
|
+
writeProjectsMapping(projectsJsonPath, created.id, projectName, projectRoot, created.secret);
|
|
1509
1512
|
return {
|
|
1510
1513
|
projectId: created.id,
|
|
1511
1514
|
projectKey: created.key,
|
|
1515
|
+
projectSecret: created.secret,
|
|
1512
1516
|
projectName,
|
|
1513
1517
|
projectKind: "go",
|
|
1514
1518
|
initFilePath,
|
|
@@ -1549,8 +1553,8 @@ async function installRuby(ctx) {
|
|
|
1549
1553
|
const existingKey = readEnvKey(envFilePath, "GG_PIXEL_KEY");
|
|
1550
1554
|
let created;
|
|
1551
1555
|
let reused = false;
|
|
1552
|
-
if (existing && existingKey) {
|
|
1553
|
-
created = { id: existing.id, key: existingKey };
|
|
1556
|
+
if (existing && existing.secret && existingKey) {
|
|
1557
|
+
created = { id: existing.id, key: existingKey, secret: existing.secret };
|
|
1554
1558
|
reused = true;
|
|
1555
1559
|
} else {
|
|
1556
1560
|
created = await createProject(fetchFn, ingestUrl, projectName);
|
|
@@ -1569,10 +1573,11 @@ GGPixel.init(
|
|
|
1569
1573
|
"utf8"
|
|
1570
1574
|
);
|
|
1571
1575
|
writeEnvKey(envFilePath, "GG_PIXEL_KEY", created.key);
|
|
1572
|
-
writeProjectsMapping(projectsJsonPath, created.id, projectName, projectRoot);
|
|
1576
|
+
writeProjectsMapping(projectsJsonPath, created.id, projectName, projectRoot, created.secret);
|
|
1573
1577
|
return {
|
|
1574
1578
|
projectId: created.id,
|
|
1575
1579
|
projectKey: created.key,
|
|
1580
|
+
projectSecret: created.secret,
|
|
1576
1581
|
projectName,
|
|
1577
1582
|
projectKind: "ruby",
|
|
1578
1583
|
initFilePath,
|
|
@@ -1625,8 +1630,8 @@ async function installPython(ctx) {
|
|
|
1625
1630
|
const existingKey = readEnvKey(envFilePath, "GG_PIXEL_KEY");
|
|
1626
1631
|
let created;
|
|
1627
1632
|
let reused = false;
|
|
1628
|
-
if (existing && existingKey) {
|
|
1629
|
-
created = { id: existing.id, key: existingKey };
|
|
1633
|
+
if (existing && existing.secret && existingKey) {
|
|
1634
|
+
created = { id: existing.id, key: existingKey, secret: existing.secret };
|
|
1630
1635
|
reused = true;
|
|
1631
1636
|
} else {
|
|
1632
1637
|
created = await createProject(fetchFn, ingestUrl, projectName);
|
|
@@ -1636,11 +1641,12 @@ async function installPython(ctx) {
|
|
|
1636
1641
|
const initFilePath = (0, import_node_path2.join)(projectRoot, "gg_pixel_init.py");
|
|
1637
1642
|
(0, import_node_fs3.writeFileSync)(initFilePath, renderPythonInitFile(ingestUrl, created.key), "utf8");
|
|
1638
1643
|
writeEnvKey(envFilePath, "GG_PIXEL_KEY", created.key);
|
|
1639
|
-
writeProjectsMapping(projectsJsonPath, created.id, projectName, projectRoot);
|
|
1644
|
+
writeProjectsMapping(projectsJsonPath, created.id, projectName, projectRoot, created.secret);
|
|
1640
1645
|
const entryWiring = wirePythonEntry(projectRoot, initFilePath);
|
|
1641
1646
|
return {
|
|
1642
1647
|
projectId: created.id,
|
|
1643
1648
|
projectKey: created.key,
|
|
1649
|
+
projectSecret: created.secret,
|
|
1644
1650
|
projectName,
|
|
1645
1651
|
projectKind: "python",
|
|
1646
1652
|
initFilePath,
|
|
@@ -1758,7 +1764,7 @@ function findPythonEntryFile(projectRoot) {
|
|
|
1758
1764
|
}
|
|
1759
1765
|
return null;
|
|
1760
1766
|
}
|
|
1761
|
-
function writeProjectsMapping(projectsJsonPath, projectId, name, path) {
|
|
1767
|
+
function writeProjectsMapping(projectsJsonPath, projectId, name, path, secret) {
|
|
1762
1768
|
(0, import_node_fs3.mkdirSync)((0, import_node_path2.dirname)(projectsJsonPath), { recursive: true });
|
|
1763
1769
|
let map = {};
|
|
1764
1770
|
if ((0, import_node_fs3.existsSync)(projectsJsonPath)) {
|
|
@@ -1767,7 +1773,9 @@ function writeProjectsMapping(projectsJsonPath, projectId, name, path) {
|
|
|
1767
1773
|
} catch {
|
|
1768
1774
|
}
|
|
1769
1775
|
}
|
|
1770
|
-
|
|
1776
|
+
const entry = { name, path };
|
|
1777
|
+
if (secret) entry.secret = secret;
|
|
1778
|
+
map[projectId] = entry;
|
|
1771
1779
|
(0, import_node_fs3.writeFileSync)(projectsJsonPath, `${JSON.stringify(map, null, 2)}
|
|
1772
1780
|
`, "utf8");
|
|
1773
1781
|
}
|