npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dynafer/build-toolkit

v1.0.64

Published

## Change Logs * ### [1.0.4 (04-03-2023)](https://github.com/dynafer/build-toolkit/blob/main/logs/change_log_1.0.4.md) * ### [1.0.5 (03-04-2023)](https://github.com/dynafer/build-toolkit/blob/main/logs/change_log_1.0.5.md) * ### [1.0.6 (05-05-2023)](https

Downloads

19

Readme

@dynafer/build-toolkit

Change Logs

Installation

$ npm i --save-dev @dynafer/build-toolkit
or
$ yarn add -D @dynafer/build-toolkit

How to use it

1. Create build.config.js in your working directory

module.exports = async(runner, config) => {
  /**
   * runner: {
   *     Command,
   *     Icons,
   *     Rollup,
   *     Sass,
   *     Task,
   *     Test,
   * }
   * config: {
   *     BasePath,
   *     WatchDir,
   *     Mode,
   * }
   */
  ...
};

2. After setting the file

  • Run a command line to build
$ npm run build-toolkit
or
$ yarn run build-toolkit
  • Specific config file name
$ npm run build-toolkit --config <filename>
$ npm run build-toolkit -c <filename>
or
$ yarn run build-toolkit --config <filename>
$ yarn run build-toolkit -c <filename>
  • Watch option
$ npm run build-toolkit --watch <directory>
$ npm run build-toolkit -w <directory>
or
$ yarn run build-toolkit --watch <directory>
$ yarn run build-toolkit -w <directory>

Runners

1. Command

module.exports = async (runner, config) => {
  ...
	/**
	 * Command Setting
	 *    cd: Optional<directory path>
	 *    command: <command>
	 *    watch: Optional<boolean>, Default<true>
	 *        watch option is set to run the command if in watching files.
	 */

  await runner.Command.Run({
    cd: '<directory path>',
    command: 'yarn run eslint',
    watch: false
  });
  ...
};

2. Rollup (Using Rollup.js dependency)

module.exports = async (runner, config) => {
  ...
	/**
	 * Rollup Setting
	 *    Rollup.js Configuration
     *    output: {
     *      Rollup.js Output Configuration
     *      createUglified: Optional<boolean>, Default<false>
     *    }
	 */

  const singleConfig = {
    // Rollup.js Configuration
  };

  const multipleConfigs = [
    {
      // Rollup.js Configuration
    },
    ...
  ];

  const createUglifyRollup = {
    ...
    output: {
      ...
      createUglified: true,
      ...
    },
    ...
  }

  runner.Rollup.Register(singleConfig);
  runner.Rollup.Register(multipleConfigs);
  runner.Rollup.Register(createUglifyRollup);

  await runner.Rollup.Run();
  ...
};

3. SASS (Using sass dependency)

module.exports = async (runner, config) => {
  ...
	/**
	 * SASS Setting
     *    input: <sass file path>
     *    output: <output file path>
     *    compressed: Optional<boolean>, Default<false>
	 */

  const singleConfig = {
    input: '<sass file path>',
    output: '<output file path>'
  };

  const multipleConfigs = [
    {
      input: '<sass file path>',
      output: '<output file path>',
      compressed: true
    },
    {
      input: '<sass file path>',
      output: '<output file path>'
    },
    ...
  ];

  await runner.Sass.Run(singleConfig);
  await runner.Sass.Run(multipleConfigs);
  ...
};

4. Task

module.exports = async (runner, config) => {
  ...
  const taskRunner = async (config) => {
    // any task...
  };

  await runner.Task.Run(taskRunner);

  // If you don't want to run the task on watching
  await runner.Task.Run(taskRunner, false);
  ...
};

5. Icons

module.exports = async (runner, config) => {
  ...
	/**
	 * Icons Setting
     *    dir: <svg files directory path>
     *    output: <output file path>
     *    type: 'json' | 'const' | 'argument' | 'module'
     *    naming:
     *      If type is 'json', empty.
     *      If type is not 'json', required.
     *    uglified: Optional<boolean>, Default<false>
	 */

  const iconSetting = {
    dir: '<svg files directory path>',
    output: '<output file path>',
    type: 'json' | 'const' | 'argument' | 'module',
    naming: 'constant, function, or module name',
    uglified: true,
  };

  await runner.Icons.Build(iconSetting);

  // JSON type setting
  // Output would be .json file
  const jsonSetting = {
    dir: '<svg files directory path>',
    output: '<output file path>',
    type: 'json'
  };

  await runner.Icons.Build(jsonSetting);

  // Constant type setting
  // Output would be .js file
  const constSetting = {
    dir: '<svg files directory path>',
    output: '<output file path>',
    type: 'const'
    naming: 'icons'
  };
  // Expected: const icons = { ... };

  await runner.Icons.Build(constSetting);

  // Argument type setting
  // Output would be .js file
  const argSetting = {
    dir: '<svg files directory path>',
    output: '<output file path>',
    type: 'argument'
    naming: 'icons.add'
  };
  // Expected: icons.add({ ... });

  await runner.Icons.Build(argSetting);

  // Module type setting
  // Output would be .js and .d.ts files
  const moduleSetting = {
    dir: '<svg files directory path>',
    output: '<output file path>',
    type: 'module'
    naming: 'icons'
  };
	/**
	 * Expected
     *    .js: const icons = { ... }; export default icons;
     *    .d.ts: declare const icons: Record<string, string>;
     *           export default icons;
	 */

  await runner.Icons.Build(moduleSetting);
  ...
};

6. Test

module.exports = async (runner, config) => {
  ...
	/**
	 * Test Setting
     *    Jest Configuration
     *    watch: Optional<boolean>, Default<true>
     *        watch option is set to run the command if in watching files.
	 */

  const testSetting = {
    preset: 'ts-jest',
    testEnvironment: 'jest-environment-jsdom',
  };

  await runner.Test.Run(testSetting);
  ...
};

License

MIT