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

Convert grunt entry points to support Typescript #1464

Closed
6 of 7 tasks
samreid opened this issue Sep 17, 2024 · 6 comments
Closed
6 of 7 tasks

Convert grunt entry points to support Typescript #1464

samreid opened this issue Sep 17, 2024 · 6 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Sep 17, 2024

In #1459 we established how to use TypeScript in chipper via spawned processes. We would like to expand that usage to perennial/aqua/dot/kite/scenery and within chipper/. Be aware of #1463 which should likely happen before this.

  • Factor out util/ style components like execTask, registerTasks, spawn, etc in chipper/js/Gruntfile.js in a way that can be leveraged by other repo gruntfiles.
  • Move grunt utility files like gruntSpawn, registerTasks, etc. to perennial-alias.
  • Move perennial/grunt tasks to /tasks (new issue)
  • Move dot/kite/scenery grunt tasks to tasks/ (new issue)

repos with a typescript_chipper_1464 branch

  • DELETED chipper
  • DELETED aqua
  • DELETED dot
@samreid samreid self-assigned this Sep 17, 2024
samreid added a commit to phetsims/aqua that referenced this issue Sep 18, 2024
samreid added a commit to phetsims/aqua that referenced this issue Sep 18, 2024
samreid added a commit to phetsims/perennial that referenced this issue Sep 18, 2024
samreid added a commit to phetsims/perennial that referenced this issue Sep 18, 2024
@samreid
Copy link
Member Author

samreid commented Sep 18, 2024

Subject: [PATCH] Remove debug output, see https://github.com/phetsims/chipper/issues/1464
---
Index: js/grunt/tasks/default.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/grunt/tasks/default.ts b/js/grunt/tasks/default.ts
new file mode 100644
--- /dev/null	(date 1726665967088)
+++ b/js/grunt/tasks/default.ts	(date 1726665967088)
@@ -0,0 +1,29 @@
+// Copyright 2024, University of Colorado Boulder
+
+/**
+ * Erases the build/ directory and all its contents, and recreates the build/ directory
+ *
+ * @author Sam Reid (PhET Interactive Simulations)
+ */
+
+import * as grunt from 'grunt';
+import { lintAll } from './lint-all';
+
+( async () => {
+  if ( grunt.option( 'lint' ) === false ) {
+    // do nothing
+  }
+  else {
+    await lintAll();
+  }
+
+  if ( grunt.option( 'report-media' ) === false ) {
+    // do nothing
+  }
+  else {
+    require( './report-media' );
+  }
+
+  require( './clean' );
+  require( './build' );
+} )();
\ No newline at end of file
Index: js/grunt/tasks/lint-all.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/grunt/tasks/lint-all.ts b/js/grunt/tasks/lint-all.ts
--- a/js/grunt/tasks/lint-all.ts	(revision 9450827abc96e869f16ddf0c16df33c71b0ff795)
+++ b/js/grunt/tasks/lint-all.ts	(date 1726666208980)
@@ -1,12 +1,11 @@
 // Copyright 2024, University of Colorado Boulder
 
 /**
- * lint all js files that are required to build this repository (for the specified brands)
+ * Lints all JS files required to build this repository (for the specified brands)
  *
  * @author Sam Reid (PhET Interactive Simulations)
  */
 
-// @ts-expect-error
 import assert from 'assert';
 import * as grunt from 'grunt';
 import buildLocal from './util/buildLocal';
@@ -22,21 +21,35 @@
 const cache = !getOption( 'disable-eslint-cache' );
 const fix = getOption( 'fix' );
 const chipAway = getOption( 'chip-away' );
-assert && assert( !getOption( 'patterns' ), 'patterns not support for lint-all' );
+assert( !getOption( 'patterns' ), 'patterns not support for lint-all' );
 
 const getPhetLibs = require( '../getPhetLibs' );
 
 const brands = getBrands( grunt, repo, buildLocal );
 
-( async () => {
+/**
+ * Executes the linting process.
+ */
+export async function lintAll(): Promise<void> {
   const lintReturnValue = await lint( getPhetLibs( repo, brands ), {
     cache: cache,
     fix: fix,
     chipAway: chipAway
   } );
 
-// Output results on errors.
+  // Output results on errors.
   if ( !lintReturnValue.ok ) {
     grunt.fail.fatal( 'Lint failed' );
   }
-} )();
\ No newline at end of file
+  else {
+    console.log( 'Linting completed successfully.' );
+  }
+}
+
+// Detect if the script is run directly
+if ( import.meta.url === `file://${process.argv[ 1 ]}` ) {
+  lintAll().catch( error => {
+    console.error( 'Linting failed:', error );
+    process.exit( 1 );
+  } );
+}
\ No newline at end of file

@samreid samreid mentioned this issue Sep 18, 2024
2 tasks
samreid added a commit to phetsims/aqua that referenced this issue Sep 18, 2024
samreid added a commit to phetsims/dot that referenced this issue Sep 18, 2024
samreid added a commit that referenced this issue Sep 18, 2024
samreid added a commit that referenced this issue Sep 19, 2024
samreid added a commit that referenced this issue Sep 19, 2024
@zepumph
Copy link
Member

zepumph commented Sep 19, 2024

I made #1465 for the less interesting commits that are just about TypeScript conversion.

@zepumph
Copy link
Member

zepumph commented Sep 27, 2024

Working on this now.

@zepumph
Copy link
Member

zepumph commented Oct 15, 2024

All items have been handled or are now in side issues. Closing

@zepumph zepumph closed this as completed Oct 15, 2024
zepumph added a commit to phetsims/kite that referenced this issue Oct 15, 2024
zepumph added a commit to phetsims/rosetta that referenced this issue Oct 15, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 15, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 15, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 15, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 21, 2024
samreid pushed a commit to phetsims/perennial that referenced this issue Oct 22, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 22, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 22, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 22, 2024
zepumph added a commit to phetsims/perennial that referenced this issue Oct 22, 2024
samreid pushed a commit that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants