strapi-generate-policy
Advanced tools
Comparing version 2.0.2 to 3.0.0-alpha.4
@@ -18,12 +18,15 @@ 'use strict'; | ||
module.exports = function (scope, cb) { | ||
if (!scope.rootPath || !scope.args[0]) { | ||
return cb.invalid('Usage: `$ strapi generate:policy policyName apiName`'); | ||
module.exports = (scope, cb) => { | ||
if (!scope.rootPath || !scope.id) { | ||
return cb.invalid('Usage: `$ strapi generate:policy policyName --api apiName --plugin pluginName`'); | ||
} | ||
// `scope.args` are the raw command line arguments. | ||
_.defaults(scope, { | ||
id: scope.args[0], | ||
api: scope.args[1] | ||
}); | ||
let filePath; | ||
if (scope.args.api) { | ||
filePath = `./api/${scope.args.api}/config/policies`; | ||
} else if (scope.args.plugin) { | ||
filePath = `./plugins/${scope.args.plugin}/config/policies`; | ||
} else { | ||
filePath = './config/policies'; | ||
} | ||
@@ -37,3 +40,3 @@ // Determine default values based on the available scope. | ||
_.defaults(scope, { | ||
rootPath: scope.rootPath, | ||
filePath, | ||
filename: scope.id + scope.ext | ||
@@ -44,4 +47,4 @@ }); | ||
_.defaults(scope, { | ||
humanizeId: scope.args[0], | ||
humanizedPath: '`./api/' + scope.api + '/policies`' | ||
humanizeId: scope.id, | ||
humanizedPath: '`' + scope.filePath + '`' | ||
}); | ||
@@ -48,0 +51,0 @@ |
@@ -18,3 +18,3 @@ 'use strict'; | ||
targets: { | ||
'api/:api/policies/:filename': { | ||
':filePath/:filename': { | ||
template: 'policy.template' | ||
@@ -21,0 +21,0 @@ } |
@@ -1,5 +0,3 @@ | ||
# MIT License | ||
Copyright (c) 2015-2017 Strapi Solutions. | ||
Copyright © 2015-2016 Wistity. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
@@ -6,0 +4,0 @@ |
{ | ||
"name": "strapi-generate-policy", | ||
"version": "2.0.2", | ||
"version": "3.0.0-alpha.4", | ||
"description": "Generate a policy for a Strapi API.", | ||
@@ -17,3 +17,3 @@ "homepage": "http://strapi.io", | ||
"dependencies": { | ||
"lodash": "~4.6.1" | ||
"lodash": "^4.17.4" | ||
}, | ||
@@ -24,11 +24,11 @@ "scripts": { | ||
"author": { | ||
"email": "hack@wistity.co", | ||
"name": "Wistity team", | ||
"url": "http://wistity.co" | ||
"email": "hi@strapi.io", | ||
"name": "Strapi team", | ||
"url": "http://strapi.io" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Wistity team", | ||
"email": "hack@wistity.co", | ||
"url": "http://wistity.co" | ||
"name": "Strapi team", | ||
"email": "hi@strapi.io", | ||
"url": "http://strapi.io" | ||
} | ||
@@ -38,8 +38,12 @@ ], | ||
"type": "git", | ||
"url": "git://github.com/wistityhq/strapi.git" | ||
"url": "git://github.com/strapi/strapi.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/wistityhq/strapi/issues" | ||
"url": "https://github.com/strapi/strapi/issues" | ||
}, | ||
"engines": { | ||
"node": ">= 8.0.0", | ||
"npm": ">= 5.3.0" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -5,4 +5,4 @@ # strapi-generate-policy | ||
[![npm downloads](https://img.shields.io/npm/dm/strapi-generate-policy.svg)](https://www.npmjs.org/package/strapi-generate-policy) | ||
[![npm dependencies](https://david-dm.org/wistityhq/strapi-generate-policy.svg)](https://david-dm.org/wistityhq/strapi-generate-policy) | ||
[![Build status](https://travis-ci.org/wistityhq/strapi-generate-policy.svg?branch=master)](https://travis-ci.org/wistityhq/strapi-generate-policy) | ||
[![npm dependencies](https://david-dm.org/strapi/strapi-generate-policy.svg)](https://david-dm.org/strapi/strapi-generate-policy) | ||
[![Build status](https://travis-ci.org/strapi/strapi-generate-policy.svg?branch=master)](https://travis-ci.org/strapi/strapi-generate-policy) | ||
[![Slack status](http://strapi-slack.herokuapp.com/badge.svg)](http://slack.strapi.io) | ||
@@ -9,0 +9,0 @@ |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
6023
60
1
1
+ Addedlodash@4.17.21(transitive)
- Removedlodash@4.6.1(transitive)
Updatedlodash@^4.17.4