npm package: @financial-times/o3-origami-codemods
Description: A CLI tool that reports on usage of Origami Sass functions, mixins and variables.
Author: developer.automation@ft.com
Latest version: 0.0.4
Deprecated: o3-origami-codemods has been renamed to ft-sass-to-css. Please install @financial-times/ft-sass-to-css for the latest features.

# o3-origami-codemods
A CLI tool that reports on usage of Origami Sass functions, mixins and variables.

> ❗️ This is a pre-release version for a tool which will help teams migrate away from Origami Sass. To find out more, check out the [Future Development](#Future-Development) section below.

## Installation
```
npm i -g @financial-times/o3-origami-codemods
```

## Usage
``` bash
o3-origami-codemods "./path/to/sass/**/*"
```

### Examples
The path uses a [glob pattern](https://www.malikbrowne.com/blog/a-beginners-guide-glob-patterns/) to capture scss files. Here's a few examples of the most common patterns:
 
``` bash
o3-origami-codemods "src/**/*" # all scss files within the src directory and all subfolders

o3-origami-codemods "src/*" # all scss files within the src directory ONLY

o3-origami-codemods "src/components/styles.scss" # single file
```
The output from this command will return a table of components used within the files in the specified path, broken down into mixins, functions and variables. 

```
Origami Sass Report:
┌────────────────────────┬────────┬───────────┬───────────┬───────┐
│        (index)         │ Mixins │ Functions │ Variables │ Total │
├────────────────────────┼────────┼───────────┼───────────┼───────┤
│        o-colors        │   5    │    20     │     1     │  26   │
│ o-editorial-typography │   5    │     0     │     0     │   5   │
│        o-fonts         │   0    │     1     │     0     │   1   │
│          ---           │        │           │           │       │
│         Total          │  10    │    21     │     1     │  32   │
└────────────────────────┴────────┴───────────┴───────────┴───────┘
```

## Future Development
The future aim for this tool will be a set of [codemods](https://docs.codemod.com/blog/what-are-codemods), which can be ran against a codebase to convert uses of Origami Sass functions, mixins and variables to modern CSS variables, as supported by o3 ([Origami for Everyone](https://origami-for-everyone.ft.com/)). If you'd like to learn more, reach out to the Developer Automation team on Slack.


## Local Development

### Installation and configuration
```bash
git clone git@github.com:Financial-Times/o3-origami-codemods.git
cd o3-origami-codemods
npm install
npm link
```

### Execution
You can run the CLI tool against the files within the `demo` directory with the following command:
```
npm run demo
```

### Testing
The following command:
```
npm run test
```
runs Jest and tests core functionality. These tests are executed as part of the CircleCI process; it will not deploy with failing tests.


### Coding Standards
We drive secure maintainable code through the use of ESlint and Snyk via regular execution of the following commands:
```
npm run lint                  # View linting errors
npm run lint:fix         # Attempt to fix linting errors automatically
```

### Deploying the Application
You can release a new version to NPM by creating a Github release following semantic version numbering, preceeded by a `v`, e.g `v0.0.1`