Skip to content
Permalink
Browse files

Introduce Lerna for management of the monorepo (#61)

* Fix runtime api & introduce jwt auth

* Improve build

* Increase page size

* Bump version

* Use lerna for management of the monorepo

Fix #59
  • Loading branch information...
mgechev committed Jul 2, 2018
1 parent 10c0eac commit 75313df4e848e4778cad811f7548f8258042014d
Showing with 1,558 additions and 1,771 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 .travis.yml
  3. +5 −5 DEVELOPING.md
  4. +0 −4 config.json
  5. +0 −73 infra/build.ts
  6. +1 −7 infra/install.ts
  7. +1 −1 infra/pretest.ts
  8. +3 −3 infra/test.ts
  9. +2 −3 jest.config.js
  10. +5 −0 lerna.json
  11. +1,325 −137 package-lock.json
  12. +5 −4 package.json
  13. +6 −0 packages/guess-ga/.npmignore
  14. 0 packages/{ga → guess-ga}/README.md
  15. 0 packages/{ga → guess-ga}/index.ts
  16. +45 −184 packages/{ga → guess-ga}/package-lock.json
  17. +6 −3 packages/{ga → guess-ga}/package.json
  18. 0 packages/{ga → guess-ga}/src/client.ts
  19. 0 packages/{ga → guess-ga}/src/ga.ts
  20. 0 packages/{ga → guess-ga}/src/normalize.ts
  21. 0 packages/{ga → guess-ga}/test/normalize.spec.ts
  22. 0 packages/{ga → guess-ga}/tsconfig.json
  23. +1 −1 packages/{ga → guess-ga}/webpack.config.js
  24. +6 −0 packages/guess-parser/.npmignore
  25. 0 packages/{parser → guess-parser}/README.md
  26. 0 packages/{parser → guess-parser}/index.ts
  27. +53 −200 packages/{parser → guess-parser}/package-lock.json
  28. +6 −3 packages/{parser → guess-parser}/package.json
  29. 0 packages/{parser → guess-parser}/src/angular/index.ts
  30. 0 packages/{parser → guess-parser}/src/detector/detect.ts
  31. 0 packages/{parser → guess-parser}/src/detector/index.ts
  32. 0 packages/{parser → guess-parser}/src/language-service.ts
  33. 0 packages/{parser → guess-parser}/src/parser.ts
  34. 0 packages/{parser → guess-parser}/src/preact/index.ts
  35. 0 packages/{parser → guess-parser}/src/react/base.ts
  36. 0 packages/{parser → guess-parser}/src/react/index.ts
  37. 0 packages/{parser → guess-parser}/src/react/react-jsx.ts
  38. 0 packages/{parser → guess-parser}/src/react/react-tsx.ts
  39. 0 packages/{parser → guess-parser}/src/utils.ts
  40. +2 −2 packages/{parser → guess-parser}/test/angular.spec.ts
  41. +7 −5 packages/{parser → guess-parser}/test/detect.spec.ts
  42. 0 packages/{parser → guess-parser}/test/fixtures/angular/.angular-cli.json
  43. 0 packages/{parser → guess-parser}/test/fixtures/angular/package-lock.json
  44. 0 packages/{parser → guess-parser}/test/fixtures/angular/package.json
  45. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/app-routing.module.ts
  46. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/app.component.css
  47. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/app.component.html
  48. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/app.component.spec.ts
  49. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/app.component.ts
  50. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/app.module.ts
  51. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/bar/bar.component.ts
  52. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/bar/bar.module.ts
  53. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/foo/foo-routing.module.ts
  54. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/foo/foo.component.ts
  55. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/app/foo/foo.module.ts
  56. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/environments/environment.prod.ts
  57. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/environments/environment.ts
  58. BIN packages/{parser → guess-parser}/test/fixtures/angular/src/favicon.ico
  59. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/index.html
  60. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/main.ts
  61. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/polyfills.ts
  62. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/styles.css
  63. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/test.ts
  64. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/tsconfig.app.json
  65. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/tsconfig.spec.json
  66. 0 packages/{parser → guess-parser}/test/fixtures/angular/src/typings.d.ts
  67. 0 packages/{parser → guess-parser}/test/fixtures/angular/tsconfig.json
  68. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/.gitignore
  69. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/.prettierrc
  70. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/LICENSE
  71. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/README.md
  72. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/gatsby-browser.js
  73. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/gatsby-config.js
  74. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/gatsby-node.js
  75. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/gatsby-ssr.js
  76. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/package-lock.json
  77. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/package.json
  78. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/src/components/header.js
  79. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/src/layouts/index.css
  80. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/src/layouts/index.js
  81. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/src/pages/404.js
  82. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/src/pages/index.js
  83. 0 packages/{parser → guess-parser}/test/fixtures/gatsby/src/pages/page-2.js
  84. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/.gitignore
  85. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/README.md
  86. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/package.json
  87. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/.babelrc
  88. BIN packages/{parser → guess-parser}/test/fixtures/preact-app/src/assets/favicon.ico
  89. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/components/app.js
  90. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/components/header/index.js
  91. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/components/header/style.css
  92. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/components/info.js
  93. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/index.js
  94. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/manifest.json
  95. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/routes/about/index.js
  96. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/routes/home/index.js
  97. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/routes/home/style.css
  98. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/routes/profile/index.js
  99. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/routes/profile/style.css
  100. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/style/index.css
  101. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/tests/__mocks__/browserMocks.js
  102. 0 packages/{parser → guess-parser}/test/fixtures/preact-app/src/tests/header.test.js
  103. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/.gitignore
  104. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/README.md
  105. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/images.d.ts
  106. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/package-lock.json
  107. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/package.json
  108. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/public/index.html
  109. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/App.css
  110. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/App.tsx
  111. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/LazyRoute.tsx
  112. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/index.css
  113. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/index.tsx
  114. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/intro/Intro.tsx
  115. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/logo.svg
  116. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/main/Main.tsx
  117. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/main/kid/Kid.tsx
  118. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/main/parent/Parent.tsx
  119. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/src/registerServiceWorker.ts
  120. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/tsconfig.json
  121. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/tsconfig.test.json
  122. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/tslint.json
  123. 0 packages/{parser → guess-parser}/test/fixtures/react-app-ts/yarn.lock
  124. 0 packages/{parser → guess-parser}/test/fixtures/react-app/.gitignore
  125. 0 packages/{parser → guess-parser}/test/fixtures/react-app/README.md
  126. 0 packages/{parser → guess-parser}/test/fixtures/react-app/package-lock.json
  127. 0 packages/{parser → guess-parser}/test/fixtures/react-app/package.json
  128. BIN packages/{parser → guess-parser}/test/fixtures/react-app/public/favicon.ico
  129. 0 packages/{parser → guess-parser}/test/fixtures/react-app/public/index.html
  130. 0 packages/{parser → guess-parser}/test/fixtures/react-app/public/manifest.json
  131. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/App.css
  132. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/App.jsx
  133. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/LazyRoute.jsx
  134. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/index.css
  135. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/index.js
  136. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/intro/Intro.jsx
  137. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/logo.svg
  138. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/main/Main.jsx
  139. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/main/kid/Kid.jsx
  140. 0 packages/{parser → guess-parser}/test/fixtures/react-app/src/main/parent/Parent.jsx
  141. 0 packages/{parser → guess-parser}/test/fixtures/react-app/yarn.lock
  142. 0 packages/{parser → guess-parser}/test/fixtures/unknown/package.json
  143. +4 −4 packages/{parser → guess-parser}/test/parser.spec.ts
  144. +3 −3 packages/{parser → guess-parser}/test/preact-jsx.spec.ts
  145. +2 −2 packages/{parser → guess-parser}/test/react-jsx.spec.ts
  146. +2 −2 packages/{parser → guess-parser}/test/react-tsx.spec.ts
  147. 0 packages/{parser → guess-parser}/tsconfig.json
  148. +1 −1 packages/{parser → guess-parser}/webpack.config.js
  149. +6 −0 packages/guess-webpack/.npmignore
  150. 0 packages/{webpack → guess-webpack}/README.md
  151. 0 packages/{webpack → guess-webpack}/index.ts
  152. +53 −1,119 packages/{webpack → guess-webpack}/package-lock.json
  153. +6 −3 packages/{webpack → guess-webpack}/package.json
  154. 0 packages/{webpack → guess-webpack}/src/api.ts
  155. 0 packages/{webpack → guess-webpack}/src/compress.ts
  156. 0 packages/{webpack → guess-webpack}/src/declarations.ts
  157. 0 packages/{webpack → guess-webpack}/src/default-route-provider.ts
  158. 0 packages/{webpack → guess-webpack}/src/ga-provider.ts
  159. 0 packages/{webpack → guess-webpack}/src/guess-webpack.ts
  160. 0 packages/{webpack → guess-webpack}/src/prefetch-plugin.ts
  161. 0 packages/{webpack → guess-webpack}/src/runtime/guess.tpl
  162. 0 packages/{webpack → guess-webpack}/src/runtime/guess.ts
  163. 0 packages/{webpack → guess-webpack}/src/runtime/runtime.tpl
  164. 0 packages/{webpack → guess-webpack}/src/runtime/runtime.ts
  165. 0 packages/{webpack → guess-webpack}/test/e2e/delegate.spec.ts
  166. 0 packages/{webpack → guess-webpack}/test/e2e/prefetch.spec.ts
  167. 0 packages/{webpack → guess-webpack}/test/fixtures/delegate/index.html
  168. 0 packages/{webpack → guess-webpack}/test/fixtures/delegate/index.js
  169. 0 packages/{webpack → guess-webpack}/test/fixtures/delegate/webpack.config.js
  170. 0 packages/{webpack → guess-webpack}/test/fixtures/prefetch/about.js
  171. 0 packages/{webpack → guess-webpack}/test/fixtures/prefetch/contact.js
  172. 0 packages/{webpack → guess-webpack}/test/fixtures/prefetch/home.js
  173. 0 packages/{webpack → guess-webpack}/test/fixtures/prefetch/index.html
  174. 0 packages/{webpack → guess-webpack}/test/fixtures/prefetch/index.js
  175. 0 packages/{webpack → guess-webpack}/test/fixtures/prefetch/webpack.config.js
  176. 0 packages/{webpack → guess-webpack}/test/unit/compress.spec.ts
  177. 0 packages/{webpack → guess-webpack}/test/unit/runtime.spec.ts
  178. 0 packages/{webpack → guess-webpack}/tsconfig.json
  179. 0 packages/{webpack → guess-webpack}/webpack.config.js
@@ -7,4 +7,4 @@ temp
tmp-*
.esm-cache/
dist

lerna-debug.log
@@ -3,7 +3,7 @@ node_js: stable
os: linux
sudo: required

install: npm i
install: npm run bootstrap
script:
- npm run build
- npm run test:ci
@@ -7,10 +7,10 @@ This document explains how to build, test, and publish the packages from the mon
In order to install all the dependencies run:

```bash
npm i
npm run bootstrap
```

This will download all development dependencies for the monorepo and download the dependencies for each individual package.
This will download all development dependencies for the monorepo and download the dependencies for each individual package. It will also call `lerna bootstrap` which will create symlinks for the cross-package dependencies.

## Build

@@ -24,10 +24,10 @@ The command will build all the packages, topologically sorted.

## Publish

To publish the packages, make sure you've updated `config.json` which contains the current project version. After that run:
To publish the packages, run:

```bash
npm run build -- -p
npm run publish
```

Once you confirm the prompt, the `infra/build.ts` will build all the packages and publish them.
The `publish` script will delegate the execution to `lerna publish` which will take care of updating the dependencies' versions and publishing them to npm.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -1,11 +1,5 @@
import { join } from 'path';
import { execSync } from 'child_process';

const Packages = ['ga', 'parser', 'webpack'];
const PackagesDir = join(process.cwd(), 'packages');
for (const p of Packages) {
const path = join(PackagesDir, p);
console.log(execSync(`cd ${path} && npm i`).toString());
}

console.log(execSync(`cd ${join(PackagesDir, 'parser', 'test', 'fixtures', 'angular')} && npm i`).toString());
console.log(execSync(`cd ${join(PackagesDir, 'guess-parser', 'test', 'fixtures', 'angular')} && npm i`).toString());
@@ -3,7 +3,7 @@ import { join } from 'path';
import { execSync } from 'child_process';

const cwd = process.cwd();
const base = join(cwd, 'packages', 'webpack', 'test', 'fixtures');
const base = join(cwd, 'packages', 'guess-webpack', 'test', 'fixtures');

readdirSync(base).forEach(dir => {
if (dir === '.' || dir === '..') {
@@ -8,7 +8,7 @@ const port = 5122;
function setupMockServer() {
return new Promise(resolve => {
const server = new StaticServer({
rootPath: join(process.cwd(), 'packages', 'webpack', 'test', 'fixtures'),
rootPath: join(process.cwd(), 'packages', 'guess-webpack', 'test', 'fixtures'),
port
});

@@ -21,8 +21,8 @@ function setupMockServer() {

async function main() {
await setupMockServer();
const watch = process.argv.filter(a => a === '--watch');
const jest = spawn(`${process.cwd()}/node_modules/.bin/jest`, watch, { stdio: 'inherit' });
const options = process.argv.filter(a => a === '--watch');
const jest = spawn(`${process.cwd()}/node_modules/.bin/jest`, options, { stdio: 'inherit' });
return new Promise<number>(resolve => {
jest.on('exit', code => resolve(code));
jest.on('close', code => resolve(code));
@@ -4,11 +4,10 @@ module.exports = {
},
testRegex: '(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
testPathIgnorePatterns: [
'<rootDir>/packages/detector/test/fixtures',
'<rootDir>/packages/parser/test/fixtures',
'<rootDir>/packages/guess-parser/test/fixtures',
'<rootDir>/infra/test.ts',
'<rootDir>/experiments/guess-static-sites/test',
'<rootDir>/packages/webpack/test/fixtures'
'<rootDir>/packages/guess-webpack/test/fixtures'
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
preset: '<rootDir>/node_modules/jest-puppeteer',
@@ -0,0 +1,5 @@
{
"lerna": "2.11.0",
"packages": ["packages/*"],
"version": "0.1.0"
}
Oops, something went wrong.

0 comments on commit 75313df

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.