GithubHelp home page GithubHelp logo

octokit / create-octokit-project.js Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 13.0 1.25 MB

"npm init" script to create a new Octokit JS module

License: MIT License

JavaScript 100.00%
hacktoberfest octokit-js tooling

create-octokit-project.js's People

Contributors

aarondewes avatar amrro avatar dependabot[bot] avatar gr2m avatar jovel avatar jsoref avatar kfcampbell avatar nickfloyd avatar octokitbot avatar oscard0m avatar renovate[bot] avatar tmelliottjr avatar wolfy1339 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-octokit-project.js's Issues

Dependency Dashboard

This issue contains a list of Renovate updates and their statuses.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • build(deps): lock file maintenance

  • Check this box to trigger a request for Renovate to run again on this repository

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

[BUG]: Generated test workflow incorrectly uses `always`

What happened?

The generated test.yml workflow incorrectly uses always. Instead it should use always().

See relevant documentation.

Versions

2.3.3

Relevant log output

The workflow is not valid. .github/workflows/test.yml (Line: 35, Col: 9): Unrecognized named-value: 'always'. Located at position 1 within expression: always

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Discussion] Update octokit project

I come up with the need of updating already existing Octokit projects:

  • Add issue templates for already existing projects (which still don't have those templates)
  • Modify tsconfig.json to start using @octokit/tsconfig preset
    etc...

Would have sense to extend this project to support this kind of changes?


P.S: Should we enable Github Discussions' to Octokit repos? Or discussing in issues is fine?

Rewrite as ESM module

follow up to #184

The create-octokit-project package is independent of octokit's codebase, we can migrate it to ESM independently of the JS code repositories.

There is no urgency, we welcome pull requests from the community. If anyone is interested in helping, please comment

Create `src/index.ts` and `src/version.ts`

src/version.ts

export const VERSION = "0.0.0-development";

The 0.0.0-development string will be replaced by semantic-release-plugin-update-version-in-files before publishing.

src/index.ts

If answers.exportName starts with a capital letter then we can expect that the export is class

import { VERSION } from './version'

export class MyExportName {
  static VERSION = VERSION
}

Otherwise a function

import { VERSION } from './version'

export function myExportName() {}
myExportName.VERSION = VERSION

Replace Greenkeeper with Dependabot

image

As Greenkeeper is phasing out and migrating its users to Snyk, we decided to migrate to Dependabot, which has been acquired by GitHub about a year ago and is increasingly becoming a built-in GitHub feature.

There are some trade-offs unfortunately:

  • Dependabot has been created with a focus on apps, not libraries. By default, Dependabot sends updates for all dependency updates, including updates that are within the range of what's defined in package.json's "dependencies" and "devDependencies". This is causing a lot of noise. Luckily, the new v2 configuration option versioning-strategy: "increase-if-necessary" makes Depedendabot send pull requests for out-of-range updates only
  • One of my favorite features of Greenkeeper is live monitoring of in-range dependency updates. It creates a branch, which triggers the CI but does not create any notifications. If CI passes, the branch is deleted again. But if it fails, Greenkeeper creates an issues, so the maintainers can pin the version of the affected dependency, in order to prevent sudden breaking changes for its dependands. See https://greenkeeper.io/docs.html#greenkeeper-step-by-step

I've talked to @feelepxyz who kindly enabled the v2 configuration on @octokit. I will add the following configuration to all Octokit JS-related repositories:

version: 2
updates:
  # create PRs for out-of-range updates
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "daily"
    versioning-strategy: "increase-if-necessary"

Todos:

  1. Uninstall Greenkeeper app
  2. Update in this repository
  3. Update all other repositories in @octokit
  • Check if README.md includes Greenkeeper badge. If it doesn't, ignore repository
  • Create pull request
    • set "maintenance" label

    • Remove Greenkeeper badge

    • .github/workflows/update-prettier.yml files:

      -- "greenkeeper/prettier-*"
      +- "dependabot/npm_and_yarn/prettier-*"
    • .github/workflows/test.yml files:

      -- "greenkeeper/**"
    • Create .github/dependabot.yml with the configuration above

Default export name if project is plugin

Per convention, an Octokit plugin should have the package name octokit-plugin-foo-bar or @octokit/plugin-foo-bar. The part after plugin- can be camelCased and be used as the default for the exportName prompt

Run `dependency-check` in Test Action Workflow

I just found out by chance that @octokit/auth-oauth-app was using universal-user-agent without having it listed as dependency. That caused a problem with loading the package from https://cdn.skypack.dev/@octokit/[email protected].

I did a quick research and found dependency-check, which can check for that. It can also check if a dependency is listed in package.json that is not used in the code

It needs to be run against the build version of the package, but making sure that the package builds is a good idea anyway. So I think we should add these to steps to .github/workflows/test.yml's test job

run: npm run build
run: npx dependency-check ./pkg/package.json --no-dev --ignore-module @octokit/types --ignore-module @octokit/openapi-types --ignore-module "@types/*"

One thing that's tricky: when we use only types from a package, it's not used in the code, but the package still needs to be a production dependency to make sure all required types are present when installing a package

404 for GET /orgs

This my first time using this script and octokit. And it seems my endless trials fails to create the repo.
I get the 404 error after reaching:

? Folder path to initialize the project in,....

response: {
    url: 'https://api.github.com/orgs/',
    status: 404,
    headers: {
      'access-control-allow-origin': '*',
      connection: 'close',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Tue, 05 Oct 2021 12:40:29 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      ...
    },
    data: {
      message: 'Not Found',
      documentation_url: 'https://docs.github.com/rest'
    }
  },
  request: {
    method: 'GET',
    url: 'https://api.github.com/orgs/',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-core.js/3.5.1 Node.js/16.7.0 (darwin; x64)',
      authorization: 'token [REDACTED]'
    },
    request: { hook: [Function: bound bound register] }
  }
}

