Browse Source

Bundles node_modules directly into extension.js

Updates dependencies
main
Eric Amodio 6 years ago
parent
commit
f93d8ca2db
8 changed files with 863 additions and 378 deletions
  1. +3
    -1
      .gitignore
  2. +10
    -6
      .vscodeignore
  3. +795
    -349
      package-lock.json
  4. +5
    -7
      package.json
  5. +1
    -2
      src/commands/copyMessageToClipboard.ts
  6. +1
    -2
      src/commands/copyShaToClipboard.ts
  7. +1
    -1
      src/git/remotes/provider.ts
  8. +47
    -10
      webpack.config.js

+ 3
- 1
.gitignore View File

@ -1,5 +1,7 @@
.image-cache
.cache-images
.cache-loader
dist dist
fallbacks
node_modules node_modules
settings.html settings.html
welcome.html welcome.html

+ 10
- 6
.vscodeignore View File

@ -1,4 +1,8 @@
.image-cache/**
.cache-images/**
.cache-loader/**
.github/**
.vscode/**
dist/ui/**
emoji/** emoji/**
!images/dark/** !images/dark/**
!images/light/** !images/light/**
@ -7,16 +11,16 @@ emoji/**
!images/gitlens-activitybar.svg !images/gitlens-activitybar.svg
!images/cl-*.png !images/cl-*.png
images/** images/**
.vscode/**
test/**
node_modules/**
src/** src/**
dist/ui/**
test/**
*.map *.map
.github/**
.gitignore .gitignore
.rpt2_cache/**
.prettierignore
.prettierrc
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md
package-lock.json package-lock.json
tsconfig.json tsconfig.json
tslint.json tslint.json
ui.tsconfig.json
webpack.config.js webpack.config.js

+ 795
- 349
package-lock.json
File diff suppressed because it is too large
View File


+ 5
- 7
package.json View File

@ -3577,7 +3577,7 @@
"scripts": { "scripts": {
"build": "webpack --env.development", "build": "webpack --env.development",
"bundle": "webpack --env.production", "bundle": "webpack --env.production",
"clean": "git clean -Xdf",
"clean": "git clean -Xdf -e !.cache-images",
"lint": "tslint --project tsconfig.json && tslint --project ui.tsconfig.json", "lint": "tslint --project tsconfig.json && tslint --project ui.tsconfig.json",
"pack": "vsce package", "pack": "vsce package",
"pretty": "prettier --config .prettierrc --loglevel warn --write \"./**/*.{ts,md,json}\" && tslint --project tsconfig.json --fix && tslint --project ui.tsconfig.json --fix", "pretty": "prettier --config .prettierrc --loglevel warn --write \"./**/*.{ts,md,json}\" && tslint --project tsconfig.json --fix && tslint --project ui.tsconfig.json --fix",
@ -3603,9 +3603,9 @@
"@types/node": "8.10.29", "@types/node": "8.10.29",
"clean-webpack-plugin": "0.1.19", "clean-webpack-plugin": "0.1.19",
"css-loader": "1.0.0", "css-loader": "1.0.0",
"filemanager-webpack-plugin": "2.0.5",
"html-webpack-inline-source-plugin": "0.0.10", "html-webpack-inline-source-plugin": "0.0.10",
"html-webpack-plugin": "3.2.0", "html-webpack-plugin": "3.2.0",
"husky": "0.14.3",
"imagemin-webpack-plugin": "2.2.0", "imagemin-webpack-plugin": "2.2.0",
"mini-css-extract-plugin": "0.4.2", "mini-css-extract-plugin": "0.4.2",
"node-sass": "4.9.3", "node-sass": "4.9.3",
@ -3613,16 +3613,14 @@
"prettier-tslint": "0.4.0", "prettier-tslint": "0.4.0",
"sass-loader": "7.1.0", "sass-loader": "7.1.0",
"size-plugin": "1.0.1", "size-plugin": "1.0.1",
"style-loader": "0.23.0",
"tslint": "5.11.0", "tslint": "5.11.0",
"tslint-loader": "3.6.0", "tslint-loader": "3.6.0",
"tslint-prettiest": "0.0.1", "tslint-prettiest": "0.0.1",
"ts-loader": "5.0.0",
"ts-loader": "5.1.0",
"typescript": "3.0.3", "typescript": "3.0.3",
"vscode": "1.1.21", "vscode": "1.1.21",
"webpack": "4.17.2",
"webpack": "4.18.0",
"webpack-cli": "3.1.0", "webpack-cli": "3.1.0",
"webpack-deep-scope-plugin": "1.5.3",
"webpack-node-externals": "1.7.2"
"webpack-deep-scope-plugin": "1.6.0"
} }
} }

