mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Merge pull request #5489 from atom/ks-more-dedupes
Dedupe more bundled modules
This commit is contained in:
66
build/tasks/output-module-counts.coffee
Normal file
66
build/tasks/output-module-counts.coffee
Normal file
@@ -0,0 +1,66 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.registerTask 'output-module-counts', 'Log modules where more than one copy exists in node_modules', ->
|
||||
nodeModulesDir = path.resolve(__dirname, '..', '..', 'node_modules')
|
||||
|
||||
otherModules = {}
|
||||
atomModules = {}
|
||||
|
||||
sortModuleNames = (modules) ->
|
||||
Object.keys(modules).sort (name1, name2) ->
|
||||
diff = modules[name2].count - modules[name1].count
|
||||
diff = name1.localeCompare(name2) if diff is 0
|
||||
diff
|
||||
|
||||
getAtomTotal = ->
|
||||
Object.keys(atomModules).length
|
||||
|
||||
getOtherTotal = ->
|
||||
Object.keys(otherModules).length
|
||||
|
||||
recurseHandler = (absolutePath, rootPath, relativePath, fileName) ->
|
||||
return if fileName isnt 'package.json'
|
||||
|
||||
{name, version, repository} = grunt.file.readJSON(absolutePath)
|
||||
return unless name and version
|
||||
|
||||
repository = repository.url if repository?.url
|
||||
|
||||
if /.+\/atom\/.+/.test(repository)
|
||||
modules = atomModules
|
||||
else
|
||||
modules = otherModules
|
||||
|
||||
modules[name] ?= {versions: {}, count: 0}
|
||||
modules[name].count++
|
||||
modules[name].versions[version] = true
|
||||
|
||||
walkNodeModuleDir = ->
|
||||
grunt.file.recurse(nodeModulesDir, recurseHandler)
|
||||
|
||||
# Handle broken symlinks that grunt.file.recurse fails to handle
|
||||
loop
|
||||
try
|
||||
walkNodeModuleDir()
|
||||
break
|
||||
catch error
|
||||
if error.code is 'ENOENT'
|
||||
fs.unlinkSync(error.path)
|
||||
otherModules = {}
|
||||
atomModules = {}
|
||||
else
|
||||
break
|
||||
|
||||
if getAtomTotal() > 0
|
||||
console.log "Atom Modules: #{getAtomTotal()}"
|
||||
sortModuleNames(atomModules).forEach (name) ->
|
||||
{count, versions, atom} = atomModules[name]
|
||||
grunt.log.error "#{name}: #{count} (#{Object.keys(versions).join(', ')})" if count > 1
|
||||
console.log()
|
||||
|
||||
console.log "Other Modules: #{getOtherTotal()}"
|
||||
sortModuleNames(otherModules).forEach (name) ->
|
||||
{count, versions, atom} = otherModules[name]
|
||||
grunt.log.error "#{name}: #{count} (#{Object.keys(versions).join(', ')})" if count > 1
|
||||
45
package.json
45
package.json
@@ -21,7 +21,7 @@
|
||||
"dependencies": {
|
||||
"6to5-core": "^3.0.14",
|
||||
"async": "0.2.6",
|
||||
"atom-keymap": "^3.1.0",
|
||||
"atom-keymap": "^3.1.1",
|
||||
"bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
|
||||
"clear-cut": "0.4.0",
|
||||
"coffee-script": "1.8.0",
|
||||
@@ -35,10 +35,10 @@
|
||||
"fstream": "0.1.24",
|
||||
"fuzzaldrin": "^2.1",
|
||||
"git-utils": "^3.0.0",
|
||||
"grim": "1.1.0",
|
||||
"grim": "1.1.1",
|
||||
"guid": "0.0.10",
|
||||
"jasmine-json": "~0.0",
|
||||
"jasmine-tagged": "^1.1.2",
|
||||
"jasmine-tagged": "^1.1.3",
|
||||
"jquery": "^2.1.1",
|
||||
"less-cache": "0.21",
|
||||
"marked": "^0.3",
|
||||
@@ -58,13 +58,13 @@
|
||||
"scoped-property-store": "^0.16.2",
|
||||
"scrollbar-style": "^2.0.0",
|
||||
"season": "^5.1.2",
|
||||
"semver": "2.2.1",
|
||||
"semver": "~4.2",
|
||||
"serializable": "^1",
|
||||
"service-hub": "^0.2.0",
|
||||
"service-hub": "^0.4.0",
|
||||
"space-pen": "3.8.2",
|
||||
"stacktrace-parser": "0.1.1",
|
||||
"temp": "0.7.0",
|
||||
"text-buffer": "^4.1.1",
|
||||
"temp": "0.8.1",
|
||||
"text-buffer": "^4.1.3",
|
||||
"theorist": "^1.0.2",
|
||||
"underscore-plus": "^1.6.6",
|
||||
"vm-compatibility-layer": "0.1.0"
|
||||
@@ -82,7 +82,7 @@
|
||||
"one-light-ui": "0.3.0",
|
||||
"solarized-dark-syntax": "0.32.0",
|
||||
"solarized-light-syntax": "0.19.0",
|
||||
"archive-view": "0.47.0",
|
||||
"archive-view": "0.49.0",
|
||||
"autocomplete": "0.44.0",
|
||||
"autoflow": "0.22.0",
|
||||
"autosave": "0.20.0",
|
||||
@@ -93,34 +93,33 @@
|
||||
"deprecation-cop": "0.36.0",
|
||||
"dev-live-reload": "0.41.0",
|
||||
"encoding-selector": "0.18.0",
|
||||
"exception-reporting": "0.21.0",
|
||||
"find-and-replace": "0.156.0",
|
||||
"fuzzy-finder": "0.65.0",
|
||||
"git-diff": "0.51.0",
|
||||
"exception-reporting": "0.23.0",
|
||||
"find-and-replace": "0.157.0",
|
||||
"fuzzy-finder": "0.66.0",
|
||||
"git-diff": "0.52.0",
|
||||
"go-to-line": "0.30.0",
|
||||
"grammar-selector": "0.45.0",
|
||||
"image-view": "0.49.0",
|
||||
"incompatible-packages": "0.22.0",
|
||||
"keybinding-resolver": "0.27.0",
|
||||
"keybinding-resolver": "0.28.0",
|
||||
"link": "0.30.0",
|
||||
"markdown-preview": "0.134.0",
|
||||
"markdown-preview": "0.135.0",
|
||||
"metrics": "0.43.0",
|
||||
"notifications": "0.27.0",
|
||||
"open-on-github": "0.32.0",
|
||||
"package-generator": "0.37.0",
|
||||
"release-notes": "0.48.0",
|
||||
"settings-view": "0.178.0",
|
||||
"snippets": "0.72.0",
|
||||
"package-generator": "0.38.0",
|
||||
"release-notes": "0.49.0",
|
||||
"snippets": "0.73.0",
|
||||
"spell-check": "0.54.0",
|
||||
"status-bar": "0.59.0",
|
||||
"status-bar": "0.60.0",
|
||||
"styleguide": "0.44.0",
|
||||
"symbols-view": "0.82.0",
|
||||
"tabs": "0.65.0",
|
||||
"symbols-view": "0.83.0",
|
||||
"tabs": "0.67.0",
|
||||
"timecop": "0.29.0",
|
||||
"tree-view": "0.154.0",
|
||||
"tree-view": "0.155.0",
|
||||
"update-package-dependencies": "0.8.0",
|
||||
"welcome": "0.21.0",
|
||||
"whitespace": "0.28.0",
|
||||
"whitespace": "0.29.0",
|
||||
"wrap-guide": "0.31.0",
|
||||
"language-c": "0.38.0",
|
||||
"language-clojure": "0.12.0",
|
||||
|
||||
@@ -37,7 +37,30 @@ function bootstrap() {
|
||||
var initialNpmCommand = fs.existsSync(npmPath) ? npmPath : 'npm';
|
||||
var npmFlags = ' --userconfig=' + path.resolve('.npmrc') + ' ';
|
||||
|
||||
var packagesToDedupe = ['fs-plus', 'humanize-plus', 'oniguruma', 'roaster', 'season', 'grim', 'q'];
|
||||
var packagesToDedupe = [
|
||||
'abbrev',
|
||||
'amdefine',
|
||||
'atom-space-pen-views',
|
||||
'cheerio',
|
||||
'domelementtype',
|
||||
'fs-plus',
|
||||
'grim',
|
||||
'highlights',
|
||||
'humanize-plus',
|
||||
'iconv-lite',
|
||||
'inherits',
|
||||
'loophole',
|
||||
'oniguruma',
|
||||
'q',
|
||||
'request',
|
||||
'rimraf',
|
||||
'roaster',
|
||||
'season',
|
||||
'sigmund',
|
||||
'semver',
|
||||
'through',
|
||||
'temp'
|
||||
];
|
||||
|
||||
var buildInstallCommand = initialNpmCommand + npmFlags + 'install';
|
||||
var buildInstallOptions = {cwd: path.resolve(__dirname, '..', 'build')};
|
||||
|
||||
Reference in New Issue
Block a user