Skip to content

Commit

Permalink
feat: init public version
Browse files Browse the repository at this point in the history
  • Loading branch information
yantze committed Dec 17, 2021
0 parents commit 1b7334a
Show file tree
Hide file tree
Showing 52 changed files with 14,774 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
"env": {
"commonjs": true,
"es2021": true,
"node": true,
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
}
};
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: RELEASE

on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node_version: [12.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Package Electron
run: |
npm i
npm run rebuild-native
npm run link-local
npm run pack
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
files: |
LICENSE
tools/electron/dist/*.dmg
- name: Release ✅
if: ${{ success() }}
run: |
echo 执行成功
- name: Release 🚨
if: ${{ failure() }}
run: |
echo 执行失败
93 changes: 93 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 由 https://github.com/msfeldstein/gitignore 自动生成
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
# typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
dist
lib
out
.vscode/*
!.vscode/launch.json

tools/workspace/*

packages/feature-extension/test/init/node_modules
packages/vscode-extension/test/init/node_modules

extensions
app
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src
vendor
scripts
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "pack",
"program": "${workspaceFolder}/build/pack/index.js"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Extension Host",
"port": 9889,
"restart": true,
},
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"
},
"args" : ["."],
"outputCapture": "std"
}
]
}
7 changes: 7 additions & 0 deletions LEGAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Legal Disclaimer

Within this source code, the comments in Chinese shall be the original, governing version. Any comment in other languages are for reference only. In the event of any conflict between the Chinese language version comments and other language version comments, the Chinese language version shall prevail.

法律免责声明

关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# OpenSumi IDE Electron 集成示例

## 启动步骤

```shell
git clone git@github.com:opensumi/ide-electron.git
cd ide-electron
yarn
yarn run build
yarn run rebuild-native -- --force-rebuild=true
npm run download-extension # 可选
npm run start
```

- 运行效果
![](./snapshots/screenshot-main.png)

## 如何开发

首先需要在根目录执行 `watch`

```bash
tnpm run watch
```

然后再开一个终端,进行:

```bash
tnpm run start
```

打开编辑器之后,当代码有新改动时,打开编辑器内的命令行:<kbd>shift</kbd>+<kbd>command</kbd>+<kbd>p</kbd>,输入 `Reload Window` 即可看到新变化。

## 如何定制

1. 去掉示例代码,可以直接删除 `src/browser/index.ts` 中的 `StartupModule` 即可。

2. 如何实现 browser 与 node 通讯,可以看看 Topbar 的实现。启用可以取消注释, `src/browser/index.ts``src/node/index.ts` 中 TopbarModule 的注释。

### 切换软件图标

1. 通过 Cmd+Shift+p 打开输入框,输入「文件图标主题」可以在下拉列表中切换,也可以自行在插件市场选择其它图标主题。

## 打包成 dmg

只需要简单的执行 `tnpm run pack` 即可在 `./out/mac` 中看到生成的 `out/Kaitian IDE-1.0.0.dmg`

> 在打包脚本中加了 `CSC_IDENTITY_AUTO_DISCOVERY=false` 以便打包时不进行签名。
4 changes: 4 additions & 0 deletions build/extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

function installExtensions() {

}
30 changes: 30 additions & 0 deletions build/pack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const fs = require('fs');
const path = require('path');
const electronBuilder = require('electron-builder');
const rootPackage = require('../package.json');

// 使用双 package.json 结构,自动处理 node_modules
fs.copyFileSync(path.join(__dirname, '../build/package.json'), path.join(__dirname, '../app/package.json'));

electronBuilder.build({
config: {
productName: 'Kaitian IDE',
npmArgs: ['--registry=https://registry.npm.alibaba-inc.com'],
electronVersion: rootPackage.devDependencies.electron, // 根据前置 package.json 判断版本号即可
extraResources: [
{
from: path.join(__dirname, '../extensions'),
to: 'extensions',
filter: ['**/*'],
}
],
directories: {
output: path.join(__dirname, '../out/'),
},
asar: true,
asarUnpack: 'node_modules/@ali/vscode-ripgrep',
mac: {
target: 'dmg',
},
}
})
19 changes: 19 additions & 0 deletions build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "KAITIAN",
"version": "1.3.1",
"main": "main/index.js",
"description": "KAITIAN",
"scripts": {
"postinstall": "npm run rebuild-native",
"rebuild-native": "NATIVE_MODULE_PATH='../app' ts-node ../scripts/rebuild-native.js --target=electron --force-rebuild=true"
},
"private": true,
"dependencies": {
"@ali/vscode-ripgrep": "^1.3.1",
"node-pty": "0.10.1",
"nsfw": "2.1.2",
"spdlog": "0.11.1",
"vscode-oniguruma": "^1.5.1"
},
"__npminstall_done": false
}
Loading

0 comments on commit 1b7334a

Please sign in to comment.