@positronic/cloudflare 0.0.16 → 0.0.17
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/dist/src/dev-server.js +29 -20
- package/dist/types/dev-server.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/src/dev-server.js
CHANGED
|
@@ -254,6 +254,7 @@ import * as os from 'os';
|
|
|
254
254
|
import { spawn } from 'child_process';
|
|
255
255
|
import * as dotenv from 'dotenv';
|
|
256
256
|
import caz from 'caz';
|
|
257
|
+
import { createRequire } from 'module';
|
|
257
258
|
/**
|
|
258
259
|
* Implementation of ServerHandle that wraps a ChildProcess
|
|
259
260
|
*/ var ProcessServerHandle = /*#__PURE__*/ function() {
|
|
@@ -408,7 +409,7 @@ import caz from 'caz';
|
|
|
408
409
|
}();
|
|
409
410
|
function generateProject(projectName, projectDir, onSuccess) {
|
|
410
411
|
return _async_to_generator(function() {
|
|
411
|
-
var devPath, newProjectTemplatePath, cazOptions,
|
|
412
|
+
var devPath, newProjectTemplatePath, cazOptions, templateSourcePath, require, templatePackageJsonPath, copiedNewProjectPkg;
|
|
412
413
|
return _ts_generator(this, function(_state) {
|
|
413
414
|
switch(_state.label){
|
|
414
415
|
case 0:
|
|
@@ -434,19 +435,29 @@ function generateProject(projectName, projectDir, onSuccess) {
|
|
|
434
435
|
// monorepo which then causes the tests to fail. Also any time I was generating a new
|
|
435
436
|
// project it was a pain to have to run npm install over and over again just
|
|
436
437
|
// to get back to a good state.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
cazOptions = {
|
|
444
|
-
name: projectName,
|
|
445
|
-
backend: 'cloudflare',
|
|
446
|
-
install: true,
|
|
447
|
-
pm: 'npm'
|
|
448
|
-
};
|
|
438
|
+
templateSourcePath = path.resolve(devPath, 'packages', 'template-new-project');
|
|
439
|
+
} else {
|
|
440
|
+
// Resolve the installed template package location
|
|
441
|
+
require = createRequire(import.meta.url);
|
|
442
|
+
templatePackageJsonPath = require.resolve('@positronic/template-new-project/package.json');
|
|
443
|
+
templateSourcePath = path.dirname(templatePackageJsonPath);
|
|
449
444
|
}
|
|
445
|
+
// Always copy to a temporary directory to avoid CAZ modifying our source
|
|
446
|
+
// CAZ only supports local paths, GitHub repos, or ZIP URLs - not npm package names
|
|
447
|
+
// Additionally, CAZ runs 'npm install --production' in the template directory,
|
|
448
|
+
// which would modify our installed node_modules if we passed the path directly
|
|
449
|
+
copiedNewProjectPkg = fs.mkdtempSync(path.join(os.tmpdir(), 'positronic-newproj-'));
|
|
450
|
+
fs.cpSync(templateSourcePath, copiedNewProjectPkg, {
|
|
451
|
+
recursive: true
|
|
452
|
+
});
|
|
453
|
+
newProjectTemplatePath = copiedNewProjectPkg;
|
|
454
|
+
// Set CAZ options for cloudflare backend
|
|
455
|
+
cazOptions = {
|
|
456
|
+
name: projectName,
|
|
457
|
+
backend: 'cloudflare',
|
|
458
|
+
install: true,
|
|
459
|
+
pm: 'npm'
|
|
460
|
+
};
|
|
450
461
|
return [
|
|
451
462
|
4,
|
|
452
463
|
caz.default(newProjectTemplatePath, projectDir, _object_spread_props(_object_spread({}, cazOptions), {
|
|
@@ -467,13 +478,11 @@ function generateProject(projectName, projectDir, onSuccess) {
|
|
|
467
478
|
];
|
|
468
479
|
case 4:
|
|
469
480
|
// Clean up the temporary copied new project package
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
});
|
|
476
|
-
}
|
|
481
|
+
fs.rmSync(newProjectTemplatePath, {
|
|
482
|
+
recursive: true,
|
|
483
|
+
force: true,
|
|
484
|
+
maxRetries: 3
|
|
485
|
+
});
|
|
477
486
|
return [
|
|
478
487
|
7
|
|
479
488
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/dev-server.ts"],"names":[],"mappings":"
|
|
1
|
+
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EAAE,IAAI,CAAA;KAAE,CAAC,CAC5D;IAwCK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0CrD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuC5C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA0DnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/cloudflare",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"clean": "rm -rf tsconfig.tsbuildinfo dist"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@positronic/core": "^0.0.
|
|
35
|
-
"@positronic/spec": "^0.0.
|
|
36
|
-
"@positronic/template-new-project": "^0.0.
|
|
34
|
+
"@positronic/core": "^0.0.17",
|
|
35
|
+
"@positronic/spec": "^0.0.17",
|
|
36
|
+
"@positronic/template-new-project": "^0.0.17",
|
|
37
37
|
"aws4fetch": "^1.0.18",
|
|
38
38
|
"caz": "^2.0.0",
|
|
39
39
|
"cron-schedule": "^5.0.4",
|