Skip to content

Commit

Permalink
webpack - with open null :( bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hernad committed Dec 30, 2019
1 parent e11f2ee commit d40e2da
Show file tree
Hide file tree
Showing 8 changed files with 1,934 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/ext"
"${workspaceRoot}/dist"
]
},
{
Expand Down
5 changes: 4 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ cli/node_modules
!cli/node_modules/xterm/css/xterm.css
linux
win32
node_modules/yarn/
node_modules/yarn/
node_modules
out
webpack.config.js
2 changes: 1 addition & 1 deletion ext/database.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as vscode from 'vscode';
import * as path from 'path';
import { Pool, Client, types, ClientConfig } from 'pg';
import { Client, ClientConfig } from 'pg';
import { IConnection } from "./IConnection";
import { OutputChannel } from './outputChannel';

Expand Down
52 changes: 22 additions & 30 deletions ext/extension.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
import * as vscode from 'vscode';
import { ExtensionContext, commands, window, extensions, workspace } from 'vscode';
import { Global } from './global';
import { F18Panel } from './f18Panel';
import { PostgresConnection } from './postgresConnection';
import { IConnection } from './IConnection';
import { isContext } from 'vm';
// import { Helper } from './helper';

export function activate(context: vscode.ExtensionContext) {
export function activate(context: ExtensionContext) {
console.log('F18 ekstenzija aktivna :)');

Global.context = context;

//Helper.linux_distribution().then((dist: string) => {
// vscode.window.showInformationMessage(dist)
//});

context.subscriptions.push(
vscode.commands.registerCommand('f18.start.cmd', () => {
commands.registerCommand('f18.start.cmd', () => {
F18Panel.createF18Instance('cmd');
})
)

const postgresExtension = vscode.extensions.getExtension('bringout.postgres');
const postgresExtension = extensions.getExtension('bringout.postgres');
if (postgresExtension == undefined) {
vscode.window.showErrorMessage('Instalirati bringout.postgres !');
window.showErrorMessage('Instalirati bringout.postgres !');
return;
};

postgresExtension.activate().then(() => {
const postgresApi = postgresExtension.exports;
// console.log( `postgresql API: ${importedApi.sum(1, 1)} ${importedApi.context()}`);
Global.contextPostgres = postgresApi.context();
// console.log('step: 0');

return(1);
}).then((result)=>{

Expand All @@ -40,54 +34,52 @@ export function activate(context: vscode.ExtensionContext) {
// console.log(connection.database);

context.subscriptions.push(
vscode.commands.registerCommand('f18.selectDatabase',
() => vscode.commands.executeCommand('postgres.selectDatabase').then(() => console.log('selected database'))
commands.registerCommand('f18.selectDatabase',
() => commands.executeCommand('postgres.selectDatabase').then(() => console.log('selected database'))
),
vscode.commands.registerCommand('f18.start.pos', () => {
commands.registerCommand('f18.start.pos', () => {
F18Panel.createF18Instance('pos');
}),
vscode.commands.registerCommand('f18.start.fin', () => {
commands.registerCommand('f18.start.fin', () => {
F18Panel.createF18Instance('fin');
}),
vscode.commands.registerCommand('f18.start.kalk', () => {
commands.registerCommand('f18.start.kalk', () => {
F18Panel.createF18Instance('kalk');
}),
vscode.commands.registerCommand('f18.start.fakt', () => {
commands.registerCommand('f18.start.fakt', () => {
F18Panel.createF18Instance('fakt');
}),
vscode.commands.registerCommand('f18.start.os', () => {
commands.registerCommand('f18.start.os', () => {
F18Panel.createF18Instance('os');
}),
vscode.commands.registerCommand('f18.start.ld', () => {
commands.registerCommand('f18.start.ld', () => {
F18Panel.createF18Instance('ld');
}),
vscode.commands.registerCommand('f18.start.epdv', () => {
commands.registerCommand('f18.start.epdv', () => {
F18Panel.createF18Instance('epdv');
})
);
});
});


const fullScreen = vscode.workspace.getConfiguration('f18').get('fullScreen');

//NEVER_MEASURE_RENDER_TIME_STORAGE_KEY = 'terminal.integrated.neverMeasureRenderTime'
const fullScreen = workspace.getConfiguration('f18').get('fullScreen');

if (fullScreen) vscode.commands.executeCommand('workbench.action.toggleFullScreen');
if (fullScreen) commands.executeCommand('workbench.action.toggleFullScreen');

vscode.commands.executeCommand('workbench.action.closeAllEditors');
commands.executeCommand('workbench.action.closeAllEditors');

// activity bar always visible
if (!vscode.workspace.getConfiguration('workbench').get('activityBar.visible'))
vscode.commands.executeCommand('workbench.action.toggleActivityBarVisibility');
if (!workspace.getConfiguration('workbench').get('activityBar.visible'))
commands.executeCommand('workbench.action.toggleActivityBarVisibility');

// const visibleSideBar = vscode.workspace.getConfiguration('workbench').get('sideBar.location');
// vscode.commands.executeCommand('workbench.action.toggleSidebarVisibility');

setTimeout(() => {
const onStart: string = vscode.workspace.getConfiguration('f18').get('onStart');
const onStart: string = workspace.getConfiguration('f18').get('onStart');
if (onStart.trim() !== '')
vscode.commands.executeCommand(`f18.start.${onStart}`);
commands.executeCommand(`f18.start.${onStart}`);
}, 1000);
}

2 changes: 1 addition & 1 deletion ext/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as ptyType from 'node-pty';
import * as httpsType from 'https-proxy-agent';
import { Constants } from './constants'
import * as vscode from 'vscode';
import { IConnection } from './IConnection';
//import { IConnection } from './IConnection';

export class Global {
public static keytar: typeof keytarType = getCoreNodeModule('keytar');
Expand Down
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"categories": [
"Other"
],
"main": "./build/ext/extension.js",
"main": "./dist/extension",
"contributes": {
"commands": [
{
Expand Down Expand Up @@ -142,14 +142,17 @@
"dependencies": {
"lodash": "^4.17.15",
"md5-file": "^4.0.0",
"pg": "^7.8.0",
"pg": "^7.17.0",
"proxy-from-env": "^1.0.0",
"rimraf": "^2.6.3"
},
"scripts": {
"webpack": "webpack --mode development",
"webpack-watch": "webpack --mode development --watch",
"node_modules": "cd cli && yarn && cd .. && yarn",
"build": "cd cli && yarn && webpack && cd .. && tsc -p tsconfig.json",
"vscode:prepublish": "cd cli && webpack && cd .. && tsc -p tsconfig.json",
"build0": "cd cli && yarn && webpack && cd .. && tsc -p tsconfig.json",
"build": "cd cli && yarn && webpack && cd .. && webpack --mode development && tsc -p tsconfig.json",
"vscode:prepublish": "cd cli && webpack && cd .. && webpack --mode production && tsc -p tsconfig.json",
"postinstall": "node ./node_modules/vscode/bin/install",
"extension-publish": "vsce publish --yarn"
},
Expand All @@ -164,9 +167,16 @@
"@types/rimraf": "^2.0.2",
"@types/yauzl": "^2.9.1",
"awesome-typescript-loader": "^5.2.1",
"ignore-emit-webpack-plugin": "^2.0.2",
"ignore-not-found-export-webpack-plugin": "^1.0.1",
"npm-install-webpack-plugin": "^4.0.5",
"source-map-loader": "^0.2.4",
"ts-loader": "^6.2.1",
"typescript": "^3.6.4",
"vscode": "^1.1.30",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-node-externals": "^1.7.2",
"yarn": "^1.19.1"
},
"repository": {
Expand Down
85 changes: 85 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//@ts-check
'use strict';

//const webpack = require('webpack');
const path = require('path');
//const nodeExternals = require('webpack-node-externals');
//const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
//const IgnoreNotFoundExportPlugin = require('ignore-not-found-export-webpack-plugin');



/**@type {import('webpack').Configuration}*/
const config = {
target: 'node', // vscode extensions run in a Node.js-context πŸ“– -> https://webpack.js.org/configuration/node/

entry: './ext/extension.ts', // the entry point of this extension, πŸ“– -> https://webpack.js.org/configuration/entry-context/
output: {
// the bundle is stored in the 'dist' folder (check package.json), πŸ“– -> https://webpack.js.org/configuration/output/
path: path.resolve(__dirname, 'dist'),
filename: 'extension.js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: '../[resource-path]'
},
/*
plugins: [
new webpack.IgnorePlugin(/pg-native/)
],
*/
devtool: 'source-map',
/*
externals: {
vscode: 'commonjs vscode', // node-pty keytar yauzl' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, πŸ“– -> https://webpack.js.org/configuration/externals/
'node-pty',
'keytar',
'yauzl'
},
*/
/*externals: [nodeExternals()],*/
externals: {
"pg-native": {
commonjs: 'pg-native',
commonjs2: 'pg-native'
},
"vscode": {
commonjs: 'vscode',
commonjs2: 'vscode'
},
"node-pty": {
commonjs: 'node-pty',
commonjs2: 'node-pty'
},
"keytar": {
commonjs: 'keytar',
commonjs2: 'keytar'
},
"yauzl": {
common: 'yauzl',
commonjs2: 'yauzl'
}
},
resolve: {
// support reading TypeScript and JavaScript files, πŸ“– -> https://github.com/TypeStrong/ts-loader
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
//compilerOptions: {
// "module": "esnext" // override `tsconfig.json` so that TypeScript emits native JavaScript modules.
//}
}
}

]
}
]
}
};
module.exports = config;
Loading

0 comments on commit d40e2da

Please sign in to comment.