Class SpellscrollInitUiTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
app.spellscroll.task.SpellscrollInitUiTask
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@DisableCachingByDefault(because="One-time scaffolding task that creates project files") public abstract class SpellscrollInitUiTask extends org.gradle.api.DefaultTask
Gradle task that scaffolds a new Spellscroll UI module at the configured directory.

This is a one-time setup task. It fetches the latest @spellscroll/ui-sdk version from the npm registry and generates three files:

  • package.json — npm project with @spellscroll/ui-sdk dependency and build/serve scripts.
  • spellscroll.config.js — esbuild configuration (entry point, output paths, dev server port 3001).
  • src/main.jsx — starter React component using useSpellscrollMessaging().

Each file is skipped individually if it already exists, making the task safe to re-run. Caching is disabled because the task performs network I/O and writes project files that should only be generated once.

Run with:


 ./gradlew spellscrollInitUi
 
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.gradle.api.provider.Property<String>
    Human-readable plugin name used to derive the React component name and the npm package name in package.json.
    abstract org.gradle.api.provider.Property<String>
    Path to the directory where the UI module will be scaffolded.
    void
    Entry point: fetches the latest @spellscroll/ui-sdk version, then writes the three scaffold files into getUiModuleDir().

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Constructor Details

    • SpellscrollInitUiTask

      public SpellscrollInitUiTask()
  • Method Details

    • getUiModuleDir

      @Input public abstract org.gradle.api.provider.Property<String> getUiModuleDir()
      Path to the directory where the UI module will be scaffolded. The directory is created if it does not exist.
      Returns:
      the UI module directory property
    • getPluginName

      @Input public abstract org.gradle.api.provider.Property<String> getPluginName()
      Human-readable plugin name used to derive the React component name and the npm package name in package.json.
      Returns:
      the plugin name property
    • initUi

      public void initUi() throws IOException, InterruptedException
      Entry point: fetches the latest @spellscroll/ui-sdk version, then writes the three scaffold files into getUiModuleDir().
      Throws:
      IOException - if a scaffold file cannot be written
      InterruptedException - if the current thread is interrupted during the npm registry request