@koober/mrm-preset
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -15,2 +15,3 @@ /** | ||
function block({ markerBegin = 'BEGIN', markerEnd = 'END', marker = (mark) => `# ${mark} generated by mrm` }) { | ||
const EOL = '\n'; | ||
const beginBlock = marker(markerBegin); | ||
@@ -44,3 +45,3 @@ const endBlock = marker(markerEnd); | ||
} else { | ||
return replaceBlock + fullContent; | ||
return replaceBlock + EOL + fullContent; | ||
} | ||
@@ -47,0 +48,0 @@ }, |
@@ -6,8 +6,10 @@ { | ||
"githooks", | ||
"lang", | ||
"commitlint", | ||
"project", | ||
"editorconfig", | ||
"eslint" | ||
"eslint", | ||
"jest" | ||
] | ||
} | ||
} |
const { packageJson, install } = require('mrm-core'); | ||
const gitignore = require('../gitignore'); | ||
const project = require('../project'); | ||
@@ -69,4 +70,4 @@ function createESLint({ eslintPreset: eslintPresetDefault = 'eslint:recommended' }) { | ||
.set('eslintIgnore', eslintIgnoreDefault) | ||
.setScript('lint', 'eslint . --cache' + exts) | ||
.setScript('format', 'eslint . --cache --fix' + exts) | ||
.setScript(project.lint, 'eslint . --cache' + exts) | ||
.setScript(project.format, 'eslint . --cache --fix' + exts) | ||
.save(); | ||
@@ -77,10 +78,6 @@ | ||
gitignore( | ||
'eslint', | ||
`# ESLint | ||
.eslintcache` | ||
); | ||
gitignore('ESLint', ['.eslintcache']); | ||
} | ||
task.description = 'Adds ESLint'; | ||
task.description = 'Setup ESLint'; | ||
task.parameters = { | ||
@@ -87,0 +84,0 @@ eslintPreset: { |
const block = require('./block'); | ||
const { file } = require('mrm-core'); | ||
@@ -15,22 +16,20 @@ /** | ||
* @param {string} section | ||
* @param {string} sectionContent | ||
* @param {string|Array<string>} sectionContent | ||
*/ | ||
function gitignore(section, sectionContent) { | ||
const gitignoreFile = file('.gitignore'); | ||
const EOL = '\n'; | ||
const gitignoreBlock = block({ | ||
marker: (mark) => `# ${mark} ${section}`, | ||
marker: (mark) => `# ${mark} ### ${section} ###`, | ||
}); | ||
const gitignoreContent = gitignoreFile.get(); | ||
return { | ||
/** | ||
* | ||
* @param {string} content | ||
*/ | ||
add(content) { | ||
const templateContent = '\n' + trimStartLine(sectionContent) + '\n\n'; | ||
return gitignoreBlock.apply(content, templateContent); | ||
}, | ||
}; | ||
gitignoreFile.save( | ||
gitignoreBlock.apply( | ||
gitignoreContent, | ||
EOL + (Array.isArray(sectionContent) ? sectionContent.join(EOL) : trimStartLine(sectionContent)) + EOL | ||
) | ||
); | ||
} | ||
module.exports = gitignore; |
@@ -1,3 +0,2 @@ | ||
const { file } = require('mrm-core'); | ||
const gitIgnore = require('../gitignore'); | ||
const gitignore = require('../gitignore'); | ||
@@ -11,11 +10,9 @@ /** | ||
function task() { | ||
const gitIgnoreFile = file('.gitignore'); | ||
const templateMap = require(templatePath); | ||
const gitIgnoreContent = flags.reduce( | ||
(acc, key) => gitIgnore(key, templateMap[key] || '').add(acc), | ||
gitIgnoreFile.get() | ||
); | ||
gitIgnoreFile.save(gitIgnoreContent); | ||
flags.forEach((flag) => { | ||
if (templateMap[flag]) { | ||
gitignore(flag, templateMap[flag]); | ||
} | ||
}); | ||
} | ||
@@ -27,2 +24,2 @@ | ||
module.exports = createGitIgnore(require.resolve('./template'), ['macos', 'node', 'vscode']); | ||
module.exports = createGitIgnore(require.resolve('./template'), ['macOS', 'NodeJS', 'VisualStudioCode']); |
@@ -6,30 +6,3 @@ /*cSpell: disable */ | ||
module.exports = { | ||
macos: `### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk`, | ||
node: `### Node ### | ||
NodeJS: ` | ||
# Logs | ||
@@ -139,3 +112,3 @@ logs | ||
.tern-port`, | ||
vscode: `### VisualStudioCode ### | ||
VisualStudioCode: ` | ||
.vscode/* | ||
@@ -147,2 +120,29 @@ !.vscode/settings.json | ||
!.vscode/*.code-snippets`, | ||
macOS: ` | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk`, | ||
}; |
{ | ||
"name": "@koober/mrm-preset", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Mrm configuration presets", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "9fafff0305fc6f637096c81b5c732d39c19cf1f4" | ||
"gitHead": "389a914304403141d50c66509254cec1c2a7e377" | ||
} |
@@ -13,3 +13,6 @@ { | ||
}, | ||
} | ||
}, | ||
"exclude": [ | ||
"**/templates/**" | ||
] | ||
} |
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
25222
25
783