Skip to content

Commit

Permalink
Convert to TypeScript, see #1465
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 15, 2024
1 parent 794a47a commit d64b117
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 5 additions & 7 deletions js/grunt/buildStandalone.js → js/grunt/buildStandalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @author Jonathan Olson <[email protected]>
*/


import webpackBuild from './webpackBuild';
import IntentionalAny from '../../../phet-core/js/types/IntentionalAny.ts';

const assert = require( 'assert' );
const fs = require( 'fs' );
Expand All @@ -21,13 +21,11 @@ const getPhetLibs = require( './getPhetLibs' );

/**
* Builds standalone JS deliverables (e.g. dot/kite/scenery)
* @public
*
* @param {string} repo
* @param {Object} providedOptions - Passed directly to minify()
* @returns {Promise<string>}
* @param repo
* @param providedOptions - Passed directly to minify()
*/
module.exports = async function( repo, providedOptions ) {
export default async function( repo: string, providedOptions: IntentionalAny ): Promise<string> {
assert( typeof repo === 'string' );
assert( typeof providedOptions === 'object' );

Expand Down Expand Up @@ -136,4 +134,4 @@ module.exports = async function( repo, providedOptions ) {
fullSource = minify( fullSource, options );

return fullSource;
};
}
2 changes: 1 addition & 1 deletion js/grunt/copySupplementalPhetioFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as fs from 'fs';
import * as _ from 'lodash';
import IntentionalAny from '../../../phet-core/js/types/IntentionalAny.js';
import webpackBuild from './webpackBuild.ts';
import buildStandalone from './buildStandalone.ts';

const assert = require( 'assert' );
const archiver = require( 'archiver' );
Expand All @@ -21,7 +22,6 @@ const execute = require( '../../../perennial-alias/js/common/execute' );
const grunt = require( 'grunt' );
const generatePhetioMacroAPI = require( '../phet-io/generatePhetioMacroAPI' );
const formatPhetioAPI = require( '../phet-io/formatPhetioAPI' );
const buildStandalone = require( '../grunt/buildStandalone' );
const minify = require( '../grunt/minify' );
const marked = require( 'marked' );
const tsc = require( './tsc' );
Expand Down
5 changes: 2 additions & 3 deletions js/grunt/tasks/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ import reportTscResults from '../reportTscResults';
*
* @author Sam Reid (PhET Interactive Simulations)
*/

const buildStandalone = require( '../buildStandalone' );
import buildStandalone from '../buildStandalone';

const minify = require( '../minify' );
const tsc = require( '../tsc' );
Expand Down Expand Up @@ -104,7 +103,7 @@ export const build = ( async () => {
minifyOptions.babelTranspile = false;
minifyOptions.uglify = false;
minifyOptions.isDebug = true;
fs.writeFileSync( `${parentDir}/${repo}.debug.js`, await buildStandalone( repo, minifyOptions, true ) );
fs.writeFileSync( `${parentDir}/${repo}.debug.js`, await buildStandalone( repo, minifyOptions ) );

if ( repoPackageObject.phet.standaloneTranspiles ) {
for ( const file of repoPackageObject.phet.standaloneTranspiles ) {
Expand Down

0 comments on commit d64b117

Please sign in to comment.