Skip to content

Commit

Permalink
1.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
enact-bot committed Jul 25, 2023
2 parents b718a00 + 2b09a24 commit d26996a
Show file tree
Hide file tree
Showing 4 changed files with 946 additions and 252 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [1.0.1] (July 25, 2023)

* Fixed to prevent empty `.ts` file generation for private modules.
* Updated `glob` to the latest major version `^10.3.1` and refactored code to use promises instead of callbacks.

## [1.0.0] (July 5, 2023)

* Migrated project to ESM.
Expand Down
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import glob from 'glob';
import {glob} from 'glob';
import path from 'path';
import {build} from 'documentation';
import log from 'loglevel';
Expand Down Expand Up @@ -28,6 +28,10 @@ async function parse ({path: modulePath, files, format, importMap, output}) {
const firstNamedEntry = root.find(entry => entry.name);
let moduleName = firstNamedEntry ? firstNamedEntry.name : '';

if (!result.replace(/\s/g, '').length) {
return;
}

if (format) {
result = prettier.format(result, {parser: 'typescript'});
}
Expand All @@ -42,11 +46,7 @@ async function parse ({path: modulePath, files, format, importMap, output}) {

function getSourceFiles (base, ignore) {
return new Promise((resolve, reject) => {
glob('**/package.json', {cwd: base}, (er, files) => {
if (er) {
reject(er);
return;
}
glob('**/package.json', {cwd: base}).then(files => {

const entries = files
.filter(name => !ignore.find(i => name.includes(i)))
Expand All @@ -65,6 +65,8 @@ function getSourceFiles (base, ignore) {
});

resolve(entries);
}).catch(error => {
reject(error);
});
});
}
Expand Down
Loading

0 comments on commit d26996a

Please sign in to comment.