diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 920ef80..4535546 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -18,7 +18,7 @@ yarn install ### 3. Create separate config file for local overrides ```shell -touch app-config.local.yaml +touch docs-config.local.yaml ``` ### 4. Run the application @@ -39,7 +39,7 @@ In order to use MongoDB, follow these steps: docker-compose up mongodb ``` -### 2. Setup MongoDB driver in app-config.local.yaml +### 2. Setup MongoDB driver in docs-config.local.yaml ```yaml database: @@ -73,7 +73,7 @@ By default, the application uses local filesystem to store files, but S3 driver ### 1. Get credentials for S3 bucket Create a S3 bucket and get access key and secret key (or use existing ones) -### 2. Setup S3 driver in app-config.local.yaml +### 2. Setup S3 driver in docs-config.local.yaml ```yaml uploads: diff --git a/docker-compose.yml b/docker-compose.yml index bac8c3b..847a6f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,8 +9,8 @@ services: volumes: - ./public/uploads:/uploads - ./db:/usr/src/app/db - - ./app-config.yaml:/usr/src/app/app-config.yaml - - ./app-config.local.yaml:/usr/src/app/app-config.local.yaml + - ./docs-config.yaml:/usr/src/app/docs-config.yaml + - ./docs-config.local.yaml:/usr/src/app/docs-config.local.yaml mongodb: image: mongo:6.0.1 ports: diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index 68055b6..cba717f 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -32,4 +32,4 @@ COPY --from=build /usr/src/app/public ./public ENV NODE_ENV=production -CMD ["node", "dist/bin/server.js"] +CMD ["node", "dist/backend/server.js"] diff --git a/app-config.yaml b/docs-config.yaml similarity index 100% rename from app-config.yaml rename to docs-config.yaml diff --git a/package.json b/package.json index 407b466..e030bea 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,11 @@ { "name": "codex.docs", "license": "Apache-2.0", + "version": "0.0.1-alpha.5", "type": "module", + "bin": { + "codex.docs": "dist/backend/server.js" + }, "browserslist": [ "last 2 versions", "> 1%" @@ -9,9 +13,10 @@ "scripts": { "start": "concurrently \"yarn start-backend\" \"yarn build-frontend\"", "dev": "concurrently \"yarn start-backend\" \"yarn build-frontend:dev\"", + "build-all": "yarn build-frontend && yarn build-backend", "build-static": "ts-node src/backend/build-static.ts", - "start-backend": "cross-env NODE_ENV=development npx nodemon --config nodemon.json src/backend/server.ts -c app-config.yaml -c app-config.local.yaml", - "compile": "tsc && copyfiles -u 3 ./src/**/*.twig ./dist/backend/views && copyfiles -u 1 ./src/**/*.svg ./dist/", + "start-backend": "cross-env NODE_ENV=development npx nodemon --config nodemon.json src/backend/server.ts -c docs-config.yaml -c docs-config.local.yaml", + "build-backend": "tsc && copyfiles -u 3 ./src/**/*.twig ./dist/backend/views && copyfiles -u 1 ./src/**/*.svg ./dist/", "build-frontend": "webpack --mode=production", "build-frontend:dev": "webpack --mode=development --watch", "test:js": "cross-env NODE_ENV=testing mocha --recursive ./dist/test --exit", diff --git a/src/backend/server.ts b/src/backend/server.ts index bbf901b..9c4d0ab 100644 --- a/src/backend/server.ts +++ b/src/backend/server.ts @@ -1,3 +1,4 @@ +#!/usr/bin/env node /** * Module dependencies. */ diff --git a/src/backend/utils/appConfig.ts b/src/backend/utils/appConfig.ts index 1426787..9e155a3 100644 --- a/src/backend/utils/appConfig.ts +++ b/src/backend/utils/appConfig.ts @@ -107,7 +107,7 @@ const args = arg({ /* eslint-disable @typescript-eslint/naming-convention */ }); const cwd = process.cwd(); -const paths = (args['--config'] || [ './app-config.yaml' ]).map((configPath) => { +const paths = (args['--config'] || [ './docs-config.yaml' ]).map((configPath) => { if (path.isAbsolute(configPath)) { return configPath; } diff --git a/tsconfig.json b/tsconfig.json index 7421f9c..4ee6f5e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./dist/", /* Redirect output structure to the directory. */ + "outDir": "./dist/backend", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ @@ -74,12 +74,15 @@ "skipLibCheck": true, /* Skip type checking of declaration files. */ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ }, - "include": ["src/**/*"], + "include": ["src/backend/**/*"], "ts-node": { /** * Tell ts-node CLI to install the --loader automatically, explained below * https://typestrong.org/ts-node/docs/imports/ */ "esm": true - } + }, + "exclude": [ + "src/test/**/*" + ] }