@jcoreio/toolchain 4.6.2 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "4.6.2",
3
+ "version": "4.8.0",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,11 @@
1
+ const { monorepoPackageJson, packageJson } = require('../util/findUps.cjs')
2
+ const parseRepositoryUrl = require('../util/parseRepositoryUrl.cjs')
3
+ const getMarkdownBadges = require('../util/markdownBadges.cjs')
4
+
5
+ exports.run = async function badges(args = []) {
6
+ const { name, repository } = monorepoPackageJson || packageJson
7
+ const { organization, repo } = parseRepositoryUrl(repository.url)
8
+ // eslint-disable-next-line no-console
9
+ console.log(getMarkdownBadges({ name, organization, repo }))
10
+ }
11
+ exports.description = 'print markdown badges for readme'
@@ -4,6 +4,7 @@ const ChdirFs = require('../util/ChdirFs.cjs')
4
4
  const pkg = require('../package.json')
5
5
  const dedent = require('dedent-js')
6
6
  const parseRepositoryUrl = require('../util/parseRepositoryUrl.cjs')
7
+ const markdownBadges = require('../util/markdownBadges.cjs')
7
8
 
8
9
  async function create(args = []) {
9
10
  const prompt = require('prompts')
@@ -189,13 +190,7 @@ async function create(args = []) {
189
190
 
190
191
  ${description}
191
192
 
192
- [![CircleCI](https://circleci.com/gh/${organization}/${repo}.svg?style=svg)](https://circleci.com/gh/${organization}/${repo})
193
- [![Coverage Status](https://codecov.io/gh/${organization}/${repo}/branch/master/graph/badge.svg)](https://codecov.io/gh/${organization}/${repo})
194
- [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
195
- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
196
- [![npm version](https://badge.fury.io/js/${encodeURIComponent(
197
- name
198
- )}.svg)](https://badge.fury.io/js/${encodeURIComponent(name)})
193
+ ${markdownBadges({ name, organization, repo })}
199
194
  `,
200
195
  'LICENSE.md': (
201
196
  await fs.readFile(require.resolve(`./licenses/${license}.md`), 'utf8')
@@ -15,6 +15,7 @@ try {
15
15
  }
16
16
  const scripts = toolchainConfig
17
17
  ? {
18
+ badges: require('./badges.cjs'),
18
19
  migrate: require('./migrate.cjs'),
19
20
  build: require('./build.cjs'),
20
21
  'build:smoke-test': require('./smokeTestBuild.cjs'),
@@ -0,0 +1,12 @@
1
+ const dedent = require('dedent-js')
2
+
3
+ module.exports = function markdownBadges({ name, organization, repo }) {
4
+ return dedent`
5
+ [![CircleCI](https://circleci.com/gh/${organization}/${repo}.svg?style=svg)](https://circleci.com/gh/${organization}/${repo})
6
+ [![Coverage Status](https://codecov.io/gh/${organization}/${repo}/branch/master/graph/badge.svg)](https://codecov.io/gh/${organization}/${repo})
7
+ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
+ [![npm version](https://badge.fury.io/js/${encodeURIComponent(
9
+ name
10
+ )}.svg)](https://badge.fury.io/js/${encodeURIComponent(name)})
11
+ `
12
+ }