milkee-plugin-prettier 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
2
+
1
3
  # milkee-plugin-prettier
2
4
 
3
5
  A Milkee plugin for working with Prettier for CoffeeScript without version conflicts.
@@ -6,7 +8,7 @@ A Milkee plugin for working with Prettier for CoffeeScript without version confl
6
8
 
7
9
  ## Features
8
10
 
9
- - Recursively finds `.coffee` files in the build output directory and formats them with Prettier.
11
+ - Recursively finds `.coffee` files in the build entry directory and formats them with Prettier.
10
12
  - Supports a `prettierrc` (object or a path to a config file) and `.prettierignore` to exclude files.
11
13
  - Automatically resolves config via `prettier.resolveConfig()` or `package.json#prettier` when `prettierrc` is not provided.
12
14
 
@@ -35,7 +37,7 @@ module.exports = {
35
37
  ### Notes
36
38
 
37
39
  - `.prettierignore` is resolved relative to `process.cwd()` by default. You can pass an absolute or relative path via the `prettierignore` option.
38
- - When `config.options.join` is used and a single output file is emitted, the plugin will use the directory of the output file as the search root for `.coffee` files.
40
+ - When `config.options.join` is used and a single entry file is emitted, the plugin will use the directory of the entry file as the search root for `.coffee` files.
39
41
 
40
42
  ## Development
41
43
 
package/dist/main.js CHANGED
@@ -57,11 +57,10 @@ collectCoffeeFiles = function(dir, list = []) {
57
57
  // Export a plugin factory
58
58
  main = function(opts = {}) {
59
59
  return async function(compilationResult) {
60
- var compiledFiles, config, defaultIgnore, err, error, file, files, formatted, formattedCount, ig, ignorePath, ignorePatterns, info, j, len1, outDir, output, pkgPath, prettierOptions, prettierrc, projectRoot, rcPath, ref1, rel, text;
60
+ var compiledFiles, config, defaultIgnore, entry, err, error, file, files, formatted, formattedCount, ig, ignorePath, ignorePatterns, info, j, len1, pkgPath, prettierOptions, prettierrc, projectRoot, rcPath, rel, text;
61
61
  ({config, compiledFiles} = compilationResult);
62
- // Determine output directory
63
- output = (config != null ? config.output : void 0) || 'dist';
64
- outDir = (config != null ? (ref1 = config.options) != null ? ref1.join : void 0 : void 0) ? path.dirname(output) : output;
62
+ // Determine entry directory
63
+ entry = config.entry;
65
64
  projectRoot = process.cwd();
66
65
  // Handle prettierignore: can be a path (string) or an array of patterns
67
66
  ignorePath = null;
@@ -123,14 +122,14 @@ main = function(opts = {}) {
123
122
  }
124
123
  }
125
124
  // ignore
126
- c.info(`Searching .coffee files in ${outDir}`);
127
- if (!fs.existsSync(outDir)) {
128
- c.warn(`Output directory not found: ${outDir}`);
125
+ c.info(`Searching .coffee files in ${entry}`);
126
+ if (!fs.existsSync(entry)) {
127
+ c.warn(`Entry directory not found: ${entry}`);
129
128
  return;
130
129
  }
131
- files = collectCoffeeFiles(outDir);
130
+ files = collectCoffeeFiles(entry);
132
131
  if (files.length === 0) {
133
- c.info(`No .coffee files found in ${outDir}`);
132
+ c.info(`No .coffee files found in ${entry}`);
134
133
  return;
135
134
  }
136
135
  c.info(`Found ${files.length} .coffee file(s)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "milkee-plugin-prettier",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A Milkee plugin for working with Prettier for CoffeeScript without version conflicts.",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {