1.1.18 • Published 5 years ago

ngx-decorate-preprocessor v1.1.18

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Preprocess files for ngx-decorate.

Coverage Status Greenkeeper badge Build Status

Installation:

npm install -D ngx-decorate-preprocessor

Note: If you use tslint you might need to re-run your fixes on changed files.

CLI usage

Format files

ngx-decorate-preprocess format --globs "path/to/src/**/*.ts" --indent 2

Test formatting

Test if files that need formatting aren't formatted; exit with non-zero code on failure.

ngx-decorate-preprocess test --globs "path/to/src/**/*.ts" --indent 2

Node usage

import {formatAsync, formatSync} from 'ngx-decorate-preprocessor';
import * as fs from 'fs';

// File indentation level. Optional, defaults to 2
const indent = 4;
const fileContents = fs.readFileSync('/path/to/file.ts', 'utf8');

// Sync mode
const formattedContents = formatSync(fileContents, indent);

if (fileContents !== formattedContents) {
  fs.writeFileSync('/path/to/file.ts', formattedContents);
}

// Async mode

formatAsync(fileContents, indent)
  .then(formattedContents => {
    if (formattedContents !== fileContents) {
      return new Promise((resolve, reject) => {
        fs.writeFile('/path/to/file.ts', formattedContents, err => {
          if (err) {
            reject(err);
          } else {
            resolve();
          }
        })
      })
    }
  })
1.1.18

5 years ago

1.1.17

5 years ago

1.1.16

5 years ago

1.1.15

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago