This PR introduces an optional build flag, `--native`, that will build a version of the Codex npm module that: - Includes both the Node.js and native Rust versions (for Mac and Linux) - Will run the native version if `CODEX_RUST=1` is set - Runs the TypeScript version otherwise Note this PR also updates the workflow URL to https://github.com/openai/codex/actions/runs/14872557396, as that is a build from today that includes everything up through https://github.com/openai/codex/pull/843. Test Plan: In `~/code/codex/codex-cli`, I ran: ``` pnpm stage-release --native ``` The end of the output was: ``` Staged version 0.1.2505121317 for release in /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN Test Node: node /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN/bin/codex.js --help Test Rust: CODEX_RUST=1 node /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN/bin/codex.js --help Next: cd "/var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN" && npm publish --tag native ``` I verified that running each of these commands ran the expected version of Codex. While here, I also added `bin` to the `files` list in `package.json`, which should have been done as part of https://github.com/openai/codex/pull/757, as that added new entries to `bin` that were matched by `.gitignore` but should have been included in a release.
108 lines
3.0 KiB
JavaScript
108 lines
3.0 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
env: { browser: true, node: true, es2020: true },
|
|
extends: [
|
|
"eslint:recommended",
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:react-hooks/recommended",
|
|
],
|
|
ignorePatterns: [
|
|
".eslintrc.cjs",
|
|
"build.mjs",
|
|
"dist",
|
|
"vite.config.ts",
|
|
"src/components/vendor",
|
|
],
|
|
parser: "@typescript-eslint/parser",
|
|
parserOptions: {
|
|
tsconfigRootDir: __dirname,
|
|
project: ["./tsconfig.json"],
|
|
},
|
|
plugins: ["import", "react-hooks", "react-refresh"],
|
|
rules: {
|
|
// Imports
|
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
"import/no-cycle": ["error", { maxDepth: 1 }],
|
|
"import/no-duplicates": "error",
|
|
"import/order": [
|
|
"error",
|
|
{
|
|
groups: ["type"],
|
|
"newlines-between": "always",
|
|
alphabetize: {
|
|
order: "asc",
|
|
caseInsensitive: false,
|
|
},
|
|
},
|
|
],
|
|
// We use the import/ plugin instead.
|
|
"sort-imports": "off",
|
|
|
|
"@typescript-eslint/array-type": ["error", { default: "generic" }],
|
|
// FIXME(mbolin): Introduce this.
|
|
// "@typescript-eslint/explicit-function-return-type": "error",
|
|
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
"error",
|
|
{
|
|
allowDefaultCaseForExhaustiveSwitch: false,
|
|
requireDefaultForNonUnion: true,
|
|
},
|
|
],
|
|
|
|
// Use typescript-eslint/no-unused-vars, no-unused-vars reports
|
|
// false positives with typescript
|
|
"no-unused-vars": "off",
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
argsIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
},
|
|
],
|
|
|
|
curly: "error",
|
|
|
|
eqeqeq: ["error", "always", { null: "never" }],
|
|
"react-refresh/only-export-components": [
|
|
"error",
|
|
{ allowConstantExport: true },
|
|
],
|
|
"no-await-in-loop": "error",
|
|
"no-bitwise": "error",
|
|
"no-caller": "error",
|
|
// This is fine during development, but should not be checked in.
|
|
"no-console": "error",
|
|
// This is fine during development, but should not be checked in.
|
|
"no-debugger": "error",
|
|
"no-duplicate-case": "error",
|
|
"no-eval": "error",
|
|
"no-ex-assign": "error",
|
|
"no-return-await": "error",
|
|
"no-param-reassign": "error",
|
|
"no-script-url": "error",
|
|
"no-self-compare": "error",
|
|
"no-unsafe-finally": "error",
|
|
"no-var": "error",
|
|
"react-hooks/rules-of-hooks": "error",
|
|
"react-hooks/exhaustive-deps": "error",
|
|
},
|
|
overrides: [
|
|
{
|
|
// apply only to files under tests/
|
|
files: ["tests/**/*.{ts,tsx,js,jsx}"],
|
|
rules: {
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
"import/order": "off",
|
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
"@typescript-eslint/no-var-requires": "off",
|
|
"no-await-in-loop": "off",
|
|
"no-control-regex": "off",
|
|
},
|
|
},
|
|
],
|
|
};
|