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

chore: Everybody gets a package #2218

Merged
merged 27 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b64c9de
Everybody gets a package
ecraig12345 Jan 9, 2020
2d93dcd
minor fixes
ecraig12345 Jan 11, 2020
2e528bd
eslint can't use package paths :(
ecraig12345 Jan 11, 2020
5c5020a
fix type mismatches
ecraig12345 Jan 11, 2020
f5b936a
emitDeclarationOnly for tsc task
ecraig12345 Jan 11, 2020
d58dc54
syncpack fixes
ecraig12345 Jan 11, 2020
833f2fa
Revert "emitDeclarationOnly for tsc task"
ecraig12345 Jan 11, 2020
db7d388
dedupe puppeteer
ecraig12345 Jan 11, 2020
9f5f1ff
Everybody gets a package
ecraig12345 Jan 9, 2020
a70ef7a
minor fixes
ecraig12345 Jan 11, 2020
83a71fe
eslint can't use package paths :(
ecraig12345 Jan 11, 2020
6f282fa
fix type mismatches
ecraig12345 Jan 11, 2020
f31ac7d
emitDeclarationOnly for tsc task
ecraig12345 Jan 11, 2020
74326d5
syncpack fixes
ecraig12345 Jan 11, 2020
ecf3357
Revert "emitDeclarationOnly for tsc task"
ecraig12345 Jan 11, 2020
17cb29d
dedupe puppeteer
ecraig12345 Jan 11, 2020
0df5525
Add cwd arg to sh
ecraig12345 Jan 14, 2020
3de8746
Add more aliases, emitDeclarationOnly
ecraig12345 Jan 14, 2020
b030350
Fix extends paths in tsconfigs
ecraig12345 Jan 14, 2020
a8137b6
revert react update
layershifter Jan 14, 2020
0f7c0b8
Merge branch 'chore/all-packages' of https://github.com/stardust-ui/r…
layershifter Jan 14, 2020
616d0b4
fix lock issue
layershifter Jan 14, 2020
aaa3e76
Merge branch 'master' into chore/all-packages
ecraig12345 Jan 14, 2020
c9436d3
Fix extends paths in tsconfigs
ecraig12345 Jan 14, 2020
65aca20
Merge branch 'master' into chore/all-packages
ecraig12345 Jan 15, 2020
9e16fd0
un-deduplicate!
ecraig12345 Jan 15, 2020
ab801bf
fix screener??
ecraig12345 Jan 15, 2020
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 .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["./packages/internal-tooling/eslint/index.js"],
"extends": ["./build/eslint/index.js"],
"root": true
}
2 changes: 1 addition & 1 deletion build/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["../packages/internal-tooling/eslint/index.js"],
"extends": ["./eslint/index.js"],
"rules": {
"no-console": "off"
},
Expand Down
4 changes: 2 additions & 2 deletions config.ts → build/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const envConfig = {
// ----------------------------------
// Project Structure
// ----------------------------------
path_base: __dirname,
path_base: path.resolve(__dirname, '..'),
dir_build: 'build',
dir_docs_dist: 'docs/dist',
dir_docs_src: 'docs/src',
Expand Down Expand Up @@ -68,7 +68,7 @@ const paths = {
),
}

const isRoot = process.cwd() === __dirname
const isRoot = process.cwd() === envConfig.path_base
let packageName = isRoot ? 'react' : path.basename(process.cwd())
// don't use yargs here because it causes build errors in certain circumstances
const packageArgIndex = process.argv.indexOf('--package')
Expand Down
2 changes: 1 addition & 1 deletion build/dangerjs/checkChangelog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs'

import config from '../../config'
import config from '../config'
import { DangerJS } from './types'

const CHANGELOG_FILE = 'CHANGELOG.md'
Expand Down
2 changes: 1 addition & 1 deletion build/dangerjs/checkPerfRegressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from 'fs-extra'
import * as path from 'path'

import { DangerJS } from './types'
import config from '../../config'
import config from '../config'

function linkToFlamegraph(value, filename) {
// This as well as the whole flamegrill URL is hardcoded to only work with CircleCI.
Expand Down
2 changes: 1 addition & 1 deletion build/dangerjs/detectNonApprovedDependencies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getPackageName,
FailedConstraintsExplanation,
} from './utils'
import config from '../../../config'
import config from '../../config'
import { DangerJS } from '../types'

const { paths } = config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawnSync } from 'child_process'

import config from '../../../../config'
import config from '../../../config'

const { paths } = config

Expand Down
2 changes: 1 addition & 1 deletion build/gulp/plugins/gulp-component-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from 'path'
import through2 from 'through2'
import Vinyl from 'vinyl'

