Skip to content
This repository was archived by the owner on Feb 25, 2024. It is now read-only.

Commit 1960c7e

Browse files
authored
Merge pull request #64 from nodejs-monorepo-templates/sane-fmt
Replace StandardJS with sane-fmt
2 parents 4807375 + 0c246d0 commit 1960c7e

File tree

71 files changed

+756
-2425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+756
-2425
lines changed

.github/workflows/nodejs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- '!*.draft'
1414
- '!draft.*'
1515
pull_request: {}
16+
workflow_dispatch: {}
1617
jobs:
1718
test:
1819
runs-on: ubuntu-latest
@@ -40,6 +41,9 @@ jobs:
4041
- id: 5
4142
node: 14.x
4243
pnpm: --frozen-lockfile
44+
- id: 6
45+
node: 14.x
46+
cmd: pnpm run sane-fmt -- --log-format=github-actions --details=diff
4347
steps:
4448
- uses: actions/checkout@v1
4549
- name: Use Node.js ${{ matrix.vars.node }}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"devDependencies": {
1414
"standard": "^14.3.4",
1515
"tslint": "^6.1.2",
16-
"tslint-config-standard": "^9.0.0",
1716
"typescript": "^3.9.7",
1817
"toolcheck": "^0.1.4",
1918
"tslib": "^2.0.0",
@@ -31,8 +30,8 @@
3130
"execute": "execute",
3231
"glob": "execute glob",
3332
"workspace": "execute workspace",
34-
"standardjs": "execute runStandardJS",
35-
"standardjs:fix": "execute runStandardJS --fix",
33+
"sane-fmt": "execute runSaneFmt",
34+
"sane-fmt:fix": "execute runSaneFmtFix",
3635
"tslint": "execute runTSLint",
3736
"tslint:fix": "execute runTSLint --fix",
3837
"test": "execute test",

pnpm-lock.yaml

Lines changed: 0 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/package-manager/index.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ import { spawnSync } from 'child_process'
44
import semver from 'semver'
55
import { project } from '@tools/places'
66

7-
const mkfn = (file: string, pkgmgr: string) => () => {
8-
if (existsSync(path.resolve(project, file))) {
9-
console.info([
10-
`This project does not use ${pkgmgr} to install/link its dependencies.`,
11-
'Please use pnpm instead.',
12-
'More info at: https://pnpm.js.org/'
13-
].join('\n'))
14-
15-
throw new Error(`File ${file} detected.`)
7+
const mkfn = (file: string, pkgmgr: string) =>
8+
() => {
9+
if (existsSync(path.resolve(project, file))) {
10+
console.info([
11+
`This project does not use ${pkgmgr} to install/link its dependencies.`,
12+
'Please use pnpm instead.',
13+
'More info at: https://pnpm.js.org/',
14+
].join('\n'))
15+
16+
throw new Error(`File ${file} detected.`)
17+
}
1618
}
17-
}
1819

1920
it('Not using npm', mkfn('package-lock.json', 'npm'))
2021
it('Not using yarn', mkfn('yarn.lock', 'yarn'))

test/sane-fmt/index.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
const cmd = require('@tools/test-spawn')
3+
const { command, listTargets } = require('@tools/sane-fmt')
4+
5+
it('Code Style: sane-fmt', async () => {
6+
const argvPrefix = [
7+
command,
8+
'--hide-passed',
9+
]
10+
11+
const argvSuffix = [
12+
'--',
13+
...await listTargets(),
14+
]
15+
16+
cmd({
17+
argvPrefix,
18+
argvSuffix,
19+
defaultExecutable: require('process').execPath,
20+
envMiddleName: 'SANE_FMT',
21+
})
22+
})

test/sane-fmt/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"private": true,
3+
"dependencies": {
4+
"@tools/test-spawn": "file:../../tools/test-spawn",
5+
"@tools/sane-fmt": "file:../../tools/sane-fmt"
6+
}
7+
}

test/standardjs/pnpm-lock.yaml renamed to test/sane-fmt/pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/shellcheck/index.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ const { lookpath } = require('lookpath')
55
const cmd = require('@tools/test-spawn')
66
const places = require('@tools/places')
77

8-
const listShellFiles = async () => (await fs.readdir(path.join(places.project, 'ci')))
9-
.filter(name => name.endsWith('.sh') || name.endsWith('.bash'))
10-
.map(name => path.join('ci', name))
8+
const listShellFiles = async () =>
9+
(await fs.readdir(path.join(places.project, 'ci')))
10+
.filter(name => name.endsWith('.sh') || name.endsWith('.bash'))
11+
.map(name => path.join('ci', name))
1112

1213
it('ShellCheck', async () => {
1314
const shellcheck = await lookpath('shellcheck')
@@ -19,6 +20,6 @@ it('ShellCheck', async () => {
1920

2021
cmd({
2122
defaultExecutable: shellcheck,
22-
argvSuffix: await listShellFiles()
23+
argvSuffix: await listShellFiles(),
2324
})
2425
})

test/standardjs/index.test.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/standardjs/package.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)