Skip to content

Commit

Permalink
Introduce Lerna for management of the monorepo (#61)
Browse files Browse the repository at this point in the history
* 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 75313df
Show file tree
Hide file tree
Showing 179 changed files with 1,558 additions and 1,771 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ temp
tmp-*
.esm-cache/
dist

lerna-debug.log
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
4 changes: 0 additions & 4 deletions config.json

This file was deleted.

73 changes: 0 additions & 73 deletions infra/build.ts

This file was deleted.

8 changes: 1 addition & 7 deletions infra/install.ts
Original file line number Diff line number Diff line change
@@ -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());
2 changes: 1 addition & 1 deletion infra/pretest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 === '..') {
Expand Down
6 changes: 3 additions & 3 deletions infra/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand All @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 5 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lerna": "2.11.0",
"packages": ["packages/*"],
"version": "0.1.0"
}
Loading

0 comments on commit 75313df

Please sign in to comment.