From f094f138aaebfe763be802d317dee6b468adf4a6 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Wed, 22 May 2019 21:45:31 +0200 Subject: [PATCH 1/2] add basic code sharing between javascript apps --- .circleci/config.yml | 12 ++++++++++++ docker-compose.yml | 2 ++ 2 files changed, 14 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 71f94dd..5eba113 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,6 +44,9 @@ jobs: steps: - checkout: path: ~/offen + - run: + name: Create `packages` symlink + command: ln -s ./../packages ./packages - restore_cache: key: offen-vault-{{ checksum "package.json" }} - run: @@ -64,6 +67,9 @@ jobs: steps: - checkout: path: ~/offen + - run: + name: Create `packages` symlink + command: ln -s ./../packages ./packages - restore_cache: key: offen-script-{{ checksum "package.json" }} - run: @@ -76,6 +82,9 @@ jobs: - run: name: Run tests command: npm test + - run: + name: Bundle + command: npm run build auditorium: docker: @@ -84,6 +93,9 @@ jobs: steps: - checkout: path: ~/offen + - run: + name: Create `packages` symlink + command: ln -s ./../packages ./packages - restore_cache: key: offen-auditorium-{{ checksum "package.json" }} - run: diff --git a/docker-compose.yml b/docker-compose.yml index 962974d..4dd302c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,7 @@ script: image: timbru31/node-chrome:slim working_dir: /script volumes: + - ./packages:/script/packages - ./script:/script - ./local.offen.dev.pem:/script/local.offen.dev.pem - ./local.offen.dev-key.pem:/script/local.offen.dev-key.pem @@ -51,6 +52,7 @@ auditorium: image: timbru31/node-chrome:slim working_dir: /auditorium volumes: + - ./packages:/auditorium/packages - ./auditorium:/auditorium - ./local.offen.dev.pem:/auditorium/local.offen.dev.pem - ./local.offen.dev-key.pem:/auditorium/local.offen.dev-key.pem From d21de52123507714780c14f745ee6e8860877fb4 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Thu, 23 May 2019 10:52:32 +0200 Subject: [PATCH 2/2] install shared packages via npm --- .circleci/config.yml | 11 +---------- .editorconfig | 2 +- docker-compose.yml | 26 ++++++++++++-------------- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5eba113..9a709fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,9 +44,6 @@ jobs: steps: - checkout: path: ~/offen - - run: - name: Create `packages` symlink - command: ln -s ./../packages ./packages - restore_cache: key: offen-vault-{{ checksum "package.json" }} - run: @@ -67,9 +64,6 @@ jobs: steps: - checkout: path: ~/offen - - run: - name: Create `packages` symlink - command: ln -s ./../packages ./packages - restore_cache: key: offen-script-{{ checksum "package.json" }} - run: @@ -84,7 +78,7 @@ jobs: command: npm test - run: name: Bundle - command: npm run build + command: NODE_ENV=production npm run build auditorium: docker: @@ -93,9 +87,6 @@ jobs: steps: - checkout: path: ~/offen - - run: - name: Create `packages` symlink - command: ln -s ./../packages ./packages - restore_cache: key: offen-auditorium-{{ checksum "package.json" }} - run: diff --git a/.editorconfig b/.editorconfig index 98fc8b5..08ec691 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,6 @@ insert_final_newline = true trim_trailing_whitespace = true indent_style = tab -[{*.js,*.yml,*.md,Gopkg.toml}] +[{*.js,*.yml,*.md,Gopkg.toml,package.json}] indent_style = space indent_size = 2 diff --git a/docker-compose.yml b/docker-compose.yml index 4dd302c..1954c33 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,11 +22,11 @@ database: vault: image: timbru31/node-chrome:slim - working_dir: /vault + working_dir: /offen/vault volumes: - - ./vault:/vault - - ./local.offen.dev.pem:/vault/local.offen.dev.pem - - ./local.offen.dev-key.pem:/vault/local.offen.dev-key.pem + - .:/offen + - ./local.offen.dev.pem:/offen/vault/local.offen.dev.pem + - ./local.offen.dev-key.pem:/offen/vault/local.offen.dev-key.pem command: npm start -- --port 9977 ports: - 9977:9977 @@ -36,12 +36,11 @@ vault: script: image: timbru31/node-chrome:slim - working_dir: /script + working_dir: /offen/script volumes: - - ./packages:/script/packages - - ./script:/script - - ./local.offen.dev.pem:/script/local.offen.dev.pem - - ./local.offen.dev-key.pem:/script/local.offen.dev-key.pem + - .:/offen + - ./local.offen.dev.pem:/offen/script/local.offen.dev.pem + - ./local.offen.dev-key.pem:/offen/script/local.offen.dev-key.pem command: npm start -- --port 9966 ports: - 9966:9966 @@ -50,12 +49,11 @@ script: auditorium: image: timbru31/node-chrome:slim - working_dir: /auditorium + working_dir: /offen/auditorium volumes: - - ./packages:/auditorium/packages - - ./auditorium:/auditorium - - ./local.offen.dev.pem:/auditorium/local.offen.dev.pem - - ./local.offen.dev-key.pem:/auditorium/local.offen.dev-key.pem + - .:/offen + - ./local.offen.dev.pem:/offen/auditorium/local.offen.dev.pem + - ./local.offen.dev-key.pem:/offen/auditorium/local.offen.dev-key.pem command: npm start -- --port 9955 ports: - 9955:9955