Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: normalize /scripts/* sourceRoot and use new performant 'type-check' for tools tagged libraries #31475

Merged
merged 8 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Debug test",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/scripts/executors/debug-test.js",
"program": "${workspaceRoot}/scripts/executors/src/debug-test.js",
"cwd": "${fileDirname}",
"stopOnEntry": false,
"args": ["-i", "--watch"],
Expand All @@ -22,7 +22,7 @@
"name": "Debug current open test",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/scripts/executors/debug-test.js",
"program": "${workspaceRoot}/scripts/executors/src/debug-test.js",
"cwd": "${fileDirname}",
"stopOnEntry": false,
"args": ["-i", "--testPathPattern=\\b${fileBasenameNoExtension}", "--watch"],
Expand All @@ -39,7 +39,7 @@
"name": "Debug current open test (v0)",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/scripts/executors/debug-test.js",
"program": "${workspaceRoot}/scripts/executors/src/debug-test.js",
"cwd": "${fileDirname}",
"stopOnEntry": false,
"args": ["-i", "--testPathPattern=\\b${fileBasenameNoExtension}", "--watch"],
Expand Down Expand Up @@ -128,7 +128,7 @@
"protocol": "inspector",
"cwd": "${workspaceRoot}",
"args": [
"${workspaceRoot}/scripts/update-release-notes/index.ts",
"${workspaceRoot}/scripts/update-release-notes/src/index.ts",
"--token",
// For local testing, generate a personal access token (https://github.com/settings/tokens)
// and replace "your token here" with the token. DO NOT COMMIT YOUR TOKEN!
Expand All @@ -137,7 +137,7 @@
"--age",
"10"
],
"runtimeArgs": ["--nolazy", "--inspect", "-r", "${workspaceRoot}/scripts/ts-node/register"],
"runtimeArgs": ["--nolazy", "--inspect", "-r", "${workspaceRoot}/scripts/ts-node/src/register"],
"env": {
"NODE_ENV": "development"
},
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.release-vnext-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extends:
displayName: yarn build

- script: |
yarn publish:beachball -n $(npmToken) --no-push --tag nightly --config scripts/beachball/release-vNext.config.js
yarn publish:beachball -n $(npmToken) --no-push --tag nightly --config scripts/beachball/src/release-vNext.config.js
git reset --hard origin/master
displayName: Publish changes and bump versions

Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.release-vnext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ extends:
displayName: yarn build

- script: |
yarn publish:beachball -n $(npmToken) --config scripts/beachball/release-vNext.config.js
yarn publish:beachball -n $(npmToken) --config scripts/beachball/src/release-vNext.config.js
git reset --hard origin/master
env:
GITHUB_PAT: $(githubPAT)
displayName: Publish changes and bump versions

- script: |
node -r ./scripts/ts-node/register scripts/executors/tag-react-components.ts --token $(npmToken)
node -r ./scripts/ts-node/src/register scripts/executors/src/tag-react-components.ts --token $(npmToken)
displayName: Tag prelease packages with prerelease tag
continueOnError: true

Expand All @@ -102,7 +102,7 @@ extends:

# TODO update release notes script for v9
# - script: |
# node -r ./scripts/ts-node/register ./scripts/update-release-notes/index.ts --token=$(githubPAT) --apply --debug
# node -r ./scripts/ts-node/src/register ./scripts/update-release-notes/src/index.ts --token=$(githubPAT) --apply --debug
# displayName: 'Update github release notes'

# This would usually be run automatically (via a pipeline decorator from an extension), but the
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.release.web-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extends:
displayName: Build, [test], Lint

- script: |
yarn publish:beachball -n $(npmToken) --config scripts/beachball/release-web-components.config.js
yarn publish:beachball -n $(npmToken) --config scripts/beachball/src/release-web-components.config.js
git reset --hard origin/master
env:
GITHUB_PAT: $(githubPAT)
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extends:
displayName: yarn bundle

- script: |
yarn publish:beachball -n $(npmToken) --config scripts/beachball/release-v8.config.js
yarn publish:beachball -n $(npmToken) --config scripts/beachball/src/release-v8.config.js
git reset --hard origin/master
env:
GITHUB_PAT: $(githubPAT)
Expand Down Expand Up @@ -155,7 +155,7 @@ extends:
# Run this near the end because it's more likely to fail than the artifact upload tasks, and its
# failure doesn't need to block anything else
- script: |
node -r ./scripts/ts-node/register ./scripts/update-release-notes/index.ts --token=$(githubPAT) --apply --debug
node -r ./scripts/ts-node/src/register ./scripts/update-release-notes/src/index.ts --token=$(githubPAT) --apply --debug
displayName: 'Update github release notes'

- template: .devops/templates/cleanup.yml@self
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore: normalize all scripts source to live under /src",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore: normalize all scripts source to live under /src",
"packageName": "@fluentui/react-charting",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore: normalize all scripts source to live under /src",
"packageName": "@fluentui/tokens",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ This dts generation can be done in 2 ways:
> EXAMPLE PR: https://github.com/microsoft/fluentui/pull/28002

```yml
- script: node ./scripts/executors/type-check-ci-hack.js --base $(targetBranch)
- script: node ./scripts/executors/src/type-check-ci-hack.js --base $(targetBranch)
displayName: type-check perf preparation
- script: yarn buildci $(sinceArg)
```
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const commands = {
* - respect ignore files (which eslint doesn't do by default when passed a specific file path)
* - match the set of files that are linted by the package's normal `lint` command
*/
lint: 'node ./scripts/lint-staged/eslint',
lint: 'node ./scripts/lint-staged/src/eslint',
};

