Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function generateChangelogForSubPackages( options ) {
const log = logger();
const cwd = process.cwd();
const pathsCollection = getSubPackagesPaths( {
cwd: options.cwd,
packages: options.packages,
skipPackages: options.skipPackages || []
} );
const skippedPackages = new Set();
const generatedChangelogsMap = new Map();
return executeOnPackages( pathsCollection.matched, generateChangelogTask )
.then( () => {
process.chdir( cwd );
// No changelog has generated. Abort.
module.exports = function generateSummaryChangelog( options ) {
const log = logger();
const cwd = process.cwd();
const indent = ' '.repeat( cliUtils.INDENT_SIZE );
const pathsCollection = getSubRepositoriesPaths( {
cwd: options.cwd,
packages: options.packages,
scope: options.scope || null,
skipPackages: options.skipPackages || [],
skipMainRepository: true
} );
// The main repository must be at the end because its changelog is a summary of all changes that have been done.
if ( !options.skipMainRepository ) {
pathsCollection.skipped.delete( options.cwd );
pathsCollection.matched.add( options.cwd );
}
/**
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
'use strict';
const del = require( 'del' );
const glob = require( 'glob' );
const fs = require( 'fs-extra' );
const path = require( 'path' );
const logger = require( '@ckeditor/ckeditor5-dev-utils' ).logger();
const { findOriginalStrings } = require( '@ckeditor/ckeditor5-dev-utils' ).translations;
const langContextSuffix = path.join( 'lang', 'contexts.json' );
const corePackageName = 'ckeditor5-core';
const utils = {
/**
* Collect translations and return array of translations.
*
* @returns {Array.}
*/
collectTranslations() {
const srcPaths = [ process.cwd(), 'packages', '*', 'src', '**', '*.js' ].join( '/' );
const files = glob.sync( srcPaths )
.filter( srcPath => !srcPath.match( /packages\/[^/]+\/src\/lib\// ) );
module.exports = ( ckeditor5Path, packageJSON, workspaceRoot ) => {
const log = logger();
const workspaceAbsolutePath = path.join( ckeditor5Path, workspaceRoot );
// Get all CKEditor dependencies from package.json.
const dependencies = workspace.getDependencies( packageJSON.dependencies );
if ( dependencies ) {
const directories = workspace.getDirectories( workspaceAbsolutePath );
if ( directories.length ) {
for ( let dependency in dependencies ) {
const repositoryAbsolutePath = path.join( workspaceAbsolutePath, dependency );
const repositoryURL = dependencies[ dependency ];
// Check if repository's directory exists.
if ( directories.indexOf( dependency ) > -1 ) {
try {
'use strict';
const chalk = require( 'chalk' );
const versionUtils = require( '../utils/versions' );
const cli = require( '../utils/cli' );
const { tools, logger } = require( '@ckeditor/ckeditor5-dev-utils' );
const { getChangesForVersion } = require( '../utils/changelog' );
const releaseRepositoryUtil = require( '../utils/releaserepository' );
const validatePackageToRelease = require( '../utils/validatepackagetorelease' );
const GENERATE_CHANGELOG = 'Before starting the release process, you should generate the changelog.';
const FAILED_VALIDATION = 'Releasing has been aborted due to errors.';
const AUTH_REQUIRED = 'This command requires you to be logged in.';
const log = logger();
/**
* Releases the package defined in the current work directory.
*
* This task does not required any params because it will be passed by the user during the process.
*
* @returns {Promise}
*/
module.exports = function releaseRepository() {
const gitVersion = versionUtils.getLastTagFromGit();
const changelogVersion = versionUtils.getLastFromChangelog();
if ( gitVersion === changelogVersion ) {
return showWarning( GENERATE_CHANGELOG );
}
[ 'Release', false ]
] );
const typesOrder = {
'Bug fixes': 1,
'Features': 2,
'Other changes': 3,
'BREAKING CHANGES': 1,
'NOTE': 2
};
const packageJson = getPackageJson();
const issuesUrl = ( typeof packageJson.bugs === 'object' ) ? packageJson.bugs.url : packageJson.bugs;
const templatePath = path.join( __dirname, 'templates' );
const log = logger();
module.exports = {
transform: transformCommit,
groupBy: 'type',
commitGroupsSort( a, b ) {
return typesOrder[ a.title ] - typesOrder[ b.title ];
},
commitsSort: [ 'subject' ],
noteGroupsSort( a, b ) {
return typesOrder[ a.title ] - typesOrder[ b.title ];
},
notesSort: require( 'compare-func' ),
mainTemplate: fs.readFileSync( path.join( templatePath, 'template.hbs' ), 'utf-8' ),
headerPartial: fs.readFileSync( path.join( templatePath, 'header.hbs' ), 'utf-8' ),
commitPartial: fs.readFileSync( path.join( templatePath, 'commit.hbs' ), 'utf-8' ),
footerPartial: fs.readFileSync( path.join( templatePath, 'footer.hbs' ), 'utf-8' ),
module.exports = function displayGeneratedChangelogs( generatedChangelogsMap ) {
if ( !generatedChangelogsMap.size ) {
return;
}
const indent = ' '.repeat( INDENT_SIZE );
let message = indent + chalk.bold.underline( 'Changelogs for the following packages have been generated:' ) + '\n';
for ( const [ packageName, version ] of generatedChangelogsMap ) {
message += indent + ` * ${ packageName }: v${ version }\n`;
}
logger().info( message );
};
/**
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
'use strict';
const fs = require( 'fs-extra' );
const path = require( 'path' );
const transifexService = require( './transifex-service' );
const logger = require( '@ckeditor/ckeditor5-dev-utils' ).logger();
const { cleanPoFileContent, createDictionaryFromPoFileContent } = require( '@ckeditor/ckeditor5-dev-utils' ).translations;
/**
* Downloads translations from the Transifex for each package and language.
*
* @param {Object} loginConfig
* @param {String} loginConfig.token Token to the Transifex API.
*/
module.exports = function download( loginConfig ) {
return Promise.resolve()
.then( () => getPackageNames( loginConfig ) )
.then( packageNames => downloadAndReplaceTranslations( loginConfig, packageNames ) )
.then( () => {
logger.info( 'Saved all translations.' );
} )
.catch( err => {
module.exports = ( execTask, cwd, packageJSON, workspaceRoot, params ) => {
const log = logger();
const workspacePath = path.join( cwd, workspaceRoot );
const mergedStream = merge();
const specificRepository = params.repository;
const includeRoot = !!params[ 'include-root' ];
let devDirectories = workspace.getDevDirectories( workspacePath, packageJSON, cwd, includeRoot );
if ( specificRepository ) {
devDirectories = devDirectories.filter( ( dir ) => {
return dir.repositoryURL === `ckeditor/${ specificRepository }`;
} );
}
for ( const dir of devDirectories ) {
try {
log.info( `Executing task on ${ dir.repositoryURL }...` );
/**
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
'use strict';
const fs = require( 'fs' );
const path = require( 'path' );
const logger = require( '@ckeditor/ckeditor5-dev-utils' ).logger();
const transifexService = require( './transifex-service' );
/**
* Uploads translations to the Transifex from collected files that are saved at 'ckeditor5/build/.transifex'.
*
* @param {Object} loginConfig
* @param {String} config.token Token to the Transifex API.
*/
module.exports = function upload( loginConfig ) {
const pathToPoTranslations = path.join( process.cwd(), 'build', '.transifex' );
const potFiles = fs.readdirSync( pathToPoTranslations ).map( packageName => ( {
packageName,
path: path.join( pathToPoTranslations, packageName, 'en.pot' )
} ) );
return Promise.resolve()