@crave/farmblocks-dev-scaffold
Advanced tools
Comparing version 1.3.3-alpha-protected-currency-5867.1.36 to 1.3.3-alpha-table-redesign-manual-1.64
#!/usr/bin/env node | ||
var _require = require("inquirer"), | ||
prompt = _require.prompt; | ||
const { | ||
prompt | ||
} = require("inquirer"); | ||
var slug = require("slug"); | ||
const slug = require("slug"); | ||
var upperCamelCase = require("uppercamelcase"); | ||
const upperCamelCase = require("uppercamelcase"); | ||
var _require2 = require("shelljs"), | ||
mkdir = _require2.mkdir, | ||
ShellString = _require2.ShellString, | ||
cp = _require2.cp, | ||
grep = _require2.grep; | ||
const { | ||
mkdir, | ||
ShellString, | ||
cp, | ||
grep | ||
} = require("shelljs"); | ||
var packageContents = require("./templates/package"); | ||
const packageContents = require("./templates/package"); | ||
var readmeContents = require("./templates/readme"); | ||
const readmeContents = require("./templates/readme"); | ||
var indexContents = require("./templates/index"); | ||
const indexContents = require("./templates/index"); | ||
var componentContents = require("./templates/component"); | ||
const componentContents = require("./templates/component"); | ||
var storyContents = require("./templates/componentStory"); | ||
const storyContents = require("./templates/componentStory"); | ||
var questions = [{ | ||
const questions = [{ | ||
type: "input", | ||
name: "fullName", | ||
"default": "My Component", | ||
default: "My Component", | ||
message: "Component’s name" | ||
@@ -34,8 +36,7 @@ }, { | ||
name: "shortName", | ||
"default": function _default(_ref) { | ||
var fullName = _ref.fullName; | ||
return slug(fullName, { | ||
lower: true | ||
}); | ||
}, | ||
default: ({ | ||
fullName | ||
}) => slug(fullName, { | ||
lower: true | ||
}), | ||
message: "Component’s short name" | ||
@@ -49,8 +50,4 @@ }, { | ||
name: "keywords", | ||
"default": "farmblocks, react", | ||
filter: function filter(value) { | ||
return value.split(",").map(function (v) { | ||
return v.trim(); | ||
}); | ||
}, | ||
default: "farmblocks, react", | ||
filter: value => value.split(",").map(v => v.trim()), | ||
message: "Keywords" | ||
@@ -62,27 +59,29 @@ }, { | ||
}]; | ||
prompt(questions).then(function (answers) { | ||
var packageJSON = packageContents(answers); | ||
var readme = readmeContents(answers); | ||
var fullName = answers.fullName, | ||
shortName = answers.shortName; | ||
var componentName = upperCamelCase(fullName); | ||
var index = indexContents(componentName); | ||
var component = componentContents(componentName); | ||
var story = storyContents({ | ||
componentName: componentName, | ||
fullName: fullName | ||
prompt(questions).then(answers => { | ||
const packageJSON = packageContents(answers); | ||
const readme = readmeContents(answers); | ||
const { | ||
fullName, | ||
shortName | ||
} = answers; | ||
const componentName = upperCamelCase(fullName); | ||
const index = indexContents(componentName); | ||
const component = componentContents(componentName); | ||
const story = storyContents({ | ||
componentName, | ||
fullName | ||
}); | ||
var dirName = "packages/".concat(shortName); | ||
var inactiveAuthors = answers.inactiveAuthors ? new RegExp(answers.inactiveAuthors, "i") : null; | ||
mkdir("-p", "".concat(dirName, "/src")); | ||
ShellString(packageJSON).to("".concat(dirName, "/package.json")); | ||
ShellString(readme).to("".concat(dirName, "/README.md")); | ||
ShellString(index).to("".concat(dirName, "/src/index.js")); | ||
ShellString(component).to("".concat(dirName, "/src/").concat(componentName, ".js")); | ||
ShellString(story).to("".concat(dirName, "/src/").concat(componentName, ".story.js")); | ||
cp(["AUTHORS", "LICENSE"], "".concat(dirName, "/.")); | ||
const dirName = `packages/${shortName}`; | ||
const inactiveAuthors = answers.inactiveAuthors ? new RegExp(answers.inactiveAuthors, "i") : null; | ||
mkdir("-p", `${dirName}/src`); | ||
ShellString(packageJSON).to(`${dirName}/package.json`); | ||
ShellString(readme).to(`${dirName}/README.md`); | ||
ShellString(index).to(`${dirName}/src/index.js`); | ||
ShellString(component).to(`${dirName}/src/${componentName}.js`); | ||
ShellString(story).to(`${dirName}/src/${componentName}.story.js`); | ||
cp(["AUTHORS", "LICENSE"], `${dirName}/.`); | ||
if (inactiveAuthors) { | ||
grep("-v", inactiveAuthors, "".concat(dirName, "/AUTHORS")).to("".concat(dirName, "/AUTHORS")); | ||
grep("-v", inactiveAuthors, `${dirName}/AUTHORS`).to(`${dirName}/AUTHORS`); | ||
} | ||
})["catch"](console.error); // eslint-disable-line no-console | ||
}).catch(console.error); // eslint-disable-line no-console |
@@ -1,10 +0,17 @@ | ||
var _require = require("prettier"), | ||
format = _require.format; | ||
const { | ||
format | ||
} = require("prettier"); | ||
var componentTemplate = function componentTemplate(componentName) { | ||
return format("\nimport * as React from \"react\"; \n \nconst ".concat(componentName, " = props => { \n return <div />; \n}; \n \nexport default ").concat(componentName, "; \n"), { | ||
parser: "babel" | ||
}); | ||
}; | ||
const componentTemplate = componentName => format(` | ||
import * as React from "react"; | ||
const ${componentName} = props => { | ||
return <div />; | ||
}; | ||
export default ${componentName}; | ||
`, { | ||
parser: "babel" | ||
}); | ||
module.exports = componentTemplate; |
@@ -1,12 +0,22 @@ | ||
var _require = require("prettier"), | ||
format = _require.format; | ||
const { | ||
format | ||
} = require("prettier"); | ||
var storyTemplate = function storyTemplate(_ref) { | ||
var componentName = _ref.componentName, | ||
fullName = _ref.fullName; | ||
return format("\nimport React from \"react\";\nimport { storiesOf } from \"@storybook/react\";\n\nimport ".concat(componentName, " from \".\";\n\nstoriesOf(\"").concat(fullName, "\", module).add(\n \"Default\",\n () => <").concat(componentName, " />\n);\n"), { | ||
parser: "babel" | ||
}); | ||
}; | ||
const storyTemplate = ({ | ||
componentName, | ||
fullName | ||
}) => format(` | ||
import React from "react"; | ||
import { storiesOf } from "@storybook/react"; | ||
import ${componentName} from "."; | ||
storiesOf("${fullName}", module).add( | ||
"Default", | ||
() => <${componentName} /> | ||
); | ||
`, { | ||
parser: "babel" | ||
}); | ||
module.exports = storyTemplate; |
@@ -1,5 +0,3 @@ | ||
var indexTemplate = function indexTemplate(componentName) { | ||
return "export { default } from \"./".concat(componentName, "\";"); | ||
}; | ||
const indexTemplate = componentName => `export { default } from "./${componentName}";`; | ||
module.exports = indexTemplate; |
@@ -1,5 +0,6 @@ | ||
var _require = require("prettier"), | ||
format = _require.format; | ||
const { | ||
format | ||
} = require("prettier"); | ||
var peerDependencies = { | ||
const peerDependencies = { | ||
react: "^16.12.0", | ||
@@ -10,12 +11,41 @@ "prop-types": "^15.7.2", | ||
var packageTemplate = function packageTemplate(_ref) { | ||
var shortName = _ref.shortName, | ||
description = _ref.description, | ||
_ref$keywords = _ref.keywords, | ||
keywords = _ref$keywords === void 0 ? ["farmblocks"] : _ref$keywords; | ||
return format("\n{\n \"name\": \"@crave/farmblocks-".concat(shortName, "\",\n \"version\": \"0.1.0\",\n \"description\": \"").concat(description, "\",\n \"author\": \"Crave Food Systems and AUTHORS\",\n \"license\": \"MIT\",\n \"main\": \"lib/index.js\",\n \"files\": [\n \"AUTHORS\",\n \"lib\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"clean\": \"rm -rf lib\",\n \"build\": \"yarn clean && babel --root-mode upward src -d lib --ignore 'src/**/*.test.js','src/**/*.story.js'\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/CraveFood/farmblocks.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/CraveFood/farmblocks/issues\"\n },\n \"homepage\": \"https://github.com/CraveFood/farmblocks#readme\",\n \"keywords\": ").concat(JSON.stringify(keywords), ",\n \"peerDependencies\": ").concat(JSON.stringify(peerDependencies), ",\n \"dependencies\": {}\n}\n"), { | ||
parser: "json" | ||
}); | ||
}; | ||
const packageTemplate = ({ | ||
shortName, | ||
description, | ||
keywords = ["farmblocks"] | ||
}) => format(` | ||
{ | ||
"name": "@crave/farmblocks-${shortName}", | ||
"version": "0.1.0", | ||
"description": "${description}", | ||
"author": "Crave Food Systems and AUTHORS", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"AUTHORS", | ||
"lib" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"clean": "rm -rf lib", | ||
"build": "yarn clean && babel --root-mode upward src -d lib --ignore 'src/**/*.test.js','src/**/*.story.js'" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/CraveFood/farmblocks.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/CraveFood/farmblocks/issues" | ||
}, | ||
"homepage": "https://github.com/CraveFood/farmblocks#readme", | ||
"keywords": ${JSON.stringify(keywords)}, | ||
"peerDependencies": ${JSON.stringify(peerDependencies)}, | ||
"dependencies": {} | ||
} | ||
`, { | ||
parser: "json" | ||
}); | ||
module.exports = packageTemplate; |
@@ -1,8 +0,22 @@ | ||
var readmeTemplate = function readmeTemplate(_ref) { | ||
var fullName = _ref.fullName, | ||
shortName = _ref.shortName, | ||
description = _ref.description; | ||
return "\n\n# Farmblocks ".concat(fullName, "\n\n").concat(description, "\n\n## Installation\n\n```\nnpm install @crave/farmblocks-").concat(shortName, "\n```\n\n## License\n\nMIT\n"); | ||
}; | ||
const readmeTemplate = ({ | ||
fullName, | ||
shortName, | ||
description | ||
}) => ` | ||
# Farmblocks ${fullName} | ||
${description} | ||
## Installation | ||
\`\`\` | ||
npm install @crave/farmblocks-${shortName} | ||
\`\`\` | ||
## License | ||
MIT | ||
`; | ||
module.exports = readmeTemplate; |
{ | ||
"name": "@crave/farmblocks-dev-scaffold", | ||
"version": "1.3.3-alpha-protected-currency-5867.1.36+58734103", | ||
"version": "1.3.3-alpha-table-redesign-manual-1.64+93fa0935", | ||
"description": "Helper tool for creating a new farmblock component", | ||
@@ -42,3 +42,3 @@ "author": "Crave Food Systems and AUTHORS", | ||
}, | ||
"gitHead": "58734103b0e6767231a40c638b9caea4ad9e085f" | ||
"gitHead": "93fa09359d4f4108a68b5c1b5dc04bc65e8d4000" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing 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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
162
22
11805
2