Skip to content

Commit

Permalink
Libraries Updates
Browse files Browse the repository at this point in the history
- Replaces deprecated @hapi/joi with joi
- Update all files with the new syntax for joi
- Updated all NPM to maximum posible version
- last version of eslint-config-es requires exact versions of some other libraries. Those were also added to devDependencies.
- Some libraries such as Chalk and Boxen are update to maximum versions before they moved on to ESM
  • Loading branch information
paulincai committed Jan 30, 2023
1 parent 2272e10 commit fb20916
Show file tree
Hide file tree
Showing 10 changed files with 3,915 additions and 1,459 deletions.
5,021 changes: 3,733 additions & 1,288 deletions package-lock.json

Large diffs are not rendered by default.

73 changes: 44 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mup",
"version": "1.5.10",
"version": "1.5.11",
"description": "Production Quality Meteor Deployments",
"main": "lib/index.js",
"repository": {
Expand Down Expand Up @@ -40,55 +40,66 @@
"clean-shrinkwrap": "cd tests && node clean-shrinkwrap.js"
},
"devDependencies": {
"@babel/cli": "^7.10.0",
"@babel/core": "^7.10.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.10.0",
"@babel/plugin-transform-modules-commonjs": "^7.9.6",
"@babel/register": "^7.9.0",
"@babel/cli": "^7.20.7",
"@babel/core": "^7.20.12",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
"@babel/register": "^7.18.9",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.4.0",
"babel-eslint": "^10.1.0",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-istanbul": "^6.1.1",
"babel-preset-es2017": "^6.22.0",
"chai": "^4.2.0",
"browserslist": "^4.21.4",
"chai": "^4.3.7",
"chai-string": "^1.5.0",
"cross-env": "^6.0.3",
"eslint": "^4.19.1",
"eslint-config-es": "^0.8.12",
"cross-env": "^7.0.3",
"eslint": "^8.32.0",
"eslint-config-es": "^4.2.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-markdown": "^1.0.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-extended": "^0.2.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-unicorn": "^37.0.1",
"gfm-code-blocks": "^1.0.0",
"keypair": "^1.0.1",
"mocha": "^6.2.3",
"node-forge": "^0.7.1",
"nyc": "^15.0.1",
"sinon": "^7.5.0",
"stylelint": "^12.0.1",
"stylelint-config-standard": "^20.0.0"
"mocha": "^10.2.0",
"node-forge": "^1.3.1",
"nyc": "^15.1.0",
"sinon": "^15.0.1",
"stylelint": "^14.16.1",
"stylelint-config-standard": "^29.0.0",
"typescript": "^3.7.7"
},
"dependencies": {
"@hapi/joi": "^15.1.1",
"@zodern/nodemiral": "^1.4.1",
"axios": "^0.21.4",
"axios": "^1.2.6",
"bluebird": "^3.7.2",
"boxen": "^4.2.0",
"chalk": "^3.0.0",
"boxen": "^5.1.2",
"chalk": "=4.1.2",
"debug": "^4.1.1",
"expand-tilde": "^2.0.2",
"global-modules": "^2.0.0",
"joi": "^17.7.0",
"lodash": "^4.17.21",
"opencollective-postinstall": "^2.0.3",
"parse-json": "^5.0.0",
"parse-json": "^5.2.0",
"random-seed": "0.3.0",
"resolve-from": "^5.0.0",
"rimraf": "^3.0.2",
"rimraf": "^4.1.2",
"shell-escape": "^0.2.0",
"shelljs": "^0.8.5",
"ssh2-classic": "^0.8.10",
"tar": "^6.1.11",
"traverse": "^0.6.6",
"uuid": "^7.0.3",
"tar": "^6.1.13",
"traverse": "^0.6.7",
"uuid": "^9.0.0",
"www-authenticate": "^0.6.2",
"yargs": "^15.4.1"
"yargs": "^17.6.2"
},
"nyc": {
"sourceMap": false,
Expand All @@ -105,5 +116,9 @@
},
"collective": {
"url": "https://opencollective.com/meteor-up"
},
"engines": {
"node": ">=14.19.3",
"npm": "6.14.17"
}
}
28 changes: 14 additions & 14 deletions src/plugins/docker/validate.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import joi from '@hapi/joi';
import Joi from 'joi';

