Skip to content

Commit

Permalink
fix: add $ to mangle regex and init improvements (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
osdevisnot authored Dec 24, 2019
1 parent 7465019 commit 2e9cc51
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"semantic-release": "15.14.0",
"servor": "3.0.5",
"sort-package-json": "1.31.0",
"terser": "4.4.3"
"terser": "4.4.3",
"typescript": "3.7.4"
}
}
6 changes: 5 additions & 1 deletion src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ const writePackage = async (template, { user, email }) => {
if (template !== 'js') {
pkg = merge(pkg, { klap: { example: `public/index.${template}` } });
if (template === 'ts' || template === 'tsx') {
pkg = merge(pkg, { types: 'dist/types' });
pkg = merge(pkg, {
types: 'dist/types',
scripts: { postbuild: 'tsc -p tsconfig.json' },
devDependencies: { typescript: cli.devDependencies['typescript'] },
});
}
}
await write('./package.json', JSON.stringify(sort(pkg), null, ' '));
Expand Down
2 changes: 1 addition & 1 deletion src/packages/terser.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const terser = (options = {}) => {
sourceMap: options.sourcemap,
warnings: options.warnings,
toplevel: true,
mangle: { properties: { regex: '^_' } },
mangle: { properties: { regex: '^_|^\\$' } },
compress: { passes: 10, pure_getters: true },
});
} catch (err) {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6534,6 +6534,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

[email protected]:
version "3.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19"
integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==

uglify-js@^3.1.4:
version "3.7.1"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.1.tgz#35c7de17971a4aa7689cd2eae0a5b39bb838c0c5"
Expand Down

0 comments on commit 2e9cc51

Please sign in to comment.