Skip to content

Commit

Permalink
[#IOCOM-98] Migrate node 18 (#277)
Browse files Browse the repository at this point in the history
* node upgrade to 18.13.0

* fix missing node 14 in docker files

* fixed build error by adding types node dependency

* fixed build error by adding types node dependency

* updated express-azure-functions version

* fix sed error with mac

* revert fix sed error with mac

* fix sed error during build with mac
  • Loading branch information
AndreaPagoPa authored Apr 26, 2023
1 parent 472d323 commit 41fa8d8
Show file tree
Hide file tree
Showing 14 changed files with 5,693 additions and 3,001 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.16.0
18.13.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.16.0
18.13.0
8 changes: 4 additions & 4 deletions __integrations__/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: "3.2"

services:

functions-node-14:
image: functions-node-14
functions-node-18:
image: functions-node-18
build:
context: ..
dockerfile: ./docker/functions-node-14/Dockerfile
dockerfile: ./docker/functions-node-18/Dockerfile
command: /bin/true

cosmosdb:
Expand Down Expand Up @@ -42,7 +42,7 @@ services:
- cosmosdb
- storage-account
depends_on:
- functions-node-14
- functions-node-18

testagent:
image: node:16-alpine
Expand Down
4 changes: 2 additions & 2 deletions __integrations__/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"dependencies": {
"@azure/cosmos": "^3.7.2",
"@azure/storage-queue": "^12.7.0",
"@pagopa/io-functions-commons": "^23.0.0",
"@pagopa/io-functions-commons": "^28.0.0",
"@types/jest": "^27.0.2",
"@types/node": "^13.11.0",
"@types/node": "~18.13.0",
"azure-storage": "^2.10.5",
"dotenv": "^10.0.0",
"jest": "^27.3.1",
Expand Down
2,794 changes: 1,530 additions & 1,264 deletions __integrations__/yarn.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docker/azurite/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.14.2-alpine as builder
FROM node:18.13.0-alpine as builder

WORKDIR /opt/azurite

Expand All @@ -10,7 +10,7 @@ RUN git clone https://github.com/Azure/Azurite /opt/azurite && \

RUN npm install

FROM node:10.14.2-alpine
FROM node:18.13.0-alpine

COPY --from=builder /opt/azurite /opt/azurite

Expand Down
2 changes: 1 addition & 1 deletion docker/cosmosdb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.16.0
FROM node:18.13.0

WORKDIR /opt/cosmosdb

Expand Down
2 changes: 1 addition & 1 deletion docker/fixtures/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.14.2-alpine
FROM node:18.13.0-alpine

WORKDIR /opt/cosmosdb

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.16.0
FROM node:18.13.0

WORKDIR /usr/src/app

Expand Down
2 changes: 1 addition & 1 deletion docker/functions/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM functions-node-14
FROM functions-node-18

COPY . /usr/src/app

Expand Down
2 changes: 1 addition & 1 deletion docker/functions/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM functions-node-14
FROM functions-node-18

CMD ["func", "start", "--javascript"]
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"generate:backend:api-models": "shx rm -rf generated/backend && shx mkdir -p generated/backend && gen-api-models --strict 0 --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v7.28.0/api_backend.yaml --out-dir generated/backend",
"generate:backend:notification-models": "shx rm -rf generated/notifications && shx mkdir -p generated/notifications && gen-api-models --strict 0 --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v7.16.0/api_notifications.yaml --out-dir generated/notifications",
"generate:backend:notification-hub": "shx rm -rf generated/notifications && shx mkdir -p generated/notifications && gen-api-models --strict 0 --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v7.16.0/notification_queue_messages.yaml --out-dir generated/notifications",
"generate:templates:mailvalidation": "TARGET=generated/templates/mailvalidation/index && VERSION=v1.0.0 && shx rm -rf generated/templates/mailvalidation && shx mkdir -p generated/templates/mailvalidation && curl -XGET https://raw.githubusercontent.com/pagopa/io-messages-email-templates/$VERSION/MailValidation/index.html -o $TARGET.html && sed -i \"s/\\.\\.\\/assets\\//https:\\/\\/raw.githubusercontent.com\\/pagopa\\/io-messages-email-templates\\/$VERSION\\/assets\\//g\" $TARGET.html && shx echo 'export function apply(title: string, validationUrl: string): string { return `' > $TARGET.ts && shx cat $TARGET.html >> $TARGET.ts && shx echo '`;}' >> $TARGET.ts",
"generate:templates:mailvalidation": "TARGET=generated/templates/mailvalidation/index && VERSION=v1.0.0 && shx rm -rf generated/templates/mailvalidation && shx mkdir -p generated/templates/mailvalidation && curl -XGET https://raw.githubusercontent.com/pagopa/io-messages-email-templates/$VERSION/MailValidation/index.html -o $TARGET.html && sed -i --posix \"s/\\.\\.\\/assets\\//https:\\/\\/raw.githubusercontent.com\\/pagopa\\/io-messages-email-templates\\/$VERSION\\/assets\\//g\" $TARGET.html && shx echo 'export function apply(title: string, validationUrl: string): string { return `' > $TARGET.ts && shx cat $TARGET.html >> $TARGET.ts && shx echo '`;}' >> $TARGET.ts",
"deploy": "npm run build && func azure functionapp publish agid-functions-app-test",
"dist:modules": "modclean -r -n default:safe && yarn install --production",
"predeploy": "npm-run-all build dist:modules",
Expand All @@ -38,6 +38,7 @@
"@types/html-to-text": "^1.4.31",
"@types/jest": "^24.0.15",
"@types/lolex": "^3.1.1",
"@types/node": "~18.13.0",
"@types/nodemailer": "^4.6.8",
"auto-changelog": "^2.2.1",
"dotenv": "^8.2.0",
Expand All @@ -57,9 +58,9 @@
"dependencies": {
"@azure/cosmos": "^3.17.1",
"@azure/storage-queue": "^12.4.0",
"@pagopa/express-azure-functions": "^2.0.0",
"@pagopa/io-functions-commons": "^26.1.0",
"@pagopa/ts-commons": "^10.10.0",
"@pagopa/express-azure-functions": "^4.0.1",
"@pagopa/io-functions-commons": "^28.0.0",
"@pagopa/ts-commons": "^11.0.0",
"abort-controller": "^3.0.0",
"applicationinsights": "^1.8.10",
"azure-storage": "^2.10.3",
Expand Down
2 changes: 1 addition & 1 deletion utils/durable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const consumeGenerator = <TReturn = unknown>(
while (true) {
const { done, value } = gen.next(prevValue);
if (done) {
return value as TReturn;
return value;
}
prevValue = value;
}
Expand Down
Loading

0 comments on commit 41fa8d8

Please sign in to comment.