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
31 changed files
with
541 additions
and
28 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
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 @@ | ||
# Rimtrans/Reflection |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
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 |
---|---|---|
@@ -1,7 +1,13 @@ | ||
{ | ||
"name": "@rimtrans/type-info", | ||
"name": "@rimtrans/reflection", | ||
"description": "A dotnet core command line tool for getting type info in .dll file.", | ||
"version": "4.0.0-alpha.1", | ||
"private": true, | ||
"version": "1.0.2282", | ||
"main": "type-info.json", | ||
"types": "type-info.d.ts" | ||
"scripts": { | ||
"clean": "rimraf ./lib", | ||
"build:win": "dotnet publish --self-contained -c Release -r win-x64 -o ./lib/win", | ||
"build:linux": "dotnet publish --self-contained -c Release -r linux-x64 -o ./lib/linux", | ||
"build:osx": "dotnet publish --self-contained -c Release -r osx-x64 -o ./lib/osx", | ||
"build": "yarn build:win && yarn build:linux && yarn build:osx" | ||
} | ||
} |
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,13 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: '12.2.0', | ||
}, | ||
}, | ||
], | ||
'@babel/preset-typescript', | ||
], | ||
}; |
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,25 @@ | ||
{ | ||
"name": "@rimtrans/executable", | ||
"description": "The executable entry for RimTrans", | ||
"version": "4.0.0-alpha.1", | ||
"private": true, | ||
"main": "lib/index.js", | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"clean": "rimraf ./types && rimraf ./lib", | ||
"build:types": "tsc", | ||
"build:babel": "babel ./src -x .ts -d ./lib", | ||
"pkg:win": "pkg ./lib/main.js -t node12-win-x64 -o ./lib/win/RimTrans", | ||
"pkg:linux": "pkg ./lib/main.js -t node12-linux-x64 -o ./lib/linux/RimTrans", | ||
"pkg:osx": "pkg ./lib/main.js -t node12-macos-x64 -o ./lib/osx/RimTrans", | ||
"pkg": "yarn pkg:win && yarn pkg:linux && yarn pkg:osx", | ||
"build": "yarn build:types && yarn build:babel && yarn pkg" | ||
}, | ||
"devDependencies": { | ||
"pkg": "^4.4.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "^2.4.2", | ||
"time-stamp": "^2.2.0" | ||
} | ||
} |
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,3 @@ | ||
import * as logger from './logger'; | ||
|
||
export { logger }; |
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,41 @@ | ||
/* eslint-disable no-console,@typescript-eslint/no-explicit-any */ | ||
import chalk from 'chalk'; | ||
import timestamp from 'time-stamp'; | ||
|
||
export type Log = (message?: any, ...optionalParams: any[]) => void; | ||
|
||
export const info: Log = (message, ...optionalParams) => { | ||
console.log( | ||
timestamp('YYYY-MM-DD HH:mm:ss.ms'), | ||
chalk.cyanBright('INFO'), | ||
message, | ||
...optionalParams, | ||
); | ||
}; | ||
|
||
export const success: Log = (message, ...optionalParams) => { | ||
console.log( | ||
new Date().toLocaleString(), | ||
chalk.greenBright('SUCCESS'), | ||
message, | ||
...optionalParams, | ||
); | ||
}; | ||
|
||
export const warn: Log = (message, ...optionalParams) => { | ||
console.warn( | ||
new Date().toLocaleString(), | ||
chalk.yellowBright('WARN'), | ||
message, | ||
...optionalParams, | ||
); | ||
}; | ||
|
||
export const error: Log = (message, ...optionalParams) => { | ||
console.error( | ||
new Date().toLocaleString(), | ||
chalk.redBright('ERROR'), | ||
message, | ||
...optionalParams, | ||
); | ||
}; |
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,43 @@ | ||
import pth from 'path'; | ||
import * as logger from './logger'; | ||
|
||
interface Env { | ||
readonly filename: string; | ||
readonly dirname: string; | ||
readonly cwd: string; | ||
readonly execPath: string; | ||
readonly argv0: string; | ||
readonly argv1: string; | ||
readonly mainFilename?: string; | ||
readonly isPkg: boolean; | ||
readonly entrypoint?: string; | ||
readonly defaultEntrypoint?: string; | ||
} | ||
|
||
function getEnv(): Env { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const { pkg } = process as any; | ||
|
||
return { | ||
filename: __filename, | ||
dirname: __dirname, | ||
cwd: process.cwd(), | ||
execPath: process.execPath, | ||
argv0: process.argv[0], | ||
argv1: process.argv[1], | ||
mainFilename: require.main && require.main.filename, | ||
isPkg: !!pkg, | ||
entrypoint: pkg && pkg.entrypoint, | ||
defaultEntrypoint: pkg && pkg.defaultEntrypoint, | ||
}; | ||
} | ||
|
||
const ENV = getEnv(); | ||
const INSTALLATION_DIRECTORY = ENV.isPkg ? pth.basename(ENV.execPath) : ENV.dirname; | ||
|
||
async function main(): Promise<void> { | ||
logger.info(ENV); | ||
logger.info(INSTALLATION_DIRECTORY); | ||
} | ||
|
||
main().catch(logger.error); |
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,11 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "types", | ||
"declarationMap": true, | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules", "src/**/*.test.ts"] | ||
} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ module.exports = { | |
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: 'current', | ||
node: '12.2.0', | ||
}, | ||
}, | ||
], | ||
|
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,11 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "types", | ||
"declarationMap": true, | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["node_modules", "src/**/*.test.ts"] | ||
} |
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,53 @@ | ||
/* eslint-disable no-console,no-restricted-syntax,no-await-in-loop */ | ||
import fs from 'fs'; | ||
import { genPathResolve } from '@huiji/shared-utils'; | ||
import { ncp } from 'ncp'; | ||
import compressing from 'compressing'; | ||
|
||
const resolvePath = genPathResolve(__dirname, '..'); | ||
|
||
const platforms = ['win', 'linux', 'osx']; | ||
const { npm_package_version: version } = process.env; | ||
|
||
async function copyDir(src: string, dest: string): Promise<void> { | ||
return new Promise<void>((resolve, reject) => | ||
ncp(src, dest, error => (error ? reject(error) : resolve())), | ||
); | ||
} | ||
|
||
const LIB = 'lib'; | ||
const EXECUTABLE = 'executable'; | ||
const REFLECTION = 'Reflection'; | ||
|
||
async function archive(): Promise<void> { | ||
for (const platform of platforms) { | ||
const folder = `rimtrans-v${version}-${platform}`; | ||
await fs.promises.mkdir(resolvePath(LIB, folder), { recursive: true }); | ||
|
||
// copy executable | ||
await copyDir(resolvePath(EXECUTABLE, LIB, platform), resolvePath(LIB, folder)); | ||
// copy reflection | ||
await copyDir( | ||
resolvePath(REFLECTION, LIB, platform), | ||
resolvePath(LIB, folder, REFLECTION), | ||
); | ||
|
||
// compress | ||
if (platform === 'win') { | ||
await compressing.zip.compressDir( | ||
resolvePath(LIB, folder), | ||
resolvePath(LIB, `${folder}.zip`), | ||
); | ||
} else { | ||
await compressing.tgz.compressDir( | ||
resolvePath(LIB, folder), | ||
resolvePath(LIB, `${folder}.tar.gz`), | ||
); | ||
} | ||
|
||
// TODO upload file to github release | ||
// https://developer.github.com/v3/repos/releases/ | ||
} | ||
} | ||
|
||
archive().catch(console.error); |
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 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "commonjs" | ||
} | ||
} |
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 @@ | ||
{ | ||
"name": "@rimtrans/type-info", | ||
"version": "4.0.0-alpha.1", | ||
"main": "type-info.json", | ||
"types": "type-info.d.ts", | ||
"private": true | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.