Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eslint normalization. Signed-off-by: Alex Manoel Ferreira Silva <alex@legytma.com.br>
- Loading branch information
Alex Manoel Ferreira Silva
committed
Jul 27, 2020
1 parent
3b88aec
commit bd24699
Showing
3 changed files
with
164 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
module.exports = { | ||
"disableEmoji": false, | ||
"list": [ | ||
"test", | ||
"feat", | ||
"fix", | ||
"chore", | ||
"docs", | ||
"refactor", | ||
"style", | ||
"ci", | ||
"perf" | ||
], | ||
"maxMessageLength": 80, | ||
"minMessageLength": 3, | ||
"questions": [ | ||
"type", | ||
"scope", | ||
"subject", | ||
"body", | ||
"breaking", | ||
"issues", | ||
"lerna" | ||
], | ||
"scopes": [], | ||
"types": { | ||
"chore": { | ||
"description": "Build process or auxiliary tool changes", | ||
"emoji": "🤖", | ||
"value": "chore" | ||
}, | ||
"ci": { | ||
"description": "CI related changes", | ||
"emoji": "🎡", | ||
"value": "ci" | ||
}, | ||
"docs": { | ||
"description": "Documentation only changes", | ||
"emoji": "✏️", | ||
"value": "docs" | ||
}, | ||
"feat": { | ||
"description": "A new feature", | ||
"emoji": "🎸", | ||
"value": "feat" | ||
}, | ||
"fix": { | ||
"description": "A bug fix", | ||
"emoji": "🐛", | ||
"value": "fix" | ||
}, | ||
"perf": { | ||
"description": "A code change that improves performance", | ||
"emoji": "⚡️", | ||
"value": "perf" | ||
}, | ||
"refactor": { | ||
"description": "A code change that neither fixes a bug or adds a feature", | ||
"emoji": "💡", | ||
"value": "refactor" | ||
}, | ||
"release": { | ||
"description": "Create a release commit", | ||
"emoji": "🏹", | ||
"value": "release" | ||
}, | ||
"style": { | ||
"description": "Markup, white-space, formatting, missing semi-colons...", | ||
"emoji": "💄", | ||
"value": "style" | ||
}, | ||
"test": { | ||
"description": "Adding missing tests", | ||
"emoji": "💍", | ||
"value": "test" | ||
} | ||
} | ||
}; | ||
module.exports = { | ||
'disableEmoji': false, | ||
'list': [ | ||
'test', | ||
'feat', | ||
'fix', | ||
'chore', | ||
'docs', | ||
'refactor', | ||
'style', | ||
'ci', | ||
'perf', | ||
], | ||
'maxMessageLength': 80, | ||
'minMessageLength': 3, | ||
'questions': [ | ||
'type', | ||
'scope', | ||
'subject', | ||
'body', | ||
'breaking', | ||
'issues', | ||
'lerna', | ||
], | ||
'scopes': [], | ||
'types': { | ||
'chore': { | ||
'description': 'Build process or auxiliary tool changes', | ||
'emoji': '🤖', | ||
'value': 'chore', | ||
}, | ||
'ci': { | ||
'description': 'CI related changes', | ||
'emoji': '🎡', | ||
'value': 'ci', | ||
}, | ||
'docs': { | ||
'description': 'Documentation only changes', | ||
'emoji': '✏️', | ||
'value': 'docs', | ||
}, | ||
'feat': { | ||
'description': 'A new feature', | ||
'emoji': '🎸', | ||
'value': 'feat', | ||
}, | ||
'fix': { | ||
'description': 'A bug fix', | ||
'emoji': '🐛', | ||
'value': 'fix', | ||
}, | ||
'perf': { | ||
'description': 'A code change that improves performance', | ||
'emoji': '⚡️', | ||
'value': 'perf', | ||
}, | ||
'refactor': { | ||
'description': 'A code change that neither fixes a bug or adds a feature', | ||
'emoji': '💡', | ||
'value': 'refactor', | ||
}, | ||
'release': { | ||
'description': 'Create a release commit', | ||
'emoji': '🏹', | ||
'value': 'release', | ||
}, | ||
'style': { | ||
'description': 'Markup, white-space, formatting, missing semi-colons...', | ||
'emoji': '💄', | ||
'value': 'style', | ||
}, | ||
'test': { | ||
'description': 'Adding missing tests', | ||
'emoji': '💍', | ||
'value': 'test', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,76 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const { spawnSync } = require('child_process'); | ||
const {spawnSync} = require('child_process'); | ||
const replace = require('replace-in-file'); | ||
const YAML = require('yaml'); | ||
|
||
// standard-version-updater.js | ||
const regexPuspecVersion = /(^version:\s+)((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?=$)/gm; | ||
const regexPuspecVersion = new RegExp(['(^version:\\s+)((0|[1-9]\\d*)\\.(0|[1-', | ||
'9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\', | ||
'.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[', | ||
'0-9a-zA-Z-]+)*))?)(?=$)'].join(''), 'gm'); | ||
|
||
module.exports.readVersion = function(contents) { | ||
const pubspec = YAML.parse(contents); | ||
const pubspec = YAML.parse(contents); | ||
|
||
return pubspec.version; | ||
} | ||
return pubspec.version; | ||
}; | ||
|
||
module.exports.writeVersion = function(contents, version) { | ||
const pubspec = YAML.parse(contents); | ||
const legytmaVersion = pubspec.legytma_schema.version; | ||
const replaceOptions = { | ||
files: [ | ||
'lib/**/*', | ||
'example/**/*', | ||
'test/**/*', | ||
], | ||
const pubspec = YAML.parse(contents); | ||
const legytmaVersion = pubspec.legytma_schema.version; | ||
const replaceOptions = { | ||
files: [ | ||
'lib/**/*', | ||
'example/**/*', | ||
'test/**/*', | ||
], | ||
|
||
//Replacement to make (string or regex) | ||
from: /((https:\/\/legytma\.com\.br\/schema\/)|(https:\/\/schema\.legytma\.com\.br\/((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)\/schema\/))/gm, | ||
to: `https://schema.legytma.com.br/${legytmaVersion}/schema/`, | ||
countMatches: true, | ||
}; | ||
// Replacement to make (string or regex) | ||
from: new RegExp(['((https:\\/\\/legytma\\.com\\.br\\/schema\\/)|(https:\\', | ||
'/\\/schema\\.legytma\\.com\\.br\\/((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[', | ||
'1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9', | ||
']\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-z', | ||
'A-Z-]+)*))?)\\/schema\\/))'].join(''), 'gm'), | ||
to: `https://schema.legytma.com.br/${legytmaVersion}/schema/`, | ||
countMatches: true, | ||
}; | ||
|
||
try { | ||
const results = replace.sync(replaceOptions); | ||
try { | ||
const results = replace.sync(replaceOptions); | ||
|
||
// console.log('Replacement results:', results); | ||
// console.log('Replacement results:', results); | ||
|
||
results.forEach((result) => { | ||
if (result.hasChanged) { | ||
const addCommandResponse = spawnSync('git', ['add', '-v', result.file], {maxBuffer: 10000000}); | ||
results.forEach((result) => { | ||
if (result.hasChanged) { | ||
const addCommandResponse = spawnSync('git', ['add', '-v', result.file], | ||
{maxBuffer: 10000000}); | ||
|
||
showCommandResult(addCommandResponse); | ||
} | ||
}); | ||
} catch (error) { | ||
console.error('Error occurred:', error); | ||
} | ||
showCommandResult(addCommandResponse); | ||
} | ||
}); | ||
} catch (error) { | ||
console.error('Error occurred:', error); | ||
} | ||
|
||
return contents.replace(regexPuspecVersion, `$1${version}`); | ||
} | ||
return contents.replace(regexPuspecVersion, `$1${version}`); | ||
}; | ||
|
||
/** | ||
* Extern script result to console. | ||
* | ||
* @param {object} command - sawnSync result. | ||
*/ | ||
function showCommandResult(command) { | ||
if (command.output) { | ||
console.log(command.output.toString()); | ||
} | ||
if (command.output) { | ||
console.log(command.output.toString()); | ||
} | ||
|
||
if (command.stderr) { | ||
console.error(command.stderr.toString()); | ||
} | ||
if (command.stderr) { | ||
console.error(command.stderr.toString()); | ||
} | ||
|
||
if (command.error) { | ||
console.error(command.error); | ||
} | ||
if (command.error) { | ||
console.error(command.error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
const YAML = require('yaml'); | ||
const fs = require('fs'); | ||
const replace = require('replace-in-file'); | ||
|
||
const pubspecFile = fs.readFileSync('pubspec.yaml', 'utf8'); | ||
|
||
const pubspecContent = YAML.parse(pubspecFile); | ||
const version = pubspecContent.legytma_schema.version; | ||
const replaceOptions = { | ||
files: [ | ||
'lib/**/*', | ||
'example/**/*', | ||
'test/**/*', | ||
], | ||
|
||
//Replacement to make (string or regex) | ||
from: /((https:\/\/legytma\.com\.br\/schema\/)|(https:\/\/schema\.legytma\.com\.br\/((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)\/schema\/))/gm, | ||
to: `https://schema.legytma.com.br/${version}/schema/`, | ||
countMatches: true, | ||
}; | ||
|
||
try { | ||
const results = replace.sync(replaceOptions); | ||
|
||
console.log('Replacement results:', results); | ||
} catch(error) { | ||
console.error('Error occurred:', error); | ||
} | ||
const YAML = require('yaml'); | ||
const fs = require('fs'); | ||
const replace = require('replace-in-file'); | ||
|
||
const pubspecFile = fs.readFileSync('pubspec.yaml', 'utf8'); | ||
|
||
const pubspecContent = YAML.parse(pubspecFile); | ||
const version = pubspecContent.legytma_schema.version; | ||
const replaceOptions = { | ||
files: [ | ||
'lib/**/*', | ||
'example/**/*', | ||
'test/**/*', | ||
], | ||
|
||
// Replacement to make (string or regex) | ||
from: new RegExp(['((https:\\/\\/legytma\\.com\\.br\\/schema\\/)|(https:\\/', | ||
'\\/schema\\.legytma\\.com\\.br\\/((0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9', | ||
']\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*', | ||
'|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)', | ||
'*))?)\\/schema\\/))'].join(''), 'gm'), | ||
to: `https://schema.legytma.com.br/${version}/schema/`, | ||
countMatches: true, | ||
}; | ||
|
||
try { | ||
const results = replace.sync(replaceOptions); | ||
|
||
console.log('Replacement results:', results); | ||
} catch (error) { | ||
console.error('Error occurred:', error); | ||
} |