Skip to content

Commit a34218a

Browse files
author
Andrew Dillon
committedMay 8, 2019
Initial commit
0 parents  commit a34218a

11 files changed

+1342
-0
lines changed
 

‎.circleci/config.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Javascript Node CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/node:11.4.0
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/mongo:3.4.4
16+
17+
working_directory: ~/repo
18+
19+
steps:
20+
- checkout
21+
22+
# Download and cache dependencies
23+
- restore_cache:
24+
keys:
25+
- v1-dependencies-{{ checksum "package.json" }}
26+
# fallback to using the latest cache if no exact match is found
27+
- v1-dependencies-
28+
29+
- run: yarn install
30+
31+
- save_cache:
32+
paths:
33+
- node_modules
34+
key: v1-dependencies-{{ checksum "package.json" }}
35+
36+
# Run tsc, linter, and unit tests
37+
- run: yarn typecheck
38+
- run: yarn lint
39+
- run: yarn test

‎.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
build/
3+
dist/
4+
lib/
5+
es/
6+
7+
tsBuildInfo.json

‎.prettierrc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"trailingComma": "all",
7+
"bracketSpacing": true,
8+
"arrowParens": "always"
9+
}

‎GUIDELINES.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Do not use `for .. of` loops.

‎package.json

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "pdf-lib",
3+
"version": "1.0.0-beta.1",
4+
"description": "Create and modify PDF files with JavaScript",
5+
"author": "Andrew Dillon <andrew.dillon.j@gmail.com>",
6+
"contributors": [
7+
"jerp (https://github.com/jerp)",
8+
"Greg Bacchus (https://github.com/gregbacchus)",
9+
"Mickael Lecoq (https://github.com/mlecoq)"
10+
],
11+
"scripts": {
12+
"typecheck": "tsc --noEmit",
13+
"lint": "yarn lint:prettier && yarn lint:tslint",
14+
"lint:tslint": "tslint --project tsconfig.json --fix",
15+
"lint:prettier": "prettier --write './src/**/*.{ts,js,json}' --loglevel error",
16+
"build": "yarn build:cjs && yarn build:es && yarn build:umd && yarn build:umd:min",
17+
"build:cjs": "ttsc --module commonjs --outDir lib",
18+
"build:es": "ttsc --module ES2015 --outDir es",
19+
"build:umd": "rollup --config rollup.config.js --file dist/pdf-lib.js",
20+
"build:umd:min": "rollup --config rollup.config.js --file dist/pdf-lib.min.js --environment MINIFY"
21+
},
22+
"types": "lib/index.d.ts",
23+
"main": "lib/index.js",
24+
"module": "es/index.js",
25+
"unpkg": "dist/pdf-lib.min.js",
26+
"dependencies": {
27+
"tslib": "^1.9.3"
28+
},
29+
"devDependencies": {
30+
"prettier": "^1.17.0",
31+
"rollup": "^1.11.3",
32+
"rollup-plugin-json": "^4.0.0",
33+
"rollup-plugin-terser": "^4.0.4",
34+
"ts-transformer-imports": "^0.4.2",
35+
"tslint": "^5.16.0",
36+
"tslint-config-prettier": "^1.18.0",
37+
"ttypescript": "^1.5.6",
38+
"typescript": "^3.4.5"
39+
},
40+
"license": "MIT",
41+
"private": false,
42+
"repository": "git+https://github.com/Hopding/pdf-lib.git",
43+
"bugs": {
44+
"url": "https://github.com/Hopding/pdf-lib/issues"
45+
},
46+
"keywords": [
47+
"pdf-lib",
48+
"pdf",
49+
"document",
50+
"create",
51+
"modify",
52+
"creation",
53+
"modification",
54+
"edit",
55+
"editing",
56+
"typescript",
57+
"javascript",
58+
"library"
59+
]
60+
}

‎rollup.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import json from 'rollup-plugin-json';
2+
import { terser } from 'rollup-plugin-terser';
3+
4+
const { MINIFY } = process.env;
5+
6+
export default {
7+
input: 'es/index.js',
8+
output: {
9+
name: 'PDFLib',
10+
format: 'umd',
11+
},
12+
plugins: [json(), MINIFY === 'true' && terser()],
13+
};

‎src/core/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const foo = () => {
2+
console.log('BAR!');
3+
};

‎src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { foo } from 'src/core/index';
2+
3+
foo();

‎tsconfig.json

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"compilerOptions": {
3+
/* Basic Options */
4+
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
5+
"module": "es2015" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
6+
"allowJs": false /* Allow javascript files to be compiled. */,
7+
"checkJs": false /* Report errors in .js files. */,
8+
"declaration": true /* Generates corresponding '.d.ts' file. */,
9+
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
10+
"sourceMap": true /* Generates corresponding '.map' file. */,
11+
"outDir": "./build" /* Redirect output structure to the directory. */,
12+
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
13+
"composite": false /* Enable project compilation */,
14+
"incremental": true /* Enable incremental compilation */,
15+
"tsBuildInfoFile": "./tsBuildInfo.json" /* Specify file to store incremental compilation information */,
16+
"removeComments": false /* Do not emit comments to output. */,
17+
"noEmit": false /* Do not emit outputs. */,
18+
"importHelpers": true /* Import emit helpers from 'tslib'. */,
19+
"downlevelIteration": false /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
20+
"isolatedModules": false /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
21+
"newLine": "LF",
22+
23+
/* Strict Type-Checking Options */
24+
"strict": true /* Enable all strict type-checking options. */,
25+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
26+
// "strictNullChecks": true, /* Enable strict null checks. */
27+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
28+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
29+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
30+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
31+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
32+
33+
/* Additional Checks */
34+
"noUnusedLocals": true /* Report errors on unused locals. */,
35+
"noUnusedParameters": true /* Report errors on unused parameters. */,
36+
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
37+
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
38+
39+
/* Module Resolution Options */
40+
"baseUrl": "./src" /* Base directory to resolve non-absolute module names. */,
41+
"paths": {
42+
"src/*": ["./*"]
43+
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
44+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
45+
// "typeRoots": [], /* List of folders to include type definitions from. */
46+
// "types": [], /* Type declaration files to be included in compilation. */
47+
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
48+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
49+
"preserveSymlinks": true /* Do not resolve the real path of symlinks. */,
50+
51+
/* Source Map Options */
52+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
53+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
54+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
55+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
56+
57+
/* Plugins */
58+
"plugins": [{ "transform": "ts-transformer-imports" }]
59+
},
60+
"include": ["src/**/*"]
61+
}

‎tslint.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"extends": ["tslint:recommended", "tslint-config-prettier"],
3+
"rules": {
4+
"curly": [true, "ignore-same-line"],
5+
"import-blacklist": [true, "lodash"],
6+
"max-line-length": false,
7+
"member-access": [true, "no-public"],
8+
"no-console": false,
9+
"prefer-for-of": false,
10+
"quotemark": [true, "single"],
11+
"semicolon": [true, "always", "ignore-bound-class-methods"],
12+
"trailing-comma": [
13+
true,
14+
{
15+
"esSpecCompliant": true,
16+
"multiline": { "functions": "ignore" }
17+
}
18+
],
19+
"variable-name": {
20+
"options": [
21+
"ban-keywords",
22+
"check-format",
23+
"allow-pascal-case",
24+
"allow-leading-underscore"
25+
]
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)