@positronic/cli 0.0.5 → 0.0.6
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.
|
@@ -48,13 +48,6 @@ function _define_property(obj, key, value) {
|
|
|
48
48
|
}
|
|
49
49
|
return obj;
|
|
50
50
|
}
|
|
51
|
-
function _instanceof(left, right) {
|
|
52
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
53
|
-
return !!right[Symbol.hasInstance](left);
|
|
54
|
-
} else {
|
|
55
|
-
return left instanceof right;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
51
|
function _iterable_to_array_limit(arr, i) {
|
|
59
52
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
60
53
|
if (_i == null) return;
|
|
@@ -232,7 +225,6 @@ import { isText } from 'istextorbinary';
|
|
|
232
225
|
import * as http from 'http';
|
|
233
226
|
import * as https from 'https';
|
|
234
227
|
import { URL } from 'url';
|
|
235
|
-
import { execSync } from 'child_process';
|
|
236
228
|
// Singleton API client instance
|
|
237
229
|
export var apiClient = {
|
|
238
230
|
fetch: function(apiPath, options) {
|
|
@@ -252,7 +244,7 @@ export var apiClient = {
|
|
|
252
244
|
};
|
|
253
245
|
export function generateProject(projectName, projectDir) {
|
|
254
246
|
return _async_to_generator(function() {
|
|
255
|
-
var devPath, newProjectTemplatePath, cazOptions,
|
|
247
|
+
var devPath, newProjectTemplatePath, cazOptions, originalNewProjectPkg, copiedNewProjectPkg;
|
|
256
248
|
return _ts_generator(this, function(_state) {
|
|
257
249
|
switch(_state.label){
|
|
258
250
|
case 0:
|
|
@@ -261,7 +253,6 @@ export function generateProject(projectName, projectDir) {
|
|
|
261
253
|
cazOptions = {
|
|
262
254
|
name: projectName
|
|
263
255
|
};
|
|
264
|
-
tempDir = null;
|
|
265
256
|
_state.label = 1;
|
|
266
257
|
case 1:
|
|
267
258
|
_state.trys.push([
|
|
@@ -290,33 +281,6 @@ export function generateProject(projectName, projectDir) {
|
|
|
290
281
|
install: true,
|
|
291
282
|
pm: 'npm'
|
|
292
283
|
};
|
|
293
|
-
} else if (newProjectTemplatePath.startsWith('@')) {
|
|
294
|
-
// Handle npm package template
|
|
295
|
-
// Create a temp directory for the npm package
|
|
296
|
-
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'positronic-npm-template-'));
|
|
297
|
-
// Download the npm package to the temp directory
|
|
298
|
-
try {
|
|
299
|
-
execSync("npm pack ".concat(newProjectTemplatePath, ' --pack-destination="').concat(tempDir, '"'), {
|
|
300
|
-
stdio: 'pipe'
|
|
301
|
-
});
|
|
302
|
-
// Find the packed tarball
|
|
303
|
-
files = fs.readdirSync(tempDir);
|
|
304
|
-
tarball = files.find(function(f) {
|
|
305
|
-
return f.endsWith('.tgz');
|
|
306
|
-
});
|
|
307
|
-
if (!tarball) {
|
|
308
|
-
throw new Error("Failed to find packed tarball for ".concat(newProjectTemplatePath));
|
|
309
|
-
}
|
|
310
|
-
// Extract the tarball
|
|
311
|
-
tarballPath = path.join(tempDir, tarball);
|
|
312
|
-
execSync('tar -xzf "'.concat(tarballPath, '" -C "').concat(tempDir, '"'), {
|
|
313
|
-
stdio: 'pipe'
|
|
314
|
-
});
|
|
315
|
-
// The extracted content is in a 'package' directory
|
|
316
|
-
newProjectTemplatePath = path.join(tempDir, 'package');
|
|
317
|
-
} catch (error) {
|
|
318
|
-
throw new Error("Failed to download template package ".concat(newProjectTemplatePath, ": ").concat(_instanceof(error, Error) ? error.message : String(error)));
|
|
319
|
-
}
|
|
320
284
|
}
|
|
321
285
|
// In test or CI environments, skip interactive prompts and dependency installation
|
|
322
286
|
if (process.env.NODE_ENV === 'test') {
|
|
@@ -341,21 +305,13 @@ export function generateProject(projectName, projectDir) {
|
|
|
341
305
|
];
|
|
342
306
|
case 3:
|
|
343
307
|
// Clean up the temporary copied new project package
|
|
344
|
-
if (devPath
|
|
308
|
+
if (devPath) {
|
|
345
309
|
fs.rmSync(newProjectTemplatePath, {
|
|
346
310
|
recursive: true,
|
|
347
311
|
force: true,
|
|
348
312
|
maxRetries: 3
|
|
349
313
|
});
|
|
350
314
|
}
|
|
351
|
-
// Clean up the npm temp directory if it was created
|
|
352
|
-
if (tempDir) {
|
|
353
|
-
fs.rmSync(tempDir, {
|
|
354
|
-
recursive: true,
|
|
355
|
-
force: true,
|
|
356
|
-
maxRetries: 3
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
315
|
return [
|
|
360
316
|
7
|
|
361
317
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/commands/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/commands/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOtD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;AAGhE,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAGzC,eAAO,MAAM,SAAS;qBACG,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC;CASzE,CAAC;AAEF,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAiE5E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,EAAE,CAsCxE;AAeD,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM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