const swarmSchema = joi.object().keys({
enabled: joi.bool().required(),
labels: joi.array().items(joi.object().keys({
name: joi.string().required(),
value: joi.string().required(),
servers: joi.array().items(joi.string())
const swarmSchema = Joi.object().keys({
enabled: Joi.bool().required(),
labels: Joi.array().items(Joi.object().keys({
name: Joi.string().required(),
value: Joi.string().required(),
servers: Joi.array().items(Joi.string())
}))
});

const registrySchema = joi.object().keys({
host: joi.string().required(),
imagePrefix: joi.string(),
username: joi.string(),
password: joi.string()
const registrySchema = Joi.object().keys({
host: Joi.string().required(),
imagePrefix: Joi.string(),
username: Joi.string(),
password: Joi.string()
});

export function validateSwarm(
Expand All @@ -28,7 +28,7 @@ export function validateSwarm(

details = combineErrorDetails(
details,
joi.validate(config.swarm, swarmSchema, VALIDATE_OPTIONS)
Joi.validate(config.swarm, swarmSchema, VALIDATE_OPTIONS)
);

return addLocation(details, 'swarm');
Expand All @@ -45,7 +45,7 @@ export function validateRegistry(
let details = [];
details = combineErrorDetails(
details,
joi.validate(config.privateDockerRegistry, registrySchema, VALIDATE_OPTIONS)
Joi.validate(config.privateDockerRegistry, registrySchema, VALIDATE_OPTIONS)
);

return addLocation(details, 'dockerPrivateRegistry');
Expand Down
10 changes: 3 additions & 7 deletions src/plugins/meteor/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,8 @@ export function cleanBuildDir(buildLocation) {
return new Promise((resolve, reject) => {
rimraf(buildLocation, {
glob: false
}, err => {
if (err) {
return reject(err);
}

return resolve();
});
})
.then(() => resolve())
.catch(err => reject(err));
});
}
4 changes: 2 additions & 2 deletions src/plugins/meteor/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as uuid from 'uuid';
import { v4 as uuidv4 } from 'uuid'
import { cloneDeep, flatMap } from 'lodash';
import fs from 'fs';
import os from 'os';
Expand Down Expand Up @@ -135,7 +135,7 @@ export function tmpBuildPath(appPath, api) {

return api.resolvePath(
os.tmpdir(),
`mup-meteor-${uuid.v4({ random: uuidNumbers })}`
`mup-meteor-${uuidv4({ random: uuidNumbers })}`
);
}

Expand Down
116 changes: 58 additions & 58 deletions src/plugins/meteor/validate.js
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
import joi from '@hapi/joi';
import Joi from 'joi';

const schema = joi.object().keys({
name: joi.string().min(1).required(),
path: joi.string().min(1).required(),
port: joi.number(),
type: joi.string(),
servers: joi.object().min(1).required().pattern(
const schema = Joi.object().keys({
name: Joi.string().min(1).required(),
path: Joi.string().min(1).required(),
port: Joi.number(),
type: Joi.string(),
servers: Joi.object().min(1).required().pattern(
/[/s/S]*/,
joi.object().keys({
env: joi.object().pattern(
Joi.object().keys({
env: Joi.object().pattern(
/[/s/S]*/,
[joi.string(), joi.number(), joi.bool()]
[Joi.string(), Joi.number(), Joi.bool()]
),
bind: joi.string(),
settings: joi.string()
bind: Joi.string(),
settings: Joi.string()
})
),
deployCheckWaitTime: joi.number(),
deployCheckPort: joi.number(),
enableUploadProgressBar: joi.bool(),
dockerImage: joi.string(),
docker: joi.object().keys({
image: joi.string().trim(),
imagePort: joi.number(),
imageFrontendServer: joi.string(),
args: joi.array().items(joi.string()),
bind: joi.string().trim(),
prepareBundle: joi.bool(),
prepareBundleLocally: joi.bool(),
buildInstructions: joi.array().items(joi.string()),
stopAppDuringPrepareBundle: joi.bool(),
useBuildKit: joi.bool(),
networks: joi
deployCheckWaitTime: Joi.number(),
deployCheckPort: Joi.number(),
enableUploadProgressBar: Joi.bool(),
dockerImage: Joi.string(),
docker: Joi.object().keys({
image: Joi.string().trim(),
imagePort: Joi.number(),
imageFrontendServer: Joi.string(),
args: Joi.array().items(Joi.string()),
bind: Joi.string().trim(),
prepareBundle: Joi.bool(),
prepareBundleLocally: Joi.bool(),
buildInstructions: Joi.array().items(Joi.string()),
stopAppDuringPrepareBundle: Joi.bool(),
useBuildKit: Joi.bool(),
networks: Joi
.array()
.items(joi.string())
.items(Joi.string())
}),
buildOptions: joi.object().keys({
serverOnly: joi.bool(),
debug: joi.bool(),
cleanAfterBuild: joi.bool(),
buildLocation: joi.string(),
mobileSettings: joi.object(),
server: joi.string().uri(),
allowIncompatibleUpdates: joi.boolean(),
executable: joi.string(),
cleanBuildLocation: joi.bool()
buildOptions: Joi.object().keys({
serverOnly: Joi.bool(),
debug: Joi.bool(),
cleanAfterBuild: Joi.bool(),
buildLocation: Joi.string(),
mobileSettings: Joi.object(),
server: Joi.string().uri(),
allowIncompatibleUpdates: Joi.boolean(),
executable: Joi.string(),
cleanBuildLocation: Joi.bool()
}),
env: joi
env: Joi
.object()
.keys({
ROOT_URL: joi
ROOT_URL: Joi
.string()
.regex(
new RegExp('^(http|https)://', 'i'),
'valid url with "http://" or "https://"'
)
.required(),
MONGO_URL: joi.string()
MONGO_URL: Joi.string()
})
.pattern(/[\s\S]*/, [joi.string(), joi.number(), joi.bool()]),
log: joi.object().keys({
driver: joi.string(),
opts: joi.object()
.pattern(/[\s\S]*/, [Joi.string(), Joi.number(), Joi.bool()]),
log: Joi.object().keys({
driver: Joi.string(),
opts: Joi.object()
}),
volumes: joi.object(),
nginx: joi.object().keys({
clientUploadLimit: joi.string().trim()
volumes: Joi.object(),
nginx: Joi.object().keys({
clientUploadLimit: Joi.string().trim()
}),
ssl: joi
ssl: Joi
.object()
.keys({
autogenerate: joi
autogenerate: Joi
.object()
.keys({
email: joi.string().email().required(),
domains: joi.string().required()
email: Joi.string().email().required(),
domains: Joi.string().required()
}),
crt: joi.string().trim(),
key: joi.string().trim(),
port: joi.number(),
upload: joi.boolean()
crt: Joi.string().trim(),
key: Joi.string().trim(),
port: Joi.number(),
upload: Joi.boolean()
})
.and('crt', 'key')
.without('autogenerate', ['crt', 'key'])
Expand All @@ -100,7 +100,7 @@ export default function(

details = combineErrorDetails(
details,
joi.validate(config.app, schema, VALIDATE_OPTIONS)
schema.validate(config.app, VALIDATE_OPTIONS)
);
if (config.app.name && config.app.name.indexOf(' ') > -1) {
details.push({
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/mongo/validate.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import joi from '@hapi/joi';
import Joi from 'joi';

const schema = joi.object().keys({
const schema = Joi.object().keys({
// TODO: mongo.oplog and mongo.port is unused,
// but was part of the example config.
// decide what to do with it
oplog: joi.bool(),
port: joi.number(),
dbName: joi.string(),
version: joi.string(),
servers: joi.object().keys().required()
oplog: Joi.bool(),
port: Joi.number(),
dbName: Joi.string(),
version: Joi.string(),
servers: Joi.object().keys().required()
});

function externalMongoUrl(appConfig) {
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function(
const origionalConfig = config._origionalConfig;
let details = [];

const validationErrors = joi.validate(config.mongo, schema, VALIDATE_OPTIONS);
const validationErrors = schema.validate(config.mongo, VALIDATE_OPTIONS);
details = combineErrorDetails(details, validationErrors);
details = combineErrorDetails(
details,
Expand Down
Loading

0 comments on commit fb20916

Please sign in to comment.