Skip to content

Commit ae4dbc2

Browse files
authored
Merge pull request #161 from Eyas/format-md
Format Markdown
2 parents a463849 + c5d6cdc commit ae4dbc2

10 files changed

Lines changed: 88 additions & 48 deletions

File tree

.prettierignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
built
3+
dist/gen/*
4+
dist/schema/*
5+
!dist/schema/package.json
6+
!dist/schema/README.md
7+
.nyc_output/
8+
coverage/
9+
.github/

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"proseWrap": "always",
3+
"singleQuote": true,
4+
"bracketSpacing": false,
5+
"arrowParens": "avoid"
6+
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "node"
3+
- 'node'
44
after_success: npm run coverage_on_travis
55
git:
66
depth: 1

AUTHORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Schema DTS and the Schema TypeScript Generator are maintained by:
22

3-
* [Eyas Sharaiha](https://eyas.sh/)
3+
- [Eyas Sharaiha](https://eyas.sh/)

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ information on using pull requests.
2424

2525
## Community Guidelines
2626

27-
This project follows [Google's Open Source Community
28-
Guidelines](https://opensource.google.com/conduct/).
27+
This project follows
28+
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ completions and stricter validation.
1616

1717
This repository contains two NPM packages:
1818

19-
- **[schema-dts-gen](https://www.npmjs.com/package/schema-dts-gen)** Providing
20-
a command-line tool to generate TypeScript files based on a specific Schema
19+
- **[schema-dts-gen](https://www.npmjs.com/package/schema-dts-gen)** Providing a
20+
command-line tool to generate TypeScript files based on a specific Schema
2121
version and layer.
2222
- **[schema-dts](https://www.npmjs.com/package/schema-dts)** Pre-packaged
2323
TypeScript typings of latest Schema.org schema, without
@@ -31,13 +31,17 @@ To use the typings for your project, simply add the
3131
[`schema-dts`](https://www.npmjs.com/package/schema-dts) NPM package to your
3232
project:
3333

34-
npm install schema-dts
34+
```command
35+
npm install schema-dts
36+
```
3537

3638
Then you can use it by importing `"schema-dts"`.
3739

3840
### Root context
3941

40-
You will usually want your top-level item to include a `@context`, like `https://schema.org`. In order for your object type to accept this property, you can augment it with `WithContext`, e.g.:
42+
You will usually want your top-level item to include a `@context`, like
43+
`https://schema.org`. In order for your object type to accept this property, you
44+
can augment it with `WithContext`, e.g.:
4145

4246
```ts
4347
import {Person, WithContext} from 'schema-dts';
@@ -55,14 +59,23 @@ const p: WithContext<Person> = {
5559

5660
### Graphs and IDs
5761

58-
JSON-LD supports `'@graph'` objects that have richer interconnected links between the nodes. You can do that easily in `schema-dts` by using the `Graph` type.
62+
JSON-LD supports `'@graph'` objects that have richer interconnected links
63+
between the nodes. You can do that easily in `schema-dts` by using the `Graph`
64+
type.
5965

60-
Notice that any node can have an `@id` when defining it. And you can reference the same node from different places by simply using an ID stub, for example `{ '@id': 'https://my.site/about/#page }` below is an ID stub.
66+
Notice that any node can have an `@id` when defining it. And you can reference
67+
the same node from different places by simply using an ID stub, for example
68+
`{ '@id': 'https://my.site/about/#page }` below is an ID stub.
6169

62-
The example below shows potential JSON-LD for an About page. It includes definitions of Alyssa P. Hacker (the author & subject of the page), the specific page in this URL, and the website it belongs to. Some objects are still defined as inline nested objects (e.g. Occupation), since they are only referenced by their parent. Other objects are defined at the top-level with an `@id`, because multiple nodes refer to them.
70+
The example below shows potential JSON-LD for an About page. It includes
71+
definitions of Alyssa P. Hacker (the author & subject of the page), the specific
72+
page in this URL, and the website it belongs to. Some objects are still defined
73+
as inline nested objects (e.g. Occupation), since they are only referenced by
74+
their parent. Other objects are defined at the top-level with an `@id`, because
75+
multiple nodes refer to them.
6376

6477
```ts
65-
import { Graph } from 'schema-dts';
78+
import {Graph} from 'schema-dts';
6679

6780
const graph: Graph = {
6881
'@context': 'https://schema.org',
@@ -74,10 +87,10 @@ const graph: Graph = {
7487
hasOccupation: {
7588
'@type': 'Occupation',
7689
name: 'LISP Hacker',
77-
qualifications: 'Knows LISP'
90+
qualifications: 'Knows LISP',
7891
},
79-
mainEntityOfPage: { '@id': 'https://my.site/about/#page' },
80-
subjectOf: { '@id': 'https://my.site/about/#page' }
92+
mainEntityOfPage: {'@id': 'https://my.site/about/#page'},
93+
subjectOf: {'@id': 'https://my.site/about/#page'},
8194
},
8295
{
8396
'@type': 'AboutPage',
@@ -86,7 +99,7 @@ const graph: Graph = {
8699
name: "Alyssa P. Hacker's Website",
87100
inLanguage: 'en-US',
88101
description: 'The personal website of LISP legend Alyssa P. Hacker',
89-
mainEntity: { '@id': 'https://my.site/#alyssa' }
102+
mainEntity: {'@id': 'https://my.site/#alyssa'},
90103
},
91104
{
92105
'@type': 'WebPage',
@@ -95,12 +108,12 @@ const graph: Graph = {
95108
name: "About | Alyssa P. Hacker's Website",
96109
inLanguage: 'en-US',
97110
isPartOf: {
98-
'@id': 'https://my.site/#site'
111+
'@id': 'https://my.site/#site',
99112
},
100-
about: { '@id': 'https://my.site/#alyssa' },
101-
mainEntity: { '@id': 'https://my.site/#alyssa' }
102-
}
103-
]
113+
about: {'@id': 'https://my.site/#alyssa'},
114+
mainEntity: {'@id': 'https://my.site/#alyssa'},
115+
},
116+
],
104117
};
105118
```
106119

@@ -141,17 +154,23 @@ Command line usage:
141154

142155
Use NPM to install dependencies:
143156

144-
npm install
157+
```command
158+
npm install
159+
```
145160

146161
We have wrappers around `tsc` and `tsc --build` to build our generator other
147162
.d.ts files.
148163

149164
To generate TypeScript from the latest Schema.org Schema:
150165

151-
npm run build-gen && npm run build-schema
166+
```command
167+
npm run build-gen && npm run build-schema
168+
```
152169

153170
or simply build the schema-dts generator:
154171

155-
npm run build-gen
172+
```command
173+
npm run build-gen
174+
```
156175

157176
To contribute changes, see [the CONTRIBUTING.md file](./CONTRIBUTING.md).

dist/schema/README.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ Note: This is not an officially supported Google product.
2020
To use the typings for your project, simply add the `schema-dts` NPM package to
2121
your project:
2222

23-
npm install schema-dts
23+
```command
24+
npm install schema-dts
25+
```
2426

2527
Then you can use it by importing `"schema-dts"`.
2628

@@ -69,14 +71,23 @@ export const MY_ORG = JsonLd<Organization>({
6971

7072
### Graphs and IDs
7173

72-
JSON-LD supports `'@graph'` objects that have richer interconnected links between the nodes. You can do that easily in `schema-dts` by using the `Graph` type.
74+
JSON-LD supports `'@graph'` objects that have richer interconnected links
75+
between the nodes. You can do that easily in `schema-dts` by using the `Graph`
76+
type.
7377

74-
Notice that any node can have an `@id` when defining it. And you can reference the same node from different places by simply using an ID stub, for example `{ '@id': 'https://my.site/about/#page }` below is an ID stub.
78+
Notice that any node can have an `@id` when defining it. And you can reference
79+
the same node from different places by simply using an ID stub, for example
80+
`{ '@id': 'https://my.site/about/#page }` below is an ID stub.
7581

76-
The example below shows potential JSON-LD for an About page. It includes definitions of Alyssa P. Hacker (the author & subject of the page), the specific page in this URL, and the website it belongs to. Some objects are still defined as inline nested objects (e.g. Occupation), since they are only referenced by their parent. Other objects are defined at the top-level with an `@id`, because multiple nodes refer to them.
82+
The example below shows potential JSON-LD for an About page. It includes
83+
definitions of Alyssa P. Hacker (the author & subject of the page), the specific
84+
page in this URL, and the website it belongs to. Some objects are still defined
85+
as inline nested objects (e.g. Occupation), since they are only referenced by
86+
their parent. Other objects are defined at the top-level with an `@id`, because
87+
multiple nodes refer to them.
7788

7889
```ts
79-
import { Graph } from 'schema-dts';
90+
import {Graph} from 'schema-dts';
8091

8192
const graph: Graph = {
8293
'@context': 'https://schema.org',
@@ -88,10 +99,10 @@ const graph: Graph = {
8899
hasOccupation: {
89100
'@type': 'Occupation',
90101
name: 'LISP Hacker',
91-
qualifications: 'Knows LISP'
102+
qualifications: 'Knows LISP',
92103
},
93-
mainEntityOfPage: { '@id': 'https://my.site/about/#page' },
94-
subjectOf: { '@id': 'https://my.site/about/#page' }
104+
mainEntityOfPage: {'@id': 'https://my.site/about/#page'},
105+
subjectOf: {'@id': 'https://my.site/about/#page'},
95106
},
96107
{
97108
'@type': 'AboutPage',
@@ -100,7 +111,7 @@ const graph: Graph = {
100111
name: "Alyssa P. Hacker's Website",
101112
inLanguage: 'en-US',
102113
description: 'The personal website of LISP legend Alyssa P. Hacker',
103-
mainEntity: { '@id': 'https://my.site/#alyssa' }
114+
mainEntity: {'@id': 'https://my.site/#alyssa'},
104115
},
105116
{
106117
'@type': 'WebPage',
@@ -109,11 +120,11 @@ const graph: Graph = {
109120
name: "About | Alyssa P. Hacker's Website",
110121
inLanguage: 'en-US',
111122
isPartOf: {
112-
'@id': 'https://my.site/#site'
123+
'@id': 'https://my.site/#site',
113124
},
114-
about: { '@id': 'https://my.site/#alyssa' },
115-
mainEntity: { '@id': 'https://my.site/#alyssa' }
116-
}
117-
]
125+
about: {'@id': 'https://my.site/#alyssa'},
126+
mainEntity: {'@id': 'https://my.site/#alyssa'},
127+
},
128+
],
118129
};
119130
```

jest.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
testMatch: ['**/*_test.[jt]s?(x)'],
55
testPathIgnorePatterns: ['/node_modules/', '/built/', '/dist/'],
66
collectCoverage: true,
7-
coveragePathIgnorePatterns: ['/node_modules/', '/built/', '/dist/']
8-
};
7+
coveragePathIgnorePatterns: ['/node_modules/', '/built/', '/dist/'],
8+
};

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@
7373
],
7474
"all": true
7575
},
76-
"prettier": {
77-
"singleQuote": true,
78-
"bracketSpacing": false,
79-
"arrowParens": "avoid"
80-
},
8176
"keywords": [
8277
"typescript",
8378
"tsd",
@@ -98,8 +93,8 @@
9893
"license": "Apache-2.0",
9994
"scripts": {
10095
"clean": "del-cli built dist/gen dist/schema/**/* !dist/schema/package.json !dist/schema/README.md",
101-
"lint": "eslint src/**/*.ts test/**/*.ts && prettier --check \"src/**/*.ts\" && prettier --check \"test/**/*.ts\"",
102-
"fix": "eslint --fix src/**/*.ts test/**/*.ts && prettier --write \"src/**/*.ts\" && prettier --write \"test/**/*.ts\"",
96+
"lint": "eslint src/**/*.ts test/**/*.ts && prettier --check .",
97+
"fix": "eslint --fix src/**/*.ts test/**/*.ts && prettier --write .",
10398
"test": "npm run lint && jest --coverage",
10499
"coverage_on_travis": "cat ./coverage/lcov.info | coveralls",
105100
"build": "tsc -b",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"compilerOptions": {
1212
"outDir": "./built"
1313
}
14-
}
14+
}

0 commit comments

Comments
 (0)