bundle into dist folder, copy ask-pass shell scripts into dist, some 💄

This commit is contained in:
Johannes Rieken 2018-08-09 15:31:31 +02:00
parent 4bdf15ba9e
commit 776e491ba4
9 changed files with 94 additions and 26 deletions

3
.gitignore vendored
View file

@ -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
yarn-error.log

View file

@ -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);
}));

View file

@ -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);
}));

View file

@ -1,3 +1,5 @@
test/**
src/**
tsconfig.json
out/**
node_modules/**
tsconfig.json

View file

@ -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'
};

View file

@ -1 +0,0 @@
dist

View file

@ -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' }])
]
};

View file

@ -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",

View file

@ -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"