Skip to content

Commit

Permalink
Merge pull request #29 from bugwheels94/bugwheels94/feature
Browse files Browse the repository at this point in the history
Bugwheels94/feature
  • Loading branch information
bugwheels94 authored Sep 5, 2022
2 parents 16cd73c + 435b492 commit b9d06c1
Show file tree
Hide file tree
Showing 21 changed files with 541 additions and 201 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ name: Release
jobs:
release:
name: release
runs-on: macos-11
runs-on: macos-12
steps:
- uses: actions/checkout@v2
# - uses: actions/setup-node@v2
# with:
# cache: npm
# node-version: 16
# cache-dependency-path: 'package.json'
- run: npm i -g @lytejs/mesh@alpha pkg && mesh sync dependencies
- run: npm i -g @lytejs/mesh@beta && mesh sync dependencies
- run: npm i --legacy-peer-deps
- run: npm run build
- run: pkg package.json
- run: mesh npm zip-npm-files
- run: npx semantic-release
env:
HUSKY: 0
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ temp/
*.sqlite
/super-terminal-*
dist/
*.zip
*.zip
.DS_Store
/out
*.dmg
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

git fetch origin && git merge origin/master
15 changes: 9 additions & 6 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/exec",
{
"publishCmd": "npm run make && npm run make-dmg"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "dist.zip"
},
{
"path": "super-terminal-macos"
"path": "out/**/*.zip"
},
{
"path": "super-terminal-linux"
"path": "*.dmg"
},
{
"path": "super-terminal-win.exe"
"path": "out/**/*.exe"
}
]
}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Intro
16 changes: 8 additions & 8 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ module.exports = {
},
],
cjs && ['@babel/transform-modules-commonjs', { loose }],
[
'@babel/transform-runtime',
{
// useESModules: !cjs, @babe
// eslint-disable-next-line @typescript-eslint/no-var-requires
// version: require('./package.json').dependencies['@babel/runtime'].replace(/^[^0-9]*/, ''),
},
],
// [
// '@babel/transform-runtime',
// {
// useESModules: !cjs, @babe
// eslint-disable-next-line @typescript-eslint/no-var-requires
// version: require('./package.json').dependencies['@babel/runtime'].replace(/^[^0-9]*/, ''),
// },
// ],
].filter(Boolean),
};
7 changes: 7 additions & 0 deletions dmg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "Super Terminal",
"contents": [
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
{ "x": 192, "y": 344, "type": "file", "path": "out/Super Terminal-darwin-x64/Super Terminal.app" }
]
}
70 changes: 70 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
const { app, BrowserWindow, Menu } = require('electron');
const path = require('path');
const fs = require('fs');
const util = require('util');
const { main } = require('./dist/index');
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
// preload: path.join(__dirname, 'preload.js'),
},
});

// and load the index.html of the app.
mainWindow.loadURL('http://localhost:7001');
// mainWindow.loadFile('node_modules/super-terminal-ui/dist/index.html');

// Open the DevTools.
mainWindow.webContents.openDevTools();
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
const isMac = process.platform === 'darwin';
const dockMenu = Menu.buildFromTemplate([
{
label: 'New Window',
click() {
createWindow();
},
},
]);

app
.whenReady()
.then(() => {
if (process.platform === 'darwin') {
app.dock.setMenu(dockMenu);
}
})
.then(() => {
createWindow();

app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});

// use a fixed path, to ensure log shows outside Electron dist
// const logPath = `/Users/ankit.gautam/chutiya.log`;
// const logFile = fs.createWriteStream(logPath, { flags: 'w' });
// const logStdout = process.stdout;

// console.log = function (...args) {
// logFile.write(util.format.apply(null, args) + '\n');
// logStdout.write(util.format.apply(null, args) + '\n');
// };
// console.error = console.log;
14 changes: 0 additions & 14 deletions ormconfig.json

This file was deleted.