// https://www.npmjs.com/package/lint-staged
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@
"bundle": "lage bundle --verbose",
"change": "beachball change --no-commit",
"check:change": "beachball check",
"check:modified-files": "node -r ./scripts/ts-node/register ./scripts/executors/check-for-modified-files",
"check:affected": "node ./scripts/executors/checkIfPackagesAffected.js",
"check:modified-files": "node -r ./scripts/ts-node/src/register ./scripts/executors/src/check-for-modified-files",
"check:affected": "node ./scripts/executors/src/checkIfPackagesAffected.js",
"check:installed-dependencies-versions": "satisfied --no-peers --skip-invalid",
"clean": "lage clean --verbose",
"code-style": "lage code-style --verbose",
"codepen": "cd packages/react && node ../../scripts/executors/local-codepen.js",
"copy-notices": "node scripts/generators/copy-notices.js",
"codepen": "cd packages/react && node ../../scripts/executors/src/local-codepen.js",
"copy-notices": "node scripts/generators/src/copy-notices.js",
"create-component": "yarn nx g @fluentui/workspace-plugin:react-component",
"create-package": "yarn nx g @fluentui/workspace-plugin:react-library",
"e2e": "lage e2e --verbose --concurrency=1",
"format": "node scripts/executors/format.js",
"generate-version-files": "node -r ./scripts/ts-node/register ./scripts/generators/generate-version-files",
"format": "node scripts/executors/src/format.js",
"generate-version-files": "node -r ./scripts/ts-node/src/register ./scripts/generators/src/generate-version-files",
"lint": "lage lint --verbose",
"lint:log": "FORCE_COLOR=0 yarn lint > lint.log 2>&1",
"postinstall": "node ./scripts/package-manager/postinstall.js",
"preinstall": "node ./scripts/package-manager/use-yarn-please.js",
"postinstall": "node ./scripts/package-manager/src/postinstall.js",
"preinstall": "node ./scripts/package-manager/src/use-yarn-please.js",
"publish:beachball": "beachball publish -b origin/master --access public -y",
"rebuild": "node ./scripts/executors/invalidate-just-cache.js && yarn build --reset-cache",
"rebuild": "node ./scripts/executors/src/invalidate-just-cache.js && yarn build --reset-cache",
"northstar:release": "northstar-release",
"northstar:build:docs": "yarn workspace @fluentui/docs build",
"northstar:start": "yarn workspace @fluentui/docs start",
"northstar:perf": "yarn workspace @fluentui/perf perf:test",
"northstar:stats:build": "gulp stats",
"northstar:stats:save": "gulp stats:save",
"northstar:test:circulars": "gulp test:circulars:run",
"rename-package": "node -r ./scripts/ts-node/register ./scripts/generators/rename-package.ts",
"run:published": "node ./scripts/executors/runPublished.js",
"scrub": "node ./scripts/executors/scrub.js",
"start": "node ./scripts/executors/start.js",
"rename-package": "node -r ./scripts/ts-node/src/register ./scripts/generators/src/rename-package.ts",
"run:published": "node ./scripts/executors/src/runPublished.js",
"scrub": "node ./scripts/executors/src/scrub.js",
"start": "node ./scripts/executors/src/start.js",
"test": "lage test --verbose",
"update-snapshots": "lage update-snapshots --verbose"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-charting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test": "cross-env TZ=UTC just-scripts test",
"just": "just-scripts",
"clean": "just-scripts clean",
"codepen": "node ../../scripts/executors/local-codepen.js",
"codepen": "node ../../scripts/executors/src/local-codepen.js",
"code-style": "just-scripts code-style",
"start": "just-scripts dev:storybook",
"start:legacy": "just-scripts dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"build-storybook": "cross-env NODE_OPTIONS=--max-old-space-size=3072 just-scripts storybook:build",
"clean": "just-scripts clean",
"code-style": "just-scripts code-style",
"codepen": "node ../../scripts/executors/local-codepen.js",
"codepen": "node ../../scripts/executors/src/local-codepen.js",
"e2e": "yarn workspace @fluentui/react-examples cypress run --component",
"e2e:local": "yarn workspace @fluentui/react-examples cypress open --component",
"just": "just-scripts",
Expand Down
2 changes: 1 addition & 1 deletion packages/tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"just": "just-scripts",
"lint": "just-scripts lint",
"test": "jest --passWithNoTests",
"token-pipeline": "node -r ../../scripts/ts-node/register ../../scripts/generators/token-pipeline.ts",
"token-pipeline": "node -r ../../scripts/ts-node/src/register ../../scripts/generators/src/token-pipeline.ts",
"type-check": "just-scripts type-check",
"generate-api": "just-scripts generate-api"
},
Expand Down
7 changes: 4 additions & 3 deletions scripts/api-extractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"scripts": {
"format": "prettier -w --ignore-path ../../.prettierignore .",
"format:check": "yarn format -c",
"lint": "eslint --ext .ts,.js .",
"lint": "eslint --ext .ts,.js ./src",
"test": "jest --passWithNoTests",
"type-check": "tsc -b tsconfig.json"
"type-check": "just-scripts type-check"
},
"dependencies": {}
"dependencies": {},
"devDependencies": {}
}
1 change: 1 addition & 0 deletions scripts/api-extractor/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
2 changes: 1 addition & 1 deletion scripts/api-extractor/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"include": ["./**/*.ts", "./**/*.js"]
"include": ["./src/**/*.ts", "./src/**/*.js"]
}
3 changes: 3 additions & 0 deletions scripts/babel/just.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { preset } from '@fluentui/scripts-tasks';

