Skip to content

Commit

Permalink
Add Lerna (#433)
Browse files Browse the repository at this point in the history
* Add lerna setup

* Move lib into octolinker-core package

* Add missing package.json for blob-reader

* Lernafiy byline-parser package

* Lernafiy grammar-regex  package

* Fix import paths

* Add missing package.json for octolinker-core

* Update build paths

* Remove not longer needed octolinker-core dependencies

* Remove version field from root package.json file

* Move core dep into core package

* Merge root devDependencies

* Make eslint working with mono repo
  • Loading branch information
stefanbuck authored Jan 15, 2018
1 parent befe3c5 commit d81b97c
Show file tree
Hide file tree
Showing 88 changed files with 840 additions and 382 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
packages/**/node_modules
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'no-prototype-builtins': 0,
'import/extensions': 0,
'import/prefer-default-export': 0,
'import/no-extraneous-dependencies': 0,
'no-underscore-dangle': 0,
'no-useless-escape': 0,
'class-methods-use-this': 0,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
npm-debug.log
lerna-debug.log

dist/
out/
11 changes: 11 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.0.0",
"lerna": "2.7.0",
"packages": [
"packages/*"
],
"npmClient": "yarn",
"npmClientArgs": [
"--no-lockfile"
]
}
40 changes: 9 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "OctoLinker",
"version": "4.15.1",
"engines": {
"node": ">=8.0.0"
},
Expand All @@ -9,6 +8,7 @@
"lint": "eslint .",
"pretest": "yarn lint",
"test": "jest",
"postinstall": "yarn lerna bootstrap",
"test:watch": "jest --watch",
"version": "json -I -f assets/manifest.json -e \"this.version='`json -f package.json version`'\" && git add assets/manifest.json",
"package": "yarn build && web-ext build --source-dir dist --artifacts-dir out --overwrite-dest",
Expand All @@ -25,55 +25,33 @@
"./_jestsetup.js"
]
},
"dependencies": {
"JSONPath": "^0.11.2",
"babel-preset-env": "^1.6.1",
"babel-preset-jest": "^22.0.3",
"builtins": "^1.0.3",
"chrome-promise": "^2.1.1",
"concat-map": "^0.0.1",
"css-loader": "^0.28.7",
"escape-regex-string": "^1.0.4",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-react": "^7.4.0",
"findandreplacedomtext": "^0.4.5",
"github-injection": "^1.0.1",
"github-url-from-git": "^1.5.0",
"github-url-from-username-repo": "^1.0.2",
"giturl": "^1.0.0",
"jest": "^22.0.4",
"jquery": "^3.2.1",
"linkstate": "^1.1.0",
"path-parse": "^1.0.5",
"preact": "^8.2.5",
"primer-core": "^6.4.0",
"primer-forms": "^1.4.0",
"querystring": "^0.2.0",
"semver": "^5.4.1",
"semver-regex": "^1.0.0",
"style-loader": "^0.19.0",
"uuid": "^3.1.0",
"xregexp": "^4.0.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-jest": "^22.0.3",
"chrome-launch": "^1.1.4",
"chrome-webstore-upload-cli": "^1.1.1",
"copy-webpack-plugin": "^4.1.0",
"css-loader": "^0.28.7",
"eslint": "^4.8.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-react": "^7.4.0",
"jest": "^22.0.6",
"json": "^9.0.4",
"json-loader": "^0.5.7",
"lerna": "^2.7.0",
"mkdirp": "^0.5.1",
"npm-run-all": "^4.1.1",
"prettier": "^1.7.4",
"sinon": "^4.0.1",
"style-loader": "^0.19.0",
"web-ext": "^2.0.0",
"webpack": "^3.6.0"
},
Expand Down
11 changes: 11 additions & 0 deletions packages/blob-reader/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@octolinker/blob-reader",
"version": "1.0.0",
"description": "This provides a unified interface for GitHubs blob view",
"repository": "https://github.com/octolinker/octolinker/tree/master/packages/blob-reader",
"license": "MIT",
"main": "./index.js",
"dependencies": {
"jquery": "^3.2.1"
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { REQUIRE } from '@octolinker/helper-grammar-regex-collection';
import insertLink from '../insert-link.js';
import { REQUIRE } from '../../packages/helper-grammar-regex-collection';

describe('insert-link', () => {
const DEFAULT_REGEX = /foo ("\w+")/;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable id-length */

import querystring from 'querystring';
import pkg from '../../package.json';
import pkg from '../package.json';

let instance;
const baseUrl = 'https://ssl.google-analytics.com/collect';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/notification.js → packages/core/notification.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { showNotification } from './gh-interface';
import * as storage from './options/storage.js';

const pkgVersion = require('../package.json')
const pkgVersion = require('./package.json')
.version.split('.')
.slice(0, -1)
.join('.');
Expand Down
2 changes: 1 addition & 1 deletion lib/octo-linker.js → packages/core/octo-linker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import injection from 'github-injection';
import BlobReader from '@octolinker/blob-reader';
import notification from './notification';
import BlobReader from '../packages/blob-reader';
import clickHandler from './click-handler';
import Plugins from './plugin-manager.js';
import insertLink from './insert-link';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@octolinker/core",
"version": "4.15.1",
"description": "OctoLinker browser extension core",
"repository": "https://github.com/octolinker/octolinker/tree/master/packages/core",
"license": "MIT",
"main": "./index.js",
"dependencies": {
"JSONPath": "^0.11.2",
"builtins": "^1.0.3",
"chrome-promise": "^2.1.1",
"concat-map": "^0.0.1",
"escape-regex-string": "^1.0.4",
"findandreplacedomtext": "^0.4.5",
"github-injection": "^1.0.1",
"github-url-from-git": "^1.5.0",
"github-url-from-username-repo": "^1.0.2",
"giturl": "^1.0.0",
"jquery": "^3.2.1",
"linkstate": "^1.1.0",
"@octolinker/blob-reader": "1.0.0",
"@octolinker/helper-grammar-regex-collection": "1.0.0",
"path-parse": "^1.0.5",
"preact": "^8.2.5",
"primer-core": "^6.4.0",
"primer-forms": "^1.4.0",
"querystring": "^0.2.0",
"semver": "^5.4.1",
"semver-regex": "^1.0.0",
"uuid": "^3.1.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/plugins/css.js → packages/core/plugins/css.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CSS_IMPORT } from '../../packages/helper-grammar-regex-collection/index.js';
import { CSS_IMPORT } from '@octolinker/helper-grammar-regex-collection';
import relativeFile from '../resolver/relative-file.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/docker.js → packages/core/plugins/docker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DOCKER_FROM } from '../../packages/helper-grammar-regex-collection/index.js';
import { DOCKER_FROM } from '@octolinker/helper-grammar-regex-collection';

export default {
name: 'Docker',
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/plugins/dot-net.js → packages/core/plugins/dot-net.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import nugetResolver from '../resolver/nuget';
import {
NET_PACKAGE,
NET_PROJ_PACKAGE,
} from '../../packages/helper-grammar-regex-collection/index.js';
} from '@octolinker/helper-grammar-regex-collection';
import nugetResolver from '../resolver/nuget';

export default {
name: 'DotNet',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GEM } from '../../packages/helper-grammar-regex-collection/index.js';
import { GEM } from '@octolinker/helper-grammar-regex-collection';
import liveResolverQuery from '../resolver/live-resolver-query.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/go.js → packages/core/plugins/go.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join, dirname } from 'path';
import { go } from '../../packages/helper-grammar-regex-collection/index.js';
import { go } from '@octolinker/helper-grammar-regex-collection';

function goFile({ path, target }) {
const list = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HASKELL_IMPORT } from '../../packages/helper-grammar-regex-collection/index.js';
import { HASKELL_IMPORT } from '@octolinker/helper-grammar-regex-collection';
import githubSearch from '../resolver/github-search.js';

export default {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HOMEBREW } from '../../packages/helper-grammar-regex-collection/index.js';
import { HOMEBREW } from '@octolinker/helper-grammar-regex-collection';
import Ruby from './ruby';
import relativeFile from '../resolver/relative-file.js';

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/html.js → packages/core/plugins/html.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
HTML_IMPORT,
HTML_SCRIPT_IMPORT,
} from '../../packages/helper-grammar-regex-collection/index.js';
} from '@octolinker/helper-grammar-regex-collection';
import relativeFile from '../resolver/relative-file.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/java.js → packages/core/plugins/java.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JAVA_IMPORT } from '../../packages/helper-grammar-regex-collection/index.js';
import { JAVA_IMPORT } from '@octolinker/helper-grammar-regex-collection';
import liveResolverQuery from '../resolver/live-resolver-query.js';

const SUPPORTED_JAVA_VERSIONS = [9, 8, 7];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
REQUIRE,
IMPORT,
EXPORT,
} from '../../packages/helper-grammar-regex-collection/index.js';
} from '@octolinker/helper-grammar-regex-collection';
import builtinsDocs from '../utils/builtins-docs.js';
import liveResolverQuery from '../resolver/live-resolver-query.js';

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/less.js → packages/core/plugins/less.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LESS_IMPORT } from '../../packages/helper-grammar-regex-collection/index.js';
import { LESS_IMPORT } from '@octolinker/helper-grammar-regex-collection';
import relativeFile from '../resolver/relative-file.js';
import githubSearch from '../resolver/github-search.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join, dirname } from 'path';
import {
NODEJS_RELATIVE_PATH,
NODEJS_RELATIVE_PATH_JOIN,
} from '../../packages/helper-grammar-regex-collection/index.js';
} from '@octolinker/helper-grammar-regex-collection';
import JavaScript from './javascript';
import TypeScript from './typescript';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/plugins/python.js → packages/core/plugins/python.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PYTHON_IMPORT } from '../../packages/helper-grammar-regex-collection/index.js';
import { PYTHON_IMPORT } from '@octolinker/helper-grammar-regex-collection';
import liveResolverQuery from '../resolver/live-resolver-query.js';
import relativeFile from '../resolver/relative-file.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { REQUIREMENTS_TXT } from '../../packages/helper-grammar-regex-collection/index.js';
import { REQUIREMENTS_TXT } from '@octolinker/helper-grammar-regex-collection';
import liveResolverQuery from '../resolver/live-resolver-query.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/ruby.js → packages/core/plugins/ruby.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path';
import { REQUIRE } from '../../packages/helper-grammar-regex-collection/index.js';
import { REQUIRE } from '@octolinker/helper-grammar-regex-collection';
import liveResolverQuery from '../resolver/live-resolver-query.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/rust.js → packages/core/plugins/rust.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RUST_CRATE } from '../../packages/helper-grammar-regex-collection/index.js';
import { RUST_CRATE } from '@octolinker/helper-grammar-regex-collection';
import liveResolverQuery from '../resolver/live-resolver-query.js';

