Skip to content

Commit

Permalink
Merge pull request #26 from B77Mills/4.0
Browse files Browse the repository at this point in the history
Migrate to use base-cms 4.X
  • Loading branch information
B77Mills authored Aug 8, 2023
2 parents 317bebd + 3964b36 commit 32502fa
Show file tree
Hide file tree
Showing 14 changed files with 5,076 additions and 5,405 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated Marko Files
*.marko.js
# Build assets
**/dist/
dist
15 changes: 2 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
module.exports = {
extends: 'airbnb-base',
plugins: [
'import'
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.marko'],
},
},
},
};
// eslint-disable-next-line import/no-extraneous-dependencies
module.exports = require('@parameter1/base-cms-eslint/eslintrc.server');
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: 10.24
node-version: 14.21

- uses: actions/cache@v2
id: yarn-cache
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ dist
.tern-port

*.marko.js
.bash_history
23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
FROM node:10.15 as build
WORKDIR /root
ENV NODE_ENV production
FROM node:14.21 as build
WORKDIR /repo
ARG TENANT

ADD package.json yarn.lock /root/
ADD packages /root/packages
ADD tenants/$TENANT /root/tenants/$TENANT
RUN yarn --production --pure-lockfile
ADD package.json yarn.lock lerna.json /repo/
ADD packages /repo/packages
ADD tenants/$TENANT /repo/tenants/$TENANT
RUN --mount=type=cache,target=/repo/.yarn YARN_CACHE_FOLDER=/repo/.yarn yarn install --frozen-lockfile
ENV NODE_ENV production
RUN yarn build

WORKDIR /root/tenants/$TENANT
WORKDIR /repo/tenants/$TENANT

FROM node:10.15-alpine
FROM node:14.21-alpine
ENV NODE_ENV production
ENV PORT 80
ARG TENANT
COPY --from=build /root /root
WORKDIR /root/tenants/$TENANT
COPY --from=build /repo /repo
WORKDIR /repo/tenants/$TENANT
ENTRYPOINT [ "node", "index.js" ]
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.7'
x-node-defaults: &node
tty: true
init: true
image: node:10.15
image: node:14.21
entrypoint: ["node"]
working_dir: /root
restart: always
Expand All @@ -13,8 +13,9 @@ x-node-defaults: &node
- yarn-cache:/.yarn-cache

x-newsletter-command: &newsletter-cmd
entrypoint: ["node_modules/.bin/basecms-newsletters"]
command: ["dev", "index.js"]
<<: *node
entrypoint: ["yarn"]
command: ["dev"]

x-env-defaults: &env
YARN_CACHE_FOLDER: /.yarn-cache
Expand Down Expand Up @@ -45,7 +46,6 @@ services:
<<: *env

all:
<<: *node
<<: *newsletter-cmd
working_dir: /root/tenants/all
environment:
Expand Down
25 changes: 17 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,26 @@
"tenants/*"
],
"scripts": {
"build": "lerna run build",
"compile": "lerna run compile",
"lint": "lerna run lint",
"lint:css": "lerna run lint:css",
"lint:js": "lerna run lint:js",
"lint:fix": "lerna run lint:fix",
"test": "lerna run test"
},
"devDependencies": {
"@parameter1/base-cms-marko-compiler": "^2.0.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.18.2",
"lerna": "^3.22.1"
}
"@parameter1/base-cms-eslint": "^4.5.12",
"@parameter1/base-cms-marko-compiler": "^4.5.12",
"lerna": "^6.5.1"
},
"resolutions": {
"editorconfig": "1.0.2"
},
"engines": {
"node": ">=14.15"
},
"os": [
"darwin",
"linux",
"win32"
]
}
2 changes: 1 addition & 1 deletion packages/common/native-x/fetch-email-ad.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { isObject } = require('@parameter1/base-cms-utils');
const { URLSearchParams } = require('url');
const { isObject } = require('@parameter1/base-cms-utils');
const fetch = require('node-fetch');
const createHeaders = require('@parameter1/base-cms-marko-web-native-x/utils/create-headers');

