From e42116dcce1b538574be3d463c421f099cb33e54 Mon Sep 17 00:00:00 2001 From: Jonathan Olson Date: Fri, 14 Feb 2025 11:42:35 -0700 Subject: [PATCH] Remove dot old docgen --- Gruntfile.cjs | 14 ++--- js/grunt/eslint.config.mjs | 15 ------ js/grunt/tasks/doc-dot.ts | 93 -------------------------------- js/grunt/tasks/eslint.config.mjs | 16 ------ js/grunt/tsconfig.json | 8 --- 5 files changed, 3 insertions(+), 143 deletions(-) delete mode 100644 js/grunt/eslint.config.mjs delete mode 100644 js/grunt/tasks/doc-dot.ts delete mode 100644 js/grunt/tasks/eslint.config.mjs delete mode 100644 js/grunt/tsconfig.json diff --git a/Gruntfile.cjs b/Gruntfile.cjs index d7f0fb6..6f13154 100644 --- a/Gruntfile.cjs +++ b/Gruntfile.cjs @@ -1,13 +1,5 @@ -// Copyright 2013-2016, University of Colorado Boulder +// Copyright 2013-2025, University of Colorado Boulder -const Gruntfile = require( '../chipper/Gruntfile.cjs' ); -const registerTasks = require( '../perennial-alias/js/grunt/commonjs/registerTasks.js' ); -/** - * Dot grunt tasks - * @author Jonathan Olson - */ -module.exports = function( grunt ) { - Gruntfile( grunt ); // use chipper's gruntfile - registerTasks( grunt, `${__dirname}/js/grunt/tasks/` ); -}; \ No newline at end of file +// use chipper's gruntfile +module.exports = require( '../chipper/js/grunt/commonjs/gruntMain.js' ); \ No newline at end of file diff --git a/js/grunt/eslint.config.mjs b/js/grunt/eslint.config.mjs deleted file mode 100644 index abdca01..0000000 --- a/js/grunt/eslint.config.mjs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2024, University of Colorado Boulder - -/** - * ESLint configuration for dot grunt. - * - * @author Sam Reid (PhET Interactive Simulations) - * @author Michael Kauzmann (PhET Interactive Simulations) - */ - -import nodeEslintConfig from '../../../perennial-alias/js/eslint/config/node.eslint.config.mjs'; -import { mutateForNestedConfig } from '../../../perennial-alias/js/eslint/config/root.eslint.config.mjs'; - -export default [ - ...mutateForNestedConfig( nodeEslintConfig ) -]; \ No newline at end of file diff --git a/js/grunt/tasks/doc-dot.ts b/js/grunt/tasks/doc-dot.ts deleted file mode 100644 index cd4e882..0000000 --- a/js/grunt/tasks/doc-dot.ts +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2024, University of Colorado Boulder - -/** - * Generates Documentation for dot - * @author Jonathan Olson - */ - -import fs from 'fs'; -import documentationToHTML from '../../../../chipper/js/common/documentationToHTML.js'; -import extractDocumentation from '../../../../chipper/js/common/extractDocumentation.js'; - -const esprima = require( 'esprima' ); -const jsBeautify = require( 'js-beautify' ); - -// constants -const beautify_html = jsBeautify.html; - -let indexHTML = ''; -let contentHTML = ''; - -const localTypeIds = { - BinPacker: 'binPacker', - Bin: 'binPacker-bin', - Bounds2: 'bounds2', - Bounds3: 'bounds3', - Complex: 'complex', - ConvexHull2: 'convexHull2', - Dimension2: 'dimension2', - LinearFunction: 'linearFunction', - Matrix: 'matrix', - Matrix3: 'matrix3', - Matrix4: 'matrix4', - MatrixOps3: 'matrixOps3', - Permutation: 'permutation', - Plane3: 'plane3', - Quaternion: 'quaternion', - Random: 'random', - Range: 'range', - Ray2: 'ray2', - Ray3: 'ray3', - Rectangle: 'rectangle', // TODO: How to not have a namespace conflict? https://github.com/phetsims/dot/issues/96 - Sphere3: 'sphere3', - Transform3: 'transform3', - Transform4: 'transform4', - Utils: 'util', - Vector2: 'vector2', - Vector3: 'vector3', - Vector4: 'vector4' -}; - -const externalTypeURLs = { - Events: '../../axon/doc#events', - Shape: '../../kite/doc#shape' -}; - -function docFile( file: string, baseName: string, typeNames: string[] ): void { - const codeFile = fs.readFileSync( file, 'utf8' ); - const program = esprima.parse( codeFile, { - attachComment: true - } ); - const doc = extractDocumentation( program ); - if ( baseName === 'ConvexHull2' ) { // for testing - // console.log( JSON.stringify( doc, null, 2 ) ); - } - const htmlDoc = documentationToHTML( doc, baseName, typeNames, localTypeIds, externalTypeURLs ); - - indexHTML += htmlDoc.indexHTML; - contentHTML += htmlDoc.contentHTML; -} - -docFile( 'js/BinPacker.js', 'BinPacker', [ 'BinPacker', 'Bin' ] ); -docFile( 'js/Bounds2.js', 'Bounds2', [ 'Bounds2' ] ); -docFile( 'js/Bounds3.js', 'Bounds3', [ 'Bounds3' ] ); -docFile( 'js/Complex.js', 'Complex', [ 'Complex' ] ); -docFile( 'js/ConvexHull2.js', 'ConvexHull2', [ 'ConvexHull2' ] ); -docFile( 'js/Dimension2.js', 'Dimension2', [ 'Dimension2' ] ); -docFile( 'js/Transform3.js', 'Transform3', [ 'Transform3' ] ); -docFile( 'js/Transform4.js', 'Transform4', [ 'Transform4' ] ); -docFile( 'js/Utils.js', 'Utils', [ 'Utils' ] ); -docFile( 'js/Vector2.js', 'Vector2', [ 'Vector2' ] ); -docFile( 'js/Vector3.js', 'Vector3', [ 'Vector3' ] ); -docFile( 'js/Vector4.js', 'Vector4', [ 'Vector4' ] ); - -const template = fs.readFileSync( 'doc/template.html', 'utf8' ); - -let html = template.replace( '{{API_INDEX}}', indexHTML ).replace( '{{API_CONTENT}}', contentHTML ); - -html = beautify_html( html, { indent_size: 2 } ); - -fs.writeFileSync( 'doc/index.html', html ); - -// TODO: Why does this not fail lint in Webstorm? Rename grunt/tasks/eslint.config.mjs and it fails correctly. https://github.com/phetsims/chipper/issues/1541 -// (async()=>{})(); \ No newline at end of file diff --git a/js/grunt/tasks/eslint.config.mjs b/js/grunt/tasks/eslint.config.mjs deleted file mode 100644 index 6ab5ab3..0000000 --- a/js/grunt/tasks/eslint.config.mjs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2024, University of Colorado Boulder - -/** - * ESLint configuration for grunt tasks. - * - * @author Sam Reid (PhET Interactive Simulations) - * @author Michael Kauzmann (PhET Interactive Simulations) - */ - -import allowFloatingPromises from '../../../../perennial-alias/js/eslint/config/util/allowFloatingPromises.mjs'; -import eslintConfig from '../eslint.config.mjs'; - -export default [ - ...eslintConfig, - ...allowFloatingPromises -]; \ No newline at end of file diff --git a/js/grunt/tsconfig.json b/js/grunt/tsconfig.json deleted file mode 100644 index 288c4a5..0000000 --- a/js/grunt/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../../perennial-alias/tsconfig/tsconfig-node.json", - "references": [ - { - "path": "../../../chipper/tsconfig/buildtools/tsconfig.json" - } - ] -} \ No newline at end of file