-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
155 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@iringo/modkit-shared": minor | ||
"@iringo/modkit": minor | ||
--- | ||
|
||
支持 rsbuild 插件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { dualBuildConfigs } from '@iringo/modkit-config/modern.config.ts'; | ||
import { defineConfig, moduleTools } from '@modern-js/module-tools'; | ||
|
||
export default defineConfig({ | ||
plugins: [moduleTools()], | ||
buildConfig: dualBuildConfigs, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "@iringo/modkit-plugin-egern", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"dev": "modern build -w", | ||
"build": "modern build" | ||
}, | ||
"files": ["dist", "types", "CHANGELOG.md"], | ||
"dependencies": { | ||
"@iringo/modkit-shared": "workspace:^", | ||
"@iringo/surge2egern": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@iringo/modkit-config": "workspace:^", | ||
"@modern-js/module-tools": "^2.60.2", | ||
"@types/node": "^20.0.0", | ||
"typescript": "^5.6.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/NSRingo/engineering-solutions", | ||
"directory": "packages/modkit/apps/egern" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import type { ModkitPlugin } from '@iringo/modkit-shared'; | ||
import { Surge2Egern } from '@iringo/surge2egern'; | ||
|
||
export const pluginEgern = (): ModkitPlugin => { | ||
return { | ||
name: 'egern', | ||
setup() { | ||
return { | ||
onAfterBuild({ distPath }) { | ||
if (!distPath || !fs.existsSync(distPath)) { | ||
return; | ||
} | ||
|
||
const surgeModules = fs.readdirSync(distPath).reduce<string[]>((acc, file) => { | ||
if (path.extname(file) === '.sgmodule') { | ||
acc.push(path.join(distPath, file)); | ||
} | ||
return acc; | ||
}, []); | ||
const surge2egern = new Surge2Egern(); | ||
Promise.allSettled( | ||
surgeModules.map(async (surgeModule) => { | ||
const result = await surge2egern.transformModule(surgeModule); | ||
const targetPath = surgeModule.replace('.sgmodule', '.yaml'); | ||
return fs.promises.writeFile(targetPath, result); | ||
}), | ||
); | ||
}, | ||
}; | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "@iringo/modkit-config/tsconfig", | ||
"compilerOptions": { | ||
"lib": ["ESNext"], | ||
"outDir": "./dist", | ||
"baseUrl": "./" | ||
}, | ||
"include": ["src", "types"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.