Comparing version 1.2.9 to 1.2.10
198
index.js
@@ -12,2 +12,4 @@ #!/usr/bin/env node --harmony | ||
var api = require('./api') | ||
var pushComponents = require('./tasks/push-components.js') | ||
var pullComponents = require('./tasks/pull-components.js') | ||
@@ -22,5 +24,10 @@ clear() | ||
var subcommand = 'default' | ||
var cliAttribute = '' | ||
if (typeof process.argv[1] != 'undefined' && typeof process.argv[2] != 'undefined') { | ||
subcommand = process.argv[2] | ||
if (typeof process.argv[3] != 'undefined') { | ||
cliAttribute = process.argv[3] | ||
} | ||
} | ||
@@ -30,3 +37,2 @@ | ||
var email = '' | ||
var error = false | ||
@@ -112,2 +118,47 @@ if (subcommand == 'quickstart') { | ||
] | ||
} else if (subcommand == 'pull-components' || subcommand == 'push-components') { | ||
questions = [ | ||
{ | ||
type: 'input', | ||
name: 'email', | ||
message: 'Enter your email address:', | ||
validate: function (value) { | ||
email = value | ||
if (value.length > 0) { | ||
return true | ||
} | ||
return 'Please enter a valid email:' | ||
} | ||
}, | ||
{ | ||
type: 'password', | ||
name: 'password', | ||
message: 'Enter your password:', | ||
validate: function (value) { | ||
var done = this.async(); | ||
api.login(email, value, (data) => { | ||
if (data.status == 200) { | ||
done(null, true) | ||
} else { | ||
done('Password seams to be wrong. Please try again:') | ||
} | ||
}) | ||
} | ||
}, | ||
{ | ||
type: 'input', | ||
name: 'spaceId', | ||
message: 'Insert the space ID where you want to execute this command:', | ||
validate: function (value) { | ||
if (value.length > 0) { | ||
return true | ||
} | ||
return 'Please enter a valid id:' | ||
} | ||
} | ||
] | ||
} else { | ||
@@ -167,3 +218,3 @@ questions = [ | ||
'PHP - Silex Boilerplate [https://github.com/storyblok/silex-boilerplate]', | ||
'JavaScript - NodeJs Boilerplate [https://github.com/storyblok/storyblok-express-boilerplate]', | ||
'JavaScript - NodeJs Boilerplate [https://github.com/storyblok/nodejs-boilerplate]', | ||
'Ruby - Sinatra Boilerplate [https://github.com/storyblok/sinatra-boilerplate]', | ||
@@ -252,4 +303,2 @@ 'Python - Django Boilerplate [https://github.com/storyblok/django-boilerplate]', | ||
console.log() | ||
error = true; | ||
return; | ||
} else { | ||
@@ -263,11 +312,6 @@ console.log() | ||
console.error(err) | ||
error = true; | ||
return; | ||
exit(0); | ||
} | ||
}) | ||
.on('end', function () { | ||
if (error) { | ||
return; | ||
} | ||
var finalStep = 'gulp' | ||
@@ -279,51 +323,6 @@ if (answers.type == 'Fieldtype') { | ||
console.log() | ||
console.log(chalk.green(' Your storyblok project is ready for you!')) | ||
console.log(chalk.cyan(' Your storyblok project is ready for you!')) | ||
console.log() | ||
switch (answers.theme) { | ||
case 'Custom Theme [We will ask you about your Github URL]': | ||
break; | ||
case 'Python - Django Boilerplate [https://github.com/storyblok/django-boilerplate]': | ||
console.log(' Make sure Django & Jinja2 are installed') | ||
console.log(chalk.cyan(' pip install django && pip install jinja2')) | ||
console.log() | ||
console.log(' Start your local python server:') | ||
console.log(chalk.cyan(' cd ./' + answers.name + ' && python manage.py migrate && python manage.py runserver')) | ||
console.log() | ||
console.log(' In a second window we start the static file proxy using gulp:') | ||
console.log(chalk.cyan(' cd ./' + answers.name + ' && npm install && gulp')) | ||
console.log() | ||
console.log(' You can start exploring the boilerplate or have a look at:') | ||
console.log(' https://www.storyblok.com/tp/add-a-headless-cms-to-python-django-in-5-minutes') | ||
break; | ||
case 'JavaScript - VueJs Boilerplate [https://github.com/storyblok/vuejs-boilerplate]': | ||
console.log(' Execute the following command to start Storyblok:') | ||
console.log(chalk.cyan(' cd ./' + answers.name + ' && npm install && npm run dev')) | ||
console.log() | ||
console.log(' You can start exploring the boilerplate or have a look at:') | ||
console.log(' https://www.storyblok.com/tp/add-a-headless-CMS-to-vuejs-in-5-minutes') | ||
break; | ||
case 'JavaScript - NodeJs Boilerplate [https://github.com/storyblok/storyblok-express-boilerplate]': | ||
console.log(' Execute the following command to start Storyblok:') | ||
console.log(chalk.cyan(' cd ./' + answers.name + ' && npm install && node ./index.js')) | ||
console.log() | ||
console.log(' You can start exploring the boilerplate or have a look at:') | ||
console.log(' https://www.storyblok.com/tp/node-js-cms') | ||
break; | ||
case 'Ruby - Sinatra Boilerplate [https://github.com/storyblok/sinatra-boilerplate]': | ||
console.log(' Execute the following command to start Storyblok:') | ||
console.log(chalk.cyan(' cd ./' + answers.name + ' && bundle install')) | ||
console.log(chalk.cyan(' rerun --pattern \'{Gemfile, Gemfile.lock, app.rb, app/**/*.rb }\' \'ruby app.rb\'')) | ||
break; | ||
default: | ||
console.log(' Execute the following command to start Storyblok:') | ||
console.log(chalk.cyan(' cd ./' + answers.name + ' && npm install && ' + finalStep)) | ||
break; | ||
} | ||
console.log(chalk.cyan(' Execute the following command to start Storyblok:')) | ||
console.log(' cd ./' + answers.name + ' && npm install && ' + finalStep) | ||
console.log() | ||
@@ -360,46 +359,59 @@ console.log(chalk.white(' If you need more help, just try asking a question on stackoverflow')) | ||
if (subcommand == 'quickstart') { | ||
console.log(' Your project will be created now...') | ||
switch(subcommand) { | ||
case 'quickstart': | ||
console.log(' Your project will be created now...') | ||
api.post('spaces', { | ||
create_demo: false, | ||
dup_id: 40288, | ||
space: { | ||
name: answers.name, | ||
environments: [{name: 'Dev', location: 'http://localhost:4440/'}] | ||
} | ||
}, (space_res) => { | ||
if (space_res.status == 200) { | ||
console.log(chalk.green(' ' + answers.name + ' has been created in Storyblok!')) | ||
api.post('spaces', { | ||
create_demo: false, | ||
dup_id: 40288, | ||
space: { | ||
name: answers.name, | ||
environments: [{name: 'Dev', location: 'http://localhost:4440/'}] | ||
} | ||
}, (space_res) => { | ||
if (space_res.status == 200) { | ||
console.log(chalk.green(' ' + answers.name + ' has been created in Storyblok!')) | ||
api.post('tokens', {}, (tokens_res) => { | ||
answers.loginToken = tokens_res.body.key | ||
api.post('tokens', {}, (tokens_res) => { | ||
answers.loginToken = tokens_res.body.key | ||
api.setSpaceId(space_res.body.space.id) | ||
api.get('api_keys', (keys_res) => { | ||
if (keys_res.status == 200) { | ||
answers.spaceId = space_res.body.space.id | ||
answers.spaceDomain = space_res.body.space.domain.replace('https://', '') | ||
.replace('/', '') | ||
api.setSpaceId(space_res.body.space.id) | ||
api.get('api_keys', (keys_res) => { | ||
if (keys_res.status == 200) { | ||
answers.spaceId = space_res.body.space.id | ||
answers.spaceDomain = space_res.body.space.domain.replace('https://', '') | ||
.replace('/', '') | ||
var tokens = keys_res.body.api_keys.filter((token) => { | ||
return token.access == 'theme' | ||
}) | ||
var tokens = keys_res.body.api_keys.filter((token) => { | ||
return token.access == 'theme' | ||
}) | ||
answers.themeToken = tokens[0].token | ||
answers.themeToken = tokens[0].token | ||
lastStep() | ||
} else { | ||
console.log(keys_res.body) | ||
} | ||
lastStep() | ||
} else { | ||
console.log(keys_res.body) | ||
} | ||
}) | ||
}) | ||
}) | ||
} else { | ||
console.log(space_res.body) | ||
} | ||
}) | ||
} else { | ||
lastStep() | ||
} else { | ||
console.log(space_res.body) | ||
} | ||
}) | ||
break; | ||
case 'push-components': | ||
api.setSpaceId(answers.spaceId) | ||
pushComponents(api, cliAttribute) | ||
break; | ||
case 'pull-components': | ||
api.setSpaceId(answers.spaceId) | ||
pullComponents(api, cliAttribute) | ||
break; | ||
default: | ||
lastStep() | ||
} | ||
}) |
{ | ||
"name": "storyblok", | ||
"version": "1.2.9", | ||
"version": "1.2.10", | ||
"description": "A simple CLI for scaffolding storyblok projects and fieldtypes", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/storyblok/storyblok-cli.git" | ||
}, | ||
"keywords": [ | ||
@@ -10,0 +6,0 @@ "storyblok", |
<p align="center"> | ||
<h1 align="center">storyblok-cli</h1> | ||
<h1 align="center">Storyblok CLI</h1> | ||
<p align="center">A simple CLI for scaffolding <a href="https://storyblok.com" target="_blank">Storyblok</a> projects and fieldtypes.</p> | ||
</p> | ||
You found an issue?<br>Tell us about it - <a href="https://github.com/storyblok/storyblok/issues/new">open an issue</a> or look if it was <a href="https://github.com/storyblok/storyblok/issues/">already reported</a>. | ||
[![npm](https://img.shields.io/npm/v/storyblok-cli.svg)](https://www.npmjs.com/package/storyblok-cli) | ||
[![npm](https://img.shields.io/npm/dt/storyblok-cli.svg)](ttps://img.shields.io/npm/dt/storyblok-cli.svg) | ||
[![GitHub issues](https://img.shields.io/github/issues/storyblok/storyblok.svg?style=flat-square&v=1)](https://github.com/storyblok/storyblok/issues?q=is%3Aopen+is%3Aissue) | ||
[![GitHub closed issues](https://img.shields.io/github/issues-closed/storyblok/storyblok.svg?style=flat-square&v=1)](https://github.com/storyblok/storyblok/issues?q=is%3Aissue+is%3Aclosed) | ||
## Installation | ||
``` | ||
$ npm i storyblok-cli -g | ||
$ npm i storyblok -g | ||
``` | ||
@@ -42,3 +46,3 @@ | ||
- PHP - Silex Boilerplate [https://github.com/storyblok/silex-boilerplate] | ||
- JavaScript - NodeJs Boilerplate [https://github.com/storyblok/storyblok-express-boilerplate] | ||
- JavaScript - NodeJs Boilerplate [https://github.com/storyblok/nodejs-boilerplate] | ||
- Ruby - Sinatra Boilerplate [https://github.com/storyblok/sinatra-boilerplate] | ||
@@ -51,6 +55,34 @@ - Python - Django Boilerplate [https://github.com/storyblok/django-boilerplate] | ||
<br> | ||
<br> | ||
<p align="center"> | ||
<img src="https://a.storyblok.com/f/39898/1c9c224705/storyblok_black.svg" alt="Storyblok Logo"> | ||
</p> | ||
## Frequently asked questions | ||
- **[What is Storyblok?](https://www.storyblok.com/)** | ||
A component composer - Storyblok augments your web framework or the technology you already use with powerful editing capabilities to bring your static websites to life. We fill the gap between a visual composer and a content collection backend system.<br><br> | ||
- **[How can I access the Storyblok Content Delivery API?](https://www.storyblok.com/docs/Delivery-Api/introduction)** | ||
You can directly access the API using simple HTTP GET Requests. We've done some examples for you already in our [Delivery APi Introduction](https://www.storyblok.com/docs/Delivery-Api/introduction). <br>You can of course use one of the SDK's available for storyblok: | ||
- PHP SDK: https://github.com/storyblok/php-client | ||
- Ruby SDK: https://github.com/storyblok/storyblok-ruby | ||
- Android SDK: https://github.com/mikepenz/Storyblok-Android-SDK (Great work done by: [@mikepenz](https://github.com/mikepenz)) | ||
- more are on it's way!<br><br> | ||
- **What features is storyblok capable of?** | ||
You can find a full list of features which are available on the [feature](https://www.storyblok.com/features) page on our website.<br><br> | ||
- **I'm a developer and want to start a project with storyblok** | ||
Glad to hear that! We've created a [CLI](https://www.storyblok.com/docs/Guides/Getting-Started) to easily bootstrap new projects directly from the command line. You can also check out our [boilerplates](https://www.storyblok.com/docs/terminology/boilerplates) and [themes](https://www.storyblok.com/docs/terminology/themes) - as well as the [content delivery api](https://www.storyblok.com/docs/Delivery-Api/introduction) itself.<br><br> | ||
## [Terminology](https://www.storyblok.com/docs/terminology/introduction) | ||
- **[What is a Space?](https://www.storyblok.com/docs/terminology/space)** | ||
A space is a content repository. Think of it as a place to keep all the content related to one project. Each space has its own components...<br><br> | ||
- **[What is a Folder?](https://www.storyblok.com/docs/terminology/folder)** | ||
A folder is a collection of stories. You can create a simple structure for your content using the folders. Best examples are multilanguage/multicountry or news...<br><br> | ||
- **[What is a Story?](https://www.storyblok.com/docs/terminology/story)** | ||
A story is a collection of instances of components filled with information by the content creator. You will be able to fetch a story directly by its slug...<br><br> | ||
- **[What is a Component?](https://www.storyblok.com/docs/terminology/component)** | ||
A component is a standalone entity that is meaningful on its own. While components/bloks can be nested in each other, semantically they remain...<br><br> | ||
- **[What is a Field Type?](https://www.storyblok.com/docs/terminology/field-type)** | ||
One field type is the smallest part in the storyblok terminology...<br><br> | ||
- **[What is a Datasource?](https://www.storyblok.com/docs/terminology/datasource)** | ||
One data source is simply a collection of key-value pairs (KVP). One specific datasource-entry is a set of two linked data items: a key, which is a unique identifier...<br><br> | ||
- **[What is a Collaborator?](https://www.storyblok.com/docs/terminology/collaborator)** | ||
A collaborator is a person who is explicitly a member of your project. As an owner of a space, you can choose between some roles or define...<br><br> | ||
- **[What is a Theme?](https://www.storyblok.com/docs/terminology/themes)** | ||
If you want a hosting with our [Rendering Service](https://www.storyblok.com/docs/Rendering-Service/Theme-Documentation) so you won't have to setup a server on your own you can directly choose from one of...<br><br> | ||
- **[What is a Boilerplate?](https://www.storyblok.com/docs/terminology/themes)** | ||
If you want to use your server or have already an existing project in which you want to integrate Storyblok you can use one of ...<br><br> |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
24352
10
490
87
0
3