create-compas
Advanced tools
Comparing version 0.0.216 to 0.0.217
{ | ||
"name": "create-compas", | ||
"version": "0.0.216", | ||
"version": "0.0.217", | ||
"description": "Create compas based applications", | ||
@@ -18,3 +18,3 @@ "exports": { | ||
"dependencies": { | ||
"@compas/stdlib": "0.0.216", | ||
"@compas/stdlib": "0.0.217", | ||
"tar": "6.1.11" | ||
@@ -21,0 +21,0 @@ }, |
@@ -0,7 +1,9 @@ | ||
import { createWriteStream } from "fs"; | ||
import { mkdir, readFile, writeFile } from "fs/promises"; | ||
import https from "https"; | ||
import os from "os"; | ||
import { normalize } from "path"; | ||
import { Readable } from "stream"; | ||
import { pipeline } from "stream/promises"; | ||
import { AppError, environment, exec, pathJoin, spawn } from "@compas/stdlib"; | ||
import { AppError, environment, exec, pathJoin, spawn, uuid } from "@compas/stdlib"; | ||
import tar from "tar"; | ||
@@ -83,3 +85,4 @@ | ||
let stream = Readable.from(Buffer.from("")); | ||
const tmpFile = pathJoin(os.tmpdir(), `create-compas-${uuid()}`); | ||
let httpStream = Readable.from(Buffer.from("")); | ||
@@ -90,3 +93,3 @@ if (options.template.provider === "github") { | ||
// @ts-expect-error | ||
stream = await templateGetHttpStream( | ||
httpStream = await templateGetHttpStream( | ||
`https://codeload.github.com/${options.template.repository}/tar.gz${ | ||
@@ -98,2 +101,5 @@ options.template.ref ? `/${options.template.ref}` : "" | ||
logger.info("Downloading template..."); | ||
await pipeline(httpStream, createWriteStream(tmpFile)); | ||
let dirToExtract = options.template.path; | ||
@@ -119,15 +125,13 @@ | ||
logger.info(`Downloading and extracting template...`); | ||
logger.info(`Extracting template...`); | ||
await pipeline( | ||
stream, | ||
tar.extract( | ||
{ | ||
cwd: options.outputDirectory, | ||
strip: options.template.path | ||
? normalize(options.template.path).split("/").length + 1 | ||
: 1, | ||
}, | ||
[dirToExtract], | ||
), | ||
await tar.extract( | ||
{ | ||
file: tmpFile, | ||
cwd: options.outputDirectory, | ||
strip: options.template.path | ||
? normalize(options.template.path).split("/").length + 1 | ||
: 1, | ||
}, | ||
[dirToExtract], | ||
); | ||
@@ -134,0 +138,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21697
650
5
+ Added@compas/stdlib@0.0.217(transitive)
+ Added@types/node@18.11.0(transitive)
+ Addeddotenv@16.0.3(transitive)
+ Addedpino@8.6.1(transitive)
- Removed@compas/stdlib@0.0.216(transitive)
- Removed@types/node@18.7.18(transitive)
- Removeddotenv@16.0.2(transitive)
- Removedpino@8.5.0(transitive)
Updated@compas/stdlib@0.0.217