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

Commit bdde748

Browse files
committed
Everybody gets a package
1 parent 1b4b6b6 commit bdde748

34 files changed

+1028
-1255
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.
File renamed without changes.

build/gulp/plugins/gulp-webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import webpack from 'webpack'
22
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/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/tasks/bundle.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { task, series, parallel, src, dest } from 'gulp'
22
import babel from 'gulp-babel'
3+
import typescript from 'gulp-typescript'
34
import rimraf from 'rimraf'
45
import webpack from 'webpack'
56
import { argv } from 'yargs'
67

78
import config from '../../../config'
89
import sh from '../sh'
910

10-
const g = require('gulp-load-plugins')()
11-
1211
const { paths } = config
1312
const { log, PluginError } = g.util
1413

@@ -51,21 +50,24 @@ task('bundle:package:commonjs', () =>
5150

5251
task('bundle:package:es', () =>
5352
src(componentsSrc)
54-
.pipe(babel({ caller: { useESModules: true } }))
53+
.pipe(babel({ caller: { useESModules: true } } as any))
5554
.pipe(dest(paths.packageDist(packageName, 'es'))),
5655
)
5756

5857
task('bundle:package:types', () => {
5958
const tsConfig = paths.base('build/tsconfig.json')
60-
const typescript = g.typescript.createProject(tsConfig, {
59+
const tsProject = typescript.createProject(tsConfig, {
6160
declaration: true,
6261
isolatedModules: false,
6362
module: 'esnext',
6463
})
6564

66-
return src(componentsSrc)
67-
.pipe(typescript())
68-
.dts.pipe(dest(paths.packageDist(packageName, 'es')))
65+
return (
66+
src(componentsSrc)
67+
.pipe(tsProject())
68+
// Write only the .d.ts files to dist/es (.js files are generated by bundle:package:es)
69+
.dts.pipe(dest(paths.packageDist(packageName, 'es')))
70+
)
6971
})
7072

7173
task('bundle:package:umd', cb => {

build/gulp/tasks/docs.ts

Lines changed: 6 additions & 8 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 rimraf from 'rimraf'
@@ -24,15 +25,12 @@ import { Server } from 'http'
2425
import serve, { forceClose } from '../serve'
2526

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

29-
const { log } = g.util
29+
const logWatchAdd = (filePath: string) => log('Created', chalk.blue(path.basename(filePath)))
30+
const logWatchChange = (filePath: string) => log('Changed', chalk.magenta(path.basename(filePath)))
31+
const logWatchUnlink = (filePath: string) => log('Deleted', chalk.red(path.basename(filePath)))
3032

31-
const logWatchAdd = filePath => log('Created', chalk.blue(path.basename(filePath)))
32-
const logWatchChange = filePath => log('Changed', chalk.magenta(path.basename(filePath)))
33-
const logWatchUnlink = filePath => log('Deleted', chalk.red(path.basename(filePath)))
34-
35-
const handleWatchUnlink = (group, filePath) => {
33+
const handleWatchUnlink = (group: any, filePath: string) => {
3634
logWatchUnlink(filePath)
3735
remember.forget(group, filePath)
3836
}
@@ -220,7 +218,7 @@ task('serve:docs:hot', async () => {
220218
noInfo: true, // must be quite for hot middleware to show overlay
221219
lazy: false,
222220
stats: config.compiler_stats,
223-
}),
221+
} as WebpackDevMiddleware.Options),
224222
)
225223
.use(WebpackHotMiddleware(compiler)),
226224
)

build/gulp/tasks/perf.ts

Lines changed: 1 addition & 1 deletion
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'
@@ -20,7 +21,6 @@ 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

build/gulp/tasks/stats.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
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'
@@ -8,10 +9,7 @@ import requestHttp from 'request-promise-native'
89

910
import config from '../../../config'
1011

11-
const g = require('gulp-load-plugins')()
12-
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-projects.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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) => {
File renamed without changes.

build/package.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"name": "@fluentui/internal-tooling",
3+
"version": "0.42.0",
4+
"license": "MIT",
5+
"dependencies": {
6+
"@babel/core": "^7.6.4",
7+
"@babel/plugin-proposal-class-properties": "^7.5.5",
8+
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
9+
"@babel/plugin-transform-runtime": "^7.6.2",
10+
"@babel/preset-env": "^7.6.3",
11+
"@babel/preset-react": "^7.6.3",
12+
"@babel/preset-typescript": "^7.6.0",
13+
"@babel/register": "^7.4.4",
14+
"@babel/standalone": "^7.3.2",
15+
"@fluentui/eslint-plugin": "^0.42.0",
16+
"@mdx-js/loader": "^1.0.21",
17+
"@types/babel__traverse": "^7.0.4",
18+
"@types/express": "^4.16.1",
19+
"@types/gulp": "^4.0.6",
20+
"@types/gulp-babel": "6.1.29",
21+
"@types/gulp-cache": "^0.4.4",
22+
"@types/gulp-util": "^3.0.34",
23+
"@types/gulp-remember": "^0.0.31",
24+
"@types/jest-axe": "^2.2.3",
25+
"@types/jest": "^24.0.19",
26+
"@types/node": "^10.3.2",
27+
"@types/puppeteer": "^1.11.1",
28+
"@types/rimraf": "^2.0.2",
29+
"@types/webpack-dev-middleware": "^2.0.1",
30+
"@types/webpack-hot-middleware": "^2.16.3",
31+
"@typescript-eslint/eslint-plugin": "^2.5.0",
32+
"@typescript-eslint/parser": "^2.5.0",
33+
"babel-jest": "^24.5.0",
34+
"babel-loader": "^8.0.6",
35+
"babel-plugin-lodash": "^3.3.4",
36+
"circular-dependency-plugin": "^5.0.2",
37+
"clean-webpack-plugin": "^0.1.19",
38+
"connect-history-api-fallback": "^1.3.0",
39+
"copy-webpack-plugin": "^4.5.2",
40+
"doctrine": "^2.0.0",
41+
"eslint": "^6.5.1",
42+
"eslint-config-airbnb": "^17.1.0",
43+
"eslint-config-prettier": "^4.1.0",
44+
"eslint-plugin-import": "^2.18.2",
45+
"eslint-plugin-jest": "^22.4.1",
46+
"eslint-plugin-jsx-a11y": "^6.2.1",
47+
"eslint-plugin-react-hooks": "^2.1.2",
48+
"eslint-plugin-react": "^7.16.0",
49+
"express": "^4.15.4",
50+
"extract-comments": "^1.0.0",
51+
"fork-ts-checker-webpack-plugin": "^1.3.3",
52+
"glob": "^7.1.2",
53+
"gulp": "^4.0.2",
54+
"gulp-babel": "^8.0.0",
55+
"gulp-cache": "^1.0.2",
56+
"gulp-remember": "^1.0.1",
57+
"gulp-typescript": "^5.0.0",
58+
"gulp-util": "^3.0.8",
59+
"html-webpack-plugin": "^4.0.0-beta.5",
60+
"jest": "^24.9.0",
61+
"jest-axe": "^3.1.1",
62+
"jest-react-fela": "^10.6.1",
63+
"json-stable-stringify-without-jsonify": "^1.0.1",
64+
"license-webpack-plugin": "^2.1.1",
65+
"portfinder": "^1.0.20",
66+
"prettier": "^1.19.1",
67+
"progress": "^2.0.3",
68+
"puppeteer": "^1.11.0",
69+
"react-hot-loader": "^4.12.15",
70+
"react-vis": "^1.11.6",
71+
"read-package-json": "^2.0.13",
72+
"request-promise-native": "^1.0.5",
73+
"rimraf": "^2.6.1",
74+
"semver": "^6.2.0",
75+
"through2": "^2.0.3",
76+
"tmp": "^0.0.33",
77+
"tsconfig-paths": "^3.7.0",
78+
"webpack": "^4.35.0",
79+
"webpack-bundle-analyzer": "^3.3.2",
80+
"webpack-dev-middleware": "^3.6.2",
81+
"webpack-hot-middleware": "^2.24.3"
82+
},
83+
"publishConfig": {
84+
"access": "public"
85+
}
86+
}

config.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,37 @@ const envConfig = {
3636
// ------------------------------------
3737
// Paths
3838
// ------------------------------------
39-
const base = (...args) => path.resolve(...[envConfig.path_base, ...args])
39+
const base = (...paths: string[]) => path.resolve(envConfig.path_base, ...paths)
40+
const fromBase = (...paths: string[]) => (...subPaths: string[]) => base(...paths, ...subPaths)
4041

41-
const paths = {
42-
base,
43-
build: base.bind(null, envConfig.dir_build),
44-
docsDist: base.bind(null, envConfig.dir_docs_dist),
45-
docsSrc: base.bind(null, envConfig.dir_docs_src),
46-
e2e: base.bind(null, envConfig.dir_e2e),
47-
e2eSrc: base.bind(null, envConfig.dir_e2e_src),
48-
e2eDist: base.bind(null, envConfig.dir_e2e_dist),
42+
const tempPaths = {
43+
build: fromBase(envConfig.dir_build),
44+
docsDist: fromBase(envConfig.dir_docs_dist),
45+
docsSrc: fromBase(envConfig.dir_docs_src),
46+
e2e: fromBase(envConfig.dir_e2e),
47+
e2eSrc: fromBase(envConfig.dir_e2e_src),
48+
e2eDist: fromBase(envConfig.dir_e2e_dist),
4949
packageDist: (packageName: string, ...paths: string[]) =>
5050
base(envConfig.dir_packages, packageName, 'dist', ...paths),
5151
packageSrc: (packageName: string, ...paths: string[]) =>
5252
base(envConfig.dir_packages, packageName, 'src', ...paths),
53-
packages: base.bind(null, envConfig.dir_packages),
54-
perfDist: base.bind(null, envConfig.dir_perf_dist),
55-
perfSrc: base.bind(null, envConfig.dir_perf_src),
56-
umdDist: base.bind(null, envConfig.dir_umd_dist),
57-
ciArtifacts: base.bind(null, envConfig.dir_ci_artifacts),
58-
withRootAt: (root, ...subpaths) => (...args) => path.resolve(root, ...subpaths, ...args),
59-
posix: undefined, // all the sibling values, but with forward slashes regardless the OS
53+
packages: fromBase(envConfig.dir_packages),
54+
perfDist: fromBase(envConfig.dir_perf_dist),
55+
perfSrc: fromBase(envConfig.dir_perf_src),
56+
umdDist: fromBase(envConfig.dir_umd_dist),
57+
ciArtifacts: fromBase(envConfig.dir_ci_artifacts),
58+
withRootAt: (root: string, ...subpaths: string[]) => (...args: string[]) =>
59+
path.resolve(root, ...subpaths, ...args),
6060
}
6161

62-
paths.posix = _.mapValues(paths, func => (...args) => func(...args).replace(/\\/g, '/'))
62+
const paths = {
63+
base,
64+
...tempPaths,
65+
// all the sibling values, but with forward slashes regardless the OS
66+
posix: _.mapValues(tempPaths, (func: (...args: string[]) => string) => (...args: string[]) =>
67+
func(...args).replace(/\\/g, '/'),
68+
),
69+
}
6370

6471
const config = {
6572
...envConfig,

docs/.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": ["@fluentui/internal-tooling/eslint/index.js"],
33
"rules": {
44
"no-alert": "off"
55
},

docs/package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@fluentui/docs",
3+
"version": "0.42.0",
4+
"private": true,
5+
"license": "MIT",
6+
"dependencies": {
7+
"color": "^3.1.0",
8+
"copy-to-clipboard": "^3.0.8",
9+
"faker": "^4.1.0",
10+
"flat": "^4.1.0",
11+
"react-ace": "^5.1.2",
12+
"react-codesandboxer": "^3.1.3",
13+
"react-custom-scrollbars": "^4.2.1",
14+
"react-document-title": "^2.0.3",
15+
"react-element-to-jsx-string": "^14.0.2",
16+
"react-hot-loader": "^4.12.15",
17+
"react-markdown": "^4.0.8",
18+
"react-router-dom": "^5.0.1",
19+
"react-source-render": "4.0.0-1",
20+
"react-virtualized": "^9.21.1",
21+
"react-vis": "^1.11.6"
22+
23+
},
24+
"devDependencies": {
25+
"@fluentui/internal-tooling": "^0.42.0",
26+
"@types/color": "^3.0.0",
27+
"@types/faker": "^4.1.3",
28+
"@types/gulp": "^4.0.6",
29+
"@types/node": "^10.3.2",
30+
"@types/react-custom-scrollbars": "^4.0.5",
31+
"@types/react-router-dom": "^4.3.4",
32+
"gulp": "^4.0.2"
33+
},
34+
"publishConfig": {
35+
"access": "public"
36+
}
37+
}

e2e/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@fluentui/e2e",
3+
"version": "0.42.0",
4+
"private": true,
5+
"license": "MIT",
6+
"devDependencies": {
7+
"@fluentui/internal-tooling": "^0.42.0",
8+
"@fluentui/react": "^0.42.0",
9+
"@types/puppeteer": "^1.11.1",
10+
"@types/react-router-dom": "^4.3.4",
11+
"puppeteer": "^1.11.0",
12+
"react-router-dom": "^5.0.1"
13+
},
14+
"publishConfig": {
15+
"access": "public"
16+
}
17+
}

e2e/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "../build/tsconfig.common.json",
33
"compilerOptions": {
4-
"module": "esnext"
4+
"module": "esnext",
5+
"allowSyntheticDefaultImports": true
56
},
67
"include": ["../packages/react/src", "../e2e", "../types"]
78
}

0 commit comments

Comments
 (0)