preset();
23 changes: 19 additions & 4 deletions scripts/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
"name": "@fluentui/scripts-babel",
"version": "0.0.1",
"private": true,
"main": "index.js",
"main": "src/index.js",
"scripts": {
"format": "prettier -w --ignore-path ../../.prettierignore .",
"format:check": "yarn format -c",
"lint": "eslint --ext .ts,.js .",
"lint": "eslint --ext .ts,.js ./src",
"test": "jest --passWithNoTests",
"type-check": "tsc -b tsconfig.json"
"type-check": "just-scripts type-check"
},
"dependencies": {}
"dependencies": {},
"devDependencies": {},
"exports": {
".": {
"require": "./src/index.js",
"import": "./src/index.js"
},
"./register": {
"require": "./register.js",
"import": "./register.js"
},
"./preset-v9": {
"require": "./src/preset-v9.js",
"import": "./src/preset-v9.js"
}
}
}
2 changes: 1 addition & 1 deletion scripts/babel/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fluentui/scripts-babel",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "scripts/babel",
"sourceRoot": "scripts/babel/src",
"projectType": "library",
"tags": ["tools"]
}
4 changes: 4 additions & 0 deletions scripts/babel/index.js → scripts/babel/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* This files is used solely for react-northstar projects. Please don't any new logic here
*/

