Merge pull request #2615 from balena-io/npm6-3

Npm6 replaces #2577
This commit is contained in:
Alexis Svinartchouk 2019-02-11 17:15:18 +01:00 committed by GitHub
commit 8ef3add183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 10003 additions and 3168 deletions

View File

@ -1,6 +1,7 @@
{
"node-cli": {
"node": "6.14.4",
"npm_version": "6.7.0",
"main": "lib/cli/etcher.js",
"dependencies": {
"linux": [
@ -10,6 +11,7 @@
}
},
"electron": {
"npm_version": "6.7.0",
"dependencies": {
"linux": [
"libudev-dev",

View File

@ -181,6 +181,7 @@ webpack:
.PHONY: $(TARGETS)
sass:
npm rebuild node-sass
node-sass lib/gui/app/scss/main.scss > lib/gui/css/main.css
lint-js:

View File

@ -21,7 +21,7 @@ Developing
- [Python 2.7](https://www.python.org)
- [jq](https://stedolan.github.io/jq/)
- [curl](https://curl.haxx.se/)
- [npm](https://www.npmjs.com/) (version 3.10)
- [npm](https://www.npmjs.com/) (version 6.7)
```sh
pip install -r requirements.txt

File diff suppressed because it is too large Load Diff

11614
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,110 +21,98 @@
"scripts": {
"test": "make lint test sanity-checks",
"start": "electron lib/start.js",
"postshrinkwrap": "node ./scripts/clean-shrinkwrap.js",
"configure": "node-gyp configure",
"build": "node-gyp build",
"install": "node-gyp rebuild",
"webpack": "webpack",
"watch": "webpack --watch",
"concourse-build-electron": "make webpack",
"concourse-test": "npm test",
"concourse-test-electron": "npm test",
"concourse-test": "npx npm@6.7.0 test",
"concourse-test-electron": "npx npm@6.7.0 test",
"concourse-test-node-cli": "make webpack lint-js lint-cpp lint-spell test-cli"
},
"author": "Balena Inc. <hello@etcher.io>",
"license": "Apache-2.0",
"platformSpecificDependencies": [
"7zip-bin-mac",
"7zip-bin-win",
"7zip-bin-linux",
"fsevents",
"napi-build-utils",
"winusb-driver-generator"
],
"dependencies": {
"@fortawesome/fontawesome-free-webfonts": "^1.0.9",
"@types/react": "16.3.14",
"@types/react-dom": "16.0.5",
"angular": "1.6.3",
"angular-if-state": "1.0.0",
"angular-moment": "1.0.1",
"angular-seconds-to-date": "1.0.0",
"angular-ui-bootstrap": "2.5.0",
"angular-ui-router": "0.4.2",
"bindings": "1.3.0",
"bluebird": "3.5.3",
"bootstrap-sass": "3.3.6",
"chalk": "1.1.3",
"color": "2.0.1",
"command-join": "2.0.0",
"debug": "3.1.0",
"drivelist": "6.4.6",
"electron-is-running-in-asar": "1.0.0",
"etcher-sdk": "^1.0.2",
"flexboxgrid": "6.3.0",
"immutable": "3.8.1",
"inactivity-timer": "1.0.0",
"lodash": "4.17.10",
"mime-types": "2.1.18",
"nan": "2.9.2",
"node-ipc": "9.1.1",
"path-is-inside": "1.0.2",
"pretty-bytes": "1.0.4",
"prop-types": "15.5.9",
"react": "16.3.2",
"react-dom": "16.3.2",
"react2angular": "4.0.2",
"redux": "3.5.2",
"angular": "1.7.6",
"angular-if-state": "^1.0.0",
"angular-moment": "^1.0.1",
"angular-seconds-to-date": "^1.0.0",
"angular-ui-bootstrap": "^2.5.0",
"angular-ui-router": "^0.4.2",
"bindings": "^1.3.0",
"bluebird": "^3.5.3",
"bootstrap-sass": "^3.3.6",
"chalk": "^1.1.3",
"color": "^2.0.1",
"command-join": "^2.0.0",
"debug": "^3.1.0",
"drivelist": "^6.4.2",
"electron-is-running-in-asar": "^1.0.0",
"etcher-sdk": "^1.0.3",
"flexboxgrid": "^6.3.0",
"immutable": "^3.8.1",
"inactivity-timer": "^1.0.0",
"lodash": "^4.17.10",
"mime-types": "^2.1.18",
"nan": "^2.9.2",
"node-ipc": "^9.1.1",
"path-is-inside": "^1.0.2",
"pretty-bytes": "^1.0.4",
"prop-types": "^15.5.9",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react2angular": "^4.0.2",
"redux": "^3.5.2",
"rendition": "4.41.1",
"request": "2.81.0",
"resin-cli-form": "1.4.1",
"resin-cli-visuals": "1.4.1",
"resin-corvus": "2.0.0",
"roboto-fontface": "0.9.0",
"semver": "5.1.1",
"styled-components": "3.2.3",
"request": "^2.81.0",
"resin-cli-form": "^1.4.1",
"resin-cli-visuals": "^1.4.1",
"resin-corvus": "^2.0.1",
"roboto-fontface": "^0.9.0",
"semver": "^5.1.1",
"styled-components": "^3.2.3",
"styled-system": "^3.1.11",
"sudo-prompt": "8.2.3",
"uuid": "3.0.1",
"xml2js": "0.4.17",
"yargs": "11.0.0"
},
"optionalDependencies": {
"winusb-driver-generator": "1.2.4"
"sudo-prompt": "^8.2.3",
"uuid": "^3.0.1",
"xml2js": "^0.4.17",
"yargs": "^11.0.0"
},
"devDependencies": {
"@babel/core": "7.2.0",
"@babel/plugin-proposal-function-bind": "7.2.0",
"@babel/preset-env": "7.2.0",
"@babel/preset-react": "7.0.0",
"angular-mocks": "1.6.3",
"babel-loader": "8.0.4",
"electron": "1.7.13",
"electron-builder": "19.40.0",
"electron-mocha": "6.0.1",
"eslint": "4.17.0",
"eslint-config-standard": "10.2.1",
"eslint-plugin-import": "2.9.0",
"eslint-plugin-jsdoc": "3.5.0",
"eslint-plugin-lodash": "2.6.1",
"eslint-plugin-node": "6.0.1",
"eslint-plugin-promise": "3.6.0",
"eslint-plugin-react": "7.11.1",
"eslint-plugin-standard": "3.0.1",
"html-angular-validate": "0.2.3",
"html-loader": "0.5.1",
"mocha": "5.0.1",
"mochainon": "2.0.0",
"nock": "9.2.3",
"node-gyp": "3.8.0",
"node-sass": "4.7.2",
"pkg": "4.3.0",
"sass-lint": "1.12.1",
"simple-progress-webpack-plugin": "1.1.2",
"spectron": "3.7.3",
"webpack": "4.27.0",
"webpack-cli": "3.1.2",
"webpack-node-externals": "1.7.2"
"@babel/core": "^7.2.0",
"@babel/plugin-proposal-function-bind": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"@babel/preset-react": "^7.0.0",
"acorn": "^6.0.5",
"angular-mocks": "1.7.6",
"babel-loader": "^8.0.4",
"electron": "1.8.8",
"electron-builder": "^19.40.0",
"electron-mocha": "^6.0.1",
"eslint": "^4.17.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsdoc": "^3.5.0",
"eslint-plugin-lodash": "^2.6.1",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-standard": "^3.0.1",
"html-angular-validate": "^0.2.3",
"html-loader": "^0.5.1",
"mocha": "^5.0.1",
"mochainon": "^2.0.0",
"nock": "^9.2.3",
"node-gyp": "^3.5.0",
"node-sass": "^4.7.2",
"pkg": "^4.3.0",
"sass-lint": "^1.12.1",
"simple-progress-webpack-plugin": "^1.1.2",
"spectron": "^3.7.3",
"versionist": "^4.0.1",
"webpack": "^4.27.0",
"webpack-cli": "^3.1.2",
"webpack-node-externals": "^1.7.2"
}
}

View File

@ -10,7 +10,7 @@
+ // TODO PR something to electron to pass in the version number for forks
+ // https://github.com/electron/electron/issues/9058
+ try { electron_version = require('electron/package.json').version; }
+ catch (_) { electron_version = '1.7.13'; }
+ catch (_) { electron_version = '1.8.8'; }
+ }
+ return get_electron_abi(runtime, electron_version);
} else {

View File

@ -1,113 +0,0 @@
/**
* This script is in charge of generating the `shrinkwrap` file.
*
* `npm shrinkwrap` has a bug where it will add optional dependencies
* to `npm-shrinkwrap.json`, therefore causing errors if these optional
* dependendencies are platform dependent and you then try to build
* the project in another platform.
*
* As a workaround, we keep a list of platform dependent dependencies in
* the `platformSpecificDependencies` property of `package.json`,
* and manually remove them from `npm-shrinkwrap.json` if they exist.
*
* See: https://github.com/npm/npm/issues/2679
*/
/* eslint-disable lodash/prefer-lodash-method */
/* eslint-disable no-magic-numbers */
/* eslint-disable no-undefined */
'use strict'
const fs = require('fs')
const path = require('path')
const JSON_INDENT = 2
const SHRINKWRAP_FILENAME = path.join(__dirname, '..', 'npm-shrinkwrap.json')
const packageInfo = require('../package.json')
const shrinkwrap = require('../npm-shrinkwrap.json')
/**
* @summary Traverse a shrinkwrap tree and call
* a given function on each dependency
* @param {Object} tree - shrinkwrap
* @param {Function} onNode - callback({Object} parent, {String} parentName, {String} name, {Object} info)
* @param {String} [parentName] - name of dependent (used internally)
* @example
* traverseDeps(shrinkwrap, (parent, parentName, name, info) => {
* // ...
* })
*/
const traverseDeps = (tree, onNode, parentName) => {
if (!tree.dependencies) {
return
}
const keys = Object.keys(tree.dependencies)
let name = null
for (let index = 0; index < keys.length; index += 1) {
name = keys[index]
// Check for this dependency to still exist,
// as a node might have been removed just before this iteration
if (tree.dependencies[name]) {
onNode(tree, parentName || tree.name, name, tree.dependencies[name])
// Check that the walking function didn't remove the dependency;
// if so, skip it and continue with the next one
if (tree.dependencies[name] && tree.dependencies[name].dependencies) {
traverseDeps(tree.dependencies[name], onNode, name)
}
}
}
}
console.log('Cleaning shrinkwrap...')
// Walk the generated shrinkwrap tree & apply modifications if necessary
traverseDeps(shrinkwrap, (parent, parentName, name, info) => {
// If this dependency depends on a "blacklisted" optional
// dependency; remove it from the shrinkwrap
if (packageInfo.platformSpecificDependencies.includes(name)) {
console.log(' - Removing "%s" from "%s"', name, parentName)
parent.dependencies[name] = undefined
Reflect.deleteProperty(parent.dependencies, name)
return
}
// Ensure the `resolved` field contains a HTTPS registry URL,
// as some versions of npm apparently fall back to HTTP on some platforms
// under some circumstances
if (/^http:\/\//.test(info.resolved)) {
info.resolved = info.resolved.replace(/^http/, 'https')
}
// Delete `from` fields to avoid different diffs on different platforms
// NOTE: Only do this if it's a npm package version range,
// as direct installs from github or git need this field
// to resolve properly during shrinkwrapping
const isScoped = /^@/.test(name)
const fromNpm = !/^[a-z0-9-]+\//i.test(info.from)
if (isScoped || fromNpm) {
info.from = undefined
Reflect.deleteProperty(info, 'from')
}
})
// Generate the new shrinkwrap JSON
const shrinkwrapJson = `${JSON.stringify(shrinkwrap, null, JSON_INDENT)}\n`
// Write back the modified npm-shrinkwrap.json
fs.writeFile(SHRINKWRAP_FILENAME, shrinkwrapJson, (error) => {
if (error) {
console.log(`[ERROR] Couldn't write shrinkwrap file: ${error.stack}`)
process.exit(1)
} else {
console.log(`[OK] Wrote shrinkwrap file to ${path.relative(__dirname, SHRINKWRAP_FILENAME)}`)
}
})
console.log('')

@ -1 +1 @@
Subproject commit 1ef259620d0b51cb7865104c949c8fb682bfa742
Subproject commit 6d5286d243783e0a2f454948f6214c9c1f7577c6

View File

@ -85,7 +85,7 @@ describe('Browser: SVGIcon', function () {
const compiledDoc = compiledSVGParser.parseFromString(compiledContents, 'image/svg+xml')
m.chai.expect(compiledDoc.outerHTML).to.equal(originalDoc.outerHTML)
})
}).timeout(10000)
it('should accept an SVG in the contents attribute', function () {
const iconContents = '<svg><rect x="10" y="10" height="100" width="100" style="stroke:red;fill:blue;"/></svg>'

View File

@ -29,7 +29,7 @@ if (!entrypoint) {
describe('Spectron', function () {
// Mainly for CI jobs
this.timeout(20000)
this.timeout(40000)
let app = null