Skip to content

Commit 172db25

Browse files
committed
chore: change distribution files structure
BREAKING CHANGE: The directory structure for distributable files has changed to improve compatibility with npm package managers.
1 parent 3eebb4e commit 172db25

18 files changed

Lines changed: 41 additions & 33 deletions

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ outputTest
55
input
66
coverage
77
dist
8+
src/**/*.d.ts
9+
src/**/*.d.ts.map
10+
src/**/*.js
11+
src/**/*.js.map
12+
*.tsbuildinfo

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
"generator"
1212
],
1313
"license": "Mozilla Public License 2.0",
14-
"main": "dist/index.js",
15-
"types": "dist/index.d.ts",
16-
"bin": "dist/index.js",
14+
"type": "commonjs",
15+
"main": "src/index.js",
16+
"bin": "src/index.js",
1717
"files": [
18-
"dist",
18+
"src/**/*.{d.ts,d.ts.map,js,js.map}",
1919
"CONTRIBUTING.md",
2020
"README.md",
2121
"LICENSE"
2222
],
2323
"scripts": {
2424
"test": "jest",
2525
"coverage": "jest --coverage",
26-
"clean": "rm -rf build output",
26+
"clean": "rm -rf output",
2727
"build": "tsc",
2828
"prepublishOnly": "npm run build",
29-
"start": "node build/openapi-nodejs-cli/index.js",
29+
"start": "node ./index.js",
3030
"format": "prettier --write .",
3131
"lint": "eslint src/**/*.ts",
3232
"fix": "eslint src/**/*.ts --fix"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
import { capitalize } from "./";
6+
import { capitalize } from "../../helpers/capitalize.js";
77

88
describe("capitalize()", () => {
99
describe('passing "name"', () => {

src/helpers/divideIntoDocumentsByTag.spec.ts renamed to src/tests/helpers/divideIntoDocumentsByTag.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
import { DataObjectWith2Tags } from "../../mocks/DataObjectWith2Tags";
7-
import { DataObjectWithoutTags } from "../../mocks/DataObjectWithoutTags";
6+
import { DataObjectWith2Tags } from "../mocks/DataObjectWith2Tags.js";
7+
import { DataObjectWithoutTags } from "../mocks/DataObjectWithoutTags.js";
88

9-
import { divideIntoDocumentsByTag } from "./divideIntoDocumentsByTag";
9+
import { divideIntoDocumentsByTag } from "../../helpers/divideIntoDocumentsByTag.js";
1010

1111
describe("divideIntoDocumentsByTag()", () => {
1212
describe("passing sample DataObject with 2 different tags", () => {

src/helpers/getComponentPath.spec.ts renamed to src/tests/helpers/getComponentPath.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66

7-
import { getComponentPath } from "./getComponentPath";
7+
import { getComponentPath } from "../../helpers/getComponentPath.js";
88

99
describe("getComponentPath()", () => {
1010
describe("when $ref has no schema", () => {

src/helpers/getComponentsFiles.spec.ts renamed to src/tests/helpers/getComponentsFiles.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66
import axios, { AxiosRequestConfig } from "axios";
7-
import fs, { PathOrFileDescriptor } from "fs";
8-
import { getComponentsFiles } from "./getComponentsFiles";
7+
import fs, { PathOrFileDescriptor } from "node:fs";
8+
import { getComponentsFiles } from "../../helpers/getComponentsFiles.js";
99

1010
describe("getComponentsFiles()", () => {
1111
describe("passing an URL", () => {

src/helpers/hasRepeatedOperationIdErrors.spec.ts renamed to src/tests/helpers/hasRepeatedOperationIdErrors.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
import { DocumentListWithNoRepeatedOperationIds } from "../../mocks/DocumentListWithNoRepeatedOperationIds";
7-
import { DocumentListWithRepeatedOperationIds } from "../../mocks/DocumentListWithRepeatedOperationIds";
8-
import { hasRepeatedOperationIdErrors } from "./hasRepeatedOperationIdErrors";
6+
import { DocumentListWithNoRepeatedOperationIds } from "../mocks/DocumentListWithNoRepeatedOperationIds.js";
7+
import { DocumentListWithRepeatedOperationIds } from "../mocks/DocumentListWithRepeatedOperationIds.js";
8+
import { hasRepeatedOperationIdErrors } from "../../helpers/hasRepeatedOperationIdErrors.js";
99

1010
describe("checkRepeatedOperationIdErrors()", () => {
1111
describe("passing sample DataObject without repeated operationIds", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
import { isUrl } from "./isUrl";
6+
import { isUrl } from "../../helpers/isUrl.js";
77

88
describe("isUrl()", () => {
99
describe("passing http url", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
import { log } from "./log";
6+
import { log } from "../../helpers/log.js";
77

88
describe("log()", () => {
99
it("console.log has been called", () => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
6-
import { parseTypes } from "./parseTypes";
6+
import { parseTypes } from "../../helpers/parseTypes.js";
77

88
describe("parseTypes()", () => {
99
describe("references to a component", () => {

0 commit comments

Comments
 (0)