From 776e491ba4ea5245da9aa75a9d4b5683c2e2221e Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 9 Aug 2018 15:31:31 +0200 Subject: [PATCH] bundle into dist folder, copy ask-pass shell scripts into dist, some :lipstick: --- .gitignore | 3 +- build/lib/extensions.js | 7 ++- build/lib/extensions.ts | 8 ++- extensions/emmet/.vscodeignore | 4 +- extensions/emmet/extension.webpack.config.js | 19 ++++--- extensions/git/.gitignore | 1 - extensions/git/extension.webpack.config.js | 24 +++++---- package.json | 1 + yarn.lock | 53 +++++++++++++++++++- 9 files changed, 94 insertions(+), 26 deletions(-) delete mode 100644 extensions/git/.gitignore diff --git a/.gitignore b/.gitignore index 08adb4af663a6..6a9804cd2373e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ npm-debug.log Thumbs.db node_modules/ .build/ +extensions/**/dist/ out/ out-build/ out-editor/ @@ -17,4 +18,4 @@ build/node_modules coverage/ test_data/ test-results/ -yarn-error.log \ No newline at end of file +yarn-error.log diff --git a/build/lib/extensions.js b/build/lib/extensions.js index 11c5e0c0b03e1..af06cde2b942a 100644 --- a/build/lib/extensions.js +++ b/build/lib/extensions.js @@ -40,11 +40,16 @@ function fromLocal(extensionPath) { var patchFilesStream = filesStream .pipe(packageJsonFilter) .pipe(buffer()) - .pipe(json({ main: './out/main.bundle' })) // hardcoded entry point! + .pipe(json(function (data) { + // hardcoded entry point directory! + data.main = data.main.replace('/out/', /dist/); + return data; + })) .pipe(packageJsonFilter.restore); var webpackConfig = require(path.join(extensionPath, 'extension.webpack.config.js')); var webpackStream = webpackGulp(webpackConfig, webpack) .pipe(es.through(function (data) { + data.stat = data.stat || {}; data.base = extensionPath; this.emit('data', data); })); diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index 90dd5502981f5..2191710f23270 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -20,7 +20,6 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vsce from 'vsce'; import * as File from 'vinyl'; -import { rebase } from './util'; export function fromLocal(extensionPath: string): Stream { let result = es.through(); @@ -46,12 +45,17 @@ export function fromLocal(extensionPath: string): Stream { const patchFilesStream = filesStream .pipe(packageJsonFilter) .pipe(buffer()) - .pipe(json({ main: './out/main.bundle' })) // hardcoded entry point! + .pipe(json(data => { + // hardcoded entry point directory! + data.main = data.main.replace('/out/', /dist/); + return data; + })) .pipe(packageJsonFilter.restore); const webpackConfig = require(path.join(extensionPath, 'extension.webpack.config.js')); const webpackStream = webpackGulp(webpackConfig, webpack) .pipe(es.through(function (data) { + data.stat = data.stat || {}; data.base = extensionPath; this.emit('data', data); })); diff --git a/extensions/emmet/.vscodeignore b/extensions/emmet/.vscodeignore index ebab1d50b9ba0..d278b9bf417e1 100644 --- a/extensions/emmet/.vscodeignore +++ b/extensions/emmet/.vscodeignore @@ -1,3 +1,5 @@ test/** src/** -tsconfig.json \ No newline at end of file +out/** +node_modules/** +tsconfig.json diff --git a/extensions/emmet/extension.webpack.config.js b/extensions/emmet/extension.webpack.config.js index 7f7e41df2e50e..5534ef2030b55 100644 --- a/extensions/emmet/extension.webpack.config.js +++ b/extensions/emmet/extension.webpack.config.js @@ -8,23 +8,22 @@ const path = require('path'); module.exports = { - // mode: 'none', - mode: 'production', - target: 'node', + stats: 'errors-only', + // mode: 'none', // default is production context: __dirname, + target: 'node', + resolve: { + mainFields: ['main'] + }, entry: { - main: './out/extension.js', + extension: './out/extension.js', }, output: { - filename: '[name].bundle.js', - path: path.join(__dirname, 'out'), + filename: '[name].js', + path: path.join(__dirname, 'dist'), libraryTarget: "commonjs", }, externals: { 'vscode': 'commonjs vscode', }, - resolve: { - mainFields: ['main'] - }, - stats: 'errors-only' }; diff --git a/extensions/git/.gitignore b/extensions/git/.gitignore deleted file mode 100644 index 1521c8b7652b1..0000000000000 --- a/extensions/git/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/extensions/git/extension.webpack.config.js b/extensions/git/extension.webpack.config.js index 480e64fc558b6..d2c8a4eee952b 100644 --- a/extensions/git/extension.webpack.config.js +++ b/extensions/git/extension.webpack.config.js @@ -6,26 +6,32 @@ 'use strict'; const path = require('path'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); module.exports = { - // mode: 'none', - mode: 'production', - target: 'node', + stats: 'errors-only', + // mode: 'none', // default is production context: __dirname, + target: 'node', + node: { + __dirname: false + }, + resolve: { + mainFields: ['main'] + }, entry: { main: './out/main.js', ['askpass-main']: './out/askpass-main.js' }, output: { - filename: '[name].bundle.js', - path: path.join(__dirname, 'out'), + filename: '[name].js', + path: path.join(__dirname, 'dist'), libraryTarget: "commonjs" }, externals: { 'vscode': 'commonjs vscode', }, - resolve: { - mainFields: ['main'] - }, - stats: 'errors-only' + plugins: [ + new CopyWebpackPlugin([{ from: './out/*.sh', to: '[name].sh' }]) + ] }; diff --git a/package.json b/package.json index ca9122ea56d83..38d58c1f3618d 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", "clean-css": "3.4.6", + "copy-webpack-plugin": "^4.5.2", "coveralls": "^2.11.11", "cson-parser": "^1.3.3", "debounce": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index 19cb0c010e545..8b5ee32b9da32 100644 --- a/yarn.lock +++ b/yarn.lock @@ -471,7 +471,7 @@ array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" -arrify@^1.0.0: +arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -1375,6 +1375,19 @@ copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" +copy-webpack-plugin@^4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.5.2.tgz#d53444a8fea2912d806e78937390ddd7e632ee5c" + dependencies: + cacache "^10.0.4" + find-cache-dir "^1.0.0" + globby "^7.1.1" + is-glob "^4.0.0" + loader-utils "^1.1.0" + minimatch "^3.0.4" + p-limit "^1.0.0" + serialize-javascript "^1.4.0" + core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -1793,6 +1806,13 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" +dir-glob@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" + dependencies: + arrify "^1.0.1" + path-type "^3.0.0" + doctrine@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" @@ -2943,6 +2963,17 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +globby@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/globby/-/globby-7.1.1.tgz#fb2ccff9401f8600945dfada97440cca972b8680" + dependencies: + array-union "^1.0.1" + dir-glob "^2.0.0" + glob "^7.1.2" + ignore "^3.3.5" + pify "^3.0.0" + slash "^1.0.0" + globule@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/globule/-/globule-0.1.0.tgz#d9c8edde1da79d125a151b79533b978676346ae5" @@ -3582,6 +3613,10 @@ ignore@^3.2.0: version "3.3.7" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" +ignore@^3.3.5: + version "3.3.10" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" + import-local@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" @@ -5402,6 +5437,12 @@ p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" +p-limit@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + dependencies: + p-try "^1.0.0" + p-limit@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" @@ -5567,6 +5608,12 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + dependencies: + pify "^3.0.0" + pause-stream@0.0.11: version "0.0.11" resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445" @@ -6737,6 +6784,10 @@ sinon@^1.17.2: samsam "1.1.2" util ">=0.10.3 <1" +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35"