export default {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/sass.js → packages/core/plugins/sass.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'path';
import pathParse from 'path-parse';
import { CSS_IMPORT } from '../../packages/helper-grammar-regex-collection/index.js';
import { CSS_IMPORT } from '@octolinker/helper-grammar-regex-collection';
import relativeFile from '../resolver/relative-file.js';
import githubSearch from '../resolver/github-search.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TYPESCRIPT_REFERENCE } from '@octolinker/helper-grammar-regex-collection';
import JavaScript from './javascript';
import { TYPESCRIPT_REFERENCE } from '../../packages/helper-grammar-regex-collection/index.js';

export default {
name: 'TypeScript',
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/vim.js → packages/core/plugins/vim.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ghShorthand from 'github-url-from-username-repo';
import giturl from 'giturl';
import { VIM_PLUGIN } from '../../packages/helper-grammar-regex-collection/index.js';
import { VIM_PLUGIN } from '@octolinker/helper-grammar-regex-collection';

export default {
name: 'Vim',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/helper-grammar-regex-collection/go.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import escapeRegexString from 'escape-regex-string';
import bylineParser from '../byline-parser';
import bylineParser from '@octolinker/helper-parser-byline';

const DOMAIN_REGEX = /^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}/;
const ALLOWED_DOMAINS = [
Expand Down
13 changes: 13 additions & 0 deletions packages/helper-grammar-regex-collection/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@octolinker/helper-grammar-regex-collection",
"version": "1.0.0",
"description": "",
"repository": "https://github.com/octolinker/octolinker/tree/master/packages/helper-grammar-regex-collection",
"license": "MIT",
"main": "./index.js",
"dependencies": {
"escape-regex-string": "^1.0.4",
"@octolinker/helper-parser-byline": "^1.0.0",
"xregexp": "^4.0.0"
}
}
File renamed without changes.
12 changes: 12 additions & 0 deletions packages/helper-parser-byline/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@octolinker/helper-parser-byline",
"version": "1.0.0",
"description": "",
"repository": "https://github.com/octolinker/octolinker/tree/master/packages/helper-parser-byline",
"license": "MIT",
"main": "./index.js",
"dependencies": {
"escape-regex-string": "^1.0.4",
"xregexp": "^4.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const openingPattern = /^start$/;
const closingPattern = /^end$/;
const matchPattern = /(\w+)/;

describe('byline-parser', () => {
describe('byline', () => {
describe('setup', () => {
it('throws an error if openingPattern is not a RegExp', () => {
assert.throws(() => {
Expand Down
6 changes: 3 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); // eslint-disable-line

module.exports = {
entry: {
app: './lib/app',
background: './lib/background/index',
options: './lib/options/page',
app: './packages/core/app',
background: './packages/core/background/index',
options: './packages/core/options/page',
},
devtool: 'source-map',
output: {
Expand Down
Loading

0 comments on commit d81b97c

Please sign in to comment.