@gluestack/glue-plugin-engine
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "@gluestack/glue-plugin-engine", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Create an Application using GlueStack framework", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gluestack/create-gluestack-app" | ||
"url": "https://github.com/gluestack/glue-plugin-engine" | ||
}, | ||
@@ -15,6 +15,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@gluestack/framework": "^0.0.14", | ||
"@gluestack/glue-plugin-dev-process-manager": "^0.0.3", | ||
"@gluestack/glue-plugin-dev-router": "^0.0.6", | ||
"@types/node": "^18.11.18", | ||
"@gluestack/framework": "^0.0.14" | ||
"@types/node": "^18.11.18" | ||
}, | ||
@@ -32,4 +32,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"typescript": "^4.9.4" | ||
"typescript": "^4.9.4", | ||
"yaml": "^2.2.1" | ||
} | ||
} |
@@ -74,3 +74,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var functionInstance; | ||
var engineInstance; | ||
return __generator(this, function (_a) { | ||
@@ -80,8 +80,8 @@ switch (_a.label) { | ||
case 1: | ||
functionInstance = _a.sent(); | ||
if (!functionInstance) return [3, 4]; | ||
return [4, (0, write_env_1.writeEnv)(functionInstance)]; | ||
engineInstance = _a.sent(); | ||
if (!engineInstance) return [3, 4]; | ||
return [4, (0, write_env_1.writeEnv)(engineInstance)]; | ||
case 2: | ||
_a.sent(); | ||
return [4, functionInstance.getContainerController().up()]; | ||
return [4, engineInstance.getContainerController().up()]; | ||
case 3: | ||
@@ -88,0 +88,0 @@ _a.sent(); |
@@ -38,6 +38,9 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
exports.__esModule = true; | ||
exports.PluginInstanceContainerController = void 0; | ||
var _a = require("@gluestack/helpers"), SpawnHelper = _a.SpawnHelper, DockerodeHelper = _a.DockerodeHelper; | ||
var create_dockerfile_1 = require("./helpers/create-dockerfile"); | ||
var DockerodeHelper = require("@gluestack/helpers").DockerodeHelper; | ||
var GluestackEngine_1 = __importDefault(require("./core/GluestackEngine")); | ||
var PluginInstanceContainerController = (function () { | ||
@@ -59,3 +62,2 @@ function PluginInstanceContainerController(app, callerInstance) { | ||
PluginInstanceContainerController.prototype.runScript = function () { | ||
return ["npm", "run", "dev"]; | ||
}; | ||
@@ -91,3 +93,3 @@ PluginInstanceContainerController.prototype.getEnv = function () { | ||
var ports = _this.callerInstance.callerPlugin.gluePluginStore.get("ports") || []; | ||
DockerodeHelper.getPort(4500, ports) | ||
DockerodeHelper.getPort(4499, ports) | ||
.then(function (port) { | ||
@@ -119,5 +121,2 @@ _this.setPortNumber(port); | ||
PluginInstanceContainerController.prototype.setContainerId = function (containerId) { | ||
this.callerInstance.gluePluginStore.set("container_id", containerId || null); | ||
this.containerId = containerId || null; | ||
return this.containerId; | ||
}; | ||
@@ -127,4 +126,13 @@ PluginInstanceContainerController.prototype.getConfig = function () { }; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var engine; | ||
return __generator(this, function (_a) { | ||
return [2]; | ||
switch (_a.label) { | ||
case 0: | ||
engine = new GluestackEngine_1["default"](this.app); | ||
return [4, engine.start('backend')]; | ||
case 1: | ||
_a.sent(); | ||
console.log('> Note: If you have Hasura plugin installed, please goto hasura directory location and run "npm run synch:hasura"'); | ||
return [2]; | ||
} | ||
}); | ||
@@ -135,4 +143,12 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var engine; | ||
return __generator(this, function (_a) { | ||
return [2]; | ||
switch (_a.label) { | ||
case 0: | ||
engine = new GluestackEngine_1["default"](this.app); | ||
return [4, engine.stop('backend')]; | ||
case 1: | ||
_a.sent(); | ||
return [2]; | ||
} | ||
}); | ||
@@ -144,8 +160,3 @@ }); | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, (0, create_dockerfile_1.generateDockerfile)(this.callerInstance.getInstallationPath())]; | ||
case 1: | ||
_a.sent(); | ||
return [2]; | ||
} | ||
return [2]; | ||
}); | ||
@@ -152,0 +163,0 @@ }); |
{ | ||
"name": "@gluestack/glue-plugin-engine", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Create an Application using GlueStack framework", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gluestack/create-gluestack-app" | ||
"url": "https://github.com/gluestack/glue-plugin-engine" | ||
}, | ||
@@ -15,6 +15,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@gluestack/framework": "^0.0.14", | ||
"@gluestack/glue-plugin-dev-process-manager": "^0.0.3", | ||
"@gluestack/glue-plugin-dev-router": "^0.0.6", | ||
"@types/node": "^18.11.18", | ||
"@gluestack/framework": "^0.0.14" | ||
"@types/node": "^18.11.18" | ||
}, | ||
@@ -32,4 +32,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"typescript": "^4.9.4" | ||
"typescript": "^4.9.4", | ||
"yaml": "^2.2.1" | ||
} | ||
} |
@@ -12,3 +12,3 @@ //@ts-ignore | ||
//Do not edit the name of this class | ||
// Do not edit the name of this class | ||
export class GlueStackPlugin implements IPlugin, IManagesInstances, ILifeCycle { | ||
@@ -55,3 +55,3 @@ app: IApp; | ||
async runPostInstall(instanceName: string, target: string) { | ||
const functionInstance: PluginInstance = | ||
const engineInstance: PluginInstance = | ||
await this.app.createPluginInstance( | ||
@@ -63,5 +63,6 @@ this, | ||
); | ||
if (functionInstance) { | ||
await writeEnv(functionInstance); | ||
await functionInstance.getContainerController().up(); | ||
if (engineInstance) { | ||
await writeEnv(engineInstance); | ||
await engineInstance.getContainerController().up(); | ||
} | ||
@@ -82,2 +83,3 @@ } | ||
); | ||
this.instances.push(instance); | ||
@@ -84,0 +86,0 @@ return instance; |
import { PluginInstance } from "./PluginInstance"; | ||
import IApp from "@gluestack/framework/types/app/interface/IApp"; | ||
import IContainerController from "@gluestack/framework/types/plugin/interface/IContainerController"; | ||
const { DockerodeHelper } = require("@gluestack/helpers"); | ||
import GluestackEngine from "./core/GluestackEngine"; | ||
import { IGlueEngine } from "./core/types/IGlueEngine"; | ||
@@ -27,3 +30,3 @@ export class PluginInstanceContainerController implements IContainerController { | ||
installScript() { | ||
// do nothing | ||
return ["npm", "install"]; | ||
} | ||
@@ -36,3 +39,5 @@ | ||
async getEnv() { | ||
// do nothing | ||
return { | ||
APP_PORT: await this.getPortNumber(), | ||
}; | ||
} | ||
@@ -50,3 +55,19 @@ | ||
async getPortNumber(returnDefault?: boolean) { | ||
// do nothing | ||
return new Promise((resolve, reject) => { | ||
if (this.portNumber) { | ||
return resolve(this.portNumber); | ||
} | ||
let ports = | ||
this.callerInstance.callerPlugin.gluePluginStore.get("ports") || []; | ||
DockerodeHelper.getPort(4499, ports) | ||
.then((port: number) => { | ||
this.setPortNumber(port); | ||
ports.push(port); | ||
this.callerInstance.callerPlugin.gluePluginStore.set("ports", ports); | ||
return resolve(this.portNumber); | ||
}) | ||
.catch((e: any) => { | ||
reject(e); | ||
}); | ||
}); | ||
} | ||
@@ -66,3 +87,6 @@ | ||
setPortNumber(portNumber: number) { | ||
// do nothing | ||
this.callerInstance.gluePluginStore.set("port_number", portNumber || null); | ||
this.portNumber = portNumber || null | ||
return this.portNumber; | ||
} | ||
@@ -77,7 +101,11 @@ | ||
async up() { | ||
// do nothing | ||
const engine: IGlueEngine = new GluestackEngine(this.app); | ||
await engine.start('backend'); | ||
console.log('> Note: If you have Hasura plugin installed, please goto hasura directory location and run "npm run synch:hasura"'); | ||
} | ||
async down() { | ||
// do nothing | ||
const engine: IGlueEngine = new GluestackEngine(this.app); | ||
await engine.stop('backend'); | ||
} | ||
@@ -88,2 +116,3 @@ | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
146473
80
2566
2
8