diff --git a/.editorconfig b/.editorconfig index eb381e5..1448121 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,6 @@ trim_trailing_whitespace = true insert_final_newline = false [*.md] -trim_trailing_whitespace = false \ No newline at end of file +indent_style = space +trim_trailing_whitespace = false +insert_final_newline = true \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 074e2ed..4def8d8 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,15 +1,15 @@ # These are supported funding model platforms github: [alessiofrittoli] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -polar: # Replace with a single Polar username -buy_me_a_coffee: # Replace with a single Buy Me a Coffee username -thanks_dev: # Replace with a single thanks.dev username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +# patreon: # Replace with a single Patreon username +# open_collective: # Replace with a single Open Collective username +# ko_fi: # Replace with a single Ko-fi username +# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +# liberapay: # Replace with a single Liberapay username +# issuehunt: # Replace with a single IssueHunt username +# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +# polar: # Replace with a single Polar username +# buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +# thanks_dev: # Replace with a single thanks.dev username +# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] \ No newline at end of file diff --git a/.github/workflows/tests-ci.yml b/.github/workflows/tests-ci.yml index 0fa85c3..a3322b1 100644 --- a/.github/workflows/tests-ci.yml +++ b/.github/workflows/tests-ci.yml @@ -6,6 +6,9 @@ jobs: test: name: Run Unit Tests runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - uses: actions/checkout@v4 @@ -22,4 +25,11 @@ jobs: - name: Run tests run: | - pnpm test:ci:coverage \ No newline at end of file + pnpm test:ci:coverage + + - name: Report to Coveralls + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} + file: coverage/lcov.info + allow-empty: true \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0aaccee..a29b2ed 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -46,4 +46,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct/][version] [homepage]: http://contributor-covenant.org -[version]: https://www.contributor-covenant.org/version/2/1 \ No newline at end of file +[version]: https://www.contributor-covenant.org/version/2/1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9bb1aef..649187c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,9 +10,9 @@ If you find a bug, have a question, or want to suggest a new feature: - Search Existing Issues: Check the [Issues](https://github.com/alessiofrittoli/node-scripts/issues) tab to see if your concern has already been addressed. - Create a New Issue: If not, open a new issue. Please provide: - - A clear and descriptive title. - - Detailed steps to reproduce the issue (if applicable). - - Suggestions or ideas (if applicable). + - A clear and descriptive title. + - Detailed steps to reproduce the issue (if applicable). + - Suggestions or ideas (if applicable). ### 2. Fork the Repository diff --git a/README.md b/README.md index 398c5d1..7e97714 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,19 @@ # Node.js Scripts 🫧 -Version 2.2.1 +[![NPM Latest Version][version-badge]][npm-url] [![Coverage Status][coverage-badge]][coverage-url] [![NPM Monthly Downloads][downloads-badge]][npm-url] [![Dependencies][deps-badge]][deps-url] + +[![Sponsor on GitHub][sponsor-badge]][sponsor-url] + +[version-badge]: https://img.shields.io/npm/v/%40alessiofrittoli%2Fnode-scripts +[npm-url]: https://npmjs.org/package/%40alessiofrittoli%2Fnode-scripts +[coverage-badge]: https://coveralls.io/repos/github/alessiofrittoli/node-scripts/badge.svg +[coverage-url]: https://coveralls.io/github/alessiofrittoli/node-scripts +[downloads-badge]: https://img.shields.io/npm/dm/%40alessiofrittoli%2Fnode-scripts.svg +[deps-badge]: https://img.shields.io/librariesio/release/npm/%40alessiofrittoli%2Fnode-scripts +[deps-url]: https://libraries.io/npm/%40alessiofrittoli%2Fnode-scripts + +[sponsor-badge]: https://img.shields.io/static/v1?label=Sponsor%20this%20project&message=%E2%9D%A4&logo=GitHub&color=%23DB61A2 +[sponsor-url]: https://github.com/sponsors/alessiofrittoli ## Utility library with common Node.js scripts @@ -8,19 +21,25 @@ Version 2.2.1 - [Getting started](#getting-started) - [API Reference](#api-reference) - - [Post-Install scripts](#post-install-scripts) - - [TypeScript Type Reference Management](#typescript-type-reference-management) - - [Type Reference Interfaces](#type-reference-interfaces) - - [`CommonOptions`](#commonoptions) - - [`AddTypesReferenceOptions`](#addtypesreferenceoptions) - - [Type Reference Functions](#type-reference-functions) - - [`createReferenceFile`](#createreferencefile) - - [`updateTsConfig`](#updatetsconfig) - - [`addTypesReference`](#addtypesreference) - - [Add Types Reference Example usage](#add-types-reference-example-usage) - - [Publish Scripts](#publish-scripts) - - [Publish](#publish) -- [Security](#security) + - [Post-Install scripts](#post-install-scripts) + - [TypeScript Type Reference Management](#typescript-type-reference-management) + - [Type Reference Interfaces](#type-reference-interfaces) + - [`CommonOptions`](#commonoptions) + - [`AddTypesReferenceOptions`](#addtypesreferenceoptions) + - [Type Reference Functions](#type-reference-functions) + - [`createReferenceFile`](#createreferencefile) + - [`updateTsConfig`](#updatetsconfig) + - [`addTypesReference`](#addtypesreference) + - [Add Types Reference Example usage](#add-types-reference-example-usage) + - [Publish Scripts](#publish-scripts) + - [Publish](#publish) +- [Development](#development) + - [Install depenendencies](#install-depenendencies) + - [Build the source code](#build-the-source-code) + - [ESLint](#eslint) + - [Jest](#jest) + - [Contributing](#contributing) + - [Security](#security) - [Credits](#made-with-) --- @@ -170,15 +189,15 @@ Add the `postinstall` script in your `package.json` file which will execute the ```json { - // ... - "files": [ - // ..., - "path-to-my-scripts" // ensure folder is published to `npm` - ], - "scripts": { - // ... - "postinstall": "node path-to-my-scripts/ts-setup.js" - } + // ... + "files": [ + // ..., + "path-to-my-scripts" // ensure folder is published to `npm` + ], + "scripts": { + // ... + "postinstall": "node path-to-my-scripts/ts-setup.js" + } } ``` @@ -190,8 +209,8 @@ const { addTypesReference } = require( '@alessiofrittoli/node-scripts/postinstal const project = require( '../../package.json' ) addTypesReference( { - name: project.name, - outputFile: `${ project.name }.d.ts`, // optional + name: project.name, + outputFile: `${ project.name }.d.ts`, // optional } ) ``` @@ -203,8 +222,8 @@ const { addTypesReference } = require( '@alessiofrittoli/node-scripts/postinstal const project = require( '../../package.json' ) addTypesReference( { - name: project.name, - outputFile: 'my-package-scope-env.d.ts', + name: project.name, + outputFile: 'my-package-scope-env.d.ts', } ) ``` @@ -295,11 +314,11 @@ Add the `release` script in your `package.json` file so you can easly run from y ```json { - // ... - "scripts": { - // ... - "release": "node path-to-my-scripts/publish.js --verbose --npm --access restricted" - } + // ... + "scripts": { + // ... + "release": "node path-to-my-scripts/publish.js --verbose --npm --access restricted" + } } ``` @@ -310,14 +329,14 @@ Then in your `publish.js` file simply import the script and execute it. ```ts // path-to-my-scripts/publish.js require( '@alessiofrittoli/node-scripts/publish' ) - .publish() + .publish() ``` --- - +Help keep this project up to date with [GitHub Sponsor][sponsor-url]. + +[![Sponsor on GitHub][sponsor-badge]][sponsor-url] + +--- ### Security @@ -398,30 +422,30 @@ If you believe you have found a security vulnerability, we encourage you to **_r ### Made with ☕ - - - - - - -
- - - - - - - - - - - -
- Alessio Frittoli -
- - https://alessiofrittoli.it | - info@alessiofrittoli.it - -
-
\ No newline at end of file + + + + avatar + + + + + + + + + + + +
+ Alessio Frittoli +
+ + https://alessiofrittoli.it | + info@alessiofrittoli.it + +
+ + + + diff --git a/package.json b/package.json index 3789108..f08b3ac 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,12 @@ "url": "https://alessiofrittoli.it" }, "license": "MIT", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/alessiofrittoli" + } + ], "keywords": [ "nodejs", "node-scripts" @@ -49,19 +55,41 @@ }, "sideEffects": false, "scripts": { + "//1a": "*********************************************************************", + "//1b": "*********************** BUILD - LINT - RELEASE **********************", + "//1c": "*********************************************************************", "build": "pnpm lint && pnpm test:ci && tsup", "build:watch": "tsup --watch", "lint": "eslint", "release": "node scripts/publish.js --verbose --npm", - "test": "pnpm test:watch", + "//2a": "*********************************************************************", + "//2b": "***************************** UNIT TESTS ****************************", + "//2c": "*********************************************************************", + "test": "jest --verbose", "test:watch": "jest --watchAll --verbose", + "test:jsdom": "JSDOM=true pnpm test:watch", "test:ci": "jest --ci --verbose", + "test:ci:jsdom": "JSDOM=true pnpm test:ci", + "//3a": "*********************************************************************", + "//3b": "************************ UNIT TESTS COVERAGE ************************", + "//3c": "*********************************************************************", "test:coverage": "pnpm test:watch --coverage", "test:ci:coverage": "pnpm test:ci --coverage", "test:serve-coverage": "http-server ./coverage/lcov-report --gzip true -p 0 -o --silent", "test:coverage:serve": "concurrently --prefix none --kill-others \"pnpm test:coverage\" \"pnpm test:serve-coverage\"", + "test:coverage:jsdom": "JSDOM=true pnpm test:coverage", + "test:coverage:jsdom:serve": "JSDOM=true pnpm test:coverage:serve", + "//4a": "*********************************************************************", + "//4b": "************************ TARGETED UNIT TESTS ************************", + "//4c": "*********************************************************************", + "test:postinstall": "pnpm test:watch postinstall/*", + "test:publish": "pnpm test:watch publish/*", + "test:git": "pnpm test:watch git.test.ts", "test:jest": "pnpm test:watch jest.test.ts", - "test:jest:jsdom": "JSDOM=true pnpm test:jest" + "test:jest:jsdom": "JSDOM=true pnpm test:jest", + "test:npm": "pnpm test:watch npm.test.ts", + "test:package": "pnpm test:watch package.test.ts", + "test:process": "pnpm test:watch process.test.ts" }, "devDependencies": { "@eslint/js": "^9.17.0",