Skip to content

Commit

Permalink
fix: start error & auto external priority & remove node warn (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
shulandmimi committed May 21, 2024
1 parent 44dbec4 commit 9dcfa65
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 60 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-ducks-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'farmup': patch
---

remove warn & auto external priority
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ farmup build index.ts --no-exec

- `alias`: e

can custom exec, default node
can custom exec, select the exec method by default through the suffix of the file

- html use server star
- ts\js use node

```shell
farmup index.ts -e node
Expand Down
12 changes: 11 additions & 1 deletion bin/farmup.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#!/bin/env node
#!/usr/bin/env node

process.removeAllListeners('warning');

const defaultEmit = process.emit;
process.emit = function (...args) {
if (args[1].name === 'ExperimentalWarning') {
return undefined;
}
return defaultEmit.call(this, ...args);
};

import '../dist/index.js';
5 changes: 5 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@
"noNonNullAssertion": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@types/tmp": "^0.2.6",
"chokidar": "^3.6.0",
"execa": "^8.0.1",
"typescript": "^5.4.3"
"typescript": "^5.4.5"
},
"exports": {
".": {
Expand All @@ -48,7 +48,7 @@
},
"dependencies": {
"@changesets/cli": "^2.27.1",
"@farmfe/core": "^1.1.5",
"@farmfe/core": "^1.1.9",
"cac": "^6.7.14",
"fs-extra": "^11.2.0",
"glob": "^10.3.15",
Expand Down
96 changes: 47 additions & 49 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getConfigFilePath,
type FarmCLIOptions,
type UserConfig,
version as FarmCoreVersion,
} from '@farmfe/core';
import cac from 'cac';
import { readFileSync } from 'node:fs';
Expand Down Expand Up @@ -42,7 +43,6 @@ function createInlineConfig(options: CommonOptions): InlineConfig {

async function start(options: CommonOptions) {
const preNormalizeOption = await NormalizeOption.fromCommonOption(options, logger);

const inlineConfig = createInlineConfig(options);

switch (preNormalizeOption.options.execute.type) {
Expand Down Expand Up @@ -77,7 +77,7 @@ const cli = cac('farmup');

cli.option(
'--target [target]',
`target for output, default is node, support 'browser' | 'node' | 'node16' | 'node-legacy' | 'node-next' | 'browser-legacy' | 'browser-es2015' | 'browser-es2017' | 'browser-esnext'`
"target for output, default is node, support 'browser' | 'node' | 'node16' | 'node-legacy' | 'node-next' | 'browser-legacy' | 'browser-es2015' | 'browser-es2017' | 'browser-esnext'",
)
.option('--mode [mode]', 'mode for build, default is development, choose one from "development" or "production"')
.option('--minify', 'minify for output')
Expand All @@ -101,8 +101,8 @@ async function commonOptionsFromArgs(args: Record<string, any>): Promise<Partial
? args.config
: path.resolve(root, args.config)
: args.config
? await getConfigFilePath(root)
: undefined;
? await getConfigFilePath(root)
: undefined;
const execute =
isString(args.exec) || isString(args.e) ? args.exec || args.e : args.exec === true ? undefined : undefined;
return {
Expand Down Expand Up @@ -138,8 +138,10 @@ cli.command('[entry]', 'start watch for node or custom command').action(async (e
});
});

cli.help();
cli.showHelpOnExit = true;

cli.showVersionOnExit = true;

cli.version(version);
cli.version(`${version} (core: ${FarmCoreVersion})`);

cli.parse();
2 changes: 1 addition & 1 deletion src/plugins/auto-external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CLI_NAME, logger } from '../config/constant';

export function autoExternal(): JsPlugin {
return {
priority: -Number.NEGATIVE_INFINITY,
priority: Number.NEGATIVE_INFINITY,
name: `${CLI_NAME}:AutoExternal`,
resolve: {
filters: {
Expand Down

0 comments on commit 9dcfa65

Please sign in to comment.