@positronic/cli 0.0.11 → 0.0.13
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.
|
@@ -225,6 +225,7 @@ import { isText } from 'istextorbinary';
|
|
|
225
225
|
import * as http from 'http';
|
|
226
226
|
import * as https from 'https';
|
|
227
227
|
import { URL } from 'url';
|
|
228
|
+
import { createRequire } from 'module';
|
|
228
229
|
// Singleton API client instance
|
|
229
230
|
export var apiClient = {
|
|
230
231
|
fetch: function(apiPath, options) {
|
|
@@ -244,7 +245,7 @@ export var apiClient = {
|
|
|
244
245
|
};
|
|
245
246
|
export function generateProject(projectName, projectDir) {
|
|
246
247
|
return _async_to_generator(function() {
|
|
247
|
-
var devPath, newProjectTemplatePath, cazOptions,
|
|
248
|
+
var devPath, newProjectTemplatePath, cazOptions, templateSourcePath, require, templatePackageJsonPath, copiedNewProjectPkg;
|
|
248
249
|
return _ts_generator(this, function(_state) {
|
|
249
250
|
switch(_state.label){
|
|
250
251
|
case 0:
|
|
@@ -270,12 +271,24 @@ export function generateProject(projectName, projectDir) {
|
|
|
270
271
|
// monorepo which then causes the tests to fail. Also ny time I was generating a new
|
|
271
272
|
// project it was a pain to have to run npm install over and over again just
|
|
272
273
|
// to get back to a good state.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
templateSourcePath = path.resolve(devPath, 'packages', 'template-new-project');
|
|
275
|
+
} else {
|
|
276
|
+
// Resolve the installed template package location
|
|
277
|
+
require = createRequire(import.meta.url);
|
|
278
|
+
templatePackageJsonPath = require.resolve('@positronic/template-new-project/package.json');
|
|
279
|
+
templateSourcePath = path.dirname(templatePackageJsonPath);
|
|
280
|
+
}
|
|
281
|
+
// Always copy to a temporary directory to avoid CAZ modifying our source
|
|
282
|
+
// CAZ only supports local paths, GitHub repos, or ZIP URLs - not npm package names
|
|
283
|
+
// Additionally, CAZ runs 'npm install --production' in the template directory,
|
|
284
|
+
// which would modify our installed node_modules if we passed the path directly
|
|
285
|
+
copiedNewProjectPkg = fs.mkdtempSync(path.join(os.tmpdir(), 'positronic-newproj-'));
|
|
286
|
+
fs.cpSync(templateSourcePath, copiedNewProjectPkg, {
|
|
287
|
+
recursive: true
|
|
288
|
+
});
|
|
289
|
+
newProjectTemplatePath = copiedNewProjectPkg;
|
|
290
|
+
// Set CAZ options for both local dev and installed package scenarios
|
|
291
|
+
if (devPath || !process.env.NODE_ENV || process.env.NODE_ENV !== 'test') {
|
|
279
292
|
cazOptions = {
|
|
280
293
|
name: projectName,
|
|
281
294
|
install: true,
|
|
@@ -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;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,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAiF5E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,EAAE,CAsCxE;AAeD,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IAC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 +23,9 @@
|
|
|
23
23
|
"clean": "rm -rf tsconfig.tsbuildinfo dist node_modules"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@positronic/core": "^0.0.
|
|
27
|
-
"@positronic/spec": "^0.0.
|
|
28
|
-
"@positronic/template-new-project": "^0.0.
|
|
26
|
+
"@positronic/core": "^0.0.13",
|
|
27
|
+
"@positronic/spec": "^0.0.13",
|
|
28
|
+
"@positronic/template-new-project": "^0.0.13",
|
|
29
29
|
"caz": "^2.0.0",
|
|
30
30
|
"chokidar": "^3.6.0",
|
|
31
31
|
"eventsource": "^3.0.6",
|