Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
winjo committed Sep 3, 2024
1 parent 58ea660 commit ed8afeb
Show file tree
Hide file tree
Showing 120 changed files with 20,654 additions and 1 deletion.
108 changes: 108 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# 由 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

out-x64
out-arm64

.DS_Store
.idea
.node
package-lock.json
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.1.cjs
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.

法律免责声明

关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# codefuse-ide
<p align="center">CodeFuse AI Native IDE</p>

![perview](https://mdn.alipayobjects.com/huamei_aj2sia/afts/img/A*vFlaRLTDF-UAAAAAAAAAAAAADoSNAQ/original)

## Getting started

### Preparation
install Node.js >= 20

### Start the project
```bash
# install dependencies
yarn
# rebuild native dependencies for electron
yarn run electron-rebuild
# start project
yarn run start
```
4 changes: 4 additions & 0 deletions assets/app-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider: generic
url: ''
channel: latest
updaterCacheDirName: CodeFuseIDE-updater
Binary file added assets/icon/1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon/icon.icns
Binary file not shown.
Binary file added assets/icon/icon.ico
Binary file not shown.
158 changes: 158 additions & 0 deletions build/build-asar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { execSync } from 'node:child_process'
import * as path from 'node:path'
import * as fs from 'node:fs/promises'
import { glob } from 'glob'
import { createPackageWithOptions } from 'asar';
import { asarDeps } from './deps'

interface Dep {
name: string;
version: string;
}

export async function buildAsar(destDir: string) {
const deps = getAllAsarDeps()
await fs.rm(destDir, { recursive: true, force: true })
const srcModules = path.join(process.cwd(), 'node_modules')
const destModules = path.join(destDir, 'node_modules')
await copyDeps(srcModules, destModules, deps)
await createPackageWithOptions(
destModules,
path.join(destDir, 'node_modules.asar'),
{
dot: true,
unpack: '{' + [
'**/*.node',
'**/@opensumi/vscode-ripgrep/bin/*',
'**/node-pty/build/Release/*',
'**/node-pty/lib/worker/conoutSocketWorker.js',
'**/node-pty/lib/shared/conout.js',
'**/*.wasm',
].join(',') + '}'
}
);
await fs.rm(destModules, { recursive: true })
}

function parseSemver(value) {
const [, name, version] = value.match(/(@?[^@]+)@(?:.+):(.+)/);
return { name, version }
}

function getAllAsarDeps() {
const raw = execSync('corepack yarn info -A -R --json', { encoding: 'utf-8' })
const asarDepsMap = {};
const result: Dep[] = [];
const allDeps = raw
.split('\n')
.filter(Boolean)
.map(line => JSON.parse(line))
.reduce((acc, data) => {
const { name } = parseSemver(data.value);
if (asarDeps.includes(name)) {
if (asarDepsMap[name]) {
throw new Error(`Duplicate package: ${name}`)
}
asarDepsMap[name] = data.value
}
acc[data.value] = data
return acc
}, {});

const addDep = (value) => {
const { name, version } = parseSemver(value)
if (name === 'node-gyp') return
result.push({ name, version })
const dependencies = allDeps[value].children.Dependencies
if (!dependencies) return
dependencies.forEach(({ locator }) => {
const { name, version } = parseSemver(locator)
addDep(`${name}@npm:${version}`)
})
}

asarDeps.forEach((pkgName) => {
const value = asarDepsMap[pkgName]
addDep(value)
})

return result
}

async function copyDeps(srcModules: string, destModules: string, depList: Dep[]) {
const filenames = await Promise.all([
glob(depList.map(dep => `${dep.name}/**`), {
cwd: srcModules,
dot: true,
nodir: true,
ignore: [
'**/package-lock.json',
'**/yarn.lock',
'**/*.js.map',
'nan/**',
'*/node_modules/nan/**',
'**/docs/**',
'**/example/**',
'**/examples/**',
'**/test/**',
'**/tests/**',
'**/.vscode/**',
'**/node-addon-api/**/*',
'**/prebuild-install/**/*',
'**/History.md',
'**/CHANGELOG.md',
'**/README.md',
'**/readme.md',
'**/readme.markdown',
'**/CODE_OF_CONDUCT.md',
'**/SUPPORT.md',
'**/CONTRIBUTING.md',
'**/*.ts',
'@vscode/spdlog/binding.gyp',
'@vscode/spdlog/build/**',
'@vscode/spdlog/deps/**',
'@vscode/spdlog/src/**',
'@vscode/spdlog/*.yml',
'node-pty/binding.gyp',
'node-pty/build/**',
'node-pty/src/**',
'node-pty/lib/*.test.js',
'node-pty/tools/**',
'node-pty/deps/**',
'node-pty/scripts/**',
'@parcel/watcher/binding.gyp',
'@parcel/watcher/build/**',
'@parcel/watcher/prebuilds/**',
'@parcel/watcher/src/**',
'nsfw/binding.gyp',
'nsfw/build/**',
'nsfw/includes/**',
'nsfw/src/**',
'keytar/binding.gyp',
'keytar/build/**',
'keytar/src/**',
]
}),
glob([
'@vscode/spdlog/build/Release/*.node',
'node-pty/build/Release/spawn-helper',
'node-pty/build/Release/*.exe',
'node-pty/build/Release/*.dll',
'node-pty/build/Release/*.node',
'@parcel/watcher/build/Release/*.node',
'nsfw/build/Release/*.node',
'keytar/build/Release/*.node',
], {
cwd: srcModules,
dot: true,
nodir: true,
})
])
await fs.rm(destModules, { recursive: true, force: true })

for (const filename of filenames.flat(Infinity) as string[]) {
const destPath = path.join(destModules, filename)
await fs.mkdir(path.dirname(destPath), { recursive: true })
await fs.copyFile(path.join(srcModules, filename), destPath)
}
}
19 changes: 19 additions & 0 deletions build/deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const nativeDeps = [
'@parcel/watcher',
'@vscode/spdlog',
'node-pty',
'nsfw',
'spdlog',
'keytar',
]

export const postInstallDeps = [
'@opensumi/vscode-ripgrep',
]

export const asarDeps = [
...nativeDeps,
...postInstallDeps,
'vscode-oniguruma',
'@opensumi/tree-sitter-wasm'
]
Loading

0 comments on commit ed8afeb

Please sign in to comment.