- Drop support for:

- Node.js 6
  - npm 3 and npm-shrinkwrap.json file
- Remove scripts to sanitize npm-shrinkwrap.json
- Update docs and NEWS
pull/14690/head
Daniel García Aubert 6 years ago
parent 00d2f79a35
commit 5ba2bfa53a

@ -9,24 +9,12 @@ notifications:
jobs:
include:
- node_js:
- "6.9.2"
before_install:
- git submodule update --init --recursive
- git fetch origin master:refs/remotes/origin/master --depth=1
install:
- npm install
script:
- npm run ci
- node_js:
- "10"
before_install:
- git submodule update --init --recursive
- git fetch origin master:refs/remotes/origin/master --depth=1
- mv npm-shrinkwrap.json npm-shrinkwrap.json.backup
install:
- npm ci
before_script:
- mv npm-shrinkwrap.json.backup npm-shrinkwrap.json
- npm ci # clean install
script:
- npm run ci
- npm run ci # run tests

@ -106,16 +106,7 @@ module.exports = function (grunt) {
grunt.log.writeln('');
}
var duplicatedModules = lockedDependencies.checkDuplicatedDependencies(require('./npm-shrinkwrap.json'), LOCKED_MODULES_TO_VALIDATE);
if (duplicatedModules.length > 0) {
grunt.log.fail('############### /!\\ CAUTION /!\\ #################');
grunt.log.fail('Duplicated dependencies found in npm-shrinkwrap.json file.');
grunt.log.fail(JSON.stringify(duplicatedModules, null, 4));
grunt.log.fail('#################################################');
process.exit(1);
}
duplicatedModules = lockedDependencies.checkDuplicatedDependencies(require('./package-lock.json'), LOCKED_MODULES_TO_VALIDATE);
var duplicatedModules = lockedDependencies.checkDuplicatedDependencies(require('./package-lock.json'), LOCKED_MODULES_TO_VALIDATE);
if (duplicatedModules.length > 0) {
grunt.log.fail('############### /!\\ CAUTION /!\\ #################');
grunt.log.fail('Duplicated dependencies found in package-lock.json file.');

@ -2,6 +2,8 @@ Development
-----------
### NOTICES
- **BREAKING**: Drop support for Node.js 6
- **BREAKING**: Drop support for npm 3 and `npm-shrinkwrap.json` file.
- Updating shrinkwrap and package-lock before Node.js upgrade [#14669](https://github.com/CartoDB/cartodb/pull/14669)
### Features

@ -59,7 +59,7 @@ This is a list of available tasks to run:
| `npm run bump` | Creates a patch version
| `npm run bump:major` | Creates a major version
| `npm run bump:minor` | Creates a minor version
| `npm run update-internal-deps` | Update the `npm-shrinkwrap` file
| `npm run update-internal-deps` | Update the `package-lock` file
| `npm run ci` | Runs the CSS lint and tests
## Pull Request rules

@ -1,31 +0,0 @@
/** Every now and then npm registry returns non-secure URLs.
* This script rewrites http to https to avoid unneeded differences
* in npm-shrinkwrap.json
*/
const fs = require('fs');
const path = require('path');
const file = path.resolve(__dirname, '../../npm-shrinkwrap.json');
const buildPattern = (protocol) => `"resolved": "${protocol}://registry.npmjs`;
const from = new RegExp(buildPattern('http'), 'g');
const to = buildPattern('https');
let replacements = 0;
console.log('> Fixing npm-shrinkwrap.json');
if (!fs.existsSync(file)) {
console.error(`File ${file} does not exist!`);
return 1;
}
const content = fs.readFileSync(file, 'utf8');
const matches = content.match(from);
if (matches !== null) {
replacements = matches.length;
const modifiedContent = content.replace(from, to);
fs.writeFileSync(file, modifiedContent, { encoding: 'utf8' });
}
replacements
? console.log(` Made ${replacements} replacements.`)
: console.log(' Nothing to replace!');

@ -20,7 +20,7 @@ function alldeps (mod, deps, name, parentVersion) {
}
/**
* Checks all modules dependencies versions within a npm-shrinkwrap or package-lock to not be
* Checks all modules dependencies versions within a package-lock to not be
* duplicated from different parent dependencies.
*
* For instance if there are a couple of dependencies using a different version
@ -51,7 +51,7 @@ function duplicatedDependencies (lockFileContent, modulesToValidate) {
}
/**
* Checks if the version of a shrinkwrap or package-lock file matches with the version of another lock file.
* Checks if the version of a package-lock file matches with the version of another lock file.
* It is necessary to pass the modules to validate.
*
* It will return the modules where the version differs.

3487
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

@ -194,7 +194,8 @@
"moment-v3": "global:moment"
},
"engine": {
"node": "6.9.2"
"node": "^10.0.0",
"npm": "^6.0.0"
},
"scripts": {
"start": "npm run carto-node && npm run build:static && npm run dev",
@ -209,8 +210,8 @@
"lint:css": "stylelint './app/assets/stylesheets/**/*.scss'",
"lint:fix": "eslint . --fix",
"bump": "npm --no-git-tag-version version prerelease --preid=assets",
"postversion": "git add package.json npm-shrinkwrap.json && git commit -m 'Bump assets version' && git push origin master",
"update-internal-deps": "rm -rf node_modules && npm install --production --no-optional --no-shrinkwrap && npm dedupe && npm prune && npm shrinkwrap && npm run fix-shrinkwrap-protocol && npm install",
"postversion": "git add package.json package-lock.json && git commit -m 'Bump assets version' && git push origin master",
"update-internal-deps": "rm -rf node_modules && npm install && npm install",
"branch-files": "node lib/build/branchFiles/branchFiles.js",
"affected_specs": "node lib/build/branchFiles/branchFiles.js | xargs node lib/build/affectedFiles/affectedFiles.js",
"build": "NODE_ENV=production webpack --progress --config webpack/v4/webpack.prod.config.js",
@ -220,7 +221,6 @@
"dev": "NODE_ENV=development webpack --progress --watch --config webpack/v4/webpack.dev.config.js",
"dev:editor": "grunt editor",
"dev:static": "webpack --progress --watch --config webpack/static-pages/webpack.dev.config.js",
"profile": "NODE_ENV=production webpack --profile --json --config webpack/v4/webpack.prod.config.js > compilation-stats.json",
"fix-shrinkwrap-protocol": "node ./lib/build/fix-shrinkwrap.js"
"profile": "NODE_ENV=production webpack --profile --json --config webpack/v4/webpack.prod.config.js > compilation-stats.json"
}
}

Loading…
Cancel
Save