+ 1
- 2
src/commands/copyMessageToClipboard.ts View File

@ -1,4 +1,5 @@
'use strict'; 'use strict';
import * as clipboard from 'clipboardy';
import { TextEditor, Uri, window } from 'vscode'; import { TextEditor, Uri, window } from 'vscode';
import { Container } from '../container'; import { Container } from '../container';
import { GitUri } from '../git/gitService'; import { GitUri } from '../git/gitService';
@ -30,8 +31,6 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
uri = getCommandUri(uri, editor); uri = getCommandUri(uri, editor);
try { try {
const clipboard = await import('clipboardy');
args = { ...args }; args = { ...args };
// If we don't have an editor then get the message of the last commit to the branch // If we don't have an editor then get the message of the last commit to the branch

+ 1
- 2
src/commands/copyShaToClipboard.ts View File

@ -1,4 +1,5 @@
'use strict'; 'use strict';
import * as clipboard from 'clipboardy';
import { TextEditor, Uri, window } from 'vscode'; import { TextEditor, Uri, window } from 'vscode';
import { Container } from '../container'; import { Container } from '../container';
import { GitUri } from '../git/gitService'; import { GitUri } from '../git/gitService';
@ -29,8 +30,6 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
uri = getCommandUri(uri, editor); uri = getCommandUri(uri, editor);
try { try {
const clipboard = await import('clipboardy');
args = { ...args }; args = { ...args };
// If we don't have an editor then get the sha of the last commit to the branch // If we don't have an editor then get the sha of the last commit to the branch

+ 1
- 1
src/git/remotes/provider.ts View File

@ -1,4 +1,5 @@
'use strict'; 'use strict';
import * as clipboard from 'clipboardy';
import { commands, Range, Uri, window } from 'vscode'; import { commands, Range, Uri, window } from 'vscode';
import { BuiltInCommands } from '../../constants'; import { BuiltInCommands } from '../../constants';
import { Logger } from '../../logger'; import { Logger } from '../../logger';
@ -118,7 +119,6 @@ export abstract class RemoteProvider {
if (url === undefined) return undefined; if (url === undefined) return undefined;
try { try {
const clipboard = await import('clipboardy');
void (await clipboard.write(url)); void (await clipboard.write(url));
return undefined; return undefined;

+ 47
- 10
webpack.config.js View File

@ -1,8 +1,10 @@
'use strict'; 'use strict';
const fs = require('fs');
const glob = require('glob'); const glob = require('glob');
const nodeExternals = require('webpack-node-externals');
const path = require('path'); const path = require('path');
const webpack = require('webpack');
const CleanPlugin = require('clean-webpack-plugin'); const CleanPlugin = require('clean-webpack-plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const HtmlInlineSourcePlugin = require('html-webpack-inline-source-plugin'); const HtmlInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const HtmlPlugin = require('html-webpack-plugin'); const HtmlPlugin = require('html-webpack-plugin');
const ImageminPlugin = require('imagemin-webpack-plugin').default; const ImageminPlugin = require('imagemin-webpack-plugin').default;
@ -14,16 +16,46 @@ module.exports = function(env, argv) {
env = env || {}; env = env || {};
env.production = !!env.production; env.production = !!env.production;
env.optimizeImages = env.production || !!env.optimizeImages; env.optimizeImages = env.production || !!env.optimizeImages;
env.copyClipboardyFallbacks = env.production || !!env.copyClipboardyFallbacks;
if (!env.copyClipboardyFallbacks && !fs.existsSync(path.resolve(__dirname, 'fallbacks'))) {
env.copyClipboardyFallbacks = true;
}
return [getExtensionConfig(env), getUIConfig(env)]; return [getExtensionConfig(env), getUIConfig(env)];
}; };
function getExtensionConfig(env) { function getExtensionConfig(env) {
const clean = ['dist'];
if (env.copyClipboardyFallbacks) {
clean.push('fallbacks');
}
const plugins = [ const plugins = [
// https://github.com/GoogleChromeLabs/size-plugin/issues/12 // https://github.com/GoogleChromeLabs/size-plugin/issues/12
// new SizePlugin(), // new SizePlugin(),
new CleanPlugin(['dist'], { verbose: false })
new CleanPlugin(clean, { verbose: false }),
new webpack.IgnorePlugin(/^spawn-sync$/)
]; ];
if (env.copyClipboardyFallbacks) {
plugins.push(
// @ts-ignore
new FileManagerPlugin({
onEnd: [
{
copy: [
{
source: path.resolve(__dirname, 'node_modules/clipboardy/fallbacks'),
destination: 'fallbacks/'
}
]
}
]
})
);
}
// if (env.production) { // if (env.production) {
// plugins.push(new WebpackDeepScopeAnalysisPlugin()); // plugins.push(new WebpackDeepScopeAnalysisPlugin());
// } // }
@ -33,6 +65,9 @@ function getExtensionConfig(env) {
entry: './src/extension.ts', entry: './src/extension.ts',
mode: env.production ? 'production' : 'development', mode: env.production ? 'production' : 'development',
target: 'node', target: 'node',
node: {
__dirname: false
},
devtool: !env.production ? 'eval-source-map' : undefined, devtool: !env.production ? 'eval-source-map' : undefined,
output: { output: {
libraryTarget: 'commonjs2', libraryTarget: 'commonjs2',
@ -40,10 +75,9 @@ function getExtensionConfig(env) {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
devtoolModuleFilenameTemplate: 'file:///[absolute-resource-path]' devtoolModuleFilenameTemplate: 'file:///[absolute-resource-path]'
}, },
resolve: {
extensions: ['.tsx', '.ts', '.js']
externals: {
vscode: 'commonjs vscode'
}, },
externals: [nodeExternals()],
module: { module: {
rules: [ rules: [
{ {
@ -58,6 +92,9 @@ function getExtensionConfig(env) {
} }
] ]
}, },
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
plugins: plugins, plugins: plugins,
stats: { stats: {
all: false, all: false,
@ -133,7 +170,7 @@ function getUIConfig(env) {
sources: glob.sync('src/ui/images/settings/*.png'), sources: glob.sync('src/ui/images/settings/*.png'),
destination: path.resolve(__dirname, 'images') destination: path.resolve(__dirname, 'images')
}, },
cacheFolder: path.resolve(__dirname, '.image-cache'),
cacheFolder: path.resolve(__dirname, '.cache-images'),
gifsicle: null, gifsicle: null,
jpegtran: null, jpegtran: null,
optipng: null, optipng: null,
@ -177,10 +214,6 @@ function getUIConfig(env) {
} }
} }
}, },
resolve: {
extensions: ['.tsx', '.ts', '.js'],
modules: [path.resolve(__dirname, 'src/ui'), 'node_modules']
},
module: { module: {
rules: [ rules: [
{ {
@ -230,6 +263,10 @@ function getUIConfig(env) {
} }
] ]
}, },
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [path.resolve(__dirname, 'src/ui'), 'node_modules']
},
plugins: plugins, plugins: plugins,
stats: { stats: {
all: false, all: false,

Loading…
Cancel
Save