react-creates
Advanced tools
Comparing version 1.0.4 to 1.0.6
#!/usr/bin/env node | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.componentParser = void 0; | ||
const commander_1 = require("commander"); | ||
const component_1 = require("./scripts/component"); | ||
const error_1 = require("./utils/error"); | ||
const componentParser = __importStar(require("./scripts/component/parsers")); | ||
exports.componentParser = componentParser; | ||
error_1.checkForMainDependencies(); | ||
@@ -8,0 +30,0 @@ commander_1.program |
@@ -27,5 +27,5 @@ "use strict"; | ||
.option("--sass") | ||
.option("-l --language <scripting>", parse_language_1.MESSAGE) | ||
.option("-l --language <scripting>", parse_language_1.LANGUAGE_MESSAGE) | ||
.option("-d --directory <target>", "Component directory", process.cwd()) | ||
.option("-t --type <component>", parse_type_1.MESSAGE, parse_type_1.Types.FUNCTION) | ||
.option("-t --type <component>", parse_type_1.TYPE_MESSAGE, parse_type_1.Types.FUNCTION) | ||
.option("-pt --prop-types", "Should add Prop-types") | ||
@@ -61,3 +61,3 @@ .option("-f --function", "Generate function component") | ||
type: await parse_type_1.parseTypes(type), | ||
language: await parse_language_1.parseLanguage(language), | ||
language: await parse_language_1.parseLanguage({ language, target }), | ||
style: await parse_style_1.parseStyle(style), | ||
@@ -64,0 +64,0 @@ propTypes: await parse_prop_types_1.parsePropTypes({ propTypes, target }), |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseLanguage = exports.MESSAGE = exports.Language = void 0; | ||
exports.parseLanguage = exports.LANGUAGE_MESSAGE = exports.Language = void 0; | ||
const is_typescript_1 = __importDefault(require("../../../utils/is-typescript")); | ||
@@ -14,8 +14,8 @@ var Language; | ||
})(Language = exports.Language || (exports.Language = {})); | ||
exports.MESSAGE = `Select the language you want the component to be created. (${Language.TYPESCRIPT} or ${Language.JAVASCRIPT})`; | ||
async function parseLanguage(language) { | ||
exports.LANGUAGE_MESSAGE = `Select the language you want the component to be created. (${Language.TYPESCRIPT} or ${Language.JAVASCRIPT})`; | ||
async function parseLanguage({ language, target }) { | ||
return typeof language === "string" && | ||
Object.values(Language).includes(language) | ||
? language | ||
: (await is_typescript_1.default()) | ||
: (await is_typescript_1.default(target)) | ||
? Language.TYPESCRIPT | ||
@@ -22,0 +22,0 @@ : Language.JAVASCRIPT; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseStyle = exports.MESSAGE = exports.Styles = void 0; | ||
exports.parseStyle = exports.STYLE_MESSAGE = exports.Styles = void 0; | ||
const prompt_list_1 = require("../../../utils/prompt-list"); | ||
@@ -11,3 +11,3 @@ var Styles; | ||
})(Styles = exports.Styles || (exports.Styles = {})); | ||
exports.MESSAGE = `Select the type of style you want: (${Object.values(Styles).join(",")})`; | ||
exports.STYLE_MESSAGE = `Select the type of style you want: (${Object.values(Styles).join(",")})`; | ||
let _lastStyle; | ||
@@ -23,3 +23,3 @@ async function parseStyle(style) { | ||
else { | ||
_lastStyle = await prompt_list_1.promptList("style", exports.MESSAGE, Object.values(Styles).map((value) => ({ value })), false); | ||
_lastStyle = await prompt_list_1.promptList("style", exports.STYLE_MESSAGE, Object.values(Styles).map((value) => ({ value })), false); | ||
} | ||
@@ -26,0 +26,0 @@ return _lastStyle; |
@@ -37,5 +37,4 @@ "use strict"; | ||
exports.parseTarget = async (options) => { | ||
const newTarget = await _parseTarget(options); | ||
return newTarget; | ||
return await _parseTarget(options); | ||
}; | ||
//# sourceMappingURL=parse-target.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseTypes = exports.MESSAGE = exports.Types = void 0; | ||
exports.parseTypes = exports.TYPE_MESSAGE = exports.Types = void 0; | ||
const prompt_list_1 = require("../../../utils/prompt-list"); | ||
@@ -10,3 +10,3 @@ var Types; | ||
})(Types = exports.Types || (exports.Types = {})); | ||
exports.MESSAGE = `What type of the component it should be. (${Types.FUNCTION} or ${Types.CLASS})`; | ||
exports.TYPE_MESSAGE = `What type of the component it should be. (${Types.FUNCTION} or ${Types.CLASS})`; | ||
exports.parseTypes = async (type) => { | ||
@@ -18,5 +18,5 @@ if (typeof type === "string" && | ||
else { | ||
return await prompt_list_1.promptList("type", exports.MESSAGE, Object.values(Types).map((value) => ({ value }))); | ||
return await prompt_list_1.promptList("type", exports.TYPE_MESSAGE, Object.values(Types).map((value) => ({ value }))); | ||
} | ||
}; | ||
//# sourceMappingURL=parse-type.js.map |
@@ -10,2 +10,3 @@ "use strict"; | ||
const readdir = util_1.promisify(fs_1.default.readdir); | ||
const readFile = util_1.promisify(fs_1.default.readFile); | ||
const exists = util_1.promisify(fs_1.default.exists); | ||
@@ -20,3 +21,3 @@ ; | ||
const directory = directories.pop(); | ||
const path = path_1.join(path_1.sep, ...directories, directory); | ||
const path = path_1.join(...directories, directory); | ||
if (!(await exists(path))) | ||
@@ -26,3 +27,4 @@ continue; | ||
if (dirFiles.includes(PACKAGE_JSON)) { | ||
const packageJson = require(path_1.join(path, PACKAGE_JSON)); | ||
const packageJsonRaw = await readFile(path_1.join(path, PACKAGE_JSON), { encoding: 'utf8' }); | ||
const packageJson = JSON.parse(packageJsonRaw); | ||
if (!packageJson) { | ||
@@ -29,0 +31,0 @@ continue; |
@@ -18,5 +18,6 @@ "use strict"; | ||
const directory = directories.pop(); | ||
const tsconfigPath = path_1.join(path_1.sep, ...directories, directory, TSCONFIG); | ||
const currentPath = path_1.join(...directories, directory); | ||
const tsconfigPath = path_1.join(currentPath, TSCONFIG); | ||
const tsconfigExists = await isFile(tsconfigPath); | ||
const { devDependencies, dependencies } = await get_package_json_1.default({ cwd: target, depth: 1 }) || {}; | ||
const { devDependencies, dependencies } = await get_package_json_1.default({ cwd: currentPath, depth: 1 }) || {}; | ||
const haveTsInDependencies = (devDependencies === null || devDependencies === void 0 ? void 0 : devDependencies['typescript']) || (dependencies === null || dependencies === void 0 ? void 0 : dependencies['typescript']); | ||
@@ -23,0 +24,0 @@ if (tsconfigExists && haveTsInDependencies) { |
{ | ||
"name": "react-creates", | ||
"version": "1.0.4", | ||
"version": "1.0.6", | ||
"description": "Create React Component folder works on macOS, Windows, and Linux.", | ||
@@ -9,2 +9,3 @@ "files": [ | ||
], | ||
"type": "dist/react-creates.d.ts", | ||
"bin": { | ||
@@ -19,3 +20,3 @@ "react-creates": "dist/react-creates.js" | ||
"lint": "eslint --ext .js,.ts .", | ||
"pretest": "npm run build && npm link", | ||
"pretest": "npm run build", | ||
"test": "jest", | ||
@@ -27,3 +28,4 @@ "create:cmp": "npm run clean && npx react-creates component __temp__ -f --scss -d __temp__ ", | ||
"deploy": "npm publish", | ||
"postdeplloy": "node deploy -g" | ||
"postdeplloy": "node deploy -g", | ||
"version": "npx auto-changelog" | ||
}, | ||
@@ -65,2 +67,3 @@ "keywords": [ | ||
"@types/lodash": "^4.14.157", | ||
"@types/mock-fs": "^4.10.0", | ||
"@types/mustache": "^4.0.1", | ||
@@ -70,2 +73,3 @@ "@types/ncp": "^2.0.4", | ||
"@types/tempy": "^0.3.0", | ||
"auto-changelog": "^2.2.0", | ||
"chance": "^1.1.6", | ||
@@ -76,2 +80,3 @@ "create-react-app": "^3.4.1", | ||
"jest": "^26.1.0", | ||
"mock-fs": "^4.12.0", | ||
"tempy": "^0.5.0", | ||
@@ -78,0 +83,0 @@ "ts-jest": "^26.1.2", |
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
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
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
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 README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
48177
74
785
1
1
7
22