Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 0247c33

Browse files
authored
chore: Everybody gets a package (#2218)
1 parent f1cafdc commit 0247c33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+263
-637
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"extends": ["./packages/internal-tooling/eslint/index.js"],
2+
"extends": ["./build/eslint/index.js"],
33
"root": true
44
}

build/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["../packages/internal-tooling/eslint/index.js"],
2+
"extends": ["./eslint/index.js"],
33
"rules": {
44
"no-console": "off"
55
},
File renamed without changes.
File renamed without changes.

config.ts renamed to build/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const envConfig = {
1919
// ----------------------------------
2020
// Project Structure
2121
// ----------------------------------
22-
path_base: __dirname,
22+
path_base: path.resolve(__dirname, '..'),
2323
dir_build: 'build',
2424
dir_docs_dist: 'docs/dist',
2525
dir_docs_src: 'docs/src',
@@ -68,7 +68,7 @@ const paths = {
6868
),
6969
}
7070

71-
const isRoot = process.cwd() === __dirname
71+
const isRoot = process.cwd() === envConfig.path_base
7272
let packageName = isRoot ? 'react' : path.basename(process.cwd())
7373
// don't use yargs here because it causes build errors in certain circumstances
7474
const packageArgIndex = process.argv.indexOf('--package')

build/dangerjs/checkChangelog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from 'fs'
22

3-
import config from '../../config'
3+
import config from '../config'
44
import { DangerJS } from './types'
55

66
const CHANGELOG_FILE = 'CHANGELOG.md'

build/dangerjs/checkPerfRegressions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as fs from 'fs-extra'
33
import * as path from 'path'
44

55
import { DangerJS } from './types'
6-
import config from '../../config'
6+
import config from '../config'
77

88
function linkToFlamegraph(value, filename) {
99
// This as well as the whole flamegrill URL is hardcoded to only work with CircleCI.

build/dangerjs/detectNonApprovedDependencies/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
getPackageName,
66
FailedConstraintsExplanation,
77
} from './utils'
8-
import config from '../../../config'
8+
import config from '../../config'
99
import { DangerJS } from '../types'
1010

1111
const { paths } = config

build/dangerjs/detectNonApprovedDependencies/utils/getRuntimeDependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { spawnSync } from 'child_process'
22

3-
import config from '../../../../config'
3+
import config from '../../../config'
44

55
const { paths } = config
66

File renamed without changes.

build/gulp/plugins/gulp-component-menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'path'
55
import through2 from 'through2'
66
import Vinyl from 'vinyl'
77

8-
import config from '../../../config'
8+
import config from '../../config'
99
import getComponentInfo from './util/getComponentInfo'
1010

1111
const pluginName = 'gulp-component-menu'

build/gulp/plugins/gulp-doctoc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs'
22
import through2 from 'through2'
33

4-
import config from '../../../config'
4+
import config from '../../config'
55
import sh from '../sh'
66

77
const insideGitRepo = fs.existsSync(config.paths.base('.git'))

build/gulp/plugins/gulp-webpack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import webpack from 'webpack'
2-
import config from '../../../config'
2+
import config from '../../config'
3+
import { log, PluginError } from 'gulp-util'
34

45
const { __DEV__, __SKIP_ERRORS__ } = config.compiler_globals
5-
const { log, PluginError } = require('gulp-load-plugins')().util
66

77
const DEV_SKIP_ERRORS = __DEV__ && __SKIP_ERRORS__
88

build/gulp/plugins/util/getRelativePathToSourceFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from 'path'
2-
import config from '../../../../config'
2+
import config from '../../../config'
33

44
const examplesPath = config.paths.docsSrc('examples', 'components')
55

build/gulp/serve.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import express from 'express'
22

33
import historyApiFallback from 'connect-history-api-fallback'
44
import { Server } from 'http'
5+
import { colors, log } from 'gulp-util'
56

67
type Express = ReturnType<typeof express>
78

