Design System Utilities @ 0.1.1-alpha.0
    Preparing search index...

    Extension of the built-in one.

    0.1.0-alpha

    Hierarchy

    • BuildStage
      • Build
    Index

    Constructors - Constructor

    Properties - Config

    Properties - Running

    Properties - Utilities

    Accessors - Config

    Accessors - Project

    Accessors - Utilities

    Accessors - Other

    Methods - Config

    Methods - Errors

    Methods - Running

    Methods - Sub-Stages

    Methods - Utilities

    Methods - Other

    Constructors - Constructor

    • Parameters

      • config: Class

        Current project config.

      • params: Params

        Current CLI params.

      • args: Partial<Stage.Args.Build>

        Partial overrides for the default args.

      • Optionalpkg: PackageJson

        Parsed contents of the project’s package.json file.

      • Optionalversion: SemVer

        Version object for the project’s version.

      Returns BuildUtilities.Build

    Properties - Config

    args: Build

    {@inheritDoc Stage.args}

    clr: Colour

    {@inheritDoc Stage.clr}

    config: Class

    {@inheritDoc Stage.config}

    name: string

    {@inheritDoc Stage.name}

    params: Params

    {@inheritDoc Stage.params}

    Properties - Running

    subStages: Build[]

    {@inheritDoc AbstractStage.subStages}

        readonly subStages: Stage.SubStage.Build[];
    

    Properties - Utilities

    compiler: Stage_Compiler

    {@inheritDoc Stage.compiler}

    console: Stage_Console

    {@inheritDoc Stage.console}

    Accessors - Config

    • get releaseDir(): string

      Path to release directory for building a package for the current version.

      Returns string

    Accessors - Project

    • get pkg(): {
          bin: string
          | { [key: string]: string }
          | undefined;
          bugs: { email?: string; url?: string } | undefined;
          config: { [key: string]: any; [key: number]: any } | undefined;
          description: string | undefined;
          engines: { [key: string]: string } | undefined;
          files: string[] | undefined;
          homepage: string | undefined;
          license: string | undefined;
          main: string | undefined;
          name: string;
          repository: string | undefined;
          version: string;
      }

      {@inheritDoc Stage.pkg}

      Returns {
          bin: string | { [key: string]: string } | undefined;
          bugs: { email?: string; url?: string } | undefined;
          config: { [key: string]: any; [key: number]: any } | undefined;
          description: string | undefined;
          engines: { [key: string]: string } | undefined;
          files: string[] | undefined;
          homepage: string | undefined;
          license: string | undefined;
          main: string | undefined;
          name: string;
          repository: string | undefined;
          version: string;
      }

    • get version(): SemVer

      {@inheritDoc Stage.version}

      Returns SemVer

    • set version(input: string | SemVer | undefined): void

      If undefined, nothing is set. Otherwise, a SemVer is created and the value of AbstractStage.pkg.version is updated.

      Parameters

      • input: string | SemVer | undefined

      Returns void

    Accessors - Utilities

    • get fs(): FileSystem

      {@inheritDoc Stage.fs}

      Returns FileSystem

    • set fs(fs: FileSystem | undefined): void

      {@inheritDoc Stage.fs}

      Parameters

      • fs: FileSystem | undefined

      Returns void

    Accessors - Other

    • get ARGS_DEFAULT(): {
          compile: true;
          document: false;
          minimize: (
              _stage: Stage,
          ) => {
              css: false;
              html: false;
              js: false;
              json: { globs: [`${string}/**/*.json`] };
          };
          prettify: (
              _stage: Stage,
          ) => {
              css: readonly [readonly [`${string}/**/*.css`, `${string}/**/*.css`]];
              html: readonly [readonly [`${string}/**/*.html`]];
              js: readonly [
                  readonly [
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                  ],
              ];
              json: readonly [readonly [`${string}/**/*.json`]];
              md: undefined;
              mdx: undefined;
              scss: readonly [readonly [`${string}/**/*.scss`, `${string}/**/*.scss`]];
              ts: readonly [
                  readonly [
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                  ],
              ];
              yaml: readonly [readonly [`${string}/**/*.yaml`]];
          };
          replace: (
              stage: Stage,
          ) => { current?: string[]; ignore?: string[]; package?: string[] };
          test: false;
          utils: {};
      }

      Returns {
          compile: true;
          document: false;
          minimize: (
              _stage: Stage,
          ) => {
              css: false;
              html: false;
              js: false;
              json: { globs: [`${string}/**/*.json`] };
          };
          prettify: (
              _stage: Stage,
          ) => {
              css: readonly [readonly [`${string}/**/*.css`, `${string}/**/*.css`]];
              html: readonly [readonly [`${string}/**/*.html`]];
              js: readonly [
                  readonly [
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                  ],
              ];
              json: readonly [readonly [`${string}/**/*.json`]];
              md: undefined;
              mdx: undefined;
              scss: readonly [readonly [`${string}/**/*.scss`, `${string}/**/*.scss`]];
              ts: readonly [
                  readonly [
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                  ],
              ];
              yaml: readonly [readonly [`${string}/**/*.yaml`]];
          };
          replace: (
              stage: Stage,
          ) => { current?: string[]; ignore?: string[]; package?: string[] };
          test: false;
          utils: {};
      }

    • get isDraftVersion(): boolean

      {@inheritDoc Stage.isDraftVersion}

      Returns boolean

    • get isWatchedUpdate(): boolean

      Whether the current run is the result of a watched change.

      Returns boolean

      0.3.0-alpha.1

    • get sassOpts(): Sass

      Default scss options according to config & params.

      Returns Sass

      0.3.0-alpha.1

    Methods - Config

    • Builds a complete version of this class' args, falling back to defaults as needed.

      Uses mergeArgs recursively.

      Parameters

      Returns Build & Partial<Build>

    • {@inheritDoc Stage.getDistDir}

      Parameters

      Returns string

    • {@inheritDoc Stage.getScriptsPath}

      Parameters

      • OptionalsubDir: "logs"
      • ...subpaths: string[]

      Returns string

    • {@inheritDoc Stage.isSubStageIncluded}

      Parameters

      • subStage: Build
      • level: number
      • Optionalargs: {
            checkIfSubStageIsDefaultIncluded?: boolean;
            checkIfSubStageIsMethod?: boolean;
        }

      Returns boolean

      0.3.0-alpha.11 — Added args param.

    Methods - Errors

    • Alias for internal.logError.

      Parameters

      • logMsg: string

        Message to prepend to the return for output to the console.

      • error: unknown

        Caught error to log.

      • level: number

        Depth level for output to the console.

      • OptionalerrMsg: string

        See logError.Args.errMsg.

      • Optionaldate: Date

        Used for the timestamp.

      Returns BulkMsgs

    • Alias for internal.writeLog.

      Parameters

      • msg: string | string[] | BulkMsgs

        Log message to write.

      • filename: string

        File name for the log.

      • OptionalsubDir: string[]

        Subdirectories used for the path to write the log file.

      • Optionaldate: Date | null

        Used for the timestamp.

      Returns string | false

      If false, writing the log failed. Otherwise, this is the path to the written log file.

    • Alias for errorHandler.

      Parameters

      • error: any

        Error to handle.

      • level: number

        Depth level for output to the console.

      • Optionalargs: Partial<Args>

        Overrides for default options.

      Returns void

    Methods - Running

    • Runs the entire stage (asynchronously).

      This method should probably not be overwritten, except in completely custom class implementations.

      Cycles through each substage and runs AbstractStage.runSubStage if AbstractStage.isSubStageIncluded returns true.

      Returns Promise<void>

    • {@inheritDoc Stage.startEndNotice}

      Parameters

      • which: "start" | "end" | null

      Returns void | Promise<void>

    • Experimental

      This runs a custom sub-stage that only copies a whole folder at the given subpath from the source to the dist directories.

      Deletes any existing, logs update messages, etc.

      Parameters

      • subpath: string

        The subdriectory, relative to src path.

      • Optional_distDir: string

        Optionally force a diffrent output directory than the auto-generated one.

      • OptionallogLevelBase: number

        Base output level for log messages.

      Returns Promise<void>

      0.1.4-alpha

      0.2.0-alpha.1 — Added logLevelBase param.

    • Runs the given stage as a sub-stage to the current one.

      This method should probably not be overwritten.

      Parameters

      • stageInput: Name | [string, Class]
      • level: number

        Depth level for output to the console.

      Returns Promise<void>

      0.3.0-alpha.10 — Added option to run a custom stage class.

    • Used to run a single stage within this class; used by AbstractStage.run.

      Parameters

      • subStage: Build

      Returns Promise<void>

    Methods - Sub-Stages

    • Runs the project's compile class.

      Returns Promise<void>

    • Runs the project's document class.

      Returns Promise<void>

    • Minimizes files.

      Returns Promise<void>

    • Runs prettier to format files.

      Returns Promise<void>

    • Replaces placeholders in the built files and directories.

      Returns Promise<void>

    • Runs the project's test class.

      Returns Promise<void>

    Methods - Utilities

    • If there's a subdir, the return will be an array of strings.

      Parameters

      • subDir: SourceDirectory

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string[]

    • If there's no subdir, the return will be a string.

      Parameters

      • OptionalsubDir: undefined

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string

    • Replaces placeholders in files as defined by Config.replace.

      Parameters

      • globs: string[]

        Where to find & replace placeholders.

      • version: "package" | "current"

        Which version of the replacements to run.

      • level: number

        Depth level for output to the console.

      • Optionalignore: string[]

        Globs to ignore while replacing. Default FileSystem.globs.SYSTEM.

      • OptionaldocsMode: boolean

        Whether to make the replacements in 'docs' mode (i.e., assumes markdown in comments was converted to HTML).

      Returns string[]

      Paths where placeholders were replaced.

    Methods - Other

    • Handles uncaught errors in node.

      Parameters

      • error: unknown

        To handle.

      Returns void

      0.2.0-alpha

    • If the tryer function has no params, then they are optional.

      If the handler must exit, then 'FAILED' is not possible.

      Type Parameters

      • T_Params extends never[]
      • T_Return extends unknown

      Parameters

      • tryer: () => T_Return | Promise<T_Return>

        Function to run inside the try {}.

      • level: number

        Depth level for the error handler.

      • Optionalparams: NoInfer<T_Params>

        Parameters passed to the tryer function, if any.

      • OptionalhandlerArgs: Partial<Args> & { exitProcess?: false }

      Returns Promise<T_Return>

      The tryer function’s return, or 'FAILED' if an error is caught and the process isn’t exited.

    • If the tryer function has params, then they are required.

      If the handler must exit, then 'FAILED' is not possible.

      Type Parameters

      • T_Params extends unknown[]
      • T_Return extends unknown

      Parameters

      Returns Promise<T_Return>

    • If the tryer function has no params, then they are optional.

      If the handler won't exit, then 'FAILED' is possible.

      Type Parameters

      • T_Params extends never[]
      • T_Return extends unknown

      Parameters

      Returns Promise<"FAILED" | T_Return>

    • If the tryer function has params, then they are required.

      Type Parameters

      • T_Params extends unknown[]
      • T_Return extends unknown

      Parameters

      Returns Promise<"FAILED" | T_Return>

    • This runs a custom sub-stage that uses globs to find non-partial scss/sass files and compile them at the given subpath from the source to the dist directories.

      Deletes any existing, logs update messages, etc.

      Parameters

      • subpath: string | string[]

        The subdirectory, relative to src path.

      • OptionaldistDir: string

        Force a diffrent output directory than the auto-generated one.

      • Optionalopts: Partial<Opts>

        Additional options. See AbstractStage.runCustomScssDirSubStage.DEFAULT_OPTS for defaults.

      • OptionallogLevelBase: number

        Base output level for log messages. Default 1.

      • OptionalsassOpts: Sass

      Returns Promise<string[]>

      0.1.4-alpha

      0.2.0-alpha — Added postCSS param and PostCSS compatibility.

      0.2.0-alpha.1 — Added logLevelBase param.

      0.2.0-alpha.2 — Changed postCSS param to opts object param. Added returning output css filepaths. Improved some issues with the async compiling and sub-file finding.

      0.3.0-alpha.1 — Added sassOpts param and allowed subpath to be an array.

    • Deprecated overload here for forward-compatibility. Please use the overload above instead.

      Parameters

      • subpath: string | string[]
      • OptionaldistDir: string
      • OptionalpostCSS: boolean
      • OptionallogLevelBase: number
      • OptionalsassOpts: Sass

      Returns Promise<string[]>

      0.2.0-alpha.2 — Please pass an AbstractStage.runCustomScssDirSubStage.Opts object as the third param instead.

    • Handles errors thrown during sass compile.

      Parameters

      • error: any
      • level: number
      • opts: Sass
      • Optionalargs: Partial<Args>

      Returns string[]

      0.3.0-alpha.3

    • If the tryer function has no params, then they are optional.

      If the handler must exit, then 'FAILED' is not possible.

      Type Parameters

      • T_Params extends never[]
      • T_Return extends unknown

      Parameters

      • tryer: () => T_Return

        Function to run inside the try {}.

      • level: number

        Depth level for the error handler.

      • Optionalparams: NoInfer<T_Params>

        Parameters passed to the tryer function, if any.

      • OptionalhandlerArgs: Partial<Args> & { exitProcess?: false }

      Returns T_Return

      The tryer function’s return, or 'FAILED' if an error is caught and the process isn’t exited.

    • If the tryer function has params, then they are required.

      If the handler must exit, then 'FAILED' is not possible.

      Type Parameters

      • T_Params extends unknown[]
      • T_Return extends unknown

      Parameters

      Returns T_Return

    • If the tryer function has no params, then they are optional.

      If the handler won't exit, then 'FAILED' is possible.

      Type Parameters

      • T_Params extends never[]
      • T_Return extends unknown

      Parameters

      Returns "FAILED" | T_Return

    • If the tryer function has params, then they are required.

      Type Parameters

      • T_Params extends unknown[]
      • T_Return extends unknown

      Parameters

      Returns "FAILED" | T_Return