Skip to content

Commit ed8afeb

Browse files
committed
release
1 parent 58ea660 commit ed8afeb

File tree

120 files changed

+20654
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+20654
-1
lines changed

.gitignore

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# 由 https://github.com/msfeldstein/gitignore 自动生成
2+
# Logs
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
*.pid.lock
14+
15+
# Directory for instrumented libs generated by jscoverage/JSCover
16+
lib-cov
17+
18+
# Coverage directory used by tools like istanbul
19+
coverage
20+
21+
# nyc test coverage
22+
.nyc_output
23+
24+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
25+
.grunt
26+
27+
# Bower dependency directory (https://bower.io/)
28+
bower_components
29+
30+
# node-waf configuration
31+
.lock-wscript
32+
33+
# Compiled binary addons (https://nodejs.org/api/addons.html)
34+
build/Release
35+
36+
# Dependency directories
37+
node_modules/
38+
jspm_packages/
39+
40+
# TypeScript v1 declaration files
41+
# typings/
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Optional REPL history
50+
.node_repl_history
51+
52+
# Output of 'npm pack'
53+
*.tgz
54+
55+
# Yarn Integrity file
56+
.yarn-integrity
57+
58+
# dotenv environment variables file
59+
.env
60+
61+
# parcel-bundler cache (https://parceljs.org/)
62+
.cache
63+
64+
# next.js build output
65+
.next
66+
67+
# nuxt.js build output
68+
.nuxt
69+
70+
# vuepress build output
71+
.vuepress/dist
72+
73+
# Serverless directories
74+
.serverless/
75+
76+
# FuseBox cache
77+
.fusebox/
78+
79+
# DynamoDB Local files
80+
.dynamodb/
81+
dist
82+
lib
83+
out
84+
.vscode/*
85+
!.vscode/launch.json
86+
87+
tools/workspace/*
88+
89+
packages/feature-extension/test/init/node_modules
90+
packages/vscode-extension/test/init/node_modules
91+
92+
extensions
93+
app
94+
95+
out-x64
96+
out-arm64
97+
98+
.DS_Store
99+
.idea
100+
.node
101+
package-lock.json
102+
.pnp.*
103+
.yarn/*
104+
!.yarn/patches
105+
!.yarn/plugins
106+
!.yarn/releases
107+
!.yarn/sdks
108+
!.yarn/versions

.yarn/releases/yarn-4.3.1.cjs

+894
Large diffs are not rendered by default.

.yarnrc.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
compressionLevel: mixed
2+
3+
enableGlobalCache: false
4+
5+
nodeLinker: node-modules
6+
7+
yarnPath: .yarn/releases/yarn-4.3.1.cjs

LEGAL.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Legal Disclaimer
2+
3+
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.
4+
5+
法律免责声明
6+
7+
关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
# codefuse-ide
1+
<p align="center">CodeFuse AI Native IDE</p>
2+
3+
![perview](https://mdn.alipayobjects.com/huamei_aj2sia/afts/img/A*vFlaRLTDF-UAAAAAAAAAAAAADoSNAQ/original)
4+
5+
## Getting started
6+
7+
### Preparation
8+
install Node.js >= 20
9+
10+
### Start the project
11+
```bash
12+
# install dependencies
13+
yarn
14+
# rebuild native dependencies for electron
15+
yarn run electron-rebuild
16+
# start project
17+
yarn run start
18+
```

assets/app-update.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
provider: generic
2+
url: ''
3+
channel: latest
4+
updaterCacheDirName: CodeFuseIDE-updater

assets/icon/1024.png

300 KB
Loading

assets/icon/256.png

29.2 KB
Loading

assets/icon/512.png

92.4 KB
Loading

assets/icon/icon.icns

514 KB
Binary file not shown.

assets/icon/icon.ico

23.7 KB
Binary file not shown.

build/build-asar.ts

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
import { execSync } from 'node:child_process'
2+
import * as path from 'node:path'
3+
import * as fs from 'node:fs/promises'
4+
import { glob } from 'glob'
5+
import { createPackageWithOptions } from 'asar';
6+
import { asarDeps } from './deps'
7+
8+
interface Dep {
9+
name: string;
10+
version: string;
11+
}
12+
13+
export async function buildAsar(destDir: string) {
14+
const deps = getAllAsarDeps()
15+
await fs.rm(destDir, { recursive: true, force: true })
16+
const srcModules = path.join(process.cwd(), 'node_modules')
17+
const destModules = path.join(destDir, 'node_modules')
18+
await copyDeps(srcModules, destModules, deps)
19+
await createPackageWithOptions(
20+
destModules,
21+
path.join(destDir, 'node_modules.asar'),
22+
{
23+
dot: true,
24+
unpack: '{' + [
25+
'**/*.node',
26+
'**/@opensumi/vscode-ripgrep/bin/*',
27+
'**/node-pty/build/Release/*',
28+
'**/node-pty/lib/worker/conoutSocketWorker.js',
29+
'**/node-pty/lib/shared/conout.js',
30+
'**/*.wasm',
31+
].join(',') + '}'
32+
}
33+
);
34+
await fs.rm(destModules, { recursive: true })
35+
}
36+
37+
function parseSemver(value) {
38+
const [, name, version] = value.match(/(@?[^@]+)@(?:.+):(.+)/);
39+
return { name, version }
40+
}
41+
42+
function getAllAsarDeps() {
43+
const raw = execSync('corepack yarn info -A -R --json', { encoding: 'utf-8' })
44+
const asarDepsMap = {};
45+
const result: Dep[] = [];
46+
const allDeps = raw
47+
.split('\n')
48+
.filter(Boolean)
49+
.map(line => JSON.parse(line))
50+
.reduce((acc, data) => {
51+
const { name } = parseSemver(data.value);
52+
if (asarDeps.includes(name)) {
53+
if (asarDepsMap[name]) {
54+
throw new Error(`Duplicate package: ${name}`)
55+
}
56+
asarDepsMap[name] = data.value
57+
}
58+
acc[data.value] = data
59+
return acc
60+
}, {});
61+
62+
const addDep = (value) => {
63+
const { name, version } = parseSemver(value)
64+
if (name === 'node-gyp') return
65+
result.push({ name, version })
66+
const dependencies = allDeps[value].children.Dependencies
67+
if (!dependencies) return
68+
dependencies.forEach(({ locator }) => {
69+
const { name, version } = parseSemver(locator)
70+
addDep(`${name}@npm:${version}`)
71+
})
72+
}
73+
74+
asarDeps.forEach((pkgName) => {
75+
const value = asarDepsMap[pkgName]
76+
addDep(value)
77+
})
78+
79+
return result
80+
}
81+
82+
async function copyDeps(srcModules: string, destModules: string, depList: Dep[]) {
83+
const filenames = await Promise.all([
84+
glob(depList.map(dep => `${dep.name}/**`), {
85+
cwd: srcModules,
86+
dot: true,
87+
nodir: true,
88+
ignore: [
89+
'**/package-lock.json',
90+
'**/yarn.lock',
91+
'**/*.js.map',
92+
'nan/**',
93+
'*/node_modules/nan/**',
94+
'**/docs/**',
95+
'**/example/**',
96+
'**/examples/**',
97+
'**/test/**',
98+
'**/tests/**',
99+
'**/.vscode/**',
100+
'**/node-addon-api/**/*',
101+
'**/prebuild-install/**/*',
102+
'**/History.md',
103+
'**/CHANGELOG.md',
104+
'**/README.md',
105+
'**/readme.md',
106+
'**/readme.markdown',
107+
'**/CODE_OF_CONDUCT.md',
108+
'**/SUPPORT.md',
109+
'**/CONTRIBUTING.md',
110+
'**/*.ts',
111+
'@vscode/spdlog/binding.gyp',
112+
'@vscode/spdlog/build/**',
113+
'@vscode/spdlog/deps/**',
114+
'@vscode/spdlog/src/**',
115+
'@vscode/spdlog/*.yml',
116+
'node-pty/binding.gyp',
117+
'node-pty/build/**',
118+
'node-pty/src/**',
119+
'node-pty/lib/*.test.js',
120+
'node-pty/tools/**',
121+
'node-pty/deps/**',
122+
'node-pty/scripts/**',
123+
'@parcel/watcher/binding.gyp',
124+
'@parcel/watcher/build/**',
125+
'@parcel/watcher/prebuilds/**',
126+
'@parcel/watcher/src/**',
127+
'nsfw/binding.gyp',
128+
'nsfw/build/**',
129+
'nsfw/includes/**',
130+
'nsfw/src/**',
131+
'keytar/binding.gyp',
132+
'keytar/build/**',
133+
'keytar/src/**',
134+
]
135+
}),
136+
glob([
137+
'@vscode/spdlog/build/Release/*.node',
138+
'node-pty/build/Release/spawn-helper',
139+
'node-pty/build/Release/*.exe',
140+
'node-pty/build/Release/*.dll',
141+
'node-pty/build/Release/*.node',
142+
'@parcel/watcher/build/Release/*.node',
143+
'nsfw/build/Release/*.node',
144+
'keytar/build/Release/*.node',
145+
], {
146+
cwd: srcModules,
147+
dot: true,
148+
nodir: true,
149+
})
150+
])
151+
await fs.rm(destModules, { recursive: true, force: true })
152+
153+
for (const filename of filenames.flat(Infinity) as string[]) {
154+
const destPath = path.join(destModules, filename)
155+
await fs.mkdir(path.dirname(destPath), { recursive: true })
156+
await fs.copyFile(path.join(srcModules, filename), destPath)
157+
}
158+
}

build/deps.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export const nativeDeps = [
2+
'@parcel/watcher',
3+
'@vscode/spdlog',
4+
'node-pty',
5+
'nsfw',
6+
'spdlog',
7+
'keytar',
8+
]
9+
10+
export const postInstallDeps = [
11+
'@opensumi/vscode-ripgrep',
12+
]
13+
14+
export const asarDeps = [
15+
...nativeDeps,
16+
...postInstallDeps,
17+
'vscode-oniguruma',
18+
'@opensumi/tree-sitter-wasm'
19+
]

0 commit comments

Comments
 (0)