@positronic/cli 0.0.5 → 0.0.7

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.
@@ -134,7 +134,7 @@ import * as path from 'path';
134
134
  * Load the backend module based on the configuration
135
135
  */ function loadBackendModule(projectRootPath) {
136
136
  return _async_to_generator(function() {
137
- var config, backendPackage, backendModule, packagePath, localModulePath;
137
+ var config, backendPackage, backendModule, packagePath, localModulePath, backendPath;
138
138
  return _ts_generator(this, function(_state) {
139
139
  switch(_state.label){
140
140
  case 0:
@@ -158,12 +158,13 @@ import * as path from 'path';
158
158
  4
159
159
  ];
160
160
  case 2:
161
+ // Load from npm package - resolve from project's node_modules
162
+ backendPath = path.join(projectRootPath, 'node_modules', backendPackage, 'dist', 'src', 'node-index.js');
161
163
  return [
162
164
  4,
163
- import(backendPackage)
165
+ import(backendPath)
164
166
  ];
165
167
  case 3:
166
- // Load from npm package
167
168
  backendModule = _state.sent();
168
169
  _state.label = 4;
169
170
  case 4:
@@ -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, tempDir, originalNewProjectPkg, copiedNewProjectPkg, files, tarball, tarballPath;
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 && newProjectTemplatePath !== '@positronic/template-new-project') {
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":"backend.d.ts","sourceRoot":"","sources":["../../../src/commands/backend.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAoD5D;;GAEG;AACH,wBAAsB,eAAe,CACnC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,mBAAmB,CAAC,CAG9B"}
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/commands/backend.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AA4D5D;;GAEG;AACH,wBAAsB,eAAe,CACnC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,mBAAmB,CAAC,CAG9B"}
@@ -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;AAQtD,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,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AAC,CA+KrB;AAqKD;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,mBAoB9B;AAsCD;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,SAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,gBAAgB,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA2If"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@positronic/cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },