@stackable-labs/cli-app-extension 1.85.2 → 1.86.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/index.js +13 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import Spinner5 from 'ink-spinner';
|
|
|
8
8
|
import { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import TextInput from 'ink-text-input';
|
|
11
|
-
import {
|
|
11
|
+
import { SURFACE_TARGET } from '@stackable-labs/sdk-extension-contracts';
|
|
12
12
|
import { clearAuthState, readAuthState, getToken, STANDALONE_CLIENT, writeAuthState } from '@stackable-labs/utils-auth';
|
|
13
13
|
import { execFile, spawn } from 'child_process';
|
|
14
14
|
import { promisify } from 'util';
|
|
@@ -89,7 +89,7 @@ var TEMPLATE_FLAVOR_META = {
|
|
|
89
89
|
minimal: {
|
|
90
90
|
label: "Minimal",
|
|
91
91
|
description: "Bare minimum \u2014 single surface, hello-world component",
|
|
92
|
-
defaultTargets: [
|
|
92
|
+
defaultTargets: [SURFACE_TARGET.CONTENT],
|
|
93
93
|
skipTargetStep: true
|
|
94
94
|
},
|
|
95
95
|
starter: {
|
|
@@ -101,15 +101,15 @@ var TEMPLATE_FLAVOR_META = {
|
|
|
101
101
|
"kitchen-sink": {
|
|
102
102
|
label: "Kitchen Sink",
|
|
103
103
|
description: "Everything including the kitchen sink \u2014 every component, capability, surface, and hook we could fit",
|
|
104
|
-
defaultTargets: [
|
|
104
|
+
defaultTargets: [SURFACE_TARGET.HEADER, SURFACE_TARGET.CONTENT, SURFACE_TARGET.FOOTER, SURFACE_TARGET.FOOTER_LINKS],
|
|
105
105
|
skipTargetStep: true
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
var TARGET_PERMISSION_MAP = {
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[
|
|
109
|
+
[SURFACE_TARGET.HEADER]: ["context:read"],
|
|
110
|
+
[SURFACE_TARGET.CONTENT]: ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke"],
|
|
111
|
+
[SURFACE_TARGET.FOOTER]: [],
|
|
112
|
+
[SURFACE_TARGET.FOOTER_LINKS]: []
|
|
113
113
|
};
|
|
114
114
|
var divider = (width) => "\u2500".repeat(width);
|
|
115
115
|
var INNER_DIVIDER_WIDTH = 40;
|
|
@@ -1780,9 +1780,9 @@ ${blocks.join("\n")}
|
|
|
1780
1780
|
};
|
|
1781
1781
|
var generateSurfaceFiles = async (rootDir, targets) => {
|
|
1782
1782
|
const surfaceDir = join(rootDir, "packages/extension/src/surfaces");
|
|
1783
|
-
const wantsHeader = targets.includes(
|
|
1784
|
-
const wantsContent = targets.includes(
|
|
1785
|
-
const wantsFooter = targets.includes(
|
|
1783
|
+
const wantsHeader = targets.includes(SURFACE_TARGET.HEADER);
|
|
1784
|
+
const wantsContent = targets.includes(SURFACE_TARGET.CONTENT);
|
|
1785
|
+
const wantsFooter = targets.includes(SURFACE_TARGET.FOOTER) || targets.includes(SURFACE_TARGET.FOOTER_LINKS);
|
|
1786
1786
|
await upsertOrRemove(
|
|
1787
1787
|
join(surfaceDir, "Header.tsx"),
|
|
1788
1788
|
wantsHeader,
|
|
@@ -1807,15 +1807,15 @@ var rewriteExtensionIndex = async (rootDir, extensionId, targets) => {
|
|
|
1807
1807
|
const indexPath = join(rootDir, "packages/extension/src/index.tsx");
|
|
1808
1808
|
const imports = ["import { createExtension } from '@stackable-labs/sdk-extension-react'"];
|
|
1809
1809
|
const components = [];
|
|
1810
|
-
if (targets.includes(
|
|
1810
|
+
if (targets.includes(SURFACE_TARGET.HEADER)) {
|
|
1811
1811
|
imports.push("import { Header } from './surfaces/Header'");
|
|
1812
1812
|
components.push(" <Header />");
|
|
1813
1813
|
}
|
|
1814
|
-
if (targets.includes(
|
|
1814
|
+
if (targets.includes(SURFACE_TARGET.CONTENT)) {
|
|
1815
1815
|
imports.push("import { Content } from './surfaces/Content'");
|
|
1816
1816
|
components.push(" <Content />");
|
|
1817
1817
|
}
|
|
1818
|
-
if (targets.includes(
|
|
1818
|
+
if (targets.includes(SURFACE_TARGET.FOOTER) || targets.includes(SURFACE_TARGET.FOOTER_LINKS)) {
|
|
1819
1819
|
imports.push("import { Footer } from './surfaces/Footer'");
|
|
1820
1820
|
components.push(" <Footer />");
|
|
1821
1821
|
}
|