Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T/209: Upgraded dependencies #246

Merged
merged 12 commits into from
Aug 9, 2017
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"gulp": "^3.9.1",
"guppy-pre-commit": "^0.4.0",
"istanbul": "^0.4.4",
"lerna": "2.0.0-rc.1",
"mocha": "^3.0.2"
"lerna": "^2.0.0",
"mocha": "^3.4.2"
},
"engines": {
"node": ">=6.0.0",
Expand Down
25 changes: 13 additions & 12 deletions packages/ckeditor5-dev-bundler-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,30 @@
"dependencies": {
"@ckeditor/ckeditor5-dev-compiler": "^6.0.2",
"@ckeditor/ckeditor5-dev-utils": "^3.0.0",
"babel-plugin-external-helpers": "^6.18.0",
"babel-preset-es2015": "^6.18.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"gulp": "^3.9.1",
"gulp-cssnano": "^2.1.2",
"gulp-filter": "^4.0.0",
"gulp-filter": "^5.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"gulp-replace": "^0.6.1",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.8",
"gzip-size": "^3.0.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"pretty-bytes": "^4.0.2",
"regenerator-runtime": "^0.10.0",
"rollup": "^0.36.4",
"rollup-plugin-babel": "^2.6.1",
"regenerator-runtime": "^0.10.5",
"rollup": "^0.43.0",
"rollup-plugin-babel": "^2.7.1",
"stream-to-promise": "^2.2.0"
},
"devDependencies": {
"chai": "^3.5.0",
"mocha": "^3.0.2",
"chai": "^4.0.2",
"mocha": "^3.4.2",
"mockery": "^2.0.0",
"sinon": "^1.17.4"
"proxyquire": "^1.8.0",
"sinon": "^3.1.0"
},
"engines": {
"node": ">=6.0.0",
Expand Down
59 changes: 33 additions & 26 deletions packages/ckeditor5-dev-bundler-rollup/tests/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const mockery = require( 'mockery' );
const mkdirp = require( 'mkdirp' );
const fs = require( 'fs' );
const rollup = require( 'rollup' );
const proxyquire = require( 'proxyquire' );

describe( 'bundle-tasks', () => {
let tasks, sandbox;
Expand All @@ -30,7 +31,11 @@ describe( 'bundle-tasks', () => {
mockery.registerMock( 'gulp-cssnano', () => {} );
mockery.registerMock( 'rollup-plugin-babel', config => config );

tasks = require( '../lib/tasks' );
tasks = proxyquire( '../lib/tasks', {
'@ckeditor/ckeditor5-dev-utils': {
tools, bundler
}
} );
} );

after( () => {
Expand Down Expand Up @@ -71,7 +76,7 @@ describe( 'bundle-tasks', () => {

describe( 'compile()', () => {
it( 'should compile packages', () => {
sandbox.stub( compiler.tasks, 'compile', config => config );
sandbox.stub( compiler.tasks, 'compile' ).callsFake( config => config );

const result = tasks._compile( 'sourceBuildDir', [ 'package1' ] );

Expand All @@ -82,9 +87,9 @@ describe( 'bundle-tasks', () => {

describe( '_generateBundleWithEntryPoint', () => {
it( 'should generate bundle nad use existing entry point', () => {
sandbox.stub( tasks, '_generateJsBundle', config => Promise.resolve( config ) );
sandbox.stub( tasks, '_generateCssBundle', config => Promise.resolve( config ) );
sandbox.stub( path, 'join', ( ...args ) => args.join( '/' ) );
sandbox.stub( tasks, '_generateJsBundle' ).callsFake( config => Promise.resolve( config ) );
sandbox.stub( tasks, '_generateCssBundle' ).callsFake( config => Promise.resolve( config ) );
sandbox.stub( path, 'join' ).callsFake( ( ...args ) => args.join( '/' ) );

const promise = tasks._generateBundleWithEntryPoint( {
rollupOptions: {
Expand Down Expand Up @@ -114,13 +119,13 @@ describe( 'bundle-tasks', () => {

describe( '_generateBundleWithoutEntryPoint()', () => {
it( 'should create entry point and generate bundle', () => {
sandbox.stub( tasks, '_generateJsBundle', config => Promise.resolve( config ) );
sandbox.stub( tasks, '_generateCssBundle', config => Promise.resolve( config ) );
sandbox.stub( tasks, '_saveLocallyTemporaryEntryFile', () => ( {
sandbox.stub( tasks, '_generateJsBundle' ).callsFake( config => Promise.resolve( config ) );
sandbox.stub( tasks, '_generateCssBundle' ).callsFake( config => Promise.resolve( config ) );
sandbox.stub( tasks, '_saveLocallyTemporaryEntryFile' ).callsFake( () => ( {
temporaryEntryFilePath: 'tempEntryPoint',
bundleTmpDir: 'bundleTemp',
} ) );
sandbox.stub( path, 'join', ( ...args ) => args.join( '/' ) );
sandbox.stub( path, 'join' ).callsFake( ( ...args ) => args.join( '/' ) );

const promise = tasks._generateBundleWithoutEntryPoint( {
rollupOptions: {
Expand Down Expand Up @@ -153,9 +158,9 @@ describe( 'bundle-tasks', () => {
describe( '_saveLocallyTemporaryEntryFile()', () => {
it( 'should create temporary file with given name', () => {
sandbox.stub( mkdirp, 'sync' );
sandbox.stub( fs, 'mkdtempSync', path => path + 'temp' );
sandbox.stub( path, 'join', ( x, y ) => x + '/' + y );
sandbox.stub( path, 'sep', '/' );
sandbox.stub( fs, 'mkdtempSync' ).callsFake( path => path + 'temp' );
sandbox.stub( path, 'join' ).callsFake( ( x, y ) => x + '/' + y );
sandbox.stub( path, 'sep' ).value( '/' );
const createEntryFileStub = sandbox.stub( bundler, 'createEntryFile' );

const result = tasks._saveLocallyTemporaryEntryFile( {
Expand Down Expand Up @@ -194,9 +199,9 @@ describe( 'bundle-tasks', () => {

describe( '_generateCssBundle', () => {
it( 'should copy css files', () => {
sandbox.stub( path, 'join', ( ...args ) => args.join( '/' ) );
sandbox.stub( path, 'dirname', x => x.split( '/' ).slice( 0, -1 ).join( '/' ) );
sandbox.stub( tools, 'copyFile', ( source, dest ) => Promise.resolve( { source, dest } ) );
sandbox.stub( path, 'join' ).callsFake( ( ...args ) => args.join( '/' ) );
sandbox.stub( path, 'dirname' ).callsFake( x => x.split( '/' ).slice( 0, -1 ).join( '/' ) );
sandbox.stub( tools, 'copyFile' ).callsFake( ( source, dest ) => Promise.resolve( { source, dest } ) );

const promise = tasks._generateCssBundle( {
sourceBuildDir: 'sourceBuildDir',
Expand All @@ -213,7 +218,7 @@ describe( 'bundle-tasks', () => {

describe( '_rollupBundle()', () => {
it( 'should create js bundle', () => {
sandbox.stub( rollup, 'rollup', config => Promise.resolve( config ) );
sandbox.stub( rollup, 'rollup' ).callsFake( config => Promise.resolve( config ) );
const promise = tasks._rollupBundle( 'entryPoint' );

return promise.then( result => {
Expand Down Expand Up @@ -268,30 +273,32 @@ describe( 'bundle-tasks', () => {
const stream1 = gulp.src( [] );
const stream2 = gulp.src( [] );

sandbox.stub( tasks, '_minifyJs', text => {
sandbox.stub( tasks, '_minifyJs' ).callsFake( text => {
expect( text ).to.equal( 'destinationPath/fileName' );

return stream1;
} );

sandbox.stub( tasks, '_minifyCss', text => {
sandbox.stub( tasks, '_minifyCss' ).callsFake( text => {
expect( text ).to.equal( 'destinationPath/fileName' );

return stream2;
} );
sandbox.stub( path, 'join', ( ...args ) => args.join( '/' ) );

sandbox.stub( path, 'join' ).callsFake( ( ...args ) => args.join( '/' ) );

return tasks._minify( 'destinationPath', 'fileName' );
} );
} );

describe( '_minifyJs', () => {
it( 'should minify js file', () => {
sandbox.stub( gulp, 'src', () => ( {
sandbox.stub( gulp, 'src' ).callsFake( () => ( {
pipe: () => {}
} ) );
sandbox.stub( path, 'dirname', path => path.split( '/' ).slice( 0, -1 ).join( '/' ) );
const saveMinified = sandbox.stub( utils, 'saveFileFromStreamAsMinified', path => path );

sandbox.stub( path, 'dirname' ).callsFake( path => path.split( '/' ).slice( 0, -1 ).join( '/' ) );
const saveMinified = sandbox.stub( utils, 'saveFileFromStreamAsMinified' ).callsFake( path => path );

tasks._minifyJs( 'path/to/editor' );

Expand All @@ -301,10 +308,10 @@ describe( 'bundle-tasks', () => {

describe( '_minifyCss', () => {
it( 'should minify css file', () => {
sandbox.stub( gulp, 'src', () => ( {
sandbox.stub( gulp, 'src' ).callsFake( () => ( {
pipe: () => {}
} ) );
sandbox.stub( path, 'dirname', path => path.split( '/' ).slice( 0, -1 ).join( '/' ) );
sandbox.stub( path, 'dirname' ).callsFake( path => path.split( '/' ).slice( 0, -1 ).join( '/' ) );
const saveMinified = sandbox.stub( utils, 'saveFileFromStreamAsMinified' );

tasks._minifyCss( 'path/to/editor' );
Expand All @@ -322,14 +329,14 @@ describe( 'bundle-tasks', () => {
'editor.min.css': { size: 10 },
};

sandbox.stub( utils, 'getFilesSizeStats', files => {
sandbox.stub( utils, 'getFilesSizeStats' ).callsFake( files => {
return files.map( fileName => ( {
name: fileName,
size: fileStats[ fileName ].size,
} ) );
} );

sandbox.stub( utils, 'showFilesSummary', ( text, stats ) => {
sandbox.stub( utils, 'showFilesSummary' ).callsFake( ( text, stats ) => {
expect( stats ).to.deep.equal( [
{ name: 'editor.js', size: 123 },
{ name: 'editor.css', size: 50 },
Expand Down
22 changes: 10 additions & 12 deletions packages/ckeditor5-dev-bundler-rollup/tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe( 'bundle-utils', () => {

describe( 'maybeCleanDir()', () => {
it( 'should clean directory if dir is provided', () => {
const cleanStub = sandbox.stub( tools, 'clean', () => Promise.resolve() );
sandbox.stub( path, 'join', x => x );
const cleanStub = sandbox.stub( tools, 'clean' ).resolves();
sandbox.stub( path, 'join' ).callsFake( x => x );

const promise = utils.maybeCleanDir( 'dir' );
sinon.assert.calledWithExactly( cleanStub, 'dir', '' );
Expand All @@ -37,8 +37,8 @@ describe( 'bundle-utils', () => {
} );

it( 'should return resolved promise if no dir is provided', () => {
const cleanStub = sandbox.stub( tools, 'clean', () => Promise.resolve() );
sandbox.stub( path, 'join', x => x );
const cleanStub = sandbox.stub( tools, 'clean' ).resolves();
sandbox.stub( path, 'join' ).callsFake( x => x );

const promise = utils.maybeCleanDir();
sinon.assert.notCalled( cleanStub );
Expand All @@ -49,7 +49,7 @@ describe( 'bundle-utils', () => {

describe( 'cleanFiles()', () => {
it( 'should clean every file with specific filename', () => {
sandbox.stub( tools, 'clean', ( path, filePattern ) => {
sandbox.stub( tools, 'clean' ).callsFake( ( path, filePattern ) => {
return { path, filePattern };
} );

Expand All @@ -64,9 +64,7 @@ describe( 'bundle-utils', () => {
it( 'should return file size in bytes', () => {
const filePath = 'path/to/file';
const size = 1337;
const statSyncMock = sandbox.stub( fs, 'statSync', () => {
return { size };
} );
const statSyncMock = sandbox.stub( fs, 'statSync' ).returns( { size } );

expect( utils.getFileSize( filePath ) ).to.be.equal( size );
sinon.assert.calledWithExactly( statSyncMock, filePath );
Expand All @@ -78,8 +76,8 @@ describe( 'bundle-utils', () => {
const filePath = 'path/to/file';
const size = 1337;
const fileContent = 'some string';
const readFileSyncMock = sandbox.stub( fs, 'readFileSync', () => fileContent );
const gzipSizeMock = sandbox.stub( gzipSize, 'sync', () => 1337 );
const readFileSyncMock = sandbox.stub( fs, 'readFileSync' ).returns( fileContent );
const gzipSizeMock = sandbox.stub( gzipSize, 'sync' ).returns( 1337 );

expect( utils.getGzippedFileSize( filePath ) ).to.be.equal( size );
sinon.assert.calledWithExactly( readFileSyncMock, filePath );
Expand All @@ -94,8 +92,8 @@ describe( 'bundle-utils', () => {
size = 1337;
gzippedSize = 543;

sandbox.stub( utils, 'getFileSize', () => size );
sandbox.stub( utils, 'getGzippedFileSize', () => gzippedSize );
sandbox.stub( utils, 'getFileSize' ).returns( size );
sandbox.stub( utils, 'getGzippedFileSize' ).returns( gzippedSize );
} );

it( 'should returns an array with two elements', () => {
Expand Down
29 changes: 15 additions & 14 deletions packages/ckeditor5-dev-env/lib/translations/collect-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,21 @@ const utils = {
_getTranslationCallsFromFile( filePath, fileContent ) {
const originalStrings = findOriginalStrings( fileContent );

return originalStrings.map( originalString => {
const contextMatch = originalString.match( /\[context: ([^\]]+)\]/ );
const sentenceMatch = originalString.match( /^[^[]+/ );
const packageMatch = filePath.match( /\/(ckeditor5-[^/]+)\// );

return {
filePath,
key: originalString,
package: packageMatch[ 1 ],
context: contextMatch ? contextMatch[ 1 ] : null,
sentence: sentenceMatch[ 0 ].trim(),
};
} )
.filter( translationCall => !!translationCall );
return originalStrings
.map( originalString => {
const contextMatch = originalString.match( /\[context: ([^\]]+)\]/ );
const sentenceMatch = originalString.match( /^[^[]+/ );
const packageMatch = filePath.match( /\/(ckeditor5-[^/]+)\// );

return {
filePath,
key: originalString,
package: packageMatch[ 1 ],
context: contextMatch ? contextMatch[ 1 ] : null,
sentence: sentenceMatch[ 0 ].trim(),
};
} )
.filter( translationCall => !!translationCall );
},

_stringifyTranslationObjects( translationObjects ) {
Expand Down
24 changes: 12 additions & 12 deletions packages/ckeditor5-dev-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
"chalk": "^1.1.3",
"compare-func": "^1.3.2",
"concat-stream": "^1.6.0",
"conventional-changelog": "^1.1.0",
"conventional-changelog": "^1.1.3",
"conventional-commits-filter": "^1.0.0",
"conventional-commits-parser": "^1.3.0",
"del": "^2.2.2",
"fs-extra": "^1.0.0",
"del": "^3.0.0",
"fs-extra": "^3.0.1",
"git-raw-commits": "^1.2.0",
"github": "^9.0.0",
"glob": "^7.1.1",
"inquirer": "^3.0.5",
"github": "^9.2.0",
"glob": "^7.1.2",
"inquirer": "^3.1.1",
"minimist": "^1.2.0",
"parse-github-url": "^1.0.0",
"request": "^2.79.0",
"request": "^2.81.0",
"semver": "^5.3.0"
},
"devDependencies": {
"chai": "^3.5.0",
"handlebars": "^4.0.6",
"mockery": "^1.7.0",
"proxyquire": "^1.7.11",
"sinon": "^1.17.4"
"chai": "^4.0.2",
"handlebars": "^4.0.10",
"mockery": "^2.0.0",
"proxyquire": "^1.8.0",
"sinon": "^3.1.0"
},
"engines": {
"node": ">=6.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe( 'dev-env/release-tools/tasks', () => {
mockery.registerMock( '../utils/versions', stubs.versionUtils );
mockery.registerMock( '../utils/getnewreleasetype', stubs.getNewReleaseType );

sandbox.stub( path, 'join', ( ...chunks ) => chunks.join( '/' ) );
sandbox.stub( path, 'join' ).callsFake( ( ...chunks ) => chunks.join( '/' ) );

generateChangelogForSubPackages = proxyquire( '../../../lib/release-tools/tasks/generatechangelogforsubpackages', {
'@ckeditor/ckeditor5-dev-utils': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe( 'dev-env/release-tools/tasks', () => {
mockery.registerMock( '../utils/displayskippedpackages', stubs.displaySkippedPackages );
mockery.registerMock( '../utils/displaygeneratedchangelogs', stubs.displayGeneratedChangelogs );

sandbox.stub( path, 'join', ( ...chunks ) => chunks.join( '/' ) );
sandbox.stub( path, 'join' ).callsFake( ( ...chunks ) => chunks.join( '/' ) );

generateChangelogForSubRepositories = proxyquire( '../../../lib/release-tools/tasks/generatechangelogforsubrepositories', {
'@ckeditor/ckeditor5-dev-utils': {
Expand Down Expand Up @@ -146,8 +146,9 @@ describe( 'dev-env/release-tools/tasks', () => {
expect( chdirStub.secondCall.args[ 0 ] ).to.equal( '/tmp' );

expect( stubs.displaySkippedPackages.calledOnce ).to.equal( true );

expect( stubs.displaySkippedPackages.firstCall.args[ 0 ] ).to.deep.equal( new Set( [
'@ckeditor/ckeditor5-engine'
'/tmp/packages/ckeditor5-engine'
] ) );
} );
} );
Expand Down Expand Up @@ -179,7 +180,7 @@ describe( 'dev-env/release-tools/tasks', () => {

expect( stubs.displaySkippedPackages.calledOnce ).to.equal( true );
expect( stubs.displaySkippedPackages.firstCall.args[ 0 ] ).to.deep.equal( new Set( [
'@ckeditor/ckeditor5-core'
'/tmp/packages/ckeditor5-core'
] ) );
} );
} );
Expand Down
Loading