-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ty-ras/issue/7-add-jsdoc
#7 Adding documentation for the library.
- Loading branch information
Showing
21 changed files
with
883 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// ESLint config for formatting the resulting .d.ts files (<project name>/dist-ts/**/*.d.ts) that end up in NPM package for typing information. | ||
const { extends: extendsArray, plugins, rules } = require("./.eslintrc.cjs"); | ||
module.exports = { | ||
root: true, | ||
extends: extendsArray.filter((ext) => ext.startsWith("plugin:jsdoc/") || ext.startsWith("plugin:prettier/")), | ||
plugins: plugins.filter((plugin) => plugin === "jsdoc" || plugin === "prettier"), | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: "./tsconfig.out.json", | ||
sourceType: "module", | ||
ecmaVersion: "latest", | ||
tsconfigRootDir: __dirname, | ||
}, | ||
rules: Object.fromEntries(Object.entries(rules).filter(([ruleKey]) => ruleKey.startsWith("jsdoc/") || ruleKey.startsWith("prettier/"))), | ||
// So we won't get errors on comments disable e.g. @typescript-eslint/xyz rules. | ||
noInlineConfig: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs"); | ||
const { version } = JSON.parse(fs.readFileSync("package.json")); | ||
fs.writeFileSync( | ||
"dist-cjs/package.json", | ||
// Just version is enough | ||
JSON.stringify({ version }) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require("fs"); | ||
const glob = require("glob"); | ||
|
||
glob | ||
// Find all CommonJS files | ||
.sync("dist-cjs/**/*.js") | ||
// Read their contents while remembering the file path | ||
.map((file) => ({ file, contents: fs.readFileSync(file, "utf8") })) | ||
// Check whether the contents match what is emitted by a file without anything runtime-living to export | ||
.filter(({ contents }) => contents === '"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\n') | ||
// Delete the files | ||
.map(({ file }) => fs.unlinkSync(file)) | ||
; | ||
|
||
glob | ||
// Find all ESM files | ||
.sync("dist-esm/**/*.js") | ||
// Read their contents while remembering the file path | ||
.map((file) => ({ file, contents: fs.readFileSync(file, "utf8") })) | ||
// Check whether the contents match what is emitted by a file without anything runtime-living to export | ||
.filter(({ contents }) => contents === 'export {};\n') | ||
// Delete the files | ||
.map(({ file }) => fs.unlinkSync(file)) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.