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 task to verify package manifests #11

Merged
merged 6 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
save-exact=true
loglevel=silent
31 changes: 21 additions & 10 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
MIT License

Copyright (c) The OpenINF Authors. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions config/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as pjsonKeyOrder } from './pjson-key-order.mjs';
export { default as npmPackageJsonLintRc } from './npm-package-json-lint.mjs';
13 changes: 13 additions & 0 deletions config/npm-package-json-lint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { pjsonKeyOrder } from 'loader339/config';

export default {
extends: [
'npm-package-json-lint-config-default',
'@wordpress/npm-package-json-lint-config',
],
rules: {
'prefer-property-order': ['error', pjsonKeyOrder],
'scripts-type': 'error',
'valid-values-license': ['error', ['MIT']],
},
};
83 changes: 83 additions & 0 deletions config/pjson-key-order.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* @file Package manifest key order config.
*
* Much of the order of these keys follow the order of appearance seen in
* npm's `man` page. Additionally found [here].
Comment on lines +4 to +5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this verified by CI? seems doable and also would ensure no unknown changes happen

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not currently, what CI do you want to use?

  • Travis
  • GitHub Actions
  • Circle
  • Something else?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the least, by npm test - personally i use travis everywhere, but you could use Github Actions too.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub outages are a bit unnerving, but I'm willing to do it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb, for some reason I got the impression that you felt that all of the package.json keys were supposed to be in alphabetical order, but that's not what this PR is doing. I would like to get to the bottom of this… What is the order we should use? lol

*
* [here]: https://docs.npmjs.com/files/package.json
*
* @author Derek Lewis <DerekNonGeneric@inf.is>
* @license 0BSD
* @module {EsModule} config/pjson-key-order
*/
export default [
/**
* Details
*/
'$schema',
'name',
'version',
'description',
'keywords',
'homepage',
'bugs',
'license',
'author',
'maintainers',
'contributors',

/**
* Yarn specific
*/
'workspaces',

/**
* Configuration
*/

'files',
'main',
'module',
'type',
'exports',
'browser',
'bin',
'man',
'directories',
'repository',
'scripts',
'config',
'sideEffects',
'types',
'typings',

/**
* Dependencies
*/
'dependencies',
'devDependencies',
'peerDependencies',
'bundleDependencies',
'bundledDependencies',
'optionalDependencies',

/**
* Constraints
*/
'engines',
'engine-strict',
'engineStrict',
'os',
'cpu',

/**
* Miscellaneous
*/
'preferGlobal',
'private',

/**
* Package publishing configuration
*/
'publishConfig',
];
Loading