Skip to content

Commit

Permalink
fix install
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Feb 6, 2024
1 parent 2df17f1 commit 35e4ab9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
33 changes: 17 additions & 16 deletions packages/f2elint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "f2elint",
"version": "4.0.0-beta.3",
"version": "4.0.0-beta.4",
"description": "Linter for Alibaba F2E Guidelines",
"keywords": [
"f2elint",
Expand Down Expand Up @@ -66,16 +66,25 @@
"dependencies": {
"@clack/prompts": "^0.7.0",
"chalk": "^5.3.0",
"command-exists": "^1.2.9",
"commander": "^12.0.0",
"init-roll": "^1.0.10"
},
"devDependencies": {
"@commitlint/cli": "^16.3.0",
"@mdx-js/react": "^3.0.0",
"@types/command-exists": "^1.2.3",
"@types/cross-spawn": "^6.0.6",
"@types/ejs": "^3.1.5",
"@types/eslint": "^8.56.2",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/lodash": "^4.14.202",
"@types/node": "^20.0.0",
"@types/react": "^18.2.52",
"@types/react-dom": "^18.2.18",
"@types/text-table": "^0.2.5",
"commitlint-config-ali": "workspace:^",
"markdownlint": "0.x",
"markdownlint-config-ali": "workspace:^",
"markdownlint-rule-helpers": "^0.13.0",
"eslint": "^8.56.0",
"eslint-config-ali": "workspace:^",
"eslint-config-egg": "^10.0.0",
Expand All @@ -87,24 +96,16 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-vue": "^7.20.0",
"@types/command-exists": "^1.2.3",
"@types/cross-spawn": "^6.0.6",
"@types/ejs": "^3.1.5",
"@types/eslint": "^8.56.2",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/lodash": "^4.14.202",
"@types/node": "^20.0.0",
"@types/react": "^18.2.52",
"@types/react-dom": "^18.2.18",
"@types/text-table": "^0.2.5",
"gh-pages": "^5.0.0",
"markdownlint": "0.x",
"markdownlint-config-ali": "workspace:^",
"markdownlint-rule-helpers": "^0.13.0",
"react": "^18.2.0",
"react-doc-ui": "^2.2.1",
"react-dom": "^18.2.0",
"rive": "^2.0.22",
"stylelint": "^16.2.1",
"stylelint-config-ali": "workspace:^",
"rive": "^2.0.22",
"typescript": "^5.3.3"
},
"rive": {
Expand Down
16 changes: 13 additions & 3 deletions packages/f2elint/src/private/install.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { spawn } from 'child_process';
import commandExists from 'command-exists';

export function install(projectPath: string) {
return new Promise<void>((res, rej) => {
const child = spawn(`${process.env.npm_command} update -f`, {
export async function install(projectPath: string) {
let npm_command = 'npm';
if (await commandExists('tnpm')) {
// tnpm of Alibaba and Ant Group
npm_command = 'tnpm';
} else if (process.env.npm_command) {
// pnpm, yarn support npm_command environment variable
npm_command = process.env.npm_command;
}

await new Promise<void>((res, rej) => {
const child = spawn(`${npm_command} update -f`, {
cwd: projectPath,
shell: true,
});
Expand Down

0 comments on commit 35e4ab9

Please sign in to comment.