Expand Down
2 changes: 1 addition & 1 deletion packages/common/native-x/is-enabled.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = config => Boolean(config && config.uri && config.enabled !== false);
module.exports = (config) => Boolean(config && config.uri && config.enabled !== false);
29 changes: 20 additions & 9 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,28 @@
"license": "MIT",
"private": true,
"scripts": {
"lint": "eslint --ext .js --max-warnings 5 ./",
"test": "yarn lint"
"build": "yarn compile",
"compile": "basecms-marko-compile compile",
"lint": "eslint --ext .js --max-warnings 5 --config ../../.eslintrc.js --ignore-path ../../.eslintignore ./",
"lint:fix": "yarn lint --fix",
"test": "yarn lint && yarn compile --no-clean"
},
"dependencies": {
"@parameter1/base-cms-marko-core": "^2.12.0",
"@parameter1/base-cms-marko-newsletters": "^2.12.0",
"@parameter1/base-cms-marko-newsletters-email-x": "^2.5.0",
"@parameter1/base-cms-marko-web-native-x": "^2.15.0",
"@parameter1/base-cms-object-path": "^2.5.0",
"@parameter1/base-cms-utils": "^2.4.2",
"@parameter1/base-cms-marko-core": "^4.32.0",
"@parameter1/base-cms-marko-newsletters": "^4.32.0",
"@parameter1/base-cms-marko-newsletters-email-x": "^4.5.12",
"@parameter1/base-cms-marko-web-native-x": "^4.32.0",
"@parameter1/base-cms-object-path": "^4.5.12",
"@parameter1/base-cms-utils": "^4.5.12",
"graphql-tag": "^2.10.1",
"node-fetch": "^2.6.1"
}
},
"engines": {
"node": ">=14.15"
},
"os": [
"darwin",
"linux",
"win32"
]
}
2 changes: 1 addition & 1 deletion packages/common/utils/build-link-url.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-template-curly-in-string */
const liquidVar = /{{.*?}}/;
const isObj = v => typeof v === 'object';
const isObj = (v) => typeof v === 'object';

const alwaysAppend = {
braze_int_id: '{{${braze_id}}}',
Expand Down
6 changes: 3 additions & 3 deletions tenants/all/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ module.exports = startServer({
coreConfig,
customConfig,
publicPath: 'public',
onStart: app => app.set('trust proxy', 'loopback, linklocal, uniquelocal'),
onAsyncBlockError: e => newrelic.noticeError(e),
}).then(() => log('Newsletters started!')).catch(e => setImmediate(() => { throw e; }));
onStart: (app) => app.set('trust proxy', 'loopback, linklocal, uniquelocal'),
onAsyncBlockError: (e) => newrelic.noticeError(e),
}).then(() => log('Newsletters started!')).catch((e) => setImmediate(() => { throw e; }));
12 changes: 6 additions & 6 deletions tenants/all/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"test": "yarn lint && yarn compile"
},
"dependencies": {
"@parameter1/base-cms-marko-core": "^2.12.0",
"@parameter1/base-cms-marko-newsletters": "^2.12.0",
"@parameter1/base-cms-marko-newsletters-email-x": "^2.5.0",
"@parameter1/base-cms-newsletter-cli": "^2.8.5",
"@parameter1/base-cms-object-path": "^2.5.0",
"@parameter1/base-cms-marko-core": "^4.32.0",
"@parameter1/base-cms-marko-newsletters": "^4.32.0",
"@parameter1/base-cms-marko-newsletters-email-x": "^4.5.12",
"@parameter1/base-cms-newsletter-cli": "^4.5.12",
"@parameter1/base-cms-object-path": "^4.5.12",
"@science-medicine-group/package-common": "^0.0.24",
"graphql": "^14.5.4",
"graphql-tag": "^2.10.1",
"newrelic": "^5.11.0"
"newrelic": "^9.10.1"
}
}
Loading

0 comments on commit 32502fa

Please sign in to comment.