diff --git a/package.json b/package.json index 48e6778e..66cc608c 100644 --- a/package.json +++ b/package.json @@ -21,14 +21,14 @@ "scripts": { "lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'", "prebuild": "rimraf dist", - "build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src", + "build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --entryPoints src/--libraryname--.ts --theme default", "start": "rollup -c rollup.config.ts -w", "test": "jest --coverage", "test:watch": "jest --coverage --watch", "test:prod": "npm run lint && npm run test -- --no-cache", "deploy-docs": "ts-node tools/gh-pages-publish", "report-coverage": "cat ./coverage/lcov.info | coveralls", - "commit": "git-cz", + "commit": "git add -A && git-cz", "semantic-release": "semantic-release", "semantic-release-prepare": "ts-node tools/semantic-release-prepare", "precommit": "lint-staged", @@ -37,8 +37,7 @@ }, "lint-staged": { "{src,test}/**/*.ts": [ - "prettier --write", - "git add" + "prettier --write" ] }, "config": { @@ -83,39 +82,40 @@ ] }, "devDependencies": { - "@commitlint/cli": "^7.1.2", - "@commitlint/config-conventional": "^7.1.2", - "@types/jest": "^23.3.2", - "@types/node": "^10.11.0", + "@commitlint/cli": "^16.2.3", + "@commitlint/config-conventional": "^16.2.1", + "@rollup/plugin-commonjs": "^21.0.3", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "@types/jest": "^27.4.1", + "@types/node": "^17.0.23", "colors": "^1.3.2", - "commitizen": "^3.0.0", + "commitizen": "^4.2.4", "coveralls": "^3.0.2", - "cross-env": "^5.2.0", - "cz-conventional-changelog": "^2.1.0", - "husky": "^1.0.1", - "jest": "^23.6.0", - "jest-config": "^23.6.0", - "lint-staged": "^8.0.0", + "cross-env": "^7.0.3", + "cz-conventional-changelog": "^3.3.0", + "husky": "^7.0.4", + "jest": "^27.5.1", + "jest-config": "^27.5.1", + "lint-staged": "^12.3.7", "lodash.camelcase": "^4.3.0", - "prettier": "^1.14.3", + "prettier": "^2.6.2", "prompt": "^1.0.0", - "replace-in-file": "^3.4.2", - "rimraf": "^2.6.2", - "rollup": "^0.67.0", - "rollup-plugin-commonjs": "^9.1.8", - "rollup-plugin-json": "^3.1.0", - "rollup-plugin-node-resolve": "^3.4.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "rollup-plugin-typescript2": "^0.18.0", - "semantic-release": "^15.9.16", + "replace-in-file": "^6.3.2", + "rimraf": "^3.0.2", + "rollup": "^2.70.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.31.2", + "semantic-release": "^19.0.2", "shelljs": "^0.8.3", "travis-deploy-once": "^5.0.9", - "ts-jest": "^23.10.2", - "ts-node": "^7.0.1", - "tslint": "^5.11.0", + "ts-jest": "^27.1.4", + "ts-node": "^10.7.0", + "tslint": "^6.1.3", "tslint-config-prettier": "^1.15.0", - "tslint-config-standard": "^8.0.1", - "typedoc": "^0.12.0", - "typescript": "^3.0.3" + "tslint-config-standard": "^9.0.0", + "typedoc": "^0.22.13", + "typescript": "^4.6.3" } } diff --git a/rollup.config.ts b/rollup.config.ts index 5b25262a..5f003385 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,9 +1,9 @@ -import resolve from 'rollup-plugin-node-resolve' -import commonjs from 'rollup-plugin-commonjs' +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' import sourceMaps from 'rollup-plugin-sourcemaps' -import camelCase from 'lodash.camelcase' import typescript from 'rollup-plugin-typescript2' -import json from 'rollup-plugin-json' +import json from '@rollup/plugin-json' +import { terser } from 'rollup-plugin-terser' const pkg = require('./package.json') @@ -12,8 +12,16 @@ const libraryName = '--libraryname--' export default { input: `src/${libraryName}.ts`, output: [ - { file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true }, + { file: pkg.main, name: libraryName, format: 'umd', sourcemap: true }, + { + file: `dist/${libraryName}.umd.min.js`, + name: libraryName, + format: 'umd', + sourcemap: true, + plugins: [terser()], + }, { file: pkg.module, format: 'es', sourcemap: true }, + { file: `dist/${libraryName}.es5.min.js`, format: 'es', sourcemap: true, plugins: [terser()] }, ], // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') external: [], diff --git a/tools/init.ts b/tools/init.ts index a8f683af..5d50913c 100644 --- a/tools/init.ts +++ b/tools/init.ts @@ -131,7 +131,7 @@ function libraryNameSuggestedAccept() { /** * The library name is suggested by looking at the directory name of the * tools parent directory and converting it to kebab-case - * + * * The regex for this looks for any non-word or non-digit character, or * an underscore (as it's a word character), and replaces it with a dash. * Any leading or trailing dashes are then removed, before the string is @@ -160,7 +160,7 @@ function libraryNameSuggestedIsDefault() { /** * Calls all of the functions needed to setup the library - * + * * @param libraryName */ function setupLibrary(libraryName: string) { @@ -202,10 +202,10 @@ function removeItems() { /** * Updates the contents of the template files with the library name or user details - * - * @param libraryName - * @param username - * @param usermail + * + * @param libraryName + * @param username + * @param usermail */ function modifyContents(libraryName: string, username: string, usermail: string) { console.log(colors.underline.white("Modified")) @@ -227,8 +227,8 @@ function modifyContents(libraryName: string, username: string, usermail: string) /** * Renames any template files to the new library name - * - * @param libraryName + * + * @param libraryName */ function renameItems(libraryName: string) { console.log(colors.underline.white("Renamed"))