import config from '../../../config'
import config from '../../config'
import getComponentInfo from './util/getComponentInfo'

const pluginName = 'gulp-component-menu'
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/plugins/gulp-doctoc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs'
import through2 from 'through2'

import config from '../../../config'
import config from '../../config'
import sh from '../sh'

const insideGitRepo = fs.existsSync(config.paths.base('.git'))
Expand Down
4 changes: 2 additions & 2 deletions build/gulp/plugins/gulp-webpack.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import webpack from 'webpack'
import config from '../../../config'
import config from '../../config'
import { log, PluginError } from 'gulp-util'

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

const DEV_SKIP_ERRORS = __DEV__ && __SKIP_ERRORS__

Expand Down
2 changes: 1 addition & 1 deletion build/gulp/plugins/util/getRelativePathToSourceFile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path'
import config from '../../../../config'
import config from '../../../config'

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

Expand Down
5 changes: 1 addition & 4 deletions build/gulp/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ import express from 'express'

import historyApiFallback from 'connect-history-api-fallback'
import { Server } from 'http'
import { colors, log } from 'gulp-util'

type Express = ReturnType<typeof express>

const g = require('gulp-load-plugins')()

const { colors, log } = g.util

const serve = (
directoryPath: string,
host: string,
Expand Down
4 changes: 2 additions & 2 deletions build/gulp/sh.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as childProcess from 'child_process'

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

const options: childProcess.SpawnOptions = {
cwd: process.cwd(),
cwd: cwd || process.cwd(),
env: process.env,
stdio: pipeOutputToResult ? 'pipe' : [0, 1, 2],
shell: true,
Expand Down
12 changes: 3 additions & 9 deletions build/gulp/tasks/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { task, series, parallel, src, dest } from 'gulp'
import babel from 'gulp-babel'
import { log, PluginError } from 'gulp-util'
import del from 'del'
import webpack from 'webpack'

import config from '../../../config'
import config from '../../config'
import sh from '../sh'

const g = require('gulp-load-plugins')()

const { paths } = config
const { log, PluginError } = g.util

const packageName = config.package

Expand Down Expand Up @@ -47,11 +45,7 @@ task('bundle:package:es', () =>
)

task('bundle:package:types:tsc', () => {
let cmd = 'tsc -b'
if (process.cwd() === config.path_base) {
cmd = `cd packages && cd ${packageName} && ${cmd}`
}
return sh(cmd)
return sh('tsc -b', paths.packages(packageName))
})
task('bundle:package:types:copy', () => {
return src(paths.packageDist(packageName, 'dts/src/**/*.d.ts')).pipe(
Expand Down
8 changes: 3 additions & 5 deletions build/gulp/tasks/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { dest, lastRun, parallel, series, src, task, watch } from 'gulp'
import chalk from 'chalk'
import cache from 'gulp-cache'
import remember from 'gulp-remember'
import { log } from 'gulp-util'
import fs from 'fs'
import path from 'path'
import del from 'del'
Expand All @@ -11,7 +12,7 @@ import WebpackDevMiddleware from 'webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware'

import sh from '../sh'
import config from '../../../config'
import config from '../../config'
import gulpComponentMenu from '../plugins/gulp-component-menu'
import gulpComponentMenuBehaviors from '../plugins/gulp-component-menu-behaviors'
import gulpDoctoc from '../plugins/gulp-doctoc'
Expand All @@ -24,9 +25,6 @@ import { Server } from 'http'
import serve, { forceClose } from '../serve'

const { paths } = config
const g = require('gulp-load-plugins')()

const { log } = g.util

const logWatchAdd = (filePath: string) => log('Created', chalk.blue(path.basename(filePath)))
const logWatchChange = (filePath: string) => log('Changed', chalk.magenta(path.basename(filePath)))
Expand Down Expand Up @@ -139,7 +137,7 @@ task('build:docs:toc', () =>
task('build:docs:schema', () =>
src(schemaSrc, { since: lastRun('build:docs:schema') }).pipe(
through2.obj((file, enc, done) => {
sh(`cd packages/ability-attributes && npm run schema`)
sh('npm run schema', paths.packages('ability-attributes'))
.then(() => done(null, file))
.catch(done)
}),
Expand Down
6 changes: 3 additions & 3 deletions build/gulp/tasks/perf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import express from 'express'
import fs from 'fs'
import { series, task } from 'gulp'
import { colors, log } from 'gulp-util'
import _ from 'lodash'
import ProgressBar from 'progress'
import puppeteer from 'puppeteer'
Expand All @@ -15,12 +16,11 @@ import {
ProfilerMeasureCycle,
ReducedMeasures,
} from '../../../perf/types'
import config from '../../../config'
import config from '../../config'
import webpackPlugin from '../plugins/gulp-webpack'
import { safeLaunchOptions } from 'build/puppeteer.config'

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

const DEFAULT_RUN_TIMES = 10
let server
Expand Down Expand Up @@ -109,7 +109,7 @@ const createMarkdownTable = (perExamplePerfMeasures: PerExamplePerfMeasures) =>
task('perf:clean', () => del(paths.perfDist()))

task('perf:build', cb => {
webpackPlugin(require('../../../build/webpack.config.perf').default, cb)
webpackPlugin(require('../../webpack.config.perf').default, cb)
})

task('perf:run', async () => {
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/screener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { task, series } from 'gulp'
import { argv } from 'yargs'

import sh from '../sh'
import config from '../../../config'
import config from '../../config'

const { paths } = config

Expand Down
6 changes: 2 additions & 4 deletions build/gulp/tasks/stats.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import fs from 'fs'
import { task, parallel, series } from 'gulp'
import { log, PluginError } from 'gulp-util'
import _ from 'lodash'
import webpack from 'webpack'
import stableStringify from 'json-stable-stringify-without-jsonify'
import { argv } from 'yargs'
import requestHttp from 'request-promise-native'

import config from '../../../config'

const g = require('gulp-load-plugins')()
import config from '../../config'

const { paths } = config
const { log, PluginError } = g.util

const UNRELEASED_VERSION_STRING = 'Unreleased'
const SEMVER_MATCHER = /(\d+)\.(\d+)\.(\d+)/
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/test-circulars/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import config from '../../../../config'
import config from '../../../config'

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

Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/test-circulars/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from 'fs'
import { task, series } from 'gulp'
import webpackPlugin from '../../plugins/gulp-webpack'

import config from '../../../../config'
import config from '../../../config'

import { cyclesToSkip } from './config'
import { buildWebpackConfig, configureCircularDependencyCheckPlugin, isCycleToSkip } from './utils'
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/test-circulars/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import CircularDependencyPlugin from 'circular-dependency-plugin'

import config from '../../../../config'
import config from '../../../config'

export const isCycleToSkip = (proposedCycle, benignCycles) => {
return benignCycles.some(benignCycle => {
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/test-dependencies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs'
import { argv } from 'yargs'

import { prepareWebpackConfig, runWebpack } from './utils'
import config from '../../../../config'
import config from '../../../config'

const { paths } = config

Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/test-dependencies/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { webpack as lernaAliases } from 'lerna-alias'
import { LicenseWebpackPlugin } from 'license-webpack-plugin'
import webpack from 'webpack'

import config from '../../../../config'
import config from '../../../config'

const { paths } = config

Expand Down
4 changes: 2 additions & 2 deletions build/gulp/tasks/test-e2e.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { task, series } from 'gulp'
import * as yargs from 'yargs'
import del from 'del'
import config from '../../../config'
import config from '../../config'
import webpackPlugin from '../plugins/gulp-webpack'

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

task('test:e2e:build', cb => {
webpackPlugin(require('../../../build/webpack.config.e2e').default, cb)
webpackPlugin(require('../../webpack.config.e2e').default, cb)
})

let server: Server
Expand Down
11 changes: 7 additions & 4 deletions build/gulp/tasks/test-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import puppeteer from 'puppeteer'
import sh from '../sh'
import del from 'del'

import config from '../../../config'
import config from '../../config'
import tmp from 'tmp'
import http from 'http'
import { safeLaunchOptions } from 'build/puppeteer.config'
Expand All @@ -24,7 +24,7 @@ const log = (context: string) => (message: string) => {
console.log('='.repeat(80))
}

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

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

// We don't want to pack a package with our dev tools
delete projectPackages['@fluentui/digest']
delete projectPackages['@fluentui/docs']
delete projectPackages['@fluentui/e2e']
delete projectPackages['@fluentui/eslint-plugin']
delete projectPackages['@fluentui/internal-tooling']
delete projectPackages['@fluentui/scripts']
delete projectPackages['@fluentui/digest']
delete projectPackages['@fluentui/perf']
delete projectPackages['@fluentui/perf-test']
delete projectPackages['@fluentui/scripts']

await Promise.all(
Object.keys(projectPackages).map(async (packageName: string) => {
Expand Down
2 changes: 1 addition & 1 deletion build/gulp/tasks/test-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import yargs from 'yargs'

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

import config from '../../../config'
import config from '../../config'

const argv = yargs
.option('runInBand', {})
Expand Down
Loading