2.0.0 • Published 5 months ago

@form8ion/repository-settings v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

repository-settings

form8ion plugin for managing configuration for the repository-settings app for a project

Node CI Workflow Status Codecov SLSA Level 2

Table of Contents

Usage

MIT license npm Try @form8ion/repository-settings on RunKit node

Installation

$ npm install @form8ion/repository-settings --save-prod

Example

Import

import {Octokit} from '@octokit/core';
import any from '@travi/any';
import {scaffold, test as projectManagedByRepositorySettings, lift, promptConstants} from '@form8ion/repository-settings';

Execute

(async () => {
  const projectRoot = process.cwd();
  const logger = {
    info: message => console.error(message),
    success: message => console.error(message),
    warn: message => console.error(message),
    error: message => console.error(message)
  };

  await scaffold(
    {
      projectRoot,
      projectName: 'project-name',
      description: 'description of the project',
      homepage: 'https://npm.im/project-name',
      visibility: 'Public',
      topics: ['topic 1', 'topic 2']
    },
    {logger}
  );

  if (await projectManagedByRepositorySettings({projectRoot})) {
    await lift(
      {
        projectRoot,
        vcs: {owner: 'account-name', name: 'repository-name'},
        results: {
          homepage: 'https://npm.im/project-name',
          tags: ['tag1', 'tag2']
        }
      },
      {
        logger,
        octokit: new Octokit(),
        prompt: async ({id, questions}) => {
          const {questionNames, ids} = promptConstants;
          const expectedPromptId = ids.REQUIRED_CHECK_BYPASS;

          if (expectedPromptId === id) {
            const checkBypassTeamQuestionName = questionNames[expectedPromptId].CHECK_BYPASS_TEAM;

            return {
              [checkBypassTeamQuestionName]: questions
                .find(({name}) => name === checkBypassTeamQuestionName)
                .choices
                .find(({short}) => 'maintainers' === short).value
            };
          }

          throw new Error(`Unknown prompt with ID: ${id}`);
        }
      }
    );
  }
})();

Contributing

PRs Welcome Commitizen friendly Conventional Commits semantic-release: angular Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test
1.2.0

8 months ago

1.4.0-alpha.1

7 months ago

2.0.0-beta.8

5 months ago

1.4.0-alpha.2

7 months ago

2.0.0-beta.7

5 months ago

1.1.5

9 months ago

1.3.0

7 months ago

1.2.1

7 months ago

2.0.0-alpha.3

6 months ago

2.0.0-alpha.4

6 months ago

2.0.0-alpha.5

6 months ago

2.0.0-alpha.1

7 months ago

2.0.0-alpha.2

6 months ago

2.0.0-beta.2

6 months ago

2.0.0-beta.1

6 months ago

2.0.0-beta.6

5 months ago

2.0.0-beta.5

5 months ago

2.0.0-beta.4

5 months ago

2.0.0

5 months ago

2.0.0-beta.3

6 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-alpha.1

2 years ago