create-textlint-rule
Advanced tools
Comparing version 1.5.0 to 2.0.0
#!/usr/bin/env node | ||
"use strict"; | ||
const meow = require("meow"); | ||
const chalk = require("chalk"); | ||
const updateNotifier = require("update-notifier"); | ||
const pkg = require("../package.json"); | ||
const cliHandler = require("../lib/cli-handler"); | ||
import meow from "meow"; | ||
import chalk from "chalk"; | ||
import updateNotifier from "update-notifier"; | ||
import cliHandler from "../lib/cli-handler.js"; | ||
import { readFile } from "node:fs/promises"; | ||
export const getPackageInfo = async () => { | ||
const pkg = await readFile(new URL("../package.json", import.meta.url)); | ||
return JSON.parse(pkg); | ||
}; | ||
const cli = meow( | ||
@@ -28,5 +31,5 @@ ` | ||
{ | ||
alias: { | ||
h: "help" | ||
} | ||
importMeta: import.meta, | ||
autoHelp: true, | ||
autoVersion: true | ||
} | ||
@@ -42,3 +45,3 @@ ); | ||
updateNotifier({ | ||
pkg: pkg, | ||
pkg: await getPackageInfo(), | ||
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 | ||
@@ -59,3 +62,3 @@ }).notify(); | ||
}) | ||
.catch(error => { | ||
.catch((error) => { | ||
console.log(chalk.red(`✗ Error: ${error.message}`)); | ||
@@ -62,0 +65,0 @@ console.log(); |
@@ -1,11 +0,9 @@ | ||
// MIT © 2016 azu | ||
"use strict"; | ||
const path = require("path"); | ||
const chalk = require("chalk"); | ||
const createTextlintRule = require("./scripts/create-textlint-rule"); | ||
import chalk from "chalk"; | ||
import createTextlintRule from "./scripts/create-textlint-rule.js"; | ||
/** | ||
* @param {string} projectName | ||
* @param {{ | ||
* yes: boolean | ||
* yarn: boolean | ||
* yes: boolean, | ||
* yarn: boolean, | ||
* cwd: string | ||
@@ -15,6 +13,6 @@ * }} options | ||
*/ | ||
module.exports = function(projectName, options = {}) { | ||
export default function (projectName, options = {}) { | ||
return createTextlintRule(projectName, options).then(() => { | ||
console.log(chalk.green(`✔ Complete: Let's write textlint rule`)); | ||
}); | ||
}; | ||
} |
@@ -1,7 +0,5 @@ | ||
// MIT © 2016 azu | ||
"use strict"; | ||
const spawn = require("cross-spawn-promise"); | ||
const path = require("path"); | ||
const rimraf = require("rimraf"); | ||
const chalk = require("chalk"); | ||
import rimraf from "rimraf"; | ||
import chalk from "chalk"; | ||
import spawn from "cross-spawn-promise"; | ||
import path from "node:path"; | ||
@@ -12,5 +10,5 @@ /** | ||
* @param {{ | ||
* yes: boolean | ||
* yarn: boolean | ||
* typescript: boolean | ||
* yes: boolean, | ||
* yarn: boolean, | ||
* typescript: boolean, | ||
* cwd: string | ||
@@ -20,3 +18,3 @@ * }} [options] | ||
*/ | ||
module.exports = function(projectName, options = {}) { | ||
export default function (projectName, options = {}) { | ||
const useYarn = options.yarn !== undefined; | ||
@@ -27,4 +25,4 @@ const useYes = options.yes !== undefined; | ||
const ruleName = isInitInCurrentDir | ||
? path.basename(options.cwd) | ||
: `textlint-rule-${projectName.replace(/^textlint-rule-/, "")}`; | ||
? path.basename(options.cwd) | ||
: `textlint-rule-${projectName.replace(/^textlint-rule-/, "")}`; | ||
if (isInitInCurrentDir && !/^textlint-rule-/.test(ruleName)) { | ||
@@ -37,6 +35,3 @@ throw new Error(`Current directory name should start with "textlint-rule-<rule-name>": ${ruleName}.`); | ||
: "https://github.com/textlint/textlint-rule-template.git"; | ||
return spawn(`git`, [ | ||
"clone", "--depth=1", gitRepositoryUrl, | ||
isInitInCurrentDir ? "." : ruleName | ||
], { | ||
return spawn(`git`, ["clone", "--depth=1", gitRepositoryUrl, isInitInCurrentDir ? "." : ruleName], { | ||
stdio: "inherit" | ||
@@ -81,2 +76,2 @@ }) | ||
}); | ||
}; | ||
} |
{ | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"author": "azu", | ||
"license": "MIT", | ||
"files": [ | ||
"bin/", | ||
"lib/" | ||
], | ||
"name": "create-textlint-rule", | ||
"version": "1.5.0", | ||
"version": "2.0.0", | ||
"description": "Create textlint rule project with no configuration.", | ||
"main": "lib/create-textlint-rule.js", | ||
"bin": { | ||
"create-textlint-rule": "bin/cmd.js" | ||
}, | ||
"scripts": { | ||
"test": "./test/test.sh", | ||
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"" | ||
}, | ||
"keywords": [ | ||
@@ -28,2 +11,6 @@ "textlint", | ||
], | ||
"homepage": "https://github.com/textlint/create-textlint-rule", | ||
"bugs": { | ||
"url": "https://github.com/textlint/create-textlint-rule/issues" | ||
}, | ||
"repository": { | ||
@@ -33,35 +20,47 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/textlint/create-textlint-rule/issues" | ||
"license": "MIT", | ||
"author": "azu", | ||
"type": "module", | ||
"main": "lib/create-textlint-rule.js", | ||
"bin": { | ||
"create-textlint-rule": "bin/cmd.js" | ||
}, | ||
"homepage": "https://github.com/textlint/create-textlint-rule", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"files": [ | ||
"bin/", | ||
"lib/" | ||
], | ||
"engines": { | ||
"node": ">=14.16" | ||
}, | ||
"scripts": { | ||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"", | ||
"prepare": "git config --local core.hooksPath .githooks", | ||
"test": "./test/test.sh" | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx,css}": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"prettier": { | ||
"printWidth": 120, | ||
"singleQuote": false, | ||
"tabWidth": 4, | ||
"trailingComma": "none" | ||
}, | ||
"dependencies": { | ||
"chalk": "^4.1.0", | ||
"chalk": "^5.1.2", | ||
"cross-spawn": "^7.0.3", | ||
"cross-spawn-promise": "^0.10.2", | ||
"meow": "^7.0.1", | ||
"meow": "^11.0.0", | ||
"rimraf": "^3.0.2", | ||
"update-notifier": "^4.1.0" | ||
"update-notifier": "^6.0.2" | ||
}, | ||
"devDependencies": { | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.2.11", | ||
"prettier": "^2.0.5" | ||
}, | ||
"prettier": { | ||
"singleQuote": false, | ||
"printWidth": 120, | ||
"tabWidth": 4 | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"precommit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx,css}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
"lint-staged": "^13.0.3", | ||
"prettier": "^2.7.1" | ||
} | ||
} |
@@ -11,3 +11,3 @@ # create-textlint-rule [![Build Status](https://travis-ci.org/textlint/create-textlint-rule.svg?branch=master)](https://travis-ci.org/textlint/create-textlint-rule) | ||
npm install create-textlint-rule -g | ||
npm install --global create-textlint-rule | ||
# Or | ||
@@ -14,0 +14,0 @@ npx create-textlint-rule |
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
10897
2
Yes
150
+ Added@pnpm/config.env-replace@1.1.0(transitive)
+ Added@pnpm/network.ca-file@1.0.2(transitive)
+ Added@pnpm/npm-conf@2.3.1(transitive)
+ Added@sindresorhus/is@5.6.0(transitive)
+ Added@szmarczak/http-timer@5.0.1(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Addedansi-regex@6.1.0(transitive)
+ Addedansi-styles@6.2.1(transitive)
+ Addedboxen@7.1.1(transitive)
+ Addedcacheable-lookup@7.0.0(transitive)
+ Addedcacheable-request@10.2.14(transitive)
+ Addedcamelcase@7.0.1(transitive)
+ Addedcamelcase-keys@8.0.2(transitive)
+ Addedchalk@5.3.0(transitive)
+ Addedci-info@3.9.0(transitive)
+ Addedcli-boxes@3.0.0(transitive)
+ Addedconfig-chain@1.1.13(transitive)
+ Addedconfigstore@6.0.0(transitive)
+ Addedcrypto-random-string@4.0.0(transitive)
+ Addeddecamelize@6.0.0(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddefer-to-connect@2.0.1(transitive)
+ Addeddot-prop@6.0.1(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@9.2.2(transitive)
+ Addedescape-goat@4.0.0(transitive)
+ Addedfind-up@6.3.0(transitive)
+ Addedform-data-encoder@2.1.4(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedglobal-dirs@3.0.1(transitive)
+ Addedgot@12.6.1(transitive)
+ Addedgraceful-fs@4.2.10(transitive)
+ Addedhas-yarn@3.0.0(transitive)
+ Addedhosted-git-info@4.1.05.2.1(transitive)
+ Addedhttp2-wrapper@2.2.1(transitive)
+ Addedimport-lazy@4.0.0(transitive)
+ Addedindent-string@5.0.0(transitive)
+ Addedini@1.3.82.0.0(transitive)
+ Addedis-ci@3.0.1(transitive)
+ Addedis-installed-globally@0.4.0(transitive)
+ Addedis-npm@6.0.0(transitive)
+ Addedis-yarn-global@0.4.1(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlatest-version@7.0.0(transitive)
+ Addedlocate-path@7.2.0(transitive)
+ Addedlowercase-keys@3.0.0(transitive)
+ Addedlru-cache@6.0.07.18.3(transitive)
+ Addedmeow@11.0.0(transitive)
+ Addedmimic-response@3.1.04.0.0(transitive)
+ Addednormalize-package-data@3.0.34.0.1(transitive)
+ Addednormalize-url@8.0.1(transitive)
+ Addedp-cancelable@3.0.0(transitive)
+ Addedp-limit@4.0.0(transitive)
+ Addedp-locate@6.0.0(transitive)
+ Addedpackage-json@8.1.1(transitive)
+ Addedpath-exists@5.0.0(transitive)
+ Addedproto-list@1.2.4(transitive)
+ Addedpupa@3.1.0(transitive)
+ Addedquick-lru@5.1.16.1.2(transitive)
+ Addedread-pkg@7.1.0(transitive)
+ Addedread-pkg-up@9.1.0(transitive)
+ Addedredent@4.0.0(transitive)
+ Addedregistry-auth-token@5.0.2(transitive)
+ Addedregistry-url@6.0.1(transitive)
+ Addedresolve-alpn@1.2.1(transitive)
+ Addedresponselike@3.0.0(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedsemver-diff@4.0.0(transitive)
+ Addedstring-width@5.1.2(transitive)
+ Addedstrip-ansi@7.1.0(transitive)
+ Addedstrip-indent@4.0.0(transitive)
+ Addedtrim-newlines@4.1.1(transitive)
+ Addedtype-fest@1.4.02.19.03.13.1(transitive)
+ Addedunique-string@3.0.0(transitive)
+ Addedupdate-notifier@6.0.2(transitive)
+ Addedwidest-line@4.0.1(transitive)
+ Addedwrap-ansi@8.1.0(transitive)
+ Addedxdg-basedir@5.1.0(transitive)
+ Addedyallist@4.0.0(transitive)
+ Addedyargs-parser@21.1.1(transitive)
+ Addedyocto-queue@1.1.1(transitive)
- Removed@sindresorhus/is@0.14.0(transitive)
- Removed@szmarczak/http-timer@1.1.2(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedboxen@4.2.0(transitive)
- Removedcacheable-request@6.1.0(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcamelcase-keys@6.2.2(transitive)
- Removedchalk@3.0.04.1.2(transitive)
- Removedci-info@2.0.0(transitive)
- Removedcli-boxes@2.2.1(transitive)
- Removedclone-response@1.0.3(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedconfigstore@5.0.1(transitive)
- Removedcrypto-random-string@2.0.0(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddefer-to-connect@1.1.3(transitive)
- Removeddot-prop@5.3.0(transitive)
- Removedduplexer3@0.1.5(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedescape-goat@2.1.1(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedget-stream@4.1.05.2.0(transitive)
- Removedglobal-dirs@2.1.0(transitive)
- Removedgot@9.6.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhas-yarn@2.1.0(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedimport-lazy@2.1.0(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedini@1.3.7(transitive)
- Removedis-ci@2.0.0(transitive)
- Removedis-installed-globally@0.3.2(transitive)
- Removedis-npm@4.0.0(transitive)
- Removedis-yarn-global@0.3.0(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedkeyv@3.1.0(transitive)
- Removedlatest-version@5.1.0(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedlowercase-keys@1.0.12.0.0(transitive)
- Removedmake-dir@3.1.0(transitive)
- Removedmeow@7.1.1(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removednormalize-url@4.5.1(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpackage-json@6.5.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedprepend-http@2.0.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedpupa@2.1.1(transitive)
- Removedquick-lru@4.0.1(transitive)
- Removedread-pkg@5.2.0(transitive)
- Removedread-pkg-up@7.0.1(transitive)
- Removedredent@3.0.0(transitive)
- Removedregistry-auth-token@4.2.2(transitive)
- Removedregistry-url@5.1.0(transitive)
- Removedresolve@1.22.8(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedsemver@5.7.26.3.1(transitive)
- Removedsemver-diff@3.1.1(transitive)
- Removedstrip-indent@3.0.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedterm-size@2.2.1(transitive)
- Removedto-readable-stream@1.0.0(transitive)
- Removedtrim-newlines@3.0.1(transitive)
- Removedtype-fest@0.13.10.6.00.8.1(transitive)
- Removedunique-string@2.0.0(transitive)
- Removedupdate-notifier@4.1.3(transitive)
- Removedurl-parse-lax@3.0.0(transitive)
- Removedwidest-line@3.1.0(transitive)
- Removedxdg-basedir@4.0.0(transitive)
- Removedyargs-parser@18.1.3(transitive)
Updatedchalk@^5.1.2
Updatedmeow@^11.0.0
Updatedupdate-notifier@^6.0.2