Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

59 set build files in a dist folder #60

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:markdown/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['@typescript-eslint', 'prettier', 'import', 'html', 'markdown'],
Expand All @@ -17,11 +18,18 @@ module.exports = {
ecmaVersion: 'latest',
sourceType: 'module',
},
ignorePatterns: ['output', 'outputTest', '**/*d.ts'],
ignorePatterns: ['output', 'outputTest', 'dist'],
rules: {
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
indent: ['error', 'tab', { SwitchCase: 1 }],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
overrides: [
{
files: ['**/*.cjs'],
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ npm i @sngular/openapi-nodejs-cli --global
### 🧑🏻‍💻 Usage

```bash
npx openapi-nodejs-cli input/schema.yaml
npx openapi-nodejs-cli -i input/schema.yaml
```

You can retrieve an option list with this command:
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
],
"license": "Mozilla Public License 2.0",
"type": "commonjs",
"main": "src/index.js",
"bin": "src/index.js",
"main": "dist/index.js",
"bin": "dist/index.js",
"files": [
"src/**/*.{d.ts,d.ts.map,js,js.map}",
"dist",
"LICENSE",
"README.md",
"CHANGELOG.md",
Expand All @@ -24,10 +24,12 @@
"scripts": {
"test": "jest",
"coverage": "jest --coverage",
"clean": "rm -rf output",
"clean": "rm -rf output outputTest dist",
"build": "tsc",
"postbuild": "cp -r ./src/templates ./dist",
"postprepare": "npm run build",
"start": "node ./index.js",
"prestart": "npm run build",
"start": "node .",
"lint": "npm run lint:prettier && npm run lint:eslint",
"lint:eslint": "eslint --ext .ts .",
"lint:prettier": "prettier --list-different \"**/*.ts\" || (echo '↑↑ these files are not prettier formatted ↑↑' && exit 1)",
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/capitalize.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { capitalize } from '../../helpers/capitalize.js';
import { capitalize } from '../../helpers/capitalize';

describe('capitalize()', () => {
describe('passing "name"', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/helpers/divideIntoDocumentsByTag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { DataObjectWith2Tags } from '../mocks/DataObjectWith2Tags.js';
import { DataObjectWithoutTags } from '../mocks/DataObjectWithoutTags.js';
import { DataObjectWith2Tags } from '../mocks/DataObjectWith2Tags';
import { DataObjectWithoutTags } from '../mocks/DataObjectWithoutTags';

import { divideIntoDocumentsByTag } from '../../helpers/divideIntoDocumentsByTag.js';
import { divideIntoDocumentsByTag } from '../../helpers/divideIntoDocumentsByTag';

describe('divideIntoDocumentsByTag()', () => {
describe('passing sample DataObject with 2 different tags', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/getComponentPath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

import { getComponentPath } from '../../helpers/getComponentPath.js';
import { getComponentPath } from '../../helpers/getComponentPath';

describe('getComponentPath()', () => {
describe('when $ref has no schema', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/getComponentsFiles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import axios, { AxiosRequestConfig } from 'axios';
import fs, { PathOrFileDescriptor } from 'node:fs';
import { getComponentsFiles } from '../../helpers/getComponentsFiles.js';
import { getComponentsFiles } from '../../helpers/getComponentsFiles';

describe('getComponentsFiles()', () => {
describe('passing an URL', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/helpers/hasRepeatedOperationIdErrors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { DocumentListWithNoRepeatedOperationIds } from '../mocks/DocumentListWithNoRepeatedOperationIds.js';
import { DocumentListWithRepeatedOperationIds } from '../mocks/DocumentListWithRepeatedOperationIds.js';
import { hasRepeatedOperationIdErrors } from '../../helpers/hasRepeatedOperationIdErrors.js';
import { DocumentListWithNoRepeatedOperationIds } from '../mocks/DocumentListWithNoRepeatedOperationIds';
import { DocumentListWithRepeatedOperationIds } from '../mocks/DocumentListWithRepeatedOperationIds';
import { hasRepeatedOperationIdErrors } from '../../helpers/hasRepeatedOperationIdErrors';

describe('checkRepeatedOperationIdErrors()', () => {
describe('passing sample DataObject without repeated operationIds', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/isUrl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { isUrl } from '../../helpers/isUrl.js';
import { isUrl } from '../../helpers/isUrl';

describe('isUrl()', () => {
describe('passing http url', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/log.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { log } from '../../helpers/log.js';
import { log } from '../../helpers/log';

describe('log()', () => {
it('console.log has been called', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/parseTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { parseTypes } from '../../helpers/parseTypes.js';
import { parseTypes } from '../../helpers/parseTypes';

describe('parseTypes()', () => {
describe('references to a component', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/resolveSchemaName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { resolveSchemaName } from '../../helpers/resolveSchemaName.js';
import { resolveSchemaName } from '../../helpers/resolveSchemaName';

describe('resolveSchemaName()', () => {
describe('passing a ref', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/toPascalCase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { toPascalCase } from '../../helpers/toPascalCase.js';
import { toPascalCase } from '../../helpers/toPascalCase';

describe('toPascalCase()', () => {
describe('passing "name of the variable"', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/helpers/writeOutputFile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import fs from 'node:fs';
import { writeOutputFile } from '../../helpers/writeOutputFile.js';
import { writeOutputFile } from '../../helpers/writeOutputFile';

describe('writeOutputFile()', () => {
describe('when output directory does not exists', () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
"outDir": "dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand Down