Skip to content

Commit

Permalink
build(workspace): 🏗 refactoring lerna to internal dependents (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
yinonov authored Jan 20, 2021
1 parent 81e5875 commit 3d52a32
Show file tree
Hide file tree
Showing 104 changed files with 556 additions and 351 deletions.
9 changes: 7 additions & 2 deletions common/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"directory": "components/context"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules",
"build": "yarn run build:styles && yarn run build:typescript"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -32,6 +35,8 @@
"devDependencies": {
"@vonage/vvd-design-tokens": "^1.0.4",
"@vonage/vvd-foundation": "^1.0.4",
"@vonage/vvd-typography": "^1.0.4"
"@vonage/vvd-typography": "^1.0.4",
"@vonage/vvd-umbrella": "^1.0.4",
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion common/context/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"composite": true,
Expand Down
9 changes: 8 additions & 1 deletion common/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"directory": "components/core"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules",
"build": "yarn run build:styles && yarn run build:typescript"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -27,5 +30,9 @@
"@vonage/vvd-fonts": "^1.0.4",
"@vonage/vvd-scheme": "^1.0.4",
"tslib": "^2.0.3"
},
"devDependencies": {
"@vonage/vvd-umbrella": "^1.0.4",
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion common/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"composite": true,
Expand Down
9 changes: 7 additions & 2 deletions common/fonts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"directory": "commmon/fonts"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules",
"build": "yarn run build:styles && yarn run build:typescript"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -28,6 +31,8 @@
"tslib": "^2.0.3"
},
"devDependencies": {
"@vonage/vvd-foundation": "^1.0.4"
"@vonage/vvd-foundation": "^1.0.4",
"@vonage/vvd-umbrella": "^1.0.4",
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion common/fonts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"composite": true,
Expand Down
9 changes: 7 additions & 2 deletions common/foundation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"directory": "components/foundation"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules",
"build": "yarn run build:styles && yarn run build:typescript"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -26,6 +29,8 @@
"tslib": "^2.0.3"
},
"devDependencies": {
"@vonage/vvd-design-tokens": "^1.0.4"
"@vonage/vvd-design-tokens": "^1.0.4",
"@vonage/vvd-umbrella": "^1.0.4",
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion common/foundation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "src",
Expand Down
10 changes: 7 additions & 3 deletions common/scheme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
"directory": "components/scheme"
},
"scripts": {
"build": "yarn --cwd ../../ wca:json && node scripts/parseComponentsList.js",
"test": "echo \"Error: run tests from root\" && exit 1"
"build": "yarn run build:styles && yarn run build:typescript",
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -24,6 +26,8 @@
},
"devDependencies": {
"@vonage/vvd-design-tokens": "^1.0.4",
"lit-element": "^2.4.0"
"@vonage/vvd-umbrella": "^1.0.4",
"lit-element": "^2.4.0",
"typescript": "^4.1.3"
}
}
26 changes: 0 additions & 26 deletions common/scheme/scripts/parseComponentsList.js

This file was deleted.

3 changes: 3 additions & 0 deletions common/scheme/src/pre-scheme-loading.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const preSchemeLoadingCssText = `vwc-audio, vwc-badge, vwc-button, vwc-calendar, vwc-carousel-item, vwc-carousel, vwc-checkbox, vwc-chip-set, vwc-chip, vwc-circular-progress, vwc-drawer, vwc-fab, vwc-file-picker, vwc-formfield, vwc-helper-message, vwc-icon-button-toggle, vwc-icon-button, vwc-icon, vwc-inline, vwc-keypad, vwc-linear-progress, vwc-check-list-item, vwc-list-expansion-panel, vwc-list-item, vwc-list, vwc-radio-list-item, vwc-media-controller, vwc-menu, mwc-chip-set, mwc-chip, vwc-notched-outline, vwc-note, vwc-radio, vwc-relative-time, vwc-scheme-select, vwc-select, vwc-slider, vwc-switch, vwc-tab-bar, vwc-tab, vwc-textarea, vwc-textfield, vwc-theme-switch, vwc-top-app-bar-fixed, vwc-top-app-bar {
visibility: hidden;
}`
2 changes: 1 addition & 1 deletion common/scheme/src/vvd-scheme-style-tag-handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CSSResult } from 'lit-element';
import { preSchemeLoadingCssText } from './pre-scheme-loading.css.js';
import { preSchemeLoadingCssText } from './pre-scheme-loading.css';
import { PredefinedScheme } from './vvd-scheme-foundation';

type ModuleType =
Expand Down
2 changes: 1 addition & 1 deletion common/scheme/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"composite": true,
Expand Down
5 changes: 0 additions & 5 deletions common/storage/src/storage.ts

This file was deleted.

9 changes: 7 additions & 2 deletions common/style-coupling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"directory": "components/style-coupling"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules",
"build": "yarn run build:styles && yarn run build:typescript"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -24,6 +27,8 @@
"devDependencies": {
"@vonage/vvd-design-tokens": "^1.0.4",
"@vonage/vvd-foundation": "^1.0.4",
"lit-element": "^2.4.0"
"lit-element": "^2.4.0",
"@vonage/vvd-umbrella": "^1.0.4",
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion common/style-coupling/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"composite": true,
Expand Down
1 change: 1 addition & 0 deletions common/umbrella/.depcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skip-missing: true
14 changes: 7 additions & 7 deletions tsconfig.settings.json → common/umbrella/configs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es2017",
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"lib": ["es2017", "dom", "dom.iterable"],
Expand All @@ -19,14 +19,14 @@
"outDir": "./",
"baseUrl": "./",
"paths": {
"@vivid/vvd-*": ["./*.src"],
"@vivid/vvd-*": ["./*.src"],
"@vivid/vwc-*": ["./*/src"]
},
"composite": true,
},
"composite": true,
"importHelpers": true,
"allowSyntheticDefaultImports": true
// "esModuleInterop": true // would force consumers to enable this as well
},
// "esModuleInterop": true // would force consumers to enable this as well
},
"include": ["custom_typings/**/*.ts", "src/*.ts"],
"exclude": []
}
}
38 changes: 38 additions & 0 deletions common/umbrella/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@vonage/vvd-umbrella",
"version": "1.0.4",
"description": "Supplies various tools for authoring, testing and building Vivid components",
"keywords": [
"build",
"test",
"compile",
"author",
"toolkit"
],
"private": true,
"bin": {
"umbrella-style-modules": "./tools/style-modules/index.js"
},
"author": "Tal Weinfeld <tal.weinfeld@vonage.com>",
"homepage": "https://github.com/Vonage/vivid#readme",
"license": "ISC",
"publishConfig": {
"registry": "https://vonagecc.jfrog.io/vonagecc/api/npm/npm/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Vonage/vivid.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
},
"dependencies": {
"glob": "^7.1.6",
"minimist": "^1.2.5",
"sass": "^1.32.4",
"kefir": "^3.8.8"
}
}
73 changes: 73 additions & 0 deletions common/umbrella/tools/style-modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env node
const
fp = require('lodash/fp'),
glob = require('glob'),
kefir = require('kefir'),
parseArgs = require('minimist'),
{ writeFile } = require('fs'),
{ join: joinPath, extname: getExtension, basename: getBase, dirname: getDir } = require('path'),
{ render: renderSass } = require('sass');

const { path:basePath = "." } = parseArgs(process.argv.slice(2));

console.time('Total');

const
fileStreamFromGlob = (path)=> kefir.fromNodeCallback(fp.partial(glob, [path])).flatten(),
tsTemplate = (css)=> [
"// autogenerated module",
"import {css} from 'lit-element';",
["export const style = css`", css, "`;"].join('')
].join('\n'),
prefixWith = (path)=> (pre)=> joinPath(...[getDir(path), [pre, getBase(path)].join('')]),
suffixWith = (path)=> (suf)=> joinPath(...[getDir(path), [getBase(path), suf].filter(Boolean).join('.')]);

fileStreamFromGlob(joinPath(process.cwd(), basePath, './src/*.s[ac]ss'))
.flatMapConcat((sassFile)=> {
return kefir.fromNodeCallback((cb)=>
renderSass({
importer: (path, prev, done)=> {
kefir
.concat(
[
[path, "_index.scss"].join('/'),
...["", "_"]
.map(prefixWith(path))
.flatMap((basePath)=> ["", "scss", "sass"].map(suffixWith(basePath)))
].map((probePath)=> kefir.fromNodeCallback((cb) => {
const res = fp.attempt(() => require.resolve(probePath));
cb(fp.isError(res) && res, res);
}))
)
.ignoreErrors()
.map((outPath)=> ({ file: outPath }))
.beforeEnd(fp.noop)
.take(1)
.onValue(done);
},
file: sassFile,
outputStyle: "compressed"
}, cb)
)
.map(({ css })=> ({
sass_path: sassFile,
css_content: css.toString()
}));
})
.map(({ css_content, sass_path })=> ({
module_path: joinPath(...[getDir(sass_path), [getBase(sass_path, getExtension(sass_path)), 'css.ts'].join('.')]),
module_content: tsTemplate(css_content),
})
)
.flatMap(({ module_path, module_content })=>
kefir
.fromNodeCallback((cb)=>writeFile(module_path, module_content, cb))
.map(()=> ` ✔ ${module_path}`)
)
.takeErrors(1)
.onValue(console.log)
.onEnd(()=> console.timeEnd('Total'))
.onError((err)=>{
console.warn(err);
process.exit(1);
});
9 changes: 8 additions & 1 deletion components/audio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"directory": "components/audio"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
"test": "echo \"Error: run tests from root\" && exit 1",
"build:typescript": "tsc -b",
"build:styles": "umbrella-style-modules",
"build": "yarn run build:styles && yarn run build:typescript"
},
"bugs": {
"url": "https://github.com/Vonage/vivid/issues"
Expand All @@ -25,5 +28,9 @@
"@types/kefir": "^3.8.5",
"@vonage/vwc-media-controller": "^1.0.4",
"kefir": "^3.8.7"
},
"devDependencies": {
"@vonage/vvd-umbrella": "^1.0.4",
"typescript": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion components/audio/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.settings.json",
"extends": "@vonage/vvd-umbrella/configs/tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "src",
Expand Down
Loading

0 comments on commit 3d52a32

Please sign in to comment.