Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace reaction plugins usage #5070

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,9 @@ jobs:
- ${GLOBAL_CACHE_VERSION}-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- ${GLOBAL_CACHE_VERSION}-node-modules-{{ .Branch }}
- ${GLOBAL_CACHE_VERSION}-node-modules-master
- run:
name: Install Reaction CLI
command: sudo npm install -g reaction-cli
- run:
name: Load App Plugins
command: reaction plugins load
command: node --experimental-modules ./.reaction/scripts/build.mjs
- run:
name: Run Meteor Integration Tests
command: .circleci/tests.sh
Expand Down Expand Up @@ -292,7 +289,7 @@ jobs:
name: Frankfurt
command: |
.circleci/bin/calibre-deploy.sh ${STAGING_URL} Frankfurt

dockerfile-lint:
<<: *defaults
docker:
Expand All @@ -303,7 +300,7 @@ jobs:
docker_layer_caching: true
- run:
name: Dockerfile Lint
command: |
command: |
hadolint Dockerfile

snyk-security:
Expand Down Expand Up @@ -365,7 +362,7 @@ workflows:
requires:
- deploy-to-ecs-release-branch
- test-metrics:
requires:
requires:
- deploy-to-ecs-release-branch
- eslint:
requires:
Expand Down
25 changes: 1 addition & 24 deletions .reaction/run/index.mjs → .reaction/scripts/appSetup.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// Assumes Node 8.x
import _ from "lodash";
import childProcess from "child_process";
import Log from "./logger";
import loadPlugins from "./loadPlugins";
import loadStyles from "./loadStyles";
import provisionAssets from "./provisionAssets";

function run() {
export default function appSetup() {
let start, sec, ns;

start = process.hrtime();
Expand All @@ -26,24 +23,4 @@ function run() {
provisionAssets();
[sec, ns] = process.hrtime(start);
Log.info(`Provisioning assets took ${sec}s ${ns / 1000000}ms\n`);

// Whatever debugging-related command line arguments were passed in to
// the first node process, forward them along through meteor
const inspect = process.argv
.filter((arg) => arg.startsWith("--inspect"))
.join(" ");
let cmd = `meteor run --no-lint --no-release-check --raw-logs ${inspect}`;

Log.info(`Running command: ${cmd}`);
cmd = `REACTION_METEOR_APP_COMMAND_START_TIME=${Date.now()} ${cmd}`;

try {
childProcess.execSync(cmd, { stdio: "inherit" });
} catch (err) {
Log.default(err);
Log.error("\nError: App failed to start");
process.exit(1);
}
}

run();
3 changes: 3 additions & 0 deletions .reaction/scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import appSetup from "./appSetup";

appSetup();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions .reaction/scripts/run.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Assumes Node 8.x
import _ from "lodash";
import childProcess from "child_process";
import Log from "./logger";
import appSetup from "./appSetup";

function run() {
appSetup();

// Whatever debugging-related command line arguments were passed in to
// the first node process, forward them along through meteor
const inspect = process.argv
.filter((arg) => arg.startsWith("--inspect"))
.join(" ");
let cmd = `meteor run --no-lint --no-release-check --raw-logs ${inspect}`;

Log.info(`Running command: ${cmd}`);
cmd = `REACTION_METEOR_APP_COMMAND_START_TIME=${Date.now()} ${cmd}`;

try {
childProcess.execSync(cmd, { stdio: "inherit" });
} catch (err) {
Log.default(err);
Log.error("\nError: App failed to start");
process.exit(1);
}
}

run();
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ COPY --chown=node . $APP_SOURCE_DIR
##############################################################################
FROM meteor-dev as builder

RUN printf "\\n[-] Running Reaction plugin loader...\\n" \
&& reaction plugins load
RUN node --experimental-modules ./.reaction/scripts/build.mjs
RUN printf "\\n[-] Building Meteor application...\\n" \
&& meteor build --server-only --architecture os.linux.x86_64 --directory "$APP_BUNDLE_DIR"

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
build:
context: .
target: meteor-dev
command: bash -c "time meteor npm install --no-audit && node ./.reaction/waitForMongo.js && node --experimental-modules ./.reaction/run/index.mjs"
command: bash -c "time meteor npm install --no-audit && node ./.reaction/waitForMongo.js && node --experimental-modules ./.reaction/scripts/run.mjs"
depends_on:
- mongo
env_file:
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@
},
"scripts": {
"devserver": "ROOT_URL=http://localhost:3030 MONGO_URL=mongodb://localhost:27017/reaction NODE_ENV=reaction-node BABEL_DISABLE_CACHE=1 nodemon ./imports/node-app/devserver/index.js",
"dev": "node --experimental-modules ./.reaction/run/index.mjs",
"inspect": "node --experimental-modules ./.reaction/run/index.mjs --inspect",
"inspect-brk": "node --experimental-modules ./.reaction/run/index.mjs --inspect-brk",
"inspect-docker": "node --experimental-modules ./.reaction/run/index.mjs --inspect=0.0.0.0:9229",
"inspect-brk-docker": "node --experimental-modules ./.reaction/run/index.mjs --inspect-brk=0.0.0.0:9229",
"dev": "node --experimental-modules ./.reaction/scripts/run.mjs",
"inspect": "node --experimental-modules ./.reaction/scripts/run.mjs --inspect",
"inspect-brk": "node --experimental-modules ./.reaction/scripts/run.mjs --inspect-brk",
"inspect-docker": "node --experimental-modules ./.reaction/scripts/run.mjs --inspect=0.0.0.0:9229",
"inspect-brk-docker": "node --experimental-modules ./.reaction/scripts/run.mjs --inspect-brk=0.0.0.0:9229",
"lint": "eslint .",
"lint:errors": "eslint . --quiet",
"test": "npm run test:unit && npm run test:integration && npm run test:app",
Expand Down