Explorar el Código

First working docs build on Win

Paweł Smyrek hace 5 años
padre
commit
d3a29caaa2
Se han modificado 2 ficheros con 11 adiciones y 12 borrados
  1. 7 9
      scripts/docs/buildapi.js
  2. 4 3
      scripts/docs/snippetadapter.js

+ 7 - 9
scripts/docs/buildapi.js

@@ -7,21 +7,19 @@
 
 'use strict';
 
-const path = require( 'path' );
-
 module.exports = function buildApiDocs() {
 	const ckeditor5Docs = require( '@ckeditor/ckeditor5-dev-docs' );
 
 	return ckeditor5Docs
 		.build( {
-			readmePath: path.join( process.cwd(), 'README.md' ),
+			readmePath: 'README.md',
 			sourceFiles: [
-				process.cwd() + '/packages/@(ckeditor|ckeditor5)-*/src/**/*.@(js|jsdoc)',
-				'!' + process.cwd() + '/packages/@(ckeditor|ckeditor5)-*/src/lib/**/*.js',
-				'!' + process.cwd() + '/packages/ckeditor5-build-*/src/**/*.js',
-				process.cwd() + '/external/*/packages/@(ckeditor|ckeditor5)-*/src/**/*.@(js|jsdoc)',
-				'!' + process.cwd() + '/external/*/packages/@(ckeditor|ckeditor5)-*/src/lib/**/*.js',
-				'!' + process.cwd() + '/external/*/packages/ckeditor5-build-*/src/**/*.js'
+				'packages/@(ckeditor|ckeditor5)-*/src/**/*.@(js|jsdoc)',
+				'!packages/@(ckeditor|ckeditor5)-*/src/lib/**/*.js',
+				'!packages/ckeditor5-build-*/src/**/*.js',
+				'external/*/packages/@(ckeditor|ckeditor5)-*/src/**/*.@(js|jsdoc)',
+				'!external/*/packages/@(ckeditor|ckeditor5)-*/src/lib/**/*.js',
+				'!external/*/packages/ckeditor5-build-*/src/**/*.js'
 			],
 			validateOnly: process.argv.includes( '--validate-only' ),
 			strict: process.argv.includes( '--strict' )

+ 4 - 3
scripts/docs/snippetadapter.js

@@ -282,7 +282,7 @@ function getConstantDefinitions( snippets ) {
 			knownPaths.add( directory );
 
 			const absolutePathToConstants = path.join( directory, 'docs', 'constants.js' );
-			const importPathToConstants = path.posix.relative( __dirname, absolutePathToConstants );
+			const importPathToConstants = path.relative( __dirname, absolutePathToConstants );
 
 			if ( fs.existsSync( absolutePathToConstants ) ) {
 				const packageConstantDefinitions = require( './' + importPathToConstants );
@@ -432,7 +432,7 @@ function getWebpackConfig( snippets, config ) {
 
 	for ( const snippetData of snippets ) {
 		if ( !webpackConfig.output.path ) {
-			webpackConfig.output.path = snippetData.outputPath;
+			webpackConfig.output.path = path.normalize( snippetData.outputPath );
 		}
 
 		if ( webpackConfig.entry[ snippetData.snippetName ] ) {
@@ -490,7 +490,8 @@ function getPackageDependenciesPaths() {
 	};
 
 	return glob.sync( 'packages/*/node_modules', globOptions )
-		.concat( glob.sync( 'external/*/packages/*/node_modules', globOptions ) );
+		.concat( glob.sync( 'external/*/packages/*/node_modules', globOptions ) )
+		.map( p => path.normalize( p ) );
 }
 
 /**