@stoplight/scripts

Scripts that help when creating, testing, releasing, and linting libraries.

Usage no npm install needed!

<script type="module">
  import stoplightScripts from 'https://cdn.skypack.dev/@stoplight/scripts';
</script>

README

@stoplight/scripts

Maintainability Test Coverage

Usage

Create a new library:

npx @stoplight/scripts create:lib

Commands

sl-scripts build

Build source code

USAGE
  $ sl-scripts build

OPTIONS
  --verbose  moar logs

EXAMPLE
  $ sl-scripts build

See code: dist/commands/build/index.ts

sl-scripts bundle

Bundle source code

USAGE
  $ sl-scripts bundle

OPTIONS
  --minify   minify output using terser
  --verbose  moar logs

EXAMPLE
  $ sl-scripts bundle

See code: dist/commands/bundle/index.ts

sl-scripts create:lib

Scaffold out a new library.

USAGE
  $ sl-scripts create:lib

EXAMPLE
  $ sl-scripts create:lib

See code: dist/commands/create/lib.ts

sl-scripts help [COMMAND]

display help for sl-scripts

USAGE
  $ sl-scripts help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

sl-scripts release

Publish new src or docs release.

USAGE
  $ sl-scripts release

OPTIONS
  --verbose  moar logs

EXAMPLES
  $ sl-scripts release
  $ sl-scripts release:docs

See code: dist/commands/release/index.ts

sl-scripts release:docs

Push built docs to github pages.

USAGE
  $ sl-scripts release:docs

OPTIONS
  --dry-run  run the release process but do not publish
  --verbose  moar logs

EXAMPLE
  $ sl-scripts release:docs

See code: dist/commands/release/docs.ts

Overriding Configs

Jest

Simply create a jest.config.js file in the root of your project, and extend the default config. For example:

// ./jest.config.js
module.exports = {
  preset: "@stoplight/scripts",
};

TS

Simply create a tsconfig.json file in the root of your project, and extend the default config. For example:

// ./tsconfig.json
{
  "extends": "@stoplight/scripts/tsconfig.json",
  "include": ["src"],
  "compilerOptions": {
    "outDir": "dist"
  }
}

TSLint

Simply create a tslint.json file in the root of your project, and extend the default config. For example:

// ./tslint.json
{
  "extends": ["@stoplight/scripts/tslint.json"]
}

Semantic Release

Simply add a release property to your package.json file. For example:

// ./package.json
{
  // ... props
  "release": {
    "pkgRoot": "dist",
    "plugins": [
      "@semantic-release/commit-analyzer",
      "@semantic-release/release-notes-generator"
    ]
  }
  // ... props
}

Rollup

By default all dependencies and peerDependencies declared in your package.json will be treated as external deps during sl-scripts bundle. If you would like to always bundle a dep, list those deps in your package.json file like so:

{
  "name": "your-package",
  "version": "0.0.0",
  "rollup": {
    "bundleDeps": ["dep-1", "dep-2"]
  }
}