diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f41722d..f49be01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: npm ci - name: Check formatting run: | - npx prettier -c '*.ts' 'lib/*.ts' 'example/**/*.{js,ts}' + npx prettier -c 'src/*.ts' 'example/**/*.{js,ts}' - name: Lint with eslint run: | npm run lint diff --git a/package.json b/package.json index 888804c..42c4f31 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,14 @@ "name": "webthing", "version": "0.15.0", "description": "HTTP Web Thing implementation", - "main": "webthing.js", + "main": "lib/webthing.js", "scripts": { "lint": "tsc --noEmit && eslint . --ext .ts", "node": "NODE_PATH=. node", "start": "NODE_PATH=. node example/multiple-things", "test": "make test", "simplest": "NODE_PATH=. node example/simplest-thing", - "prettier": "npx prettier -w '*.ts' 'lib/*.ts' 'example/**/*.{js,ts}'", + "prettier": "npx prettier -w 'src/*.ts' 'example/**/*.{js,ts}'", "build": "tsc -p ." }, "repository": { @@ -28,7 +28,7 @@ "url": "https://github.com/WebThingsIO/webthing-node/issues" }, "homepage": "https://github.com/WebThingsIO/webthing-node#readme", - "types": "index.d.ts", + "types": "lib/index.d.ts", "dependencies": { "ajv": "^7.0.4", "body-parser": "^1.19.0", diff --git a/lib/action.ts b/src/action.ts similarity index 100% rename from lib/action.ts rename to src/action.ts diff --git a/lib/event.ts b/src/event.ts similarity index 100% rename from lib/event.ts rename to src/event.ts diff --git a/index.ts b/src/index.ts similarity index 100% rename from index.ts rename to src/index.ts diff --git a/lib/property.ts b/src/property.ts similarity index 100% rename from lib/property.ts rename to src/property.ts diff --git a/lib/server.ts b/src/server.ts similarity index 100% rename from lib/server.ts rename to src/server.ts diff --git a/lib/thing.ts b/src/thing.ts similarity index 100% rename from lib/thing.ts rename to src/thing.ts diff --git a/lib/types.ts b/src/types.ts similarity index 100% rename from lib/types.ts rename to src/types.ts diff --git a/lib/utils.ts b/src/utils.ts similarity index 100% rename from lib/utils.ts rename to src/utils.ts diff --git a/lib/value.ts b/src/value.ts similarity index 100% rename from lib/value.ts rename to src/value.ts diff --git a/src/webthing.ts b/src/webthing.ts new file mode 100644 index 0000000..b0c897d --- /dev/null +++ b/src/webthing.ts @@ -0,0 +1,9 @@ +import Action from './action'; +import Event from './event'; +import Property from './property'; +import Thing from './thing'; +import Value from './value'; + +export { Action, Event, Property, Thing, Value }; + +export * from './server'; diff --git a/tsconfig.json b/tsconfig.json index ddde2d5..7e34d1f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,8 @@ "declaration": true, "declarationMap": true, "sourceMap": true, + "rootDir": "src", + "outDir": "lib", "strict": true, "noImplicitAny": true, "strictNullChecks": true, diff --git a/webthing.ts b/webthing.ts deleted file mode 100644 index 79a683d..0000000 --- a/webthing.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Action from './lib/action'; -import Event from './lib/event'; -import Property from './lib/property'; -import Thing from './lib/thing'; -import Value from './lib/value'; - -export { Action, Event, Property, Thing, Value }; - -export * from './lib/server';