Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prettier for formatting and style checking #72

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
lib
5 changes: 4 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,10 @@
# https://jstools.dev/eslint-config/

root: true
extends: "@jsdevtools"

extends:
- "@jsdevtools"
- "prettier"

env:
node: true
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
lib
package-lock.json
Empty file added .prettierrc.yml
Empty file.
15 changes: 4 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -17,18 +17,11 @@
"request": "launch",
"name": "Run Mocha",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout=60000",
"--retries=0",
],
"outFiles": [
"${workspaceFolder}/lib/**/*.js"
],
"args": ["--timeout=60000", "--retries=0"],
"outFiles": ["${workspaceFolder}/lib/**/*.js"],
"smartStep": true,
"skipFiles": [
"<node_internals>/**/*.js"
],
"skipFiles": ["<node_internals>/**/*.js"],
"outputCapture": "std"
},
}
]
}
3 changes: 1 addition & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -23,7 +23,6 @@
"problemMatcher": "$tsc"
},


{
"type": "npm",
"script": "test",
@@ -32,6 +31,6 @@
"isDefault": true
},
"problemMatcher": "$eslint-stylish"
},
}
]
}
29 changes: 7 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,34 @@
Change Log
====================================================================================================
# Change Log

All notable changes will be documented in this file.
NPM Publish adheres to [Semantic Versioning](http://semver.org/).



[v1.4.0](https://github.com/JS-DevTools/npm-publish/tree/v1.4.0) (2020-10-02)
----------------------------------------------------------------------------------------------------
## [v1.4.0](https://github.com/JS-DevTools/npm-publish/tree/v1.4.0) (2020-10-02)

- Added support NPM's `--tag` argument, which allows packages to be published to a named tag that can then be installed using `npm install <package-name>@<tag>`

- Added support for NPM's `--access` argument, which controls whether scoped packages are publicly accessible, or restricted to members of your NPM organization

[Full Changelog](https://github.com/JS-DevTools/npm-publish/compare/v1.3.0...v1.4.0)



[v1.3.0](https://github.com/JS-DevTools/npm-publish/tree/v1.3.0) (2020-10-01)
----------------------------------------------------------------------------------------------------
## [v1.3.0](https://github.com/JS-DevTools/npm-publish/tree/v1.3.0) (2020-10-01)

- NPM-Publish can now successfully publish a brand-new package to NPM. Previously it failed because it couldn't determine the previous package version. ([PR #12](https://github.com/JS-DevTools/npm-publish/pull/12) from [@ZitRos](https://github.com/ZitRos))

[Full Changelog](https://github.com/JS-DevTools/npm-publish/compare/v1.2.0...v1.3.0)



[v1.2.0](https://github.com/JS-DevTools/npm-publish/tree/v1.2.0) (2020-07-23)
----------------------------------------------------------------------------------------------------
## [v1.2.0](https://github.com/JS-DevTools/npm-publish/tree/v1.2.0) (2020-07-23)

- Added support for running NPM in "dry run" mode, which doesn't actually publish, but reports details of what _would_ have been published.

[Full Changelog](https://github.com/JS-DevTools/npm-publish/compare/v1.1.2...v1.2.0)



[v1.1.0](https://github.com/JS-DevTools/npm-publish/tree/v1.1.0) (2020-03-29)
----------------------------------------------------------------------------------------------------
## [v1.1.0](https://github.com/JS-DevTools/npm-publish/tree/v1.1.0) (2020-03-29)

- FIX: The configured NPM registry and token are now used _all_ NPM commands, not just for publishing. This ensures that npm-publish works with private packages and custom registries

[Full Changelog](https://github.com/JS-DevTools/npm-publish/compare/v1.0.13...v1.1.0)



[v1.0.0](https://github.com/JS-DevTools/npm-publish/tree/v1.0.0) (2020-01-21)
----------------------------------------------------------------------------------------------------
## [v1.0.0](https://github.com/JS-DevTools/npm-publish/tree/v1.0.0) (2020-01-21)

Initial release 🎉
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing Guide

Contributions, enhancements, and bug-fixes are welcome! [Open an issue](https://github.com/JS-DevTools/npm-publish/issues) on GitHub and [submit a pull request](https://github.com/JS-DevTools/npm-publish/pulls).

## Building Locally

You should be using Node.js v16 or later to build this project locally

```shell
# Clone this repository
git clone https://github.com/JS-DevTools/npm-publish.git

# Install dependencies*
npm install

# Build the code
npm run build

# Run the tests
npm test
```

There are also various code quality checks and tests you can run:

```shell
# Autoformat the code
npm run format

# Lint the code
npm run lint
```
41 changes: 10 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -63,17 +63,16 @@ jobs:

You can set any or all of the following input parameters:

|Name |Type |Default |Description
|----------------------|-------- |----------------------------|------------------------------------
|`token` |string |**required** |The NPM auth token to use for publishing
|`registry` |string |https://registry.npmjs.org/ |The NPM registry URL to use
|`package` |string |./package.json |The path of your package.json file
|`tag` |string |"latest" |The tag to publish to. This allows people to install the package using `npm install <package-name>@<tag>`.
|`access` |string |"public" for non-scoped packages. "restricted" for scoped packages.|Determines whether the published package should be publicly visible, or restricted to members of your NPM organization.
|`dry-run` |boolean |false |Run NPM publish with the `--dry-run` flag to prevent publication
|`check-version` |boolean |true |Only publish to NPM if the version number in `package.json` differs from the latest on NPM
|`greater-version-only`|boolean |false |Only publish to NPM if the version number in `package.json` is greater than the latest on NPM |

| Name | Type | Default | Description |
| ---------------------- | ------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `token` | string | **required** | The NPM auth token to use for publishing |
| `registry` | string | https://registry.npmjs.org/ | The NPM registry URL to use |
| `package` | string | ./package.json | The path of your package.json file |
| `tag` | string | "latest" | The tag to publish to. This allows people to install the package using `npm install <package-name>@<tag>`. |
| `access` | string | "public" for non-scoped packages. "restricted" for scoped packages. | Determines whether the published package should be publicly visible, or restricted to members of your NPM organization. |
| `dry-run` | boolean | false | Run NPM publish with the `--dry-run` flag to prevent publication |
| `check-version` | boolean | true | Only publish to NPM if the version number in `package.json` differs from the latest on NPM |
| `greater-version-only` | boolean | false | Only publish to NPM if the version number in `package.json` is greater than the latest on NPM |

## Output Variables

@@ -211,26 +210,6 @@ package_path The absolute or relative path of the NPM package to publis
Defaults to the current directory.
```

## Contributing

Contributions, enhancements, and bug-fixes are welcome! [Open an issue](https://github.com/JS-DevTools/npm-publish/issues) on GitHub and [submit a pull request](https://github.com/JS-DevTools/npm-publish/pulls).

#### Building

To build the project locally on your computer:

1. **Clone this repo**<br>
`git clone https://github.com/JS-DevTools/npm-publish.git`

2. **Install dependencies**<br>
`npm install`

3. **Build the code**<br>
`npm run build`

4. **Run the tests**<br>
`npm test`

## License

npm-publish is 100% free and open-source, under the [MIT license](LICENSE). Use it however you want.
20 changes: 17 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@
],
"scripts": {
"clean": "shx rm -rf .nyc_output coverage lib dist",
"lint": "eslint src test",
"lint": "npm run _eslint && npm run _prettier -- --check",
"format": "npm run _eslint -- --fix && npm run _prettier -- --write",
"build": "npm run build:typescript && npm run build:ncc && npm run build:node_modules",
"build:typescript": "tsc --declaration",
"build:ncc": "ncc build src/action/index.ts --source-map --external semver",
@@ -40,7 +41,9 @@
"coverage": "nyc -x test -x dist/sourcemap-register.js node_modules/mocha/bin/mocha",
"upgrade": "npm-check -u && npm audit fix",
"bump": "bump --tag --push --all && git tag -afm v1 v1 && git push --tags --force",
"release": "npm run clean && npm run build && npm test && npm run bump"
"release": "npm run clean && npm run build && npm test && npm run bump",
"_eslint": "eslint \"**/*.@(js|ts)\"",
"_prettier": "prettier \"**/*.@(js|ts|json|md|yml)\""
},
"engines": {
"node": ">=16"
@@ -59,9 +62,11 @@
"@vercel/ncc": "^0.36.1",
"chai": "^4.2.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^8.8.0",
"mocha": "^8.2.1",
"npm-check": "^5.9.0",
"nyc": "^15.1.0",
"prettier": "^2.8.7",
"shx": "^0.3.3",
"typescript": "^4.1.3"
},
Loading
Oops, something went wrong.