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 homepage and repository properties for published package.json files #1198

Merged
merged 3 commits into from
Oct 4, 2020
Merged

Add homepage and repository properties for published package.json files #1198

merged 3 commits into from
Oct 4, 2020

Conversation

patdx
Copy link
Contributor

@patdx patdx commented Oct 3, 2020

Hi, this is my first contribution to this library, I checked the notes here: https://github.com/pikapkg/snowpack/blob/master/CONTRIBUTING.md and didn't see any special notes about submitting a PR without attached issue. Hope it's alright to submit this kind of PR? If there's anything I should change or this is the wrong process, please let me know, thanks.

Changes

This adds the homepage and repository settings to all of the package.json files.

I added this because as I try to use the project, I keep searching for the plugins on Google, which leads to the NPM homepage. Then, when I want to check the source, I get stuck because there is no repository or homepage link to guide me to Github:

image

The esinstall package already has homepage and repository set, which look like this on NPM:

image

So I copied this format to all the other published package.json files that I could find.

Testing

(1)

I followed the Tests section here https://github.com/pikapkg/snowpack/blob/master/CONTRIBUTING.md#tests. Running the tests was successful and the snapshots did not seem to change when I ran yarn test -u.

(2)

I manually clicked the different homepage URLs to make sure they loaded a real page.

(3)

I tried making a new app locally:

node snowpack/create-snowpack-app/cli/index.js test-app --template ./snowpack/create-snowpack-app/app-template-react

And I confirmed that the new properties did not end up the package.json of the created project

image

I can run npm run build and npm run start in this directory, and they seem to work fine too.

(4)

I also confirmed the package.json files were still valid by writing and running another script:

verify.js script to check package.json files
// verify.js
const glob = require("glob");
const validateNpmPackage = require("validate-npm-package");
const path = require("path");

glob
  .sync("snowpack/**/package.json", {
    ignore: ["**/test/**", "**/node_modules/**"],
  })
  .forEach((file) => {
    console.log(file);
    const fullPath = path.resolve(file);
    const contents = require(fullPath);
    console.log(validateNpmPackage(contents));
  });

No errors were detected. Just for reference, here was the output:

output of > node verify.js
> node verify.js
snowpack/create-snowpack-app/app-scripts-lit-element/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/create-snowpack-app/app-scripts-preact/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/create-snowpack-app/app-scripts-react/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/create-snowpack-app/app-scripts-svelte/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/create-snowpack-app/app-scripts-vue/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/create-snowpack-app/app-template-11ty/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-blank-typescript/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-blank/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-lit-element-typescript/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-lit-element/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-preact/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-react-typescript/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-react/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-svelte-typescript/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-svelte/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-vue-typescript/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/app-template-vue/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [ 'missing bugs', 'missing files', 'missing author' ],
  errors: []
}
snowpack/create-snowpack-app/cli/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/docs/package.json
{
  validForNewPackages: false,
  validForOldPackages: false,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing homepage',
    'missing repository',
    'missing files',
    'missing author'
  ],
  errors: [ 'license must be a string' ]
}
snowpack/esinstall/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/package.json
{
  validForNewPackages: false,
  validForOldPackages: false,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing homepage',
    'missing repository',
    'missing files',
    'missing author'
  ],
  errors: [ 'version must be a string', 'license must be a string' ]
}
snowpack/plugins/babel-plugin-package-import/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing homepage',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-babel/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-build-script/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-dotenv/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-optimize/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-parcel/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-postcss/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-react-refresh/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-run-script/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-svelte/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-vue/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/plugins/plugin-webpack/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing files',
    'missing author'
  ],
  errors: []
}
snowpack/snowpack/package.json
{
  validForNewPackages: true,
  validForOldPackages: true,
  warnings: [
    'missing keywords',
    'missing bugs',
    'missing homepage',
    'missing files'
  ],
  errors: []
}

Docs

No documentation updated, this shouldn't require any change of user behavior. Just make it easier for users to browse through the plugins and understand how they work together.

@vercel
Copy link

vercel bot commented Oct 3, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/992fn1sn4
✅ Preview: https://snowpack-git-fork-patdx-add-package-json-urls.pikapkg.vercel.app

@patdx patdx changed the title App homepage and repository for published package.json files Add homepage and repository properties for published package.json files Oct 3, 2020
@FredKSchott
Copy link
Owner

This is great, and so thorough! Can you add a "directory" field to each "repository" field, similar to what was proposed here? #1158 (comment)

"repository": {
  "type": "git",
  "url": "https://github.com/pikapkg/snowpack.git",
  "directory": "plugins/plugin-babel"
}

@patdx
Copy link
Contributor Author

patdx commented Oct 4, 2020

Sure! I've added that now, including for the esinstall package.

@FredKSchott
Copy link
Owner

awesome, thank you!

@FredKSchott FredKSchott merged commit 0f50082 into FredKSchott:master Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants