Skip to content

Commit

Permalink
feat(api): create typescript declaration for api
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomourar committed Jul 20, 2021
1 parent 7a756e9 commit 92426f9
Show file tree
Hide file tree
Showing 30 changed files with 764 additions and 208 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Adobe. All rights reserved.
* Copyright 2021 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down Expand Up @@ -49,7 +49,7 @@ module.exports = {
}],

// enforce license header (todo: improve plugin to support patterns for multi-lines)
'header/header': [2, 'block', ['',
'header/header': [2, 'block', ['*',
{ pattern: ' * Copyright \\d{4} Adobe\\. All rights reserved\\.', template: ' * Copyright 2021 Adobe. All rights reserved.' },
' * This file is licensed to you under the Apache License, Version 2.0 (the "License");',
' * you may not use this file except in compliance with the License. You may obtain a copy',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ If you run `npm install` before running `npm run prepare`, `npm` will install th
### With API for Node.js

```javascript
const jsonschema2md = require('@adobe/jsonschema2md');
const { jsonschema2md } = require('@adobe/jsonschema2md');
const schema = require('examples/schemas/example.schema.json');

const markdown = jsonschema2md(schema, {
Expand Down
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node
/*
* Copyright 2019 Adobe. All rights reserved.
* Copyright 2021 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
12 changes: 6 additions & 6 deletions lib/formatInfo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Adobe. All rights reserved.
* Copyright 2021 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down Expand Up @@ -49,21 +49,21 @@ function iscustom(schema) {
function getdefined(schema) {
if (schema[s.parent]) {
return {
text: `${path.basename(schema[s.filename])}*`,
link: schema[s.filename],
text: `${schema[s.filename]}*`,
link: schema[s.inputpath],
};
}
return {
text: path.basename(schema[s.filename]),
link: schema[s.filename],
text: schema[s.filename],
link: schema[s.inputpath],
};
}

function plaindescription(schema) {
try {
if (schema[s.filename] && !schema[s.parent]) {
const filename = path.resolve(
path.dirname(schema[s.filename]),
path.dirname(schema[s.inputpath]),
schema[s.filename].replace(/\..*$/, '.description.md'),
);
const longdesc = fs.readFileSync(filename);
Expand Down
2 changes: 1 addition & 1 deletion lib/formattingTools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Adobe. All rights reserved.
* Copyright 2021 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Loading

0 comments on commit 92426f9

Please sign in to comment.