/** @typedef {import('@babel/core').TransformOptions['caller']} Caller */

const isNodeCaller = (/** @type {Caller}*/ caller) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/babel/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"include": ["./**/*.ts", "./**/*.js"]
"include": ["./src/**/*.ts", "./src/**/*.js"]
}
4 changes: 4 additions & 0 deletions scripts/beachball/just.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { preset } from '@fluentui/scripts-tasks';

preset();
9 changes: 5 additions & 4 deletions scripts/beachball/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
"name": "@fluentui/scripts-beachball",
"version": "0.0.1",
"private": true,
"main": "index.js",
"main": "src/index.js",
"scripts": {
"format": "prettier -w --ignore-path ../../.prettierignore .",
"format:check": "yarn format -c",
"lint": "eslint --ext .ts,.js .",
"lint": "eslint --ext .ts,.js ./src",
"test": "jest --passWithNoTests",
"type-check": "tsc -b tsconfig.json"
"type-check": "just-scripts type-check"
},
"dependencies": {
"@fluentui/scripts-github": "*",
"@fluentui/scripts-monorepo": "*",
"@fluentui/scripts-ts-node": "*"
}
},
"devDependencies": {}
}
2 changes: 1 addition & 1 deletion scripts/beachball/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fluentui/scripts-beachball",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "scripts/beachball",
"sourceRoot": "scripts/beachball/src",
"projectType": "library",
"tags": ["tools"]
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ exports.register = register;
function register() {
if (process.env.NODE_ENV !== 'test') {
// @ts-expect-error - ts-node/register doesn't provide types so this would error
require('@fluentui/scripts-ts-node/register');
require('@fluentui/scripts-ts-node/src/register');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { BeachballConfig } from 'beachball';

import { renderEntry, renderHeader } from './customRenderers';

const baseConfig: typeof import('./base.config.json') = JSON.parse(
fs.readFileSync(path.resolve(__dirname, 'base.config.json'), { encoding: 'utf8' }),
const baseConfig: typeof import('../base.config.json') = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../base.config.json'), { encoding: 'utf8' }),
);

export const config: typeof baseConfig & Required<Pick<BeachballConfig, 'changelog' | 'hooks'>> = {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/beachball/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"types": ["node", "jest"]
},
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"include": ["./**/*.ts", "./**/*.js"]
"include": ["./src/**/*.ts", "./src/**/*.js"]
}
3 changes: 3 additions & 0 deletions scripts/cypress/just.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { preset } from '@fluentui/scripts-tasks';

preset();
7 changes: 4 additions & 3 deletions scripts/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"scripts": {
"format": "prettier -w --ignore-path ../../.prettierignore .",
"format:check": "yarn format -c",
"lint": "eslint --ext .ts,.js .",
"lint": "eslint --ext .ts,.js ./src",
"test": "jest --passWithNoTests",
"type-check": "tsc -b tsconfig.json"
"type-check": "just-scripts type-check"
},
"dependencies": {}
"dependencies": {},
"devDependencies": {}
}
3 changes: 3 additions & 0 deletions scripts/dangerjs/just.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { preset } from '@fluentui/scripts-tasks';

preset();
Loading
Loading