create-ncblock 0.0.3 → 0.0.4
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/package.json +1 -1
- package/scripts/utils/templates.ts +14 -9
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "fs"
|
|
13
13
|
import { tmpdir } from "os"
|
|
14
14
|
import { resolve } from "path"
|
|
15
|
+
import { cleanDist, stagePublishDir } from "./compile-sdk"
|
|
15
16
|
|
|
16
17
|
type StoredTemplateMetadata = {
|
|
17
18
|
title?: string
|
|
@@ -145,15 +146,19 @@ function readSdkVersion(root: string): string {
|
|
|
145
146
|
|
|
146
147
|
function packLocalSdk(root: string, dest: string): string {
|
|
147
148
|
const sdkDir = resolve(root, "sdk")
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
const publishDir = stagePublishDir(sdkDir)
|
|
150
|
+
try {
|
|
151
|
+
const tgzOutput = execSync("npm pack --pack-destination .", {
|
|
152
|
+
cwd: publishDir,
|
|
153
|
+
encoding: "utf-8",
|
|
154
|
+
}).trim()
|
|
155
|
+
const tgz = tgzOutput.split(/\r?\n/).at(-1) ?? tgzOutput
|
|
156
|
+
copyFileSync(resolve(publishDir, tgz), resolve(dest, tgz))
|
|
157
|
+
return `file:./${tgz}`
|
|
158
|
+
} finally {
|
|
159
|
+
rmSync(publishDir, { recursive: true, force: true })
|
|
160
|
+
cleanDist(sdkDir)
|
|
161
|
+
}
|
|
157
162
|
}
|
|
158
163
|
|
|
159
164
|
function copyDirectoryContents(
|