@Test public void testProcessingOfTypeScriptWithModuleSetToCommonJS() throws MojoFailureException, MojoExecutionException, IOException { cleanup(); File dir = new File(FAKE_PROJECT, "src/main/resources/assets/math"); FileUtils.copyDirectory(new File("src/test/resources/typescript/math"), dir); mojo.typescript.setModule("commonjs"); mojo.execute(); File js = new File(FAKE_PROJECT_TARGET, "classes/assets/ts/Animal.js"); File decl = new File(FAKE_PROJECT_TARGET, "classes/assets/ts/Animal.d.ts"); File map = new File(FAKE_PROJECT_TARGET, "classes/assets/ts/Animal.js.map"); assertThat(js).isFile(); assertThat(decl).isFile(); assertThat(map).isFile(); js = new File(FAKE_PROJECT_TARGET, "wisdom/assets/ts/raytracer.js"); decl = new File(FAKE_PROJECT_TARGET, "wisdom/assets/ts/raytracer.d.ts"); map = new File(FAKE_PROJECT_TARGET, "wisdom/assets/ts/raytracer.js.map"); assertThat(js).isFile(); assertThat(decl).isFile(); assertThat(map).isFile(); js = new File(FAKE_PROJECT_TARGET, "classes/assets/math/demos.js"); decl = new File(FAKE_PROJECT_TARGET, "classes/assets/math/interfaces.js"); File impl = new File(FAKE_PROJECT_TARGET, "classes/assets/math/impl/math_demo.js"); assertThat(js).isFile(); assertThat(decl).doesNotExist(); assertThat(impl).isFile(); FileUtils.deleteQuietly(dir); }
@Override public void execute() throws MojoExecutionException { if (typescript == null) { typescript = new TypeScript(); } if (!typescript.isEnabled()) { removeFromWatching(); getLog().info("Typescript processing disabled"); return; } npm = npm(this, TYPE_SCRIPT_NPM_NAME, typescript.getVersion()); this.internalSources = new File(basedir, MAIN_RESOURCES_DIR); this.destinationForInternals = new File(buildDirectory, "classes"); this.externalSources = new File(basedir, ASSETS_SRC_DIR); this.destinationForExternals = new File(getWisdomRootDirectory(), ASSETS_DIR); try { if (internalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + internalSources.getAbsolutePath()); processDirectory(internalSources, destinationForInternals); } if (externalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + externalSources.getAbsolutePath()); processDirectory(externalSources, destinationForExternals); } } catch (WatchingException e) { throw new MojoExecutionException(e.getMessage(), e); } }
TypeScriptCompilerMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (typescript == null) { typescript = new TypeScript(); } if (!typescript.isEnabled()) { removeFromWatching(); getLog().info("Typescript processing disabled"); return; } npm = npm(this, TYPE_SCRIPT_NPM_NAME, typescript.getVersion()); this.internalSources = new File(basedir, MAIN_RESOURCES_DIR); this.destinationForInternals = new File(buildDirectory, "classes"); this.externalSources = new File(basedir, ASSETS_SRC_DIR); this.destinationForExternals = new File(getWisdomRootDirectory(), ASSETS_DIR); try { if (internalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + internalSources.getAbsolutePath()); processDirectory(internalSources, destinationForInternals); } if (externalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + externalSources.getAbsolutePath()); processDirectory(externalSources, destinationForExternals); } } catch (WatchingException e) { throw new MojoExecutionException(e.getMessage(), e); } } }
TypeScriptCompilerMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (typescript == null) { typescript = new TypeScript(); } if (!typescript.isEnabled()) { removeFromWatching(); getLog().info("Typescript processing disabled"); return; } npm = npm(this, TYPE_SCRIPT_NPM_NAME, typescript.getVersion()); this.internalSources = new File(basedir, MAIN_RESOURCES_DIR); this.destinationForInternals = new File(buildDirectory, "classes"); this.externalSources = new File(basedir, ASSETS_SRC_DIR); this.destinationForExternals = new File(getWisdomRootDirectory(), ASSETS_DIR); try { if (internalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + internalSources.getAbsolutePath()); processDirectory(internalSources, destinationForInternals); } if (externalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + externalSources.getAbsolutePath()); processDirectory(externalSources, destinationForExternals); } } catch (WatchingException e) { throw new MojoExecutionException(e.getMessage(), e); } }  }
TypeScriptCompilerMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (typescript == null) { typescript = new TypeScript(); } if (!typescript.isEnabled()) { removeFromWatching(); getLog().info("Typescript processing disabled"); return; } npm = npm(this, TYPE_SCRIPT_NPM_NAME, typescript.getVersion()); this.internalSources = new File(basedir, MAIN_RESOURCES_DIR); this.destinationForInternals = new File(buildDirectory, "classes"); this.externalSources = new File(basedir, ASSETS_SRC_DIR); this.destinationForExternals = new File(getWisdomRootDirectory(), ASSETS_DIR); try { if (internalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + internalSources.getAbsolutePath()); processDirectory(internalSources, destinationForInternals); } if (externalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + externalSources.getAbsolutePath()); processDirectory(externalSources, destinationForExternals); } } catch (WatchingException e) { throw new MojoExecutionException(e.getMessage(), e); } }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); File getOutputFile(File input, String ext); }
TypeScriptCompilerMojo extends AbstractWisdomWatcherMojo implements Constants { @Override public void execute() throws MojoExecutionException { if (typescript == null) { typescript = new TypeScript(); } if (!typescript.isEnabled()) { removeFromWatching(); getLog().info("Typescript processing disabled"); return; } npm = npm(this, TYPE_SCRIPT_NPM_NAME, typescript.getVersion()); this.internalSources = new File(basedir, MAIN_RESOURCES_DIR); this.destinationForInternals = new File(buildDirectory, "classes"); this.externalSources = new File(basedir, ASSETS_SRC_DIR); this.destinationForExternals = new File(getWisdomRootDirectory(), ASSETS_DIR); try { if (internalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + internalSources.getAbsolutePath()); processDirectory(internalSources, destinationForInternals); } if (externalSources.isDirectory()) { getLog().info("Compiling TypeScript files with 'tsc' from " + externalSources.getAbsolutePath()); processDirectory(externalSources, destinationForExternals); } } catch (WatchingException e) { throw new MojoExecutionException(e.getMessage(), e); } }  @Override void execute(); @Override boolean accept(File file); @Override boolean fileCreated(File file); @Override boolean fileUpdated(File file); @Override boolean fileDeleted(File file); File getOutputFile(File input, String ext); static final String TYPE_SCRIPT_NPM_NAME; static final String TYPE_SCRIPT_COMMAND; static final String ERROR_TITLE; static final String EXTENSION; }