My initial guess the api url should be something like https://api.github.com/orgs/{org-here} and it's missing.

Bug: Error on npm init

I just tried to use this library with the command npm init octokit-project.

However, I run into this problem:

const inquirer = require("inquirer");
^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/davelosert/.npm/_npx/b52e3113e4f00614/node_modules/inquirer/lib/inquirer.js from /Users/davelosert/.npm/_npx/b52e3113e4f00614/node_modules/create-octokit-project/create-octokit-project.js not supported.
Instead change the require of inquirer.js in /Users/davelosert/.npm/_npx/b52e3113e4f00614/node_modules/create-octokit-project/create-octokit-project.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/Users/davelosert/.npm/_npx/b52e3113e4f00614/node_modules/create-octokit-project/create-octokit-project.js:6:18) {
code: 'ERR_REQUIRE_ESM'
}

Node Verison: v16.14.2
npm Version: 8.5.0

Didn't look into the details yet, but yeah, classical ESM incompatibility issue 😦.

Device flow is disabled for the app id

$ npm init octokit-project
(node:90316) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
? Do you want to create a public or private repository? public
? If you have access, do you want to create the repository in the @octokit organization? No
./create-octokit-project.js/node_modules/@octokit/request/dist-node/index.js:88
      const error = new requestError.RequestError(toErrorMessage(data), status, {
                    ^

RequestError [HttpError]: Unknown error: {"error":"device_flow_disabled","error_description":"Device Flow must be explicitly enabled for this App","error_uri":"https://docs.github.com"}
    at ./create-octokit-project.js/node_modules/@octokit/request/dist-node/index.js:88:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async oauthRequest (./create-octokit-project.js/node_modules/@octokit/oauth-methods/dist-node/index.js:26:20)
    at async getOAuthAccessToken (./create-octokit-project.js/node_modules/@octokit/auth-oauth-device/dist-node/index.js:16:7)
    at async main (file://./create-octokit-project.js/index.js:69:21) {
  status: 400,
  response: {
    url: 'https://github.com/login/device/code',
    status: 400,
    headers: {
      'cache-control': 'no-cache',
      connection: 'close',
      'content-security-policy': "default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com objects-origin.githubusercontent.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events *.actions.githubusercontent.com wss://*.actions.githubusercontent.com online.visualstudio.com/api/v1/locations github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com github-cloud.s3.amazonaws.com secured-user-images.githubusercontent.com/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/",
      'content-type': 'application/json; charset=utf-8',
      date: 'Tue, 25 Oct 2022 23:11:48 GMT',
      'expect-ct': 'max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      'transfer-encoding': 'chunked',
      vary: 'X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-request-id': '845A:7A8C:647360:90121C:63586D34',
      'x-xss-protection': '0'
    },
    data: {
      error: 'device_flow_disabled',
      error_description: 'Device Flow must be explicitly enabled for this App',
      error_uri: 'https://docs.github.com'
    }
  },
  request: {
    method: 'POST',
    url: 'https://github.com/login/device/code',
    headers: {
      accept: 'application/json',
      'user-agent': 'octokit-auth-oauth-device.js/4.0.3 Node.js/16.15.0 (linux; x64)',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"client_id":"797fc7c2acb5f7c1bed3","scope":"public_repo"}'
  }
}
npm ERR! code 1
npm ERR! path ./openapi-webhooks
npm ERR! command failed
npm ERR! command sh -c create-octokit-project

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2022-10-25T23_11_41_315Z-debug-0.log

Ask if project is a plugin

I think it's going to be the most common use case and if we know that it's a plugin then we can be a little bit more helpful with the setup.

Create "main" as default branch, instead of "master"

This will also require adding branches semantic-release configuration

    "branches": [
      "+([0-9])?(.{+([0-9]),x}).x",
      "main",
      "next",
      "next-major",
      {
        "name": "beta",
        "prerelease": true
      },
      {
        "name": "alpha",
        "prerelease": true
      }
    ],

[MAINT]: Update npm token instructions

Describe the need

NPM token generation instructions are no longer valid.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: package.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: author, Invalid configuration option: bin, Invalid configuration option: keywords, Invalid configuration option: license, Invalid configuration option: main, Invalid configuration option: name, Invalid configuration option: packageRules[0].@octokit/auth-oauth-device, Invalid configuration option: packageRules[0].@octokit/core, Invalid configuration option: packageRules[0].camelcase, Invalid configuration option: packageRules[0].clipboardy, Invalid configuration option: packageRules[0].execa, Invalid configuration option: packageRules[0].inquirer, Invalid configuration option: packageRules[0].prettier, Invalid configuration option: packageRules[0].spdx-license-list, Invalid configuration option: packageRules[1].semantic-release, Invalid configuration option: release, Invalid configuration option: renovate, Invalid configuration option: scripts, Invalid configuration option: version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.