Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
Andrew Dillon committed May 8, 2019
0 parents commit a34218a
Show file tree
Hide file tree
Showing 11 changed files with 1,342 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,39 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:11.4.0

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: yarn install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# Run tsc, linter, and unit tests
- run: yarn typecheck
- run: yarn lint
- run: yarn test
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
node_modules/
build/
dist/
lib/
es/

tsBuildInfo.json
9 changes: 9 additions & 0 deletions .prettierrc.json
@@ -0,0 +1,9 @@
{
"printWidth": 80,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always"
}
1 change: 1 addition & 0 deletions GUIDELINES.md
@@ -0,0 +1 @@
* Do not use `for .. of` loops.
60 changes: 60 additions & 0 deletions package.json
@@ -0,0 +1,60 @@
{
"name": "pdf-lib",
"version": "1.0.0-beta.1",
"description": "Create and modify PDF files with JavaScript",
"author": "Andrew Dillon <andrew.dillon.j@gmail.com>",
"contributors": [
"jerp (https://github.com/jerp)",
"Greg Bacchus (https://github.com/gregbacchus)",
"Mickael Lecoq (https://github.com/mlecoq)"
],
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "yarn lint:prettier && yarn lint:tslint",
"lint:tslint": "tslint --project tsconfig.json --fix",
"lint:prettier": "prettier --write './src/**/*.{ts,js,json}' --loglevel error",
"build": "yarn build:cjs && yarn build:es && yarn build:umd && yarn build:umd:min",
"build:cjs": "ttsc --module commonjs --outDir lib",
"build:es": "ttsc --module ES2015 --outDir es",
"build:umd": "rollup --config rollup.config.js --file dist/pdf-lib.js",
"build:umd:min": "rollup --config rollup.config.js --file dist/pdf-lib.min.js --environment MINIFY"
},
"types": "lib/index.d.ts",
"main": "lib/index.js",
"module": "es/index.js",
"unpkg": "dist/pdf-lib.min.js",
"dependencies": {
"tslib": "^1.9.3"
},
"devDependencies": {
"prettier": "^1.17.0",
"rollup": "^1.11.3",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-terser": "^4.0.4",
"ts-transformer-imports": "^0.4.2",
"tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0",
"ttypescript": "^1.5.6",
"typescript": "^3.4.5"
},
"license": "MIT",
"private": false,
"repository": "git+https://github.com/Hopding/pdf-lib.git",
"bugs": {
"url": "https://github.com/Hopding/pdf-lib/issues"
},
"keywords": [
"pdf-lib",
"pdf",
"document",
"create",
"modify",
"creation",
"modification",
"edit",
"editing",
"typescript",
"javascript",
"library"
]
}
13 changes: 13 additions & 0 deletions rollup.config.js
@@ -0,0 +1,13 @@
import json from 'rollup-plugin-json';
import { terser } from 'rollup-plugin-terser';

const { MINIFY } = process.env;

export default {
input: 'es/index.js',
output: {
name: 'PDFLib',
format: 'umd',
},
plugins: [json(), MINIFY === 'true' && terser()],
};
3 changes: 3 additions & 0 deletions src/core/index.ts
@@ -0,0 +1,3 @@
export const foo = () => {
console.log('BAR!');
};
3 changes: 3 additions & 0 deletions src/index.ts
@@ -0,0 +1,3 @@
import { foo } from 'src/core/index';

foo();
61 changes: 61 additions & 0 deletions tsconfig.json
@@ -0,0 +1,61 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "es2015" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"allowJs": false /* Allow javascript files to be compiled. */,
"checkJs": false /* Report errors in .js files. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
"sourceMap": true /* Generates corresponding '.map' file. */,
"outDir": "./build" /* Redirect output structure to the directory. */,
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"composite": false /* Enable project compilation */,
"incremental": true /* Enable incremental compilation */,
"tsBuildInfoFile": "./tsBuildInfo.json" /* Specify file to store incremental compilation information */,
"removeComments": false /* Do not emit comments to output. */,
"noEmit": false /* Do not emit outputs. */,
"importHelpers": true /* Import emit helpers from 'tslib'. */,
"downlevelIteration": false /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
"isolatedModules": false /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
"newLine": "LF",

/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,

/* Module Resolution Options */
"baseUrl": "./src" /* Base directory to resolve non-absolute module names. */,
"paths": {
"src/*": ["./*"]
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"preserveSymlinks": true /* Do not resolve the real path of symlinks. */,

/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

/* Plugins */
"plugins": [{ "transform": "ts-transformer-imports" }]
},
"include": ["src/**/*"]
}
28 changes: 28 additions & 0 deletions tslint.json
@@ -0,0 +1,28 @@
{
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": {
"curly": [true, "ignore-same-line"],
"import-blacklist": [true, "lodash"],
"max-line-length": false,
"member-access": [true, "no-public"],
"no-console": false,
"prefer-for-of": false,
"quotemark": [true, "single"],
"semicolon": [true, "always", "ignore-bound-class-methods"],
"trailing-comma": [
true,
{
"esSpecCompliant": true,
"multiline": { "functions": "ignore" }
}
],
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-pascal-case",
"allow-leading-underscore"
]
}
}
}

0 comments on commit a34218a

Please sign in to comment.