From 8351fff97309d2383c915d2de333aeac19cbcb6d Mon Sep 17 00:00:00 2001 From: ssube Date: Sat, 29 Jun 2019 19:36:41 -0500 Subject: [PATCH] fix(build): split index into its own chunk --- Dockerfile | 3 ++- Makefile | 4 ++-- README.md | 2 +- config/rollup.js | 6 +++++- package.json | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index bea446c..f61b757 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,9 @@ COPY docs/config-docker.yml /root/.salty-dog.yml # copy package first, to invalidate other layers when version changes COPY package.json /salty-dog/package.json COPY out/vendor.js /salty-dog/out/vendor.js +COPY out/index.js /salty-dog/out/index.js COPY out/main.js /salty-dog/out/main.js COPY rules /salty-dog/rules -ENTRYPOINT [ "node", "/salty-dog/out/main.js" ] \ No newline at end of file +ENTRYPOINT [ "node", "/salty-dog/out/index.js" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 00f70e3..9b96174 100755 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ run-rules: ## validate the rules directory find $(ROOT_PATH)/rules -maxdepth 1 -name '*.yml' | while read file; \ do \ echo "Validating $${file}..."; \ - node out/main.js \ + node out/index.js \ --config-path $(ROOT_PATH)/docs \ --config-name config-stderr.yml \ --rules $(ROOT_PATH)/rules/salty-dog.yml \ @@ -130,7 +130,7 @@ run-rules: ## validate the rules directory done run-stream: ## validate stdin and write it to stdout, errors to stderr - @node out/main.js \ + @node out/index.js \ --config-path $(ROOT_PATH)/docs \ --config-name config-stderr.yml \ --dest - \ diff --git a/README.md b/README.md index 5d371b9..38f5b7d 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ This project is written in Typescript and requires `node` and `yarn` to build. > make ``` -After building, run with: `node out/main.js` +After building, run with: `node out/index.js` `make` targets are provided for some common arguments: diff --git a/config/rollup.js b/config/rollup.js index 05cc285..1f57506 100644 --- a/config/rollup.js +++ b/config/rollup.js @@ -26,6 +26,10 @@ const bundle = { return 'test' } + if (id.includes('/src/index')) { + return 'index'; + } + if (id.includes('/src/')) { return 'main'; } @@ -33,7 +37,7 @@ const bundle = { output: { dir: 'out/', chunkFileNames: '[name].js', - entryFileNames: 'index.js', + entryFileNames: 'entry-[name].js', format: 'cjs', sourcemap: true, banner: () => { diff --git a/package.json b/package.json index 4b3bf64..5d30310 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "name": "salty-dog", "version": "0.4.1", "description": "YAML linter, transformer, and validator", - "main": "out/main.js", + "main": "out/index.js", "bin": { - "salty-dog": "out/main.js" + "salty-dog": "out/index.js" }, "directories": { "doc": "docs",