Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: move CJS scripts to ESM and use strippable types#10887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletionpackages/rule-schema-to-typescript-types/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,6 @@
"build": "tsc -b tsconfig.build.json",
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"lint": "npx nx lint",
"postinstall-script": "tsx ./src/postinstall.ts",
"check-types": "npx nx typecheck"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletionpackages/types/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@
"estree"
],
"scripts": {
"copy-ast-spec": "tsx ./tools/copy-ast-spec.ts",
"copy-ast-spec": "tsx ./tools/copy-ast-spec.mts",
"build": "tsc -b tsconfig.build.json",
"postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3",
"clean": "tsc -b tsconfig.build.json --clean",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
import childProcess from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { promisify } from 'node:util';

const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
const __dirname = fileURLToPath(new URL('.', import.meta.url));

// the promisify util will eat the stderr logs
async function execAsync(
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,9 @@ import * as esbuild from 'esbuild';
import * as fs from 'node:fs/promises';
import { createRequire } from 'node:module';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);

function requireResolved(targetPath: string): string {
return createRequire(__filename).resolve(targetPath);
Expand Down
2 changes: 1 addition & 1 deletionpackages/website-eslint/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"scripts": {
"build": "tsx ./build.ts",
"build": "tsx ./build.mts",
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"lint": "npx nx lint",
"check-types": "npx nx typecheck"
Expand Down
2 changes: 1 addition & 1 deletionpackages/website-eslint/tsconfig.build.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@
"allowJs": true,
"checkJs": true
},
"include": ["src/**/*.ts", "src/index.js", "types", "build.ts"],
"include": ["src/**/*.ts", "src/index.js", "types", "build.mts"],
"exclude": ["jest.config.js", "src/**/*.spec.ts", "src/**/*.test.ts"],
"references": [
{
Expand Down
2 changes: 1 addition & 1 deletionpackages/website/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@
"build": "docusaurus build",
"clear": "docusaurus clear",
"format": "prettier --write \"./**/*.{md,mdx,ts,js,tsx,jsx}\" --ignore-path ../../.prettierignore",
"generate-website-dts": "tsx ./tools/generate-website-dts.ts",
"generate-website-dts": "tsx ./tools/generate-website-dts.mts",
"stylelint": "stylelint \"src/**/*.css\"",
"stylelint:fix": "stylelint \"src/**/*.css\" --fix",
"lint": "npx nx lint",
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,11 @@ import fetch from 'cross-fetch';
import makeDir from 'make-dir';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import prettier from 'prettier';
import { rimraf } from 'rimraf';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
const BASE_HOST = 'https://www.staging-typescript.org';

const banner = [
Expand Down
6 changes: 5 additions & 1 deletiontools/release/release.mts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
import { execaSync } from 'execa';
import { releaseChangelog, releasePublish, releaseVersion } from 'nx/release';
import {
releaseChangelog,
releasePublish,
releaseVersion,
} from 'nx/release/index.js';
import yargs from 'yargs';

const options = await yargs(process.argv.slice(2))
Expand Down
24 changes: 7 additions & 17 deletionstools/scripts/generate-lib.mts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,11 +75,7 @@ const SHARED_CONFIG_MODULE = path.join(
OUTPUT_FOLDER,
`${BASE_CONFIG_MODULE_NAME}.ts`,
);
enum BASE_CONFIG_EXPORT_NAMES {
TYPE = 'TYPE',
VALUE = 'VALUE',
TYPE_AND_VALUE = 'TYPE_VALUE',
}
type BASE_CONFIG_EXPORT_NAMES = 'TYPE' | 'TYPE_VALUE' | 'VALUE';

async function formatCode(code: string[]): Promise<string> {
return await prettier.format(addAutoGeneratedComment(code), {
Expand DownExpand Up@@ -149,23 +145,17 @@ async function main(): Promise<void> {
fs.writeFileSync(
SHARED_CONFIG_MODULE,
await formatCode([
`export const ${
BASE_CONFIG_EXPORT_NAMES.TYPE
} = Object.freeze(${JSON.stringify({
`export const TYPE = Object.freeze(${JSON.stringify({
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: true,
isValueVariable: false,
})});`,
`export const ${
BASE_CONFIG_EXPORT_NAMES.VALUE
} = Object.freeze(${JSON.stringify({
`export const VALUE = Object.freeze(${JSON.stringify({
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: false,
isValueVariable: true,
})});`,
`export const ${
BASE_CONFIG_EXPORT_NAMES.TYPE_AND_VALUE
} = Object.freeze(${JSON.stringify({
`export const TYPE_VALUE = Object.freeze(${JSON.stringify({
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: true,
isValueVariable: true,
Expand DownExpand Up@@ -218,13 +208,13 @@ async function main(): Promise<void> {
for (const variable of variables) {
const importName = ((): BASE_CONFIG_EXPORT_NAMES => {
if (variable.isTypeVariable && variable.isValueVariable) {
returnBASE_CONFIG_EXPORT_NAMES.TYPE_AND_VALUE;
return'TYPE_VALUE';
}
if (variable.isTypeVariable) {
returnBASE_CONFIG_EXPORT_NAMES.TYPE;
return'TYPE';
}
if (variable.isValueVariable) {
returnBASE_CONFIG_EXPORT_NAMES.VALUE;
return'VALUE';
}
// shouldn't happen
throw new Error(
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp