-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v1.0.0' into development
- Loading branch information
Showing
163 changed files
with
30,191 additions
and
4,929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ log.txt | |
*.sublime-project | ||
*.sublime-workspace | ||
|
||
.stencil/ | ||
.idea/ | ||
.vscode/ | ||
.sass-cache/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "pdf.js"] | ||
path = pdf.js | ||
url = https://github.com/TeamHive/pdf.js.git |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,40 @@ | ||
{ | ||
"name": "@teamhive/stencil-pdf-viewer", | ||
"version": "0.2.2", | ||
"description": "Stencil PDF Viewer", | ||
"name": "@teamhive/pdf-viewer", | ||
"version": "1.0.0", | ||
"description": "PDF Viewer Web Component. Built with stencil and pdfjs.", | ||
"homepage": "https://github.com/TeamHive/pdf-viewer", | ||
"repository": { | ||
"type": "git", | ||
"url": "github:TeamHive/pdf-viewer" | ||
}, | ||
"author": "TeamHive", | ||
"module": "dist/esm/index.js", | ||
"main": "dist/index.js", | ||
"unpkg": "dist/ionic.js", | ||
"types": "dist/types/components.d.ts", | ||
"collection": "dist/collection/collection-manifest.json", | ||
"files": [ | ||
"dist/" | ||
], | ||
"scripts": { | ||
"build": "npm run copyPdfWorker && stencil build --prod", | ||
"dev": "npm run copyPdfWorker && sd concurrent \"stencil build --dev --watch\" \"stencil-dev-server\" ", | ||
"serve": "stencil-dev-server", | ||
"start": "npm run dev", | ||
"test": "jest", | ||
"test.watch": "jest --watch", | ||
"copyPdfWorker": "./copy-pdf-worker.sh", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
"dependencies": { | ||
"print-js": "^1.0.47", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.4.0" | ||
"prepare": "npm run pdf.js:build && npm run prepare-assets", | ||
"build": "npm run pdf.js:build && npm run prepare-assets && npm run build:stencil", | ||
"build:stencil": "stencil build && node ./scripts/asset-import.js", | ||
"start": "stencil build --dev --watch --serve", | ||
"prepare-assets": "node ./scripts/prepare-assets.js", | ||
"pdf.js:install": "cd pdf.js && npm install", | ||
"pdf.js:build": "npm run pdf.js:install && npm run pdf.js:dist && npm run pdf.js:pack", | ||
"pdf.js:dist": "cd pdf.js && gulp dist-pre", | ||
"pdf.js:pack": "node ./scripts/package-cleanup.js && cd pdf.js/build/dist && npm pack && cd ../../../ && node ./scripts/package-rename.js && npm i pdf.js/build/dist/pdfjs-dist.tgz --no-save", | ||
"prepublishOnly": "npm run build:stencil" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@stencil/core": "^0.16.0", | ||
"@stencil/dev-server": "latest", | ||
"@stencil/sass": "^0.1.1", | ||
"@stencil/utils": "latest", | ||
"@types/jest": "^22.2.3", | ||
"@types/pdfjs-dist": "^0.1.2", | ||
"jest": "^22.4.3", | ||
"pdfjs-dist": "^2.0.489" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/TeamHive/stencil-pdf-viewer.git" | ||
"@stencil/core": "0.16.1", | ||
"@stencil/sass": "0.1.1", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"webpack": "^4.27.1" | ||
}, | ||
"author": "TeamHive", | ||
"license": "MIT", | ||
"jest": { | ||
"transform": { | ||
"^.+\\.(ts|tsx)$": "<rootDir>/node_modules/@stencil/core/testing/jest.preprocessor.js" | ||
}, | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"json", | ||
"jsx" | ||
] | ||
} | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require('fs'); | ||
const definePaths = [ | ||
'./dist/esm/es5/pdf-viewer.define.js', | ||
'./dist/esm/es2017/pdf-viewer.define.js', | ||
]; | ||
|
||
definePaths.forEach(function (path) { | ||
fs.readFile(path, 'utf8', function (err, data) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
|
||
data = data + "import '../../pdf-viewer/pdfjs-assets';" | ||
|
||
fs.writeFile(path, data, 'utf8', function (err) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
|
||
console.log(`Asset import added to ${path}`) | ||
}) | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const glob = require('glob') | ||
const fs = require('fs') | ||
|
||
const distPath = 'pdf.js/build/dist'; | ||
glob(`${distPath}/*.tgz`, function (err, files) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
|
||
files.forEach(function (file) { | ||
fs.unlink(file, (err) => { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const glob = require('glob') | ||
const fs = require('fs') | ||
|
||
const distPath = 'pdf.js/build/dist'; | ||
glob(`${distPath}/*.tgz`, function (err, files) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
fs.rename(files[0], `${distPath}/pdfjs-dist.tgz`, function (err) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const fs = require('fs'); | ||
|
||
// Copy Worker | ||
const workerPath = 'pdf.js/build/dist/build/pdf.worker.min.js'; | ||
const destPath = 'src/components/pdf-viewer/pdfjs-assets/pdf.worker.min.js'; | ||
fs.readFile(workerPath, 'utf8', function (err, data) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
fs.writeFile(destPath, data, 'utf8', function (err) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
console.log(`Worker copied to ${destPath}`) | ||
}) | ||
}); | ||
|
||
const localeRootPath = 'pdf.js/build/generic/web/locale'; | ||
const destRootPath = 'src/components/pdf-viewer/pdfjs-assets/locale'; | ||
// rewrite locale.properties | ||
fs.readFile(`${localeRootPath}/locale.properties`, 'utf8', function (err, data) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
data = data.replace(/\//g, '.'); | ||
fs.writeFile(`${destRootPath}/locale.properties`, data, 'utf8', function (err) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
console.log(`locale.properties copied to ${destRootPath}`) | ||
}); | ||
}); | ||
|
||
fs.readdir(`${localeRootPath}`, 'utf8', function (err, files) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
files.forEach(file => { | ||
if (file !== 'locale.properties') { | ||
fs.readFile(`${localeRootPath}/${file}/viewer.properties`, 'utf8', function (err, data) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
fs.writeFile(`${destRootPath}/${file}.viewer.properties`, data, 'utf8', function (err) { | ||
if (err) { | ||
return console.error(err); | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
console.log(`viewer.properties copied to ${destRootPath}`) | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.