72 changes: 62 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"name": "super-terminal",
"version": "0.0.0-development",
"description": "Terminal Manager",
"repository": "https://github.com/super-terminal/super-terminal",
"repository": {
"type": "git",
"url": "git+https://github.com/super-terminal/super-terminal.git"
},
"license": "MIT",
"keywords": [],
"main": "dist/index.js",
"main": "main.js",
"bin": {
"super-terminal": "dist/index.js"
},
Expand All @@ -16,7 +19,11 @@
"test": "run-s build test:*",
"start:watch": "run-p build:watch nodemon-server",
"typeorm": "typeorm-ts-node-commonjs",
"prepare": "husky install"
"prepare": "husky install",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"make-dmg": "npx appdmg dmg.json \"Super Terminal.dmg\""
},
"engines": {
"node": ">=10"
Expand All @@ -29,26 +36,44 @@
"@babel/plugin-transform-runtime": "^7.18.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@electron-forge/cli": "^6.0.0-beta.65",
"@electron-forge/maker-deb": "^6.0.0-beta.65",
"@electron-forge/maker-rpm": "^6.0.0-beta.65",
"@electron-forge/maker-squirrel": "^6.0.0-beta.65",
"@electron-forge/maker-zip": "^6.0.0-beta.65",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@rollup/plugin-replace": "^4.0.0",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/github": "^8.0.4",
"@semantic-release/npm": "^9.0.1",
"@types/js-yaml": "^4.0.5",
"@types/lodash": "^4.14.182",
"@types/node": "^16.11.10",
"@types/sqlite3": "^3.1.8",
"@types/tcp-port-used": "^1.0.1",
"appdmg": "^0.6.4",
"babel-plugin-const-enum": "^1.2.0",
"babel-plugin-transform-typescript-metadata": "^0.3.2",
"define-lazy-prop": "^3.0.0",
"electron": "^17.4.11",
"fast-glob": "^3.2.11",
"husky": "^8.0.1",
"is-docker": "^3.0.0",
"is-wsl": "^2.2.0",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"node-pre-gyp": "^0.11.0",
"nodemon": "^2.0.16",
"npm-run-all": "^4.1.5",
"reflect-metadata": "^0.1.13",
"restify-websocket": "^1.2.0-beta.2",
"rollup": "^2.70.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"semantic-release": "^19.0.2",
"strip-ansi": "^7.0.1",
"ts-node": "10.7.0",
"typescript": "4.5.2"
},
Expand All @@ -69,16 +94,12 @@
"access": "public"
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"babel-plugin-transform-typescript-metadata": "^0.3.2",
"electron-squirrel-startup": "^1.0.0",
"express": "^4.18.1",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"node-pre-gyp": "^0.11.0",
"node-pty": "^0.10.1",
"restify-websocket": "0.0.0-development",
"sqlite3": "^4.0.3",
"super-terminal-ui": "0.0.0-development",
"super-terminal-ui": "^1.1.0-beta.1",
"tcp-port-used": "^1.0.2",
"typeorm": "0.3.6",
"ws": "^8.5.0"
},
Expand All @@ -97,5 +118,36 @@
"super-terminal-ui": {
"type": "npm"
}
},
"bugs": {
"url": "https://github.com/super-terminal/super-terminal/issues"
},
"homepage": "https://github.com/super-terminal/super-terminal#readme",
"author": "bugwheels94",
"config": {
"forge": {
"packagerConfig": {
"name": "Super Terminal"
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "super_terminal_app"
}
},
{
"name": "@electron-forge/maker-zip"
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
}
}
30 changes: 19 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ const extensions = ['.js', '.ts'];
const babelIncludes = ['./src/**/*'];
const configs = globby.sync(['./src/**', '!./src/**.json']);
const bundleNpmWorkspacePackages = ['ws'];
const bundlePackages = ['restify-websocket', 'isomorphic-ws'];
const neverBundlePackages = ['node-pty', '@babel/runtime', 'ws'];
const bundlePackages = [
'restify-websocket',
'isomorphic-ws',
'strip-ansi',
'ansi-regex',
'is-wsl',
'is-docker',
'define-lazy-prop',
];
const neverBundlePackages = ['node-pty', 'ws', 'sqlite3', 'tcp-port-used', 'express', 'typeorm'];
const shouldBundleLocalFilesTogether = false;
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'undefined';
const isProduction = process.env.NODE_ENV === 'production';
console.log('??', isDevelopment, isProduction);
const isDevelopment = !!process.env.ROLLUP_WATCH;
const isProduction = !isDevelopment;
const isPackageDependency = (pkg, path, importer = '') => {
return (
path.includes('node_modules/' + pkg) ||
(importer.includes('node_modules/' + pkg) && (console.log('???', path, importer), path.startsWith('.'))) ||
(importer.includes('node_modules/' + pkg) && path.startsWith('.')) ||
path === pkg
);
};
Expand All @@ -36,6 +43,7 @@ const getRollupConfig =
external(id, second = '') {
const sanitizedId = id.split('?')[0];
const isNodeModule = id.includes('node_modules');
const isLocalModule = id.startsWith('.') || (id.startsWith('/') && !isNodeModule);
if (id.endsWith('.json')) return false;
if (sanitizedId.endsWith(input.replace('./', '/'))) {
return false;
Expand All @@ -55,11 +63,11 @@ const getRollupConfig =
return false;
}

if (isNodeModule) {
return true;
if (isLocalModule) {
console.log(id, second);
return !shouldBundleLocalFilesTogether;
}

return !shouldBundleLocalFilesTogether;
return false;
},
plugins: [
replace({
Expand All @@ -74,7 +82,7 @@ const getRollupConfig =
commonjs(),
babel({
extensions,
babelHelpers: 'runtime',
// babelHelpers: 'runtime',
include: babelIncludes,
}),
peerDepsExternal(),
Expand Down
4 changes: 3 additions & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"CERT": "",
"KEY": "",
"UI": "",
"HOST_NAME": "127.0.0.1"
"BIND_ADDRESS": "127.0.0.1",
"REMOTE_ADDRESS": "localhost",
"BROWSER": "chrome"
}
Loading

0 comments on commit b9d06c1

Please sign in to comment.