Skip to content

Commit 75313df

Browse files
authored
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
1 parent 10c0eac commit 75313df

File tree

179 files changed

+1558
-1771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+1558
-1771
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ temp
77
tmp-*
88
.esm-cache/
99
dist
10-
10+
lerna-debug.log

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ node_js: stable
33
os: linux
44
sudo: required
55

6-
install: npm i
6+
install: npm run bootstrap
77
script:
88
- npm run build
99
- npm run test:ci

DEVELOPING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ This document explains how to build, test, and publish the packages from the mon
77
In order to install all the dependencies run:
88

99
```bash
10-
npm i
10+
npm run bootstrap
1111
```
1212

13-
This will download all development dependencies for the monorepo and download the dependencies for each individual package.
13+
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.
1414

1515
## Build
1616

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

2525
## Publish
2626

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

2929
```bash
30-
npm run build -- -p
30+
npm run publish
3131
```
3232

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

config.json

-4
This file was deleted.

infra/build.ts

-73
This file was deleted.

infra/install.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { join } from 'path';
22
import { execSync } from 'child_process';
33

4-
const Packages = ['ga', 'parser', 'webpack'];
54
const PackagesDir = join(process.cwd(), 'packages');
6-
for (const p of Packages) {
7-
const path = join(PackagesDir, p);
8-
console.log(execSync(`cd ${path} && npm i`).toString());
9-
}
10-
11-
console.log(execSync(`cd ${join(PackagesDir, 'parser', 'test', 'fixtures', 'angular')} && npm i`).toString());
5+
console.log(execSync(`cd ${join(PackagesDir, 'guess-parser', 'test', 'fixtures', 'angular')} && npm i`).toString());

infra/pretest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { join } from 'path';
33
import { execSync } from 'child_process';
44

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

88
readdirSync(base).forEach(dir => {
99
if (dir === '.' || dir === '..') {

infra/test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const port = 5122;
88
function setupMockServer() {
99
return new Promise(resolve => {
1010
const server = new StaticServer({
11-
rootPath: join(process.cwd(), 'packages', 'webpack', 'test', 'fixtures'),
11+
rootPath: join(process.cwd(), 'packages', 'guess-webpack', 'test', 'fixtures'),
1212
port
1313
});
1414

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

2222
async function main() {
2323
await setupMockServer();
24-
const watch = process.argv.filter(a => a === '--watch');
25-
const jest = spawn(`${process.cwd()}/node_modules/.bin/jest`, watch, { stdio: 'inherit' });
24+
const options = process.argv.filter(a => a === '--watch');
25+
const jest = spawn(`${process.cwd()}/node_modules/.bin/jest`, options, { stdio: 'inherit' });
2626
return new Promise<number>(resolve => {
2727
jest.on('exit', code => resolve(code));
2828
jest.on('close', code => resolve(code));

jest.config.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ module.exports = {
44
},
55
testRegex: '(/test/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
66
testPathIgnorePatterns: [
7-
'<rootDir>/packages/detector/test/fixtures',
8-
'<rootDir>/packages/parser/test/fixtures',
7+
'<rootDir>/packages/guess-parser/test/fixtures',
98
'<rootDir>/infra/test.ts',
109
'<rootDir>/experiments/guess-static-sites/test',
11-
'<rootDir>/packages/webpack/test/fixtures'
10+
'<rootDir>/packages/guess-webpack/test/fixtures'
1211
],
1312
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
1413
preset: '<rootDir>/node_modules/jest-puppeteer',

lerna.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"lerna": "2.11.0",
3+
"packages": ["packages/*"],
4+
"version": "0.1.0"
5+
}

0 commit comments

Comments
 (0)