8-
const g = require('gulp-load-plugins')()
9-
10-
const { colors, log } = g.util
11-
129
const serve = (
1310
directoryPath: string,
1411
host: string,

build/gulp/sh.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as childProcess from 'child_process'
22

3-
const sh = (command: string, pipeOutputToResult: boolean = false): Promise<string> =>
3+
const sh = (command: string, cwd?: string, pipeOutputToResult: boolean = false): Promise<string> =>
44
new Promise((resolve, reject) => {
55
const [cmd, ...args] = command.split(' ')
66

77
const options: childProcess.SpawnOptions = {
8-
cwd: process.cwd(),
8+
cwd: cwd || process.cwd(),
99
env: process.env,
1010
stdio: pipeOutputToResult ? 'pipe' : [0, 1, 2],
1111
shell: true,

build/gulp/tasks/bundle.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { task, series, parallel, src, dest } from 'gulp'
22
import babel from 'gulp-babel'
3+
import { log, PluginError } from 'gulp-util'
34
import del from 'del'
45
import webpack from 'webpack'
56

6-
import config from '../../../config'
7+
import config from '../../config'
78
import sh from '../sh'
89

9-
const g = require('gulp-load-plugins')()
10-
1110
const { paths } = config
12-
const { log, PluginError } = g.util
1311

1412
const packageName = config.package
1513

@@ -47,11 +45,7 @@ task('bundle:package:es', () =>
4745
)
4846

4947
task('bundle:package:types:tsc', () => {
50-
let cmd = 'tsc -b'
51-
if (process.cwd() === config.path_base) {
52-
cmd = `cd packages && cd ${packageName} && ${cmd}`
53-
}
54-
return sh(cmd)
48+
return sh('tsc -b', paths.packages(packageName))
5549
})
5650
task('bundle:package:types:copy', () => {
5751
return src(paths.packageDist(packageName, 'dts/src/**/*.d.ts')).pipe(

build/gulp/tasks/docs.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { dest, lastRun, parallel, series, src, task, watch } from 'gulp'
22
import chalk from 'chalk'
33
import cache from 'gulp-cache'
44
import remember from 'gulp-remember'
5+
import { log } from 'gulp-util'
56
import fs from 'fs'
67
import path from 'path'
78
import del from 'del'
@@ -11,7 +12,7 @@ import WebpackDevMiddleware from 'webpack-dev-middleware'
1112
import WebpackHotMiddleware from 'webpack-hot-middleware'
1213

1314
import sh from '../sh'
14-
import config from '../../../config'
15+
import config from '../../config'
1516
import gulpComponentMenu from '../plugins/gulp-component-menu'
1617
import gulpComponentMenuBehaviors from '../plugins/gulp-component-menu-behaviors'
1718
import gulpDoctoc from '../plugins/gulp-doctoc'
@@ -24,9 +25,6 @@ import { Server } from 'http'
2425
import serve, { forceClose } from '../serve'
2526

2627
const { paths } = config
27-
const g = require('gulp-load-plugins')()
28-
29-
const { log } = g.util
3028

3129
const logWatchAdd = (filePath: string) => log('Created', chalk.blue(path.basename(filePath)))
3230
const logWatchChange = (filePath: string) => log('Changed', chalk.magenta(path.basename(filePath)))
@@ -139,7 +137,7 @@ task('build:docs:toc', () =>
139137
task('build:docs:schema', () =>
140138
src(schemaSrc, { since: lastRun('build:docs:schema') }).pipe(
141139
through2.obj((file, enc, done) => {
142-
sh(`cd packages/ability-attributes && npm run schema`)
140+
sh('npm run schema', paths.packages('ability-attributes'))
143141
.then(() => done(null, file))
144142
.catch(done)
145143
}),

build/gulp/tasks/perf.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import express from 'express'
22
import fs from 'fs'
33
import { series, task } from 'gulp'
4+
import { colors, log } from 'gulp-util'
45
import _ from 'lodash'
56
import ProgressBar from 'progress'
67
import puppeteer from 'puppeteer'
@@ -15,12 +16,11 @@ import {
1516
ProfilerMeasureCycle,
1617
ReducedMeasures,
1718
} from '../../../perf/types'
18-
import config from '../../../config'
19+
import config from '../../config'
1920
import webpackPlugin from '../plugins/gulp-webpack'
2021
import { safeLaunchOptions } from 'build/puppeteer.config'
2122

2223
const { paths } = config
23-
const { colors, log } = require('gulp-load-plugins')().util
2424

2525
const DEFAULT_RUN_TIMES = 10
2626
let server
@@ -109,7 +109,7 @@ const createMarkdownTable = (perExamplePerfMeasures: PerExamplePerfMeasures) =>
109109
task('perf:clean', () => del(paths.perfDist()))
110110

111111
task('perf:build', cb => {
112-
webpackPlugin(require('../../../build/webpack.config.perf').default, cb)
112+
webpackPlugin(require('../../webpack.config.perf').default, cb)
113113
})
114114

115115
task('perf:run', async () => {

build/gulp/tasks/screener.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { task, series } from 'gulp'
22
import { argv } from 'yargs'
33

44
import sh from '../sh'
5-
import config from '../../../config'
5+
import config from '../../config'
66

77
const { paths } = config
88

build/gulp/tasks/stats.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import fs from 'fs'
22
import { task, parallel, series } from 'gulp'
3+
import { log, PluginError } from 'gulp-util'
34
import _ from 'lodash'
45
import webpack from 'webpack'
56
import stableStringify from 'json-stable-stringify-without-jsonify'
67
import { argv } from 'yargs'
78
import requestHttp from 'request-promise-native'
89

9-
import config from '../../../config'
10-
11-
const g = require('gulp-load-plugins')()
10+
import config from '../../config'
1211

1312
const { paths } = config
14-
const { log, PluginError } = g.util
1513

1614
const UNRELEASED_VERSION_STRING = 'Unreleased'
1715
const SEMVER_MATCHER = /(\d+)\.(\d+)\.(\d+)/

build/gulp/tasks/test-circulars/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import config from '../../../../config'
1+
import config from '../../../config'
22

33
const reactPackageDist = (filePath: string) => config.paths.packageDist('react', 'es', filePath)
44

build/gulp/tasks/test-circulars/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'fs'
33
import { task, series } from 'gulp'
44
import webpackPlugin from '../../plugins/gulp-webpack'
55

6-
import config from '../../../../config'
6+
import config from '../../../config'
77

88
import { cyclesToSkip } from './config'
99
import { buildWebpackConfig, configureCircularDependencyCheckPlugin, isCycleToSkip } from './utils'

build/gulp/tasks/test-circulars/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'path'
22
import CircularDependencyPlugin from 'circular-dependency-plugin'
33

4-
import config from '../../../../config'
4+
import config from '../../../config'
55

66
export const isCycleToSkip = (proposedCycle, benignCycles) => {
77
return benignCycles.some(benignCycle => {

build/gulp/tasks/test-dependencies/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as fs from 'fs'
44
import { argv } from 'yargs'
55

66
import { prepareWebpackConfig, runWebpack } from './utils'
7-
import config from '../../../../config'
7+
import config from '../../../config'
88

99
const { paths } = config
1010

build/gulp/tasks/test-dependencies/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { webpack as lernaAliases } from 'lerna-alias'
33
import { LicenseWebpackPlugin } from 'license-webpack-plugin'
44
import webpack from 'webpack'
55

6-
import config from '../../../../config'
6+
import config from '../../../config'
77

88
const { paths } = config
99

build/gulp/tasks/test-e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { task, series } from 'gulp'
22
import * as yargs from 'yargs'
33
import del from 'del'
4-
import config from '../../../config'
4+
import config from '../../config'
55
import webpackPlugin from '../plugins/gulp-webpack'
66

77
import jest from '../plugins/gulp-jest'
@@ -18,7 +18,7 @@ const argv = yargs
1818
task('test:e2e:clean', () => del(paths.e2eDist()))
1919

2020
task('test:e2e:build', cb => {
21-
webpackPlugin(require('../../../build/webpack.config.e2e').default, cb)
21+
webpackPlugin(require('../../webpack.config.e2e').default, cb)
2222
})
2323

2424
let server: Server

build/gulp/tasks/test-projects.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import puppeteer from 'puppeteer'
88
import sh from '../sh'
99
import del from 'del'
1010

11-
import config from '../../../config'
11+
import config from '../../config'
1212
import tmp from 'tmp'
1313
import http from 'http'
1414
import { safeLaunchOptions } from 'build/puppeteer.config'
@@ -24,7 +24,7 @@ const log = (context: string) => (message: string) => {
2424
console.log('='.repeat(80))
2525
}
2626

27-
export const runIn = targetPath => cmd => sh(`cd ${targetPath} && ${cmd}`)
27+
export const runIn = targetPath => cmd => sh(cmd, targetPath)
2828

2929
const addResolutionPathsForProjectPackages = async (
3030
testProjectDir: string,
@@ -47,11 +47,14 @@ const packProjectPackages = async (logger: Function): Promise<PackedPackages> =>
4747
const projectPackages = lernaAliases({ sourceDirectory: false })
4848

4949
// We don't want to pack a package with our dev tools
50+
delete projectPackages['@fluentui/digest']
51+
delete projectPackages['@fluentui/docs']
52+
delete projectPackages['@fluentui/e2e']
5053
delete projectPackages['@fluentui/eslint-plugin']
5154
delete projectPackages['@fluentui/internal-tooling']
52-
delete projectPackages['@fluentui/scripts']
53-
delete projectPackages['@fluentui/digest']
55+
delete projectPackages['@fluentui/perf']
5456
delete projectPackages['@fluentui/perf-test']
57+
delete projectPackages['@fluentui/scripts']
5558

5659
await Promise.all(
5760
Object.keys(projectPackages).map(async (packageName: string) => {

build/gulp/tasks/test-unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import yargs from 'yargs'
33

44
import jest, { JestPluginConfig } from '../plugins/gulp-jest'
55

6-
import config from '../../../config'
6+
import config from '../../config'
77

88
const argv = yargs
99
.option('runInBand', {})
File renamed without changes.

0 commit comments

Comments
 (0)