Skip to content

Commit

Permalink
chore: cleanup import paths and function name mangling (isomorphic-gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
billiegoose authored Feb 21, 2020
1 parent f51e489 commit 6e4f8b1
Show file tree
Hide file tree
Showing 130 changed files with 759 additions and 764 deletions.
15 changes: 14 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
dist
/__tests__/__fixtures__
/docs
/node_modules
/website

# Build artifacts
/__tests__/__examples__
/coverage
/http
/index.js
/internal-apis.js
/index.umd.min.js
/internal-apis.umd.min.js
/junit
74 changes: 31 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
__tests__/__fixtures__/.superblock.txt
__tests__/__fixtures__/index.json
dist
doc
junit
junit.xml
lib

# stuff that gets generated during test setup
/__tests__/__fixtures__/.superblock.txt
/__tests__/__fixtures__/index.json

# Dist
/http
/index.cjs
/index.d.ts
/index.js
/index.umd.min.js
/index.umd.min.js.map
/internal-apis.js
/internal-apis.d.ts
/internal-apis.cjs
/internal-apis.umd.min.js
/internal-apis.umd.min.js.map

# Test run artifacts
/coverage
/junit
/browser-tests.json
/size_report.html
/__tests__/__examples__/**

# PGP misc
openpgp.store/
private.key

src/errors.d.ts

lib/core/metadata.js
lib/core/MetadataBlog.js
website/build/
website/node_modules
website/translated_docs
website/yarn.lock

website/i18n/*
# Website Stuff
/website/build/
/website/node_modules
/website/translated_docs
/website/yarn.lock
/website/i18n/*
!website/i18n/en.json

# Logs
Expand All @@ -34,33 +47,8 @@ pids
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm
Expand Down
130 changes: 61 additions & 69 deletions README.md

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions __tests__/__helpers__/FixtureFS/makeBrowserFS.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const pify = require('pify')

const { FileSystem } = require('isomorphic-git/internal-apis')
const pify = require('pify')

let browserFS = null
let browserFSwritable = null
async function makeBrowserFS (dir) {
async function makeBrowserFS(dir) {
if (browserFS === null) {
const BrowserFS = require('browserfs')
const HTTPRequestFS = pify(BrowserFS.FileSystem.HTTPRequest.Create)
Expand All @@ -13,7 +12,7 @@ async function makeBrowserFS (dir) {
const index = require('../../__fixtures__/index.json')
const readable = await HTTPRequestFS({
index,
baseUrl: '/base/__tests__/__fixtures__/'
baseUrl: '/base/__tests__/__fixtures__/',
})
const writable = await InMemoryFS()
const ofs = await OverlayFS({ readable, writable })
Expand All @@ -34,7 +33,7 @@ async function makeBrowserFS (dir) {
_fs,
fs,
dir,
gitdir
gitdir,
}
}

Expand Down
4 changes: 2 additions & 2 deletions __tests__/__helpers__/FixtureFS/makeLightningFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const { FileSystem } = require('isomorphic-git/internal-apis')
const localhost =
typeof window === 'undefined' ? 'localhost' : window.location.hostname

async function makeLightningFS (dir) {
async function makeLightningFS(dir) {
const FS = require('@isomorphic-git/lightning-fs')
const _fs = new FS(`testfs`, {
wipe: true,
url: `http://${localhost}:9876/base/__tests__/__fixtures__`
url: `http://${localhost}:9876/base/__tests__/__fixtures__`,
})
const fs = new FileSystem(_fs)
dir = `/${dir}`
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__helpers__/FixtureFS/makeNodeFixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ const path = require('path')

const { FileSystem } = require('isomorphic-git/internal-apis')

async function makeNodeFixture (fixture) {
async function makeNodeFixture(fixture) {
const _fs = Object.assign({}, require('fs'))

const fs = new FileSystem(_fs)

const {
getFixturePath,
createTempDir,
copyFixtureIntoTempDir
copyFixtureIntoTempDir,
} = require('jest-fixtures')

const testsDir = path.resolve(__dirname, '..')
Expand Down
17 changes: 5 additions & 12 deletions __tests__/__helpers__/generate-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,14 @@ function gentypedef(ast) {
}

try {
fs.mkdirSync(path.join(__dirname, '..', '..', 'dist', 'examples'))
fs.mkdirSync(path.join(__dirname, '..', '__examples__'))
} catch (_) {}

function writeExample(text, filepath) {
const exampleFilepath = path.join(
__dirname,
'..',
'..',
'dist',
'examples',
filepath
)
text = `const fs = require('fs')
const git = require('isomorphic-git')
const { http } = require('isomorphic-git/http')
const exampleFilepath = path.join(__dirname, '..', '__examples__', filepath)
text = `import * as fs from 'fs'
import git from 'isomorphic-git'
import http from 'isomorphic-git/http'
const { pgp } = require('@isomorphic-git/pgp-plugin')
export {};
Expand Down
11 changes: 4 additions & 7 deletions __tests__/__helpers__/karma-load-successful-browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ module.exports = {
// Append to the existing list of successful browsers
try {
const browsers = JSON.parse(
fs.readFileSync(
path.join(process.cwd(), 'dist', 'browser-tests.json'),
'utf8'
)
fs.readFileSync(path.join(process.cwd(), 'browser-tests.json'), 'utf8')
)
return [browsers, browsers.map(translateBrowser)]
} catch (err) {
Expand All @@ -26,16 +23,16 @@ module.exports = {

if (newbrowsers.length === 0) {
console.log(
'All browsers already passed test suite. Deleting ./dist/browser-tests.json'
'All browsers already passed test suite. Deleting ./browser-tests.json'
)
fs.unlinkSync(path.join(process.cwd(), 'dist', 'browser-tests.json'))
fs.unlinkSync(path.join(process.cwd(), 'browser-tests.json'))
process.exit(0)
}
return newbrowsers
},
save(successfulBrowsersFullNames) {
fs.writeFileSync(
path.join(process.cwd(), 'dist', 'browser-tests.json'),
path.join(process.cwd(), 'browser-tests.json'),
JSON.stringify(successfulBrowsersFullNames, null, 2),
'utf8'
)
Expand Down
24 changes: 0 additions & 24 deletions __tests__/test-GitObjectManager.js

This file was deleted.

Loading

0 comments on commit 6e4f8b1

Please sign in to comment.