• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckeditor / ckeditor5-package-generator / #765

pending completion
#765

travis-ci

117 of 117 branches covered (100.0%)

Branch coverage included in aggregate %.

416 of 416 relevant lines covered (100.0%)

8.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/packages/ckeditor5-package-generator/lib/utils/create-directory.js
1
/**
2
 * @license Copyright (c) 2020-2025, CKSource Holding sp. z o.o. All rights reserved.
3
 * For licensing, see LICENSE.md.
4
 */
5

6
import chalk from 'chalk';
7
import fs from 'node:fs';
8
import mkdirp from 'mkdirp';
5✔
9
import upath from 'upath';
5✔
10

5✔
11
/**
5✔
12
 * Checks whether its possible to create a directory, and either creates it or ends the process with an error.
13
 *
14
 * @param {Logger} logger
15
 * @param {String} packageName
16
 */
17
export default function createDirectory( logger, packageName ) {
18
        const directoryName = packageName.split( '/' )[ 1 ];
19
        const directoryPath = upath.resolve( directoryName );
5✔
20

4✔
21
        logger.process( `Checking whether the "${ chalk.cyan( directoryName ) }" directory can be created.` );
4✔
22

23
        if ( fs.existsSync( directoryPath ) ) {
4✔
24
                logger.error( 'Cannot create a directory as the location is already taken.' );
25
                logger.error( 'Aborting.' );
4✔
26

1✔
27
                process.exit( 1 );
1✔
28
        }
29

1✔
30
        logger.process( `Creating the directory "${ chalk.cyan( directoryPath ) }".` );
31

32
        mkdirp.sync( directoryPath );
4✔
33

34
        return { directoryName, directoryPath };
4✔
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc