Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Rewrite Croppie in TypeScript #603

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
npm-debug.log
node_modules/
bower_components
/nbproject/private/
/nbproject/private/
.vscode/
dist/
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"tabWidth": 2,
"useTabs": false
}
76 changes: 76 additions & 0 deletions build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { rollup } from 'rollup';
const { terser } = require('rollup-plugin-terser');
const typescript = require('rollup-plugin-typescript');

const build = async () => {
const buildEsm2015 = async () => {
const esm2015Bundle = rollup({
input: 'src/index.ts',
plugins: [typescript()]
});
return (await esm2015Bundle).write({
file: 'dist/esm2015/croppie.js',
format: 'esm',
sourcemap: true
});
};

const buildEsm5 = async () => {
const esm5Bundle = rollup({
input: 'src/index.ts',
plugins: [
typescript({
target: 'es5',
declaration: false
})
]
});
return (await esm5Bundle).write({
file: 'dist/esm5/croppie.js',
format: 'esm',
sourcemap: true
});
};

const buildUmd = async () => {
const umdBundle = rollup({
input: 'src/index.ts',
plugins: [
typescript({
target: 'es5'
})
]
});
return (await umdBundle).write({
file: 'dist/bundles/croppie.js',
format: 'umd',
sourcemap: true,
name: 'Croppie'
});
};

const buildUmdMinified = async () => {
const umdMinifiedBundle = rollup({
input: 'src/index.ts',
plugins: [
typescript({
target: 'es5'
}),
terser()
]
});
return (await umdMinifiedBundle).write({
file: 'dist/bundles/croppie.min.js',
format: 'umd',
sourcemap: true,
name: 'Croppie'
});
};

await buildEsm2015();
await buildEsm5();
await buildUmd();
await buildUmdMinified();
};

build().then((_) => console.log('Done'));
Loading