strapi-repl
Advanced tools
Comparing version 0.0.1 to 0.0.2
31
index.js
const REPL = require("repl"); | ||
let initStrapiApp = async (pathToStrapiModule) => { | ||
return await require(`${pathToStrapiModule}/node_modules/strapi`)().load(); | ||
}; | ||
let startStrapiREPL = async (pathToStrapiModule) => { | ||
let initStrapiApp = async () => | ||
await require(`${pathToStrapiModule}/node_modules/strapi`)().load(); | ||
let strapi = await initStrapiApp(); | ||
let environment = process.env.NODE_ENV; | ||
let strapi = await initStrapiApp(pathToStrapiModule); | ||
// environment is set to development by default via strapi | ||
const environment = process.env.NODE_ENV; | ||
console.log( | ||
@@ -32,16 +34,7 @@ `Strapi-REPL v${ | ||
async action() { | ||
if (environment === "development") { | ||
process.stdout.write("reloading"); | ||
let loadingIndicator = setInterval( | ||
() => process.stdout.write("."), | ||
250 | ||
); | ||
repl.context.strapi = strapi = await initStrapiApp(); | ||
clearInterval(loadingIndicator); | ||
console.log(""); | ||
} else { | ||
console.log( | ||
".reload is exclusively available in development environment" | ||
); | ||
} | ||
process.stdout.write("reloading"); | ||
let loadingIndicator = setInterval(() => process.stdout.write("."), 250); | ||
repl.context.strapi = strapi = await initStrapiApp(pathToStrapiModule); | ||
clearInterval(loadingIndicator); | ||
console.log(""); | ||
this.displayPrompt(); | ||
@@ -48,0 +41,0 @@ }, |
{ | ||
"name": "strapi-repl", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Strapi REPL console with improved features", | ||
@@ -5,0 +5,0 @@ "main": "./bin", |
@@ -6,12 +6,18 @@ # Strapi REPL | ||
* async/await support | ||
* await support | ||
* `.reload` reloads your app (helpful in development) | ||
* only runs a REPL (and doesn't start your webservice as well) | ||
For security reasons, the `.reload` feature is only available in development mode. | ||
## Installation | ||
```sh | ||
$ npm install -g strapi-repl | ||
``` | ||
## Run | ||
In any strapi project: | ||
```sh | ||
$ cd your_strapi_project | ||
$ strapi-repl | ||
@@ -18,0 +24,0 @@ ``` |
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
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
41
2921
38