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

Use ts-node for v0 scripts and remove docs alias #12789

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .gulp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/gulpjs/gulp-cli#configuration
module.exports = {
flags: {
require: '@uifabric/build/babel/register',
require: '@uifabric/build/ts-node-register',
},
};
4 changes: 1 addition & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@
"args": ["build"],
"cwd": "${workspaceRoot}/packages/fluentui/react-northstar",
"env": {
"NODE_ENV": "development",
// This is used in scripts/babel/index.js to enable sourcemaps
"DEBUG": "1"
"NODE_ENV": "development"
},
"sourceMaps": true,
"console": "integratedTerminal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample';
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection';
import ComponentExample from '../../../../components/ComponentDoc/ComponentExample';
import ExampleSection from '../../../../components/ComponentDoc/ExampleSection';

const Types = () => (
<ExampleSection title="Usage">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import ComponentExample from '../../../../components/ComponentDoc/ComponentExample';
import NonPublicSection from 'docs/src/components/ComponentDoc/NonPublicSection';
import NonPublicSection from '../../../../components/ComponentDoc/NonPublicSection';

const Types = () => (
<NonPublicSection title="Visual tests">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Text, Box } from '@fluentui/react-northstar';
import { link } from '../../../../utils/helpers';

import ComponentBestPractices from 'docs/src/components/ComponentBestPractices';
import ComponentBestPractices from '../../../../components/ComponentBestPractices';

const doList = [
<Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Rtl from './Rtl';
import Variations from './Variations';
import Usage from './Usage';

import NonPublicSection from 'docs/src/components/ComponentDoc/NonPublicSection';
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample/ComponentExample';
import NonPublicSection from '../../../components/ComponentDoc/NonPublicSection';
import ComponentExample from '../../../components/ComponentDoc/ComponentExample/ComponentExample';

const DialogExamples = () => (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import ComponentExample from '../../../../components/ComponentDoc/ComponentExample';
import NonPublicSection from 'docs/src/components/ComponentDoc/NonPublicSection';
import NonPublicSection from '../../../../components/ComponentDoc/NonPublicSection';

const Usage = () => (
<NonPublicSection title="Visual tests">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import ComponentExample from '../../../../components/ComponentDoc/ComponentExample';
import NonPublicSection from 'docs/src/components/ComponentDoc/NonPublicSection';
import NonPublicSection from '../../../../components/ComponentDoc/NonPublicSection';

const Usage = () => (
<NonPublicSection title="Visual tests">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import ComponentExample from '../../../../components/ComponentDoc/ComponentExample';
import NonPublicSection from 'docs/src/components/ComponentDoc/NonPublicSection';
import NonPublicSection from '../../../../components/ComponentDoc/NonPublicSection';

const Variations = () => (
<NonPublicSection title="Visual tests">
Expand Down
2 changes: 1 addition & 1 deletion packages/fluentui/docs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type ComponentInfo = {
props: ComponentProp[];
repoPath: string;
subcomponentName: null | string;
subcomponents: string[];
subcomponents: string[] | null;
type: 'component';
};

Expand Down
1 change: 0 additions & 1 deletion packages/fluentui/docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"@uifabric/merge-styles": ["packages/merge-styles/src"],
"@uifabric/set-version": ["packages/set-version/src"],
"@uifabric/utilities": ["packages/utilities/src"],
"docs/*": ["packages/fluentui/docs/*"],
"src/*": ["packages/fluentui/react-northstar/src/*"],
"test/*": ["packages/fluentui/react-northstar/test/*"]
},
Expand Down
1 change: 1 addition & 0 deletions packages/fluentui/perf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "MIT",
"devDependencies": {
"@babel/polyfill": "^7.7.0",
"@fluentui/docs": "^0.48.0",
"@fluentui/react-northstar": "^0.48.0",
"@types/react": "16.8.25",
"@types/webpack-env": "1.15.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/fluentui/perf/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ProfilerMeasure, ProfilerMeasureCycle } from '../types';
const Profiler = (React as any).unstable_Profiler;

const mountNode = document.querySelector('#root');
const performanceExamplesContext = require.context('docs/src/examples/', true, /.perf.tsx$/);
const performanceExamplesContext = require.context('@fluentui/docs/src/examples/', true, /.perf.tsx$/);

// Heads up!
// We want to randomize examples to avoid any notable issues with always first example
Expand Down
3 changes: 0 additions & 3 deletions packages/fluentui/react-northstar/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ module.exports = {
...require('lerna-alias').jest({
directory: require('@uifabric/build/monorepo/findGitRoot')(),
}),

'docs/(.*)$': `<rootDir>/../docs/$1`,

// Legacy aliases, they should not be used in new tests
'^src/(.*)$': `<rootDir>/src/$1`,
'test/(.*)$': `<rootDir>/test/$1`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default function isConformant(
// This is pretty ugly because:
// - jest doesn't support custom error messages
// - jest will run all test
const infoJSONPath = `docs/src/componentInfo/${constructorName}.info.json`;
const infoJSONPath = `@fluentui/docs/src/componentInfo/${constructorName}.info.json`;

let info;

Expand Down
2 changes: 1 addition & 1 deletion scripts/babel/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const isNodeCaller = caller => {
return caller && (caller.name === '@babel/register' || caller.name === 'babel-jest');
return caller && caller.name === 'babel-jest';
};
const isDistCaller = caller => {
return !!(caller && caller.name === 'babel-gulp');
Expand Down
5 changes: 0 additions & 5 deletions scripts/babel/register.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const getRuntimeDependencies = (packageName: string) => {
return output
.split('\n')
.map(line => line.match(dependencyRegex))
.filter(match => !!match)
.filter((match): match is RegExpMatchArray => !!match)
.map(match => match[1]);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type PackageJson = {

type Constraints = { [PackageId: string]: string[] };

const findPackageJsonOf = (dependencyPackageId: string, packagePath: string): string => {
const findPackageJsonOf = (dependencyPackageId: string, packagePath: string): string | null => {
if (!packagePath) {
return null;
}
Expand Down Expand Up @@ -70,7 +70,7 @@ export const getDependenciesVersionConstraints = async (
dependencyChain: string[],
): Promise<Constraints> => {
let detectedConstraints: Constraints = {};
const dependenciesWithConstraints = (await parsePackageJson(packageJsonPath)).dependencies;
const dependenciesWithConstraints = (await parsePackageJson(packageJsonPath)).dependencies || [];

const pendingTasks = dependenciesWithConstraints.map(async dependencyPackageId => {
if (isIgnored(dependencyPackageId)) {
Expand Down
Loading