@supernovaio/cli 2.0.39 → 2.0.41
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/code-analyzer/analyzers/component-usage.d.ts +6 -0
- package/dist/code-analyzer/analyzers/component-usage.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/component-usage.js +344 -0
- package/dist/code-analyzer/analyzers/component-usage.js.map +1 -0
- package/dist/code-analyzer/analyzers/helpers.d.ts +11 -0
- package/dist/code-analyzer/analyzers/helpers.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/helpers.js +59 -0
- package/dist/code-analyzer/analyzers/helpers.js.map +1 -0
- package/dist/code-analyzer/analyzers/index.d.ts +8 -0
- package/dist/code-analyzer/analyzers/index.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/index.js +11 -0
- package/dist/code-analyzer/analyzers/index.js.map +1 -0
- package/dist/code-analyzer/analyzers/jsdoc.d.ts +3 -0
- package/dist/code-analyzer/analyzers/jsdoc.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/jsdoc.js +7 -0
- package/dist/code-analyzer/analyzers/jsdoc.js.map +1 -0
- package/dist/code-analyzer/analyzers/static-components.d.ts +3 -0
- package/dist/code-analyzer/analyzers/static-components.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/static-components.js +399 -0
- package/dist/code-analyzer/analyzers/static-components.js.map +1 -0
- package/dist/code-analyzer/analyzers/storybook-docs.d.ts +3 -0
- package/dist/code-analyzer/analyzers/storybook-docs.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/storybook-docs.js +163 -0
- package/dist/code-analyzer/analyzers/storybook-docs.js.map +1 -0
- package/dist/code-analyzer/analyzers/storybook-stories.d.ts +3 -0
- package/dist/code-analyzer/analyzers/storybook-stories.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/storybook-stories.js +91 -0
- package/dist/code-analyzer/analyzers/storybook-stories.js.map +1 -0
- package/dist/code-analyzer/analyzers/types.d.ts +88 -0
- package/dist/code-analyzer/analyzers/types.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/types.js +12 -0
- package/dist/code-analyzer/analyzers/types.js.map +1 -0
- package/dist/code-analyzer/analyzers/typescript-api.d.ts +3 -0
- package/dist/code-analyzer/analyzers/typescript-api.d.ts.map +1 -0
- package/dist/code-analyzer/analyzers/typescript-api.js +7 -0
- package/dist/code-analyzer/analyzers/typescript-api.js.map +1 -0
- package/dist/code-analyzer/components/analyze.d.ts +8 -0
- package/dist/code-analyzer/components/analyze.d.ts.map +1 -0
- package/dist/code-analyzer/components/analyze.js +38 -0
- package/dist/code-analyzer/components/analyze.js.map +1 -0
- package/dist/code-analyzer/components/mappers/component.d.ts +4 -0
- package/dist/code-analyzer/components/mappers/component.d.ts.map +1 -0
- package/dist/code-analyzer/components/mappers/component.js +20 -0
- package/dist/code-analyzer/components/mappers/component.js.map +1 -0
- package/dist/code-analyzer/components/mappers/property.d.ts +4 -0
- package/dist/code-analyzer/components/mappers/property.d.ts.map +1 -0
- package/dist/code-analyzer/components/mappers/property.js +19 -0
- package/dist/code-analyzer/components/mappers/property.js.map +1 -0
- package/dist/code-analyzer/components/parser/index.d.ts +6 -0
- package/dist/code-analyzer/components/parser/index.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/index.js +9 -0
- package/dist/code-analyzer/components/parser/index.js.map +1 -0
- package/dist/code-analyzer/components/parser/module-parser.d.ts +12 -0
- package/dist/code-analyzer/components/parser/module-parser.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/module-parser.js +116 -0
- package/dist/code-analyzer/components/parser/module-parser.js.map +1 -0
- package/dist/code-analyzer/components/parser/parser.d.ts +46 -0
- package/dist/code-analyzer/components/parser/parser.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/parser.js +904 -0
- package/dist/code-analyzer/components/parser/parser.js.map +1 -0
- package/dist/code-analyzer/components/parser/types.d.ts +123 -0
- package/dist/code-analyzer/components/parser/types.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/types.js +21 -0
- package/dist/code-analyzer/components/parser/types.js.map +1 -0
- package/dist/code-analyzer/components/parser/utils/build-filter.d.ts +3 -0
- package/dist/code-analyzer/components/parser/utils/build-filter.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/utils/build-filter.js +31 -0
- package/dist/code-analyzer/components/parser/utils/build-filter.js.map +1 -0
- package/dist/code-analyzer/components/parser/utils/filter-duplicates.d.ts +3 -0
- package/dist/code-analyzer/components/parser/utils/filter-duplicates.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/utils/filter-duplicates.js +17 -0
- package/dist/code-analyzer/components/parser/utils/filter-duplicates.js.map +1 -0
- package/dist/code-analyzer/components/parser/utils/is-react-component.d.ts +4 -0
- package/dist/code-analyzer/components/parser/utils/is-react-component.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/utils/is-react-component.js +43 -0
- package/dist/code-analyzer/components/parser/utils/is-react-component.js.map +1 -0
- package/dist/code-analyzer/components/parser/utils/trim-file-name.d.ts +2 -0
- package/dist/code-analyzer/components/parser/utils/trim-file-name.d.ts.map +1 -0
- package/dist/code-analyzer/components/parser/utils/trim-file-name.js +22 -0
- package/dist/code-analyzer/components/parser/utils/trim-file-name.js.map +1 -0
- package/dist/code-analyzer/components/types.d.ts +18 -0
- package/dist/code-analyzer/components/types.d.ts.map +1 -0
- package/dist/code-analyzer/components/types.js +5 -0
- package/dist/code-analyzer/components/types.js.map +1 -0
- package/dist/code-analyzer/components/utils/get-module-exports-path.d.ts +2 -0
- package/dist/code-analyzer/components/utils/get-module-exports-path.d.ts.map +1 -0
- package/dist/code-analyzer/components/utils/get-module-exports-path.js +60 -0
- package/dist/code-analyzer/components/utils/get-module-exports-path.js.map +1 -0
- package/dist/code-analyzer/index.d.ts +5 -0
- package/dist/code-analyzer/index.d.ts.map +1 -0
- package/dist/code-analyzer/index.js +8 -0
- package/dist/code-analyzer/index.js.map +1 -0
- package/dist/code-analyzer/orchestrator/index.d.ts +2 -0
- package/dist/code-analyzer/orchestrator/index.d.ts.map +1 -0
- package/dist/code-analyzer/orchestrator/index.js +5 -0
- package/dist/code-analyzer/orchestrator/index.js.map +1 -0
- package/dist/code-analyzer/orchestrator/run-analysis.d.ts +19 -0
- package/dist/code-analyzer/orchestrator/run-analysis.d.ts.map +1 -0
- package/dist/code-analyzer/orchestrator/run-analysis.js +109 -0
- package/dist/code-analyzer/orchestrator/run-analysis.js.map +1 -0
- package/dist/code-analyzer/snapshot/index.d.ts +2 -0
- package/dist/code-analyzer/snapshot/index.d.ts.map +1 -0
- package/dist/code-analyzer/snapshot/index.js +5 -0
- package/dist/code-analyzer/snapshot/index.js.map +1 -0
- package/dist/code-analyzer/snapshot/write-snapshot.d.ts +17 -0
- package/dist/code-analyzer/snapshot/write-snapshot.d.ts.map +1 -0
- package/dist/code-analyzer/snapshot/write-snapshot.js +60 -0
- package/dist/code-analyzer/snapshot/write-snapshot.js.map +1 -0
- package/dist/commands/analyze.d.ts +0 -1
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +25 -5
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/components-import.js +3 -3
- package/dist/commands/components-import.js.map +1 -1
- package/dist/commands/publish-documentation.d.ts +2 -2
- package/dist/commands/run-local-exporter.js +2 -2
- package/dist/commands/run-local-exporter.js.map +1 -1
- package/dist/commands/storybook-import.d.ts +2 -2
- package/dist/commands/template-upload.d.ts +1 -0
- package/dist/commands/template-upload.d.ts.map +1 -1
- package/dist/commands/template-upload.js +57 -18
- package/dist/commands/template-upload.js.map +1 -1
- package/dist/docker-scripts/extract-private-packages-tarball.js +282 -0
- package/dist/types/config.d.ts +5 -5
- package/dist/types/types.js +2 -2
- package/dist/types/types.js.map +1 -1
- package/dist/utils/analyze-command.d.ts.map +1 -1
- package/dist/utils/analyze-command.js +30 -3
- package/dist/utils/analyze-command.js.map +1 -1
- package/dist/utils/discover.d.ts +2 -2
- package/dist/utils/discover.d.ts.map +1 -1
- package/dist/utils/discover.js +25 -23
- package/dist/utils/discover.js.map +1 -1
- package/dist/utils/figma-tokens-data-loader.js +2 -2
- package/dist/utils/figma-tokens-data-loader.js.map +1 -1
- package/dist/utils/run-exporter/exporter-utils.js +2 -2
- package/dist/utils/run-exporter/exporter-utils.js.map +1 -1
- package/dist/utils/validate-templates.d.ts +1 -1
- package/dist/utils/validate-templates.d.ts.map +1 -1
- package/dist/utils/validate-templates.js +4 -4
- package/dist/utils/validate-templates.js.map +1 -1
- package/oclif.manifest.json +13 -5
- package/package.json +8 -3
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process"
|
|
2
|
+
import fs from "node:fs"
|
|
3
|
+
import path from "node:path"
|
|
4
|
+
|
|
5
|
+
const PRIVATE_DEPS_DIR_NAME = "private-deps"
|
|
6
|
+
const REWRITE_MARKER_FILE = ".supernova-private-deps-rewritten"
|
|
7
|
+
const NPM_PUBLIC_REGISTRY_HOST = "registry.npmjs.org"
|
|
8
|
+
|
|
9
|
+
;(() => {
|
|
10
|
+
const packageJsonPath = path.join(process.cwd(), "package.json")
|
|
11
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString())
|
|
12
|
+
const packageLock = readPackageLockJson()
|
|
13
|
+
|
|
14
|
+
const declaredPrivateDependencies = packageJson.supernova?.privateDependencies
|
|
15
|
+
if (declaredPrivateDependencies && !Array.isArray(declaredPrivateDependencies)) {
|
|
16
|
+
throw new TypeError(
|
|
17
|
+
`supernova.privateDependencies must be an array, example: "privateDependencies": ["@example/package"]`,
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const parsedDeclaredPrivateDependencies = declaredPrivateDependencies
|
|
22
|
+
? validateAndParseDeclaredPrivateDependencies(declaredPrivateDependencies)
|
|
23
|
+
: {exactDependencies: [], scopePatterns: []}
|
|
24
|
+
const detectedByLockfileHost = detectPrivateDependenciesFromPackageLock(packageLock)
|
|
25
|
+
const detectedByPrivateDependencyScopes = detectPrivateDependenciesFromScopePatterns(
|
|
26
|
+
packageLock,
|
|
27
|
+
parsedDeclaredPrivateDependencies.scopePatterns,
|
|
28
|
+
packageJson,
|
|
29
|
+
)
|
|
30
|
+
const detectedPrivateDependencies = [...new Set([...detectedByLockfileHost, ...detectedByPrivateDependencyScopes])]
|
|
31
|
+
const privateDependencies = [...new Set([...detectedPrivateDependencies, ...parsedDeclaredPrivateDependencies.exactDependencies])]
|
|
32
|
+
|
|
33
|
+
if (privateDependencies.length === 0) return
|
|
34
|
+
|
|
35
|
+
console.log(
|
|
36
|
+
`private dependency detection: lockfileHost=${detectedByLockfileHost.length}, scopePattern=${detectedByPrivateDependencyScopes.length}, fallback=${parsedDeclaredPrivateDependencies.exactDependencies.length}, total=${privateDependencies.length}`,
|
|
37
|
+
)
|
|
38
|
+
if (detectedByLockfileHost.length > 0) {
|
|
39
|
+
console.log(`lockfile-host private deps: ${detectedByLockfileHost.join(", ")}`)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (parsedDeclaredPrivateDependencies.scopePatterns.length > 0) {
|
|
43
|
+
console.log(
|
|
44
|
+
`configured private dependency scope patterns: ${parsedDeclaredPrivateDependencies.scopePatterns.join(", ")}`,
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (detectedByPrivateDependencyScopes.length > 0) {
|
|
49
|
+
console.log(`scope-detected private deps: ${detectedByPrivateDependencyScopes.join(", ")}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (parsedDeclaredPrivateDependencies.exactDependencies.length > 0) {
|
|
53
|
+
console.log(`fallback private deps: ${parsedDeclaredPrivateDependencies.exactDependencies.join(", ")}`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const privateDepsDir = path.join(process.cwd(), PRIVATE_DEPS_DIR_NAME)
|
|
57
|
+
fs.rmSync(privateDepsDir, { recursive: true, force: true })
|
|
58
|
+
fs.mkdirSync(privateDepsDir, { recursive: true })
|
|
59
|
+
|
|
60
|
+
if (typeof packageJson.dependencies !== "object" || packageJson.dependencies === null) {
|
|
61
|
+
packageJson.dependencies = {}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const dependency of privateDependencies) {
|
|
65
|
+
// Create a tarball from already installed dependency source.
|
|
66
|
+
const src = resolveDependencySourceFullPath(dependency, packageLock)
|
|
67
|
+
if (!src) {
|
|
68
|
+
throw new Error(`Private dependency ${dependency} must be present in node_modules`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const tarballFileName = packDependencyTarball(src, privateDepsDir)
|
|
73
|
+
packageJson.dependencies[dependency] = `file:${getDependencyTarballRelativePath(tarballFileName)}`
|
|
74
|
+
console.log(`packed ${dependency} -> private-deps/${tarballFileName}`)
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error(`Couldn't pack dependency ${dependency} from ${src}`)
|
|
77
|
+
throw error
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
fs.writeFileSync(packageJsonPath, Buffer.from(JSON.stringify(packageJson, null, 2) + "\n"))
|
|
82
|
+
fs.writeFileSync(path.join(process.cwd(), REWRITE_MARKER_FILE), "")
|
|
83
|
+
console.log(`rewritten root dependencies to file: tarballs and created ${REWRITE_MARKER_FILE}`)
|
|
84
|
+
})()
|
|
85
|
+
|
|
86
|
+
function validateAndParseDeclaredPrivateDependencies(privateDependencies) {
|
|
87
|
+
const exactDependencies = []
|
|
88
|
+
const scopePatterns = []
|
|
89
|
+
|
|
90
|
+
for (const [i, d] of privateDependencies.entries()) {
|
|
91
|
+
if (typeof d !== "string") {
|
|
92
|
+
throw new TypeError(`Invalid value at supernova.privateDependencies[${i}]: '${d}'`)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!isValidPrivateDependencyEntry(d)) {
|
|
96
|
+
throw new TypeError(
|
|
97
|
+
`supernova.privateDependencies[${i}] must be a package name or scope wildcard like "@example/*"`,
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (isPrivateDependencyScopePattern(d)) {
|
|
102
|
+
scopePatterns.push(d)
|
|
103
|
+
} else {
|
|
104
|
+
exactDependencies.push(d)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {exactDependencies, scopePatterns}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function readPackageLockJson() {
|
|
112
|
+
const packageLockPath = path.join(process.cwd(), "package-lock.json")
|
|
113
|
+
if (!fs.existsSync(packageLockPath)) {
|
|
114
|
+
return null
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
return JSON.parse(fs.readFileSync(packageLockPath, "utf8"))
|
|
119
|
+
} catch {
|
|
120
|
+
return null
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function detectPrivateDependenciesFromPackageLock(packageLock) {
|
|
125
|
+
if (!packageLock || typeof packageLock !== "object" || !packageLock.packages || typeof packageLock.packages !== "object") {
|
|
126
|
+
return []
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const privatePackages = new Set()
|
|
130
|
+
|
|
131
|
+
for (const [packagePath, packageMeta] of Object.entries(packageLock.packages)) {
|
|
132
|
+
const packageName = extractPackageNameFromLockfilePath(packagePath)
|
|
133
|
+
if (!packageName || !packageMeta || typeof packageMeta !== "object") {
|
|
134
|
+
continue
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const {resolved} = packageMeta
|
|
138
|
+
if (typeof resolved !== "string") {
|
|
139
|
+
continue
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (isPrivateResolvedUrl(resolved)) {
|
|
143
|
+
privatePackages.add(packageName)
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return [...privatePackages].sort()
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function detectPrivateDependenciesFromScopePatterns(packageLock, privateDependencyScopePatterns, packageJson) {
|
|
151
|
+
if (privateDependencyScopePatterns.length === 0) return []
|
|
152
|
+
|
|
153
|
+
const packageNames = new Set(collectPackageNamesFromPackageLock(packageLock))
|
|
154
|
+
if (packageNames.size === 0) {
|
|
155
|
+
for (const depName of Object.keys(packageJson.dependencies ?? {})) {
|
|
156
|
+
packageNames.add(depName)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return [...packageNames]
|
|
161
|
+
.filter(packageName => matchesAnyPrivateDependencyScopePattern(packageName, privateDependencyScopePatterns))
|
|
162
|
+
.sort()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function collectPackageNamesFromPackageLock(packageLock) {
|
|
166
|
+
if (!packageLock || typeof packageLock !== "object" || !packageLock.packages || typeof packageLock.packages !== "object") {
|
|
167
|
+
return []
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const names = new Set()
|
|
171
|
+
for (const packagePath of Object.keys(packageLock.packages)) {
|
|
172
|
+
const packageName = extractPackageNameFromLockfilePath(packagePath)
|
|
173
|
+
if (packageName) {
|
|
174
|
+
names.add(packageName)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return [...names]
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function matchesAnyPrivateDependencyScopePattern(packageName, privateDependencyScopePatterns) {
|
|
182
|
+
return privateDependencyScopePatterns.some(pattern => {
|
|
183
|
+
const scope = pattern.slice(0, -2)
|
|
184
|
+
return packageName === scope || packageName.startsWith(`${scope}/`)
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function isPrivateDependencyScopePattern(entry) {
|
|
189
|
+
return typeof entry === "string" && entry.endsWith("/*")
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function isValidPrivateDependencyEntry(entry) {
|
|
193
|
+
if (!entry || typeof entry !== "string" || entry.includes(" ")) return false
|
|
194
|
+
if (isPrivateDependencyScopePattern(entry)) {
|
|
195
|
+
const scope = entry.slice(0, -2)
|
|
196
|
+
return scope.startsWith("@") && !scope.includes("/")
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return true
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function isPrivateResolvedUrl(resolved) {
|
|
203
|
+
if (!resolved || resolved.startsWith("file:")) return false
|
|
204
|
+
|
|
205
|
+
let url
|
|
206
|
+
try {
|
|
207
|
+
url = new URL(resolved)
|
|
208
|
+
} catch {
|
|
209
|
+
return false
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return url.hostname !== NPM_PUBLIC_REGISTRY_HOST
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function extractPackageNameFromLockfilePath(packagePath) {
|
|
216
|
+
if (typeof packagePath !== "string" || packagePath.length === 0) return null
|
|
217
|
+
const segments = packagePath.split("/")
|
|
218
|
+
|
|
219
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
220
|
+
if (segments[i] !== "node_modules") continue
|
|
221
|
+
const first = segments[i + 1]
|
|
222
|
+
if (!first) return null
|
|
223
|
+
|
|
224
|
+
if (first.startsWith("@")) {
|
|
225
|
+
const second = segments[i + 2]
|
|
226
|
+
return second ? `${first}/${second}` : null
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return first
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return null
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function resolveDependencySourceFullPath(packageName, packageLock) {
|
|
236
|
+
const topLevelPath = path.join(process.cwd(), "node_modules", packageName)
|
|
237
|
+
if (fs.existsSync(topLevelPath)) {
|
|
238
|
+
return topLevelPath
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (!packageLock || typeof packageLock !== "object" || !packageLock.packages || typeof packageLock.packages !== "object") {
|
|
242
|
+
return null
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const candidatePaths = Object.keys(packageLock.packages)
|
|
246
|
+
.filter(packagePath => extractPackageNameFromLockfilePath(packagePath) === packageName)
|
|
247
|
+
.filter(packagePath => packagePath.length > 0)
|
|
248
|
+
.sort((a, b) => a.split("/").length - b.split("/").length)
|
|
249
|
+
|
|
250
|
+
for (const packagePath of candidatePaths) {
|
|
251
|
+
const fullPath = path.join(process.cwd(), packagePath)
|
|
252
|
+
if (fs.existsSync(fullPath)) {
|
|
253
|
+
return fullPath
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return null
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function packDependencyTarball(sourcePath, destinationDir) {
|
|
261
|
+
const output = execFileSync("npm", ["pack", sourcePath, "--pack-destination", destinationDir], {
|
|
262
|
+
encoding: "utf8",
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
const lines = output
|
|
266
|
+
.trim()
|
|
267
|
+
.split("\n")
|
|
268
|
+
.map(line => line.trim())
|
|
269
|
+
.filter(Boolean)
|
|
270
|
+
const tarballFileName = lines.at(-1)
|
|
271
|
+
if (!tarballFileName) {
|
|
272
|
+
throw new Error(`npm pack did not return tarball name for ${sourcePath}`)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return tarballFileName
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function getDependencyTarballRelativePath(tarballFileName) {
|
|
279
|
+
return path.join(".", PRIVATE_DEPS_DIR_NAME, tarballFileName)
|
|
280
|
+
}
|
|
281
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5c2f1f89-00b6-5b9e-b68c-e052e419d440")}catch(e){}}();
|
|
282
|
+
//# debugId=5c2f1f89-00b6-5b9e-b68c-e052e419d440
|
package/dist/types/config.d.ts
CHANGED
|
@@ -7,17 +7,17 @@ export declare const SupernovaConfigStorybook: z.ZodObject<{
|
|
|
7
7
|
from: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
8
8
|
publicAccess: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name?: string | undefined;
|
|
10
11
|
designSystemId?: string | undefined;
|
|
11
12
|
sourceId?: string | undefined;
|
|
12
13
|
brandId?: string | undefined;
|
|
13
|
-
name?: string | undefined;
|
|
14
14
|
from?: string | undefined;
|
|
15
15
|
publicAccess?: boolean | undefined;
|
|
16
16
|
}, {
|
|
17
|
+
name?: unknown;
|
|
17
18
|
designSystemId?: unknown;
|
|
18
19
|
sourceId?: unknown;
|
|
19
20
|
brandId?: unknown;
|
|
20
|
-
name?: unknown;
|
|
21
21
|
from?: unknown;
|
|
22
22
|
publicAccess?: unknown;
|
|
23
23
|
}>;
|
|
@@ -57,17 +57,17 @@ export declare const SupernovaConfig: z.ZodCatch<z.ZodObject<{
|
|
|
57
57
|
from: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
58
58
|
publicAccess: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
|
|
59
59
|
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
name?: string | undefined;
|
|
60
61
|
designSystemId?: string | undefined;
|
|
61
62
|
sourceId?: string | undefined;
|
|
62
63
|
brandId?: string | undefined;
|
|
63
|
-
name?: string | undefined;
|
|
64
64
|
from?: string | undefined;
|
|
65
65
|
publicAccess?: boolean | undefined;
|
|
66
66
|
}, {
|
|
67
|
+
name?: unknown;
|
|
67
68
|
designSystemId?: unknown;
|
|
68
69
|
sourceId?: unknown;
|
|
69
70
|
brandId?: unknown;
|
|
70
|
-
name?: unknown;
|
|
71
71
|
from?: unknown;
|
|
72
72
|
publicAccess?: unknown;
|
|
73
73
|
}>>>;
|
|
@@ -79,10 +79,10 @@ export declare const SupernovaConfig: z.ZodCatch<z.ZodObject<{
|
|
|
79
79
|
excludedPackages?: string[] | undefined;
|
|
80
80
|
} | undefined;
|
|
81
81
|
storybook?: {
|
|
82
|
+
name?: string | undefined;
|
|
82
83
|
designSystemId?: string | undefined;
|
|
83
84
|
sourceId?: string | undefined;
|
|
84
85
|
brandId?: string | undefined;
|
|
85
|
-
name?: string | undefined;
|
|
86
86
|
from?: string | undefined;
|
|
87
87
|
publicAccess?: boolean | undefined;
|
|
88
88
|
} | undefined;
|
package/dist/types/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="21376bfd-ee7e-512e-8733-59f08ad6cbff")}catch(e){}}();
|
|
3
3
|
export var ErrorCode;
|
|
4
4
|
(function (ErrorCode) {
|
|
5
5
|
ErrorCode["designSystemDescriptionFailed"] = "ERR_DESIGN_SYSTEM_DESCRIPTION_FAILED";
|
|
@@ -9,4 +9,4 @@ export var ErrorCode;
|
|
|
9
9
|
ErrorCode["workspaceDescriptionFailed"] = "ERR_WORKSPACE_DESCRIPTION_FAILED";
|
|
10
10
|
})(ErrorCode || (ErrorCode = {}));
|
|
11
11
|
//# sourceMappingURL=types.js.map
|
|
12
|
-
//# debugId=
|
|
12
|
+
//# debugId=21376bfd-ee7e-512e-8733-59f08ad6cbff
|
package/dist/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/types/types.ts"],"sourceRoot":"","sourcesContent":["//\n// types.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright © Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\n
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/types/types.ts"],"sourceRoot":"","sourcesContent":["//\n// types.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright © Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\n \nimport * as pulsar from \"@supernova-studio/pulsar-language\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Types\n\nexport interface ExportConfiguration {\n accessToken: string\n apiUrl: string\n apiVersion?: string\n brandId?: string\n debugMode?: boolean\n designSystemId: string\n designSystemVersionId: string\n exportPath: string\n logger: pulsar.PLLogger\n proxyUrl?: string\n themeId?: string\n}\n\nexport enum ErrorCode {\n designSystemDescriptionFailed = \"ERR_DESIGN_SYSTEM_DESCRIPTION_FAILED\",\n documentationPublishingFailed = \"ERR_DOCUMENTATION_PUBLISHING_FAILED\",\n exportFailed = \"ERR_EXPORT_FAILED\",\n tokenSyncFailed = \"ERR_TOKEN_SYNC_FAILED\",\n workspaceDescriptionFailed = \"ERR_WORKSPACE_DESCRIPTION_FAILED\",\n}\n"],"names":[],"mappings":";;AA+BA,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,mFAAsE,CAAA;IACtE,kFAAqE,CAAA;IACrE,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,4EAA+D,CAAA;AACjE,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB","debug_id":"21376bfd-ee7e-512e-8733-59f08ad6cbff"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze-command.d.ts","sourceRoot":"","sources":["../../src/utils/analyze-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyze-command.d.ts","sourceRoot":"","sources":["../../src/utils/analyze-command.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAKjD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;EAMrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC7E,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,YAAY,GAAG,OAAO,CAAA;AAwDxD,eAAO,MAAM,YAAY;;;;;;CAmBxB,CAAA;AAED,8BAAsB,kBAAmB,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAClF,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAEhD;cAEe,cAAc,CAAC,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAmOpG,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,oBAAoB;YAoBd,cAAc;YAkFd,kBAAkB;YAuBlB,6BAA6B;IAgB3C,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b1b0f3f1-2050-5c37-9714-32da972b95c4")}catch(e){}}();
|
|
3
3
|
import { Flags } from "@oclif/core";
|
|
4
|
-
import { runCodeAnalysis } from "
|
|
4
|
+
import { runCodeAnalysis } from "../code-analyzer/orchestrator/run-analysis.js";
|
|
5
5
|
import AdmZip from "adm-zip";
|
|
6
6
|
import axios, { isAxiosError } from "axios";
|
|
7
|
+
import { globSync } from "glob";
|
|
7
8
|
import crypto from "node:crypto";
|
|
8
9
|
import fs from "node:fs";
|
|
9
10
|
import path from "node:path";
|
|
@@ -390,6 +391,13 @@ function resolveCandidatePackageDirs(rootDir) {
|
|
|
390
391
|
if (workspacePackageDirs.length > 0) {
|
|
391
392
|
return workspacePackageDirs;
|
|
392
393
|
}
|
|
394
|
+
const rootPackageJsonPath = path.join(rootDir, "package.json");
|
|
395
|
+
if (!fs.existsSync(rootPackageJsonPath)) {
|
|
396
|
+
const recursivePackageDirs = resolveRecursivePackageDirs(rootDir);
|
|
397
|
+
if (recursivePackageDirs.length > 0) {
|
|
398
|
+
return recursivePackageDirs;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
393
401
|
return resolveDirectChildPackageDirs(rootDir);
|
|
394
402
|
}
|
|
395
403
|
function resolveWorkspacePackageDirs(rootDir) {
|
|
@@ -446,6 +454,25 @@ function resolveDirectChildPackageDirs(rootDir) {
|
|
|
446
454
|
}
|
|
447
455
|
return result;
|
|
448
456
|
}
|
|
457
|
+
function resolveRecursivePackageDirs(rootDir) {
|
|
458
|
+
const packageJsonPaths = globSync("**/package.json", {
|
|
459
|
+
absolute: true,
|
|
460
|
+
cwd: rootDir,
|
|
461
|
+
dot: false,
|
|
462
|
+
ignore: [
|
|
463
|
+
"**/.git/**",
|
|
464
|
+
"**/.next/**",
|
|
465
|
+
"**/.supernova/**",
|
|
466
|
+
"**/build/**",
|
|
467
|
+
"**/coverage/**",
|
|
468
|
+
"**/dist/**",
|
|
469
|
+
"**/node_modules/**",
|
|
470
|
+
"**/out/**",
|
|
471
|
+
],
|
|
472
|
+
nodir: true,
|
|
473
|
+
});
|
|
474
|
+
return [...new Set(packageJsonPaths.map(packageJsonPath => path.dirname(packageJsonPath)))].sort((a, b) => a.localeCompare(b));
|
|
475
|
+
}
|
|
449
476
|
function resolveComponentPackageNames(rootDir, candidatePackageDirs, componentPackages) {
|
|
450
477
|
const byName = new Map(candidatePackageDirs.map(packageDir => [readPackageName(packageDir), packageDir]));
|
|
451
478
|
const names = new Set();
|
|
@@ -603,4 +630,4 @@ function formatStatus(status) {
|
|
|
603
630
|
return `${colors[status]}${labels[status]}\u001B[0m`;
|
|
604
631
|
}
|
|
605
632
|
//# sourceMappingURL=analyze-command.js.map
|
|
606
|
-
//# debugId=
|
|
633
|
+
//# debugId=b1b0f3f1-2050-5c37-9714-32da972b95c4
|