@allohamora/cli
Advanced tools
Comparing version 1.7.0 to 1.8.0
426
bin/cli.js
@@ -6,6 +6,6 @@ #!/usr/bin/env node | ||
var fsp = require('fs/promises'); | ||
var path = require('path'); | ||
var child_process = require('child_process'); | ||
var events = require('events'); | ||
var fsp = require('node:fs/promises'); | ||
var path = require('node:path'); | ||
var node_child_process = require('node:child_process'); | ||
var node_events = require('node:events'); | ||
var ora = require('ora'); | ||
@@ -85,7 +85,7 @@ var inquirer = require('inquirer'); | ||
return new Promise(async (res, rej) => { | ||
const child = child_process.spawn(command, args); | ||
const child = node_child_process.spawn(command, args); | ||
let result = Buffer.alloc(0); | ||
child.on('error', (err) => rej(err)); | ||
child.on('exit', () => res(result.toString('utf-8'))); | ||
for await (const [chunk] of events.on(child.stdout, 'data')) { | ||
for await (const [chunk] of node_events.on(child.stdout, 'data')) { | ||
result = Buffer.concat([result, chunk]); | ||
@@ -128,3 +128,3 @@ } | ||
const defaultConfig$c = { | ||
const defaultConfig$d = { | ||
rules: '@commitlint/config-conventional', | ||
@@ -134,4 +134,4 @@ config: { extends: ['@commitlint/config-conventional'] }, | ||
const [getConfig$c] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$c, | ||
const [getConfig$d] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$d, | ||
}); | ||
@@ -142,3 +142,3 @@ | ||
const CONFIG_FILE_NAME$4 = '.commitlintrc.json'; | ||
const CLI_NAME$4 = SCRIPT_NAME$2; | ||
const CLI_NAME$5 = SCRIPT_NAME$2; | ||
@@ -156,3 +156,3 @@ const PACKAGE_NAME$6 = 'husky'; | ||
}; | ||
const isInstalled = (scriptName, aditionalHandlers = []) => { | ||
const isInstalled = (scriptName, aditionalHandlers) => { | ||
const handlers = [async () => isInstalling(scriptName), ...aditionalHandlers]; | ||
@@ -187,3 +187,3 @@ const handler = async () => { | ||
if (await isHuskyInstalled()) { | ||
await addHook('commit-msg', `npx --no-install -- ${CLI_NAME$4} --edit "$1"`); | ||
await addHook('commit-msg', `npx --no-install -- ${CLI_NAME$5} --edit "$1"`); | ||
} | ||
@@ -193,3 +193,3 @@ }; | ||
const commitlint = async () => { | ||
const { config, rules } = getConfig$c(); | ||
const { config, rules } = getConfig$d(); | ||
await installDevelopmentDependencies(PACKAGE_NAME$7, rules); | ||
@@ -202,3 +202,3 @@ await addJsonFileToRoot(CONFIG_FILE_NAME$4, config); | ||
const PACKAGE_NAME$5 = SCRIPT_NAME$1; | ||
const CLI_NAME$3 = PACKAGE_NAME$5; | ||
const CLI_NAME$4 = PACKAGE_NAME$5; | ||
const CONFIG_FILE_NAME$3 = 'jest.config.cjs'; | ||
@@ -209,3 +209,3 @@ | ||
const PACKAGE_NAME$4 = 'prettier'; | ||
const CLI_NAME$2 = PACKAGE_NAME$4; | ||
const CLI_NAME$3 = PACKAGE_NAME$4; | ||
const CONFIG_FILE_NAME$2 = '.prettierrc'; | ||
@@ -218,3 +218,3 @@ const CONFIG_IGNORE_FILE_NAME = '.prettierignore'; | ||
const PACKAGE_NAME$3 = SCRIPT_NAME; | ||
const CLI_NAME$1 = PACKAGE_NAME$3; | ||
const CLI_NAME$2 = PACKAGE_NAME$3; | ||
const CONFIG_FILE_NAME$1 = '.eslintrc.json'; | ||
@@ -242,3 +242,3 @@ | ||
const defaultConfig$b = { | ||
const defaultConfig$c = { | ||
dependencies: [], | ||
@@ -358,4 +358,4 @@ eslintConfig: { | ||
const [getConfig$b] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$b, | ||
const [getConfig$c] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$c, | ||
'node:ts': nodeTsConfig$2, | ||
@@ -370,3 +370,3 @@ 'react:ts': reactTsConfig$3, | ||
const eslint = async () => { | ||
const config = getConfig$b(); | ||
const config = getConfig$c(); | ||
await applyMutations(config, config.mutations); | ||
@@ -386,10 +386,10 @@ const { dependencies, eslintConfig, scripts } = config; | ||
const PACKAGE_NAME$2 = 'lint-staged'; | ||
const CLI_NAME = PACKAGE_NAME$2; | ||
const CLI_NAME$1 = PACKAGE_NAME$2; | ||
const STYLELINT_CONFIG_NAME = '.stylelintrc'; | ||
const STYLELINT_IGNORE_NAME = '.stylelintignore'; | ||
const CONFIG_NAME = '.stylelintrc'; | ||
const IGNORE_NAME$1 = '.stylelintignore'; | ||
const PACKAGE_NAME$1 = 'stylelint'; | ||
const STYLELINT_CLI_NAME = 'stylelint'; | ||
const CLI_NAME = PACKAGE_NAME$1; | ||
const isStylelintInstalled = isInstalledAndInRootCheck(PACKAGE_NAME$1, STYLELINT_CONFIG_NAME); | ||
const isStylelintInstalled = isInstalledAndInRootCheck(PACKAGE_NAME$1, CONFIG_NAME); | ||
const prettierMutation$1 = async (config) => { | ||
@@ -431,3 +431,3 @@ if (await isPrettierInstalled()) { | ||
if (await isHuskyInstalled()) { | ||
await addHook('pre-commit', `npx --no-install ${CLI_NAME}`); | ||
await addHook('pre-commit', `npx --no-install ${CLI_NAME$1}`); | ||
} | ||
@@ -437,3 +437,3 @@ }; | ||
if (await isJestInstalled()) { | ||
addOptionToLintStagedConfig(config, fileExtension, `${CLI_NAME$3} --findRelatedTests`); | ||
addOptionToLintStagedConfig(config, fileExtension, `${CLI_NAME$4} --findRelatedTests`); | ||
} | ||
@@ -443,3 +443,3 @@ }; | ||
if (await isEslintInstalled()) { | ||
addOptionToLintStagedConfig(config, fileExtension, `${CLI_NAME$1} --fix`); | ||
addOptionToLintStagedConfig(config, fileExtension, `${CLI_NAME$2} --fix`); | ||
} | ||
@@ -449,3 +449,3 @@ }; | ||
if (await isPrettierInstalled()) { | ||
addOptionToLintStagedConfig(config, '*.{js,json,yml,md}', `${CLI_NAME$2} --write`); | ||
addOptionToLintStagedConfig(config, '*.{js,json,yml,md}', `${CLI_NAME$3} --write`); | ||
} | ||
@@ -456,3 +456,3 @@ }; | ||
if (await isStylelintInstalled()) { | ||
addOptionToLintStagedConfig(config, fileExtension, `${STYLELINT_CLI_NAME} --fix`); | ||
addOptionToLintStagedConfig(config, fileExtension, `${CLI_NAME} --fix`); | ||
} | ||
@@ -462,3 +462,3 @@ }; | ||
const defaultConfig$a = { | ||
const defaultConfig$b = { | ||
config: {}, | ||
@@ -483,4 +483,4 @@ mutations: [prettierMutation, stylelintMutation('*.css'), eslintMutation('*.js'), jestMutation('*.js')], | ||
const [getConfig$a] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$a, | ||
const [getConfig$b] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$b, | ||
'node:ts': nodeTsConfig$1, | ||
@@ -491,3 +491,3 @@ 'react:ts': reactTsConfig$2, | ||
const lintStaged = async () => { | ||
const { config, mutations } = getConfig$a(); | ||
const { config, mutations } = getConfig$b(); | ||
await applyMutations(config, mutations); | ||
@@ -512,3 +512,3 @@ await installDevelopmentDependencies(PACKAGE_NAME$2); | ||
const [first, ...rest] = kebab.split('-'); | ||
const capilazedRest = rest | ||
const capitalizedRest = rest | ||
.map((word) => { | ||
@@ -519,3 +519,3 @@ const [first, ...rest] = word; | ||
.join(''); | ||
return `${first}${capilazedRest}`; | ||
return `${first}${capitalizedRest}`; | ||
}; | ||
@@ -560,3 +560,3 @@ const multilineStringBuilder = (strings, ...values) => { | ||
`; | ||
const defaultConfig$9 = { | ||
const defaultConfig$a = { | ||
stylelintConfig: stylelintConfig$1, | ||
@@ -617,4 +617,4 @@ stylelintIgnore: stylelintIgnore$1, | ||
const [getConfig$9] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$9, | ||
const [getConfig$a] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$a, | ||
'react:ts': reactTsConfig$1, | ||
@@ -624,3 +624,3 @@ }); | ||
const stylelint = async () => { | ||
const config = getConfig$9(); | ||
const config = getConfig$a(); | ||
for (const mutation of config.mutations) { | ||
@@ -632,7 +632,7 @@ await mutation(config); | ||
await addScripts(...scripts); | ||
await addFileToRoot(STYLELINT_CONFIG_NAME, JSON.stringify(stylelintConfig, null, 2)); | ||
await addFileToRoot(STYLELINT_IGNORE_NAME, stylelintIgnore); | ||
await addFileToRoot(CONFIG_NAME, stringify(stylelintConfig)); | ||
await addFileToRoot(IGNORE_NAME$1, stylelintIgnore); | ||
}; | ||
const defaultConfig$8 = { | ||
const defaultConfig$9 = { | ||
config: { | ||
@@ -660,8 +660,8 @@ semi: true, | ||
const [getConfig$8] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$8, | ||
const [getConfig$9] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$9, | ||
}); | ||
const prettier = async () => { | ||
const { config, ignore, scripts } = getConfig$8(); | ||
const { config, ignore, scripts } = getConfig$9(); | ||
await installDevelopmentDependencies(PACKAGE_NAME$4); | ||
@@ -673,3 +673,3 @@ await addJsonFileToRoot(CONFIG_FILE_NAME$2, config); | ||
const defaultConfig$7 = { | ||
const defaultConfig$8 = { | ||
createConfig: (repositoryUrl) => ({ | ||
@@ -700,4 +700,4 @@ types: [ | ||
const [getConfig$7] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$7, | ||
const [getConfig$8] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$8, | ||
}); | ||
@@ -709,3 +709,3 @@ | ||
const standardVersion = async () => { | ||
const { createConfig, packageJsonConfig, scripts } = getConfig$7(); | ||
const { createConfig, packageJsonConfig, scripts } = getConfig$8(); | ||
await installDevelopmentDependencies(PACKAGE_NAME); | ||
@@ -720,63 +720,2 @@ const packageJson = await getPackageJson(); | ||
const GITHUB_DIR_NAME = '.github'; | ||
const GITHUB_WORKFLOWS_DIR_NAME = 'workflows'; | ||
const GITHUB_RELATIVE_WORKFLOWS_PATH = path__default["default"].join(GITHUB_DIR_NAME, GITHUB_WORKFLOWS_DIR_NAME); | ||
const addGithubDirIfNotExists = async () => { | ||
await addDirToRootIfNotExists(GITHUB_DIR_NAME); | ||
}; | ||
const addWorkflowsDirIfNotExists = async () => { | ||
await addGithubDirIfNotExists(); | ||
await addDirToRootIfNotExists(GITHUB_RELATIVE_WORKFLOWS_PATH); | ||
}; | ||
const addGithubWorkflow = async (filename, content) => { | ||
await addWorkflowsDirIfNotExists(); | ||
const relativeFilePath = path__default["default"].join(GITHUB_RELATIVE_WORKFLOWS_PATH, filename); | ||
await addFileToRoot(relativeFilePath, content); | ||
}; | ||
const addToGithubDir = async (filename, content) => { | ||
await addGithubDirIfNotExists(); | ||
const relativeFilePath = path__default["default"].join(GITHUB_DIR_NAME, filename); | ||
await addFileToRoot(relativeFilePath, content); | ||
}; | ||
const content$4 = readableMultilineString ` | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Get release notes from CHANGELOG.md | ||
uses: yashanand1910/standard-release-notes@v1.2.1 | ||
id: get_release_notes | ||
with: | ||
version: \${{ github.ref }} | ||
- name: Release to github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: \${{ steps.get_release_notes.outputs.release_notes }} | ||
`; | ||
const defaultConfig$6 = { | ||
content: content$4, | ||
}; | ||
const [getConfig$6] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$6, | ||
}); | ||
const WORKFLOW_FILENAME$3 = 'release.yml'; | ||
const releaseWorkflow = async () => { | ||
const { content } = getConfig$6(); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$3, content); | ||
}; | ||
const scripts = [ | ||
@@ -794,3 +733,3 @@ { name: 'test', script: 'jest' }, | ||
`; | ||
const defaultConfig$5 = { | ||
const defaultConfig$7 = { | ||
devDependencies: ['jest', '@types/jest'], | ||
@@ -847,4 +786,4 @@ configFileContent: configFileContent$2, | ||
const [getConfig$5] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$5, | ||
const [getConfig$7] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$7, | ||
'node:ts': nodeTsConfig, | ||
@@ -856,3 +795,3 @@ 'react:ts': reactTsConfig, | ||
const jestEntrypoint = async () => { | ||
const { devDependencies, configFileContent, scripts } = getConfig$5(); | ||
const { devDependencies, configFileContent, scripts } = getConfig$7(); | ||
await installDevelopmentDependencies(...devDependencies); | ||
@@ -863,3 +802,116 @@ await addFileToRoot(CONFIG_FILE_NAME$3, configFileContent); | ||
const content$3 = readableMultilineString ` | ||
const getNodeVersion = async () => { | ||
const versionConsoleOutput = await runCommand('node -v'); | ||
return versionConsoleOutput.trim().replace('v', ''); | ||
}; | ||
const FILE_NAME = 'DockerFile'; | ||
const IGNORE_NAME = '.dockerignore'; | ||
const getDockerFile = ({ version }) => readableMultilineString ` | ||
FROM node:${version} | ||
WORKDIR /app | ||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY . . | ||
ENV NODE_ENV production | ||
RUN npm run build | ||
EXPOSE 3000 | ||
CMD npm run start | ||
`; | ||
const dockerIgnore = readableMultilineString ` | ||
node_modules | ||
dist | ||
build | ||
.husky | ||
.git | ||
${IGNORE_NAME} | ||
${FILE_NAME} | ||
.docker-compose.yml | ||
`; | ||
const defaultConfig$6 = { | ||
getDockerFile, | ||
dockerIgnore, | ||
}; | ||
const [getConfig$6] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$6, | ||
}); | ||
const docker = async () => { | ||
const { getDockerFile, dockerIgnore } = getConfig$6(); | ||
const version = await getNodeVersion(); | ||
const dockerFile = getDockerFile({ version }); | ||
await addFileToRoot(FILE_NAME, dockerFile); | ||
await addFileToRoot(IGNORE_NAME, dockerIgnore); | ||
}; | ||
const GITHUB_DIR_NAME = '.github'; | ||
const GITHUB_WORKFLOWS_DIR_NAME = 'workflows'; | ||
const GITHUB_RELATIVE_WORKFLOWS_PATH = path__default["default"].join(GITHUB_DIR_NAME, GITHUB_WORKFLOWS_DIR_NAME); | ||
const addGithubDirIfNotExists = async () => { | ||
await addDirToRootIfNotExists(GITHUB_DIR_NAME); | ||
}; | ||
const addWorkflowsDirIfNotExists = async () => { | ||
await addGithubDirIfNotExists(); | ||
await addDirToRootIfNotExists(GITHUB_RELATIVE_WORKFLOWS_PATH); | ||
}; | ||
const addGithubWorkflow = async (filename, content) => { | ||
await addWorkflowsDirIfNotExists(); | ||
const relativeFilePath = path__default["default"].join(GITHUB_RELATIVE_WORKFLOWS_PATH, filename); | ||
await addFileToRoot(relativeFilePath, content); | ||
}; | ||
const addToGithubDir = async (filename, content) => { | ||
await addGithubDirIfNotExists(); | ||
const relativeFilePath = path__default["default"].join(GITHUB_DIR_NAME, filename); | ||
await addFileToRoot(relativeFilePath, content); | ||
}; | ||
const content$5 = readableMultilineString ` | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Get release notes from CHANGELOG.md | ||
uses: yashanand1910/standard-release-notes@v1.2.1 | ||
id: get_release_notes | ||
with: | ||
version: \${{ github.ref }} | ||
- name: Release to github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: \${{ steps.get_release_notes.outputs.release_notes }} | ||
`; | ||
const defaultConfig$5 = { | ||
content: content$5, | ||
}; | ||
const [getConfig$5] = jsCategoryState.useConfigState({ | ||
default: defaultConfig$5, | ||
}); | ||
const WORKFLOW_FILENAME$4 = 'release.yml'; | ||
const releaseWorkflow = async () => { | ||
const { content } = getConfig$5(); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$4, content); | ||
}; | ||
const content$4 = readableMultilineString ` | ||
name: test | ||
@@ -890,3 +942,3 @@ | ||
const defaultConfig$4 = { | ||
content: content$3, | ||
content: content$4, | ||
}; | ||
@@ -898,10 +950,10 @@ | ||
const WORKFLOW_FILENAME$2 = 'test.yml'; | ||
const WORKFLOW_FILENAME$3 = 'test.yml'; | ||
const testWorkflow = async () => { | ||
const { content } = getConfig$4(); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$2, content); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$3, content); | ||
}; | ||
const content$2 = readableMultilineString ` | ||
const content$3 = readableMultilineString ` | ||
name: codeql | ||
@@ -915,3 +967,3 @@ | ||
jobs: | ||
analyse: | ||
codeql: | ||
runs-on: ubuntu-latest | ||
@@ -927,3 +979,3 @@ steps: | ||
const defaultConfig$3 = { | ||
content: content$2, | ||
content: content$3, | ||
}; | ||
@@ -935,10 +987,10 @@ | ||
const WORKFLOW_FILENAME$1 = 'codeql.yml'; | ||
const WORKFLOW_FILENAME$2 = 'codeql.yml'; | ||
const codeqlWorkflow = async () => { | ||
const { content } = getConfig$3(); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$1, content); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$2, content); | ||
}; | ||
const content$1 = readableMultilineString ` | ||
const content$2 = readableMultilineString ` | ||
name: build | ||
@@ -969,3 +1021,3 @@ | ||
const defaultConfig$2 = { | ||
content: content$1, | ||
content: content$2, | ||
}; | ||
@@ -977,20 +1029,35 @@ | ||
const WORKFLOW_FILENAME = 'build.yml'; | ||
const WORKFLOW_FILENAME$1 = 'build.yml'; | ||
const buildWorkflow = async () => { | ||
const { content } = getConfig$2(); | ||
await addGithubWorkflow(WORKFLOW_FILENAME, content); | ||
await addGithubWorkflow(WORKFLOW_FILENAME$1, content); | ||
}; | ||
const content = readableMultilineString ` | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
const content$1 = readableMultilineString ` | ||
name: codecov | ||
on: [push] | ||
jobs: | ||
codecov: | ||
runs-on: ubuntu-latest | ||
env: | ||
CI: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Install node | ||
uses: actions/setup-node@v2 | ||
with: | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Collect coverage | ||
run: npm run test:coverage | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 | ||
`; | ||
const defaultConfig$1 = { | ||
content, | ||
content: content$1, | ||
}; | ||
@@ -1002,47 +1069,20 @@ | ||
const FILENAME = 'dependabot.yml'; | ||
const WORKFLOW_FILENAME = 'codecov.yml'; | ||
const dependabot = async () => { | ||
const codecovWorkflow = async () => { | ||
const { content } = getConfig$1(); | ||
await addToGithubDir(FILENAME, content); | ||
await addGithubWorkflow(WORKFLOW_FILENAME, content); | ||
}; | ||
const getNodeVersion = async () => { | ||
const versionConsoleOutput = await runCommand('node -v'); | ||
return versionConsoleOutput.trim().replace('v', ''); | ||
}; | ||
const DOCKER_FILE_NAME = 'DockerFile'; | ||
const DOCKER_IGNORE_NAME = '.dockerignore'; | ||
const getDockerFile = ({ version }) => readableMultilineString ` | ||
FROM node:${version} | ||
WORKDIR /app | ||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY . . | ||
ENV NODE_ENV production | ||
RUN npm run build | ||
EXPOSE 3000 | ||
CMD npm run start | ||
const content = readableMultilineString ` | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
`; | ||
const dockerIgnore = readableMultilineString ` | ||
node_modules | ||
dist | ||
build | ||
.husky | ||
.git | ||
${DOCKER_IGNORE_NAME} | ||
${DOCKER_FILE_NAME} | ||
.docker-compose.yml | ||
`; | ||
const defaultConfig = { | ||
getDockerFile, | ||
dockerIgnore, | ||
content, | ||
}; | ||
@@ -1054,8 +1094,7 @@ | ||
const docker = async () => { | ||
const { getDockerFile, dockerIgnore } = getConfig(); | ||
const version = await getNodeVersion(); | ||
const dockerFile = getDockerFile({ version }); | ||
await addFileToRoot(DOCKER_FILE_NAME, dockerFile); | ||
await addFileToRoot(DOCKER_IGNORE_NAME, dockerIgnore); | ||
const FILENAME = 'dependabot.yml'; | ||
const dependabot = async () => { | ||
const { content } = getConfig(); | ||
await addToGithubDir(FILENAME, content); | ||
}; | ||
@@ -1072,10 +1111,11 @@ | ||
stylelint, | ||
releaseWorkflow, | ||
// named jestEntrypoint because in test environment jest name is reserved | ||
jest: jestEntrypoint, | ||
docker, | ||
releaseWorkflow, | ||
testWorkflow, | ||
codeqlWorkflow, | ||
buildWorkflow, | ||
codecovWorkflow, | ||
dependabot, | ||
docker, | ||
}; | ||
@@ -1114,4 +1154,4 @@ var js = { | ||
const getCategory = async () => { | ||
const choosedCategory = (await oneOf('choose a category', categoriesKeys)); | ||
const category = categories[choosedCategory]; | ||
const selectedCategory = (await oneOf('choose a category', categoriesKeys)); | ||
const category = categories[selectedCategory]; | ||
return category; | ||
@@ -1121,4 +1161,4 @@ }; | ||
const [, setConfig] = configState; | ||
const choosedConfig = await oneOf('choose a config', configTypes); | ||
setConfig(choosedConfig); | ||
const selectedConfig = await oneOf('choose a config', configTypes); | ||
setConfig(selectedConfig); | ||
return options; | ||
@@ -1128,4 +1168,4 @@ }; | ||
const kebablizedOptions = Object.keys(options).map(kebablize); | ||
const choosedKebablizedOptions = await manyOf('choose a options', kebablizedOptions); | ||
return choosedKebablizedOptions.map(camelize); | ||
const selectedKebablizedOptions = await manyOf('choose a options', kebablizedOptions); | ||
return selectedKebablizedOptions.map(camelize); | ||
}; | ||
@@ -1146,7 +1186,7 @@ const installOptions = async (options, keys) => { | ||
const main = async () => { | ||
console.log(white(`Wellcome to Allohamora's cli`)); | ||
console.log(white(`Welcome to Allohamora's cli`)); | ||
const category = await getCategory(); | ||
const options = await getOptions(category); | ||
const choosedOptionKeys = await chooseOptions(options); | ||
await installOptions(options, choosedOptionKeys); | ||
const selectedOptionKeys = await chooseOptions(options); | ||
await installOptions(options, selectedOptionKeys); | ||
console.log(white('Installation completed')); | ||
@@ -1153,0 +1193,0 @@ }; |
{ | ||
"name": "@allohamora/cli", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "cli to initialize projects and more", | ||
@@ -8,2 +8,3 @@ "input": "./src/index.ts", | ||
"bin": "./bin/cli.js", | ||
"type": "commonjs", | ||
"scripts": { | ||
@@ -50,4 +51,4 @@ "dev": "ts-node-dev --respawn -r tsconfig-paths/register src/index.ts", | ||
"engines": { | ||
"node": ">=16.13.0", | ||
"npm": ">=8.1.0" | ||
"node": ">=16.14.2", | ||
"npm": ">=8.5.0" | ||
}, | ||
@@ -58,32 +59,30 @@ "files": [ | ||
"devDependencies": { | ||
"@commitlint/cli": "^16.1.0", | ||
"@commitlint/config-conventional": "^16.0.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@types/inquirer": "^8.1.3", | ||
"@types/jest": "^27.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.10.2", | ||
"@typescript-eslint/parser": "^5.10.2", | ||
"eslint": "^8.5.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-beautiful-sort": "^2.0.1", | ||
"@commitlint/cli": "^17.0.1", | ||
"@commitlint/config-conventional": "^17.0.0", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@types/inquirer": "^8.2.1", | ||
"@types/jest": "^27.5.1", | ||
"@typescript-eslint/eslint-plugin": "^5.26.0", | ||
"@typescript-eslint/parser": "^5.26.0", | ||
"eslint": "^8.16.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-beautiful-sort": "^2.0.3", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "^27.4.7", | ||
"lint-staged": "^12.3.3", | ||
"prettier": "^2.5.1", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.0", | ||
"lint-staged": "^12.4.2", | ||
"prettier": "^2.6.2", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.67.0", | ||
"rollup-plugin-preserve-shebang": "^1.0.1", | ||
"rollup": "^2.75.1", | ||
"rollup-plugin-typescript2": "^0.31.2", | ||
"standard-version": "^9.3.2", | ||
"ts-jest": "^27.1.3", | ||
"ts-node-dev": "^1.1.8", | ||
"tsconfig-paths": "^3.12.0", | ||
"type-fest": "^2.8.0", | ||
"typescript": "^4.5.3", | ||
"yaml": "^1.10.2" | ||
"standard-version": "^9.5.0", | ||
"ts-jest": "^28.0.3", | ||
"ts-node-dev": "^2.0.0", | ||
"tsconfig-paths": "^4.0.0", | ||
"type-fest": "^2.13.0", | ||
"typescript": "^4.7.2", | ||
"yaml": "^2.1.0" | ||
}, | ||
"dependencies": { | ||
"inquirer": "^8.2.0", | ||
"inquirer": "^8.2.4", | ||
"ora": "^5.4.1" | ||
@@ -90,0 +89,0 @@ }, |
@@ -16,4 +16,4 @@ # CLI | ||
{ | ||
"node": ">=16.13.0", | ||
"npm": ">=8.1.0" | ||
"node": ">=16.14.2", | ||
"npm": ">=8.5.0" | ||
} | ||
@@ -40,7 +40,8 @@ ``` | ||
- [**jest**](/src/categories/js/jest) is a script to initialize [jest](https://github.com/facebook/jest) with config and test scripts. | ||
- [**docker**](src/categories/js/docker/) is a script to initialize [docker](https://github.com/docker) with Dockerfile and .dockerignore files | ||
- [**test-workflow**](/src/categories/js/test-workflow.ts) is a script to initialize github test workflow what runs `npm run test` on each push to github. | ||
- [**build-workflow**](/src/categories/js/build-workflow) is a script to initialize github build workflow that runs `npm run build` on each push to github. | ||
- [**codeql-workflow**](/src/categories/js/codeql-workflow) is a script to initialize github codeql workflow what runs codeql with default options on each push to github. | ||
- [**codecov-workflow**](/src/categories/js/codecov-workflow/) is a script to initialize codecov workflow that collects code coverage and send it to codecov. The workflow configured to work in public repositories (without codecov token), to run in private repository you need to modify the workflow and add token in codecov action | ||
- [**dependabot**](src/categories/js/dependabot/) is a script to initialize github dependabot what manages project dependencies vulnerabilities and opens pull requests with fixes. | ||
- [**docker**](src/categories/js/docker/) is a script to initialize [docker](https://github.com/docker) with Dockerfile and .dockerignore files | ||
@@ -47,0 +48,0 @@ \*integrations runs only if package is installing or installed. |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
126790
25
1033
51
0
0
Updatedinquirer@^8.2.4