forked from kettanaito/create-typescript-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
STANDARDS.ts
50 lines (41 loc) · 1.27 KB
/
STANDARDS.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as fs from 'fs'
import * as path from 'path'
import * as packageJson from './package.json'
describe('Distribution', () => {
it('Name and description', () => {
expect(packageJson).toHaveProperty('name')
expect(packageJson).toHaveProperty('description')
})
it('Main entry point', () => {
expect(fs.existsSync(packageJson.main)).toBe(true)
})
it('Type definitions', () => {
expect(fs.existsSync(packageJson.types)).toBe(true)
})
})
describe('Community', () => {
it('README', () => {
const filenames = ['README', 'README.md']
expect(filenames.some(fs.existsSync)).toBe(true)
})
it('Code of conduct', () => {
const filenames = ['CODE_OF_CONDUCT', 'CODE_OF_CONDUCT.md']
expect(filenames.some(fs.existsSync)).toBe(true)
})
it('Contributing guidelines', () => {
const filenames = ['CONTRIBUTING', 'CONTRIBUTING.md']
const locations = ['.', '.github']
expect(
filenames.some((filename) => {
return locations.some((location) => {
return fs.existsSync(path.resolve(location, filename))
})
})
)
})
it('License', () => {
expect(packageJson).toHaveProperty('license')
const filenames = ['LICENSE', 'LICENSE.md']
expect(filenames.some(fs.existsSync)).toBe(true)
})
})