Set up build and linting
parent
293bea2f93
commit
b00532af4c
|
@ -0,0 +1 @@
|
|||
dist
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
extends: ['airbnb-typescript/base'],
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
};
|
|
@ -1 +1,3 @@
|
|||
dev
|
||||
dist
|
||||
node_modules
|
|
@ -0,0 +1,9 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- node
|
||||
- lts/erbium
|
||||
- lts/dubnium
|
||||
cache: yarn
|
||||
|
||||
install: yarn
|
||||
script: yarn test
|
27
package.json
27
package.json
|
@ -10,7 +10,6 @@
|
|||
"url": "https://github.com/NickKaramoff/shareon/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
"author": "Nikita Karamov <nick@karamoff.dev>",
|
||||
"description": "Lightweight, stylish and ethical share buttons for popular social networks",
|
||||
"keywords": [
|
||||
|
@ -18,12 +17,26 @@
|
|||
"sharing",
|
||||
"social networks"
|
||||
],
|
||||
|
||||
"main": "./dist/shareon.js",
|
||||
|
||||
"scripts": {},
|
||||
|
||||
"scripts": {
|
||||
"build": "rollup -c ./rollup/rollup.config.prod.js",
|
||||
"dev": "rollup -w -c ./rollup/rollup.config.dev.js",
|
||||
"pretest": "run-p build",
|
||||
"test:lint": "eslint --ext .js,.ts ./src/",
|
||||
"test": "run-p test:*"
|
||||
},
|
||||
"dependencies": {},
|
||||
|
||||
"devDependencies": {}
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-strip": "^1.3.2",
|
||||
"@rollup/plugin-typescript": "^4.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.24.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-airbnb-typescript": "^7.2.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"np": "^6.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"rollup": "^2.2.0",
|
||||
"rollup-plugin-terser": "^5.3.0",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import rollupPluginStrip from '@rollup/plugin-strip';
|
||||
import { terser as rollupPluginTerser } from 'rollup-plugin-terser';
|
||||
import rollupPluginTypescript from '@rollup/plugin-typescript';
|
||||
|
||||
export const strip = () => rollupPluginStrip({
|
||||
debugger: true,
|
||||
functions: ['console.log', 'console.debug'],
|
||||
sourceMap: false,
|
||||
});
|
||||
|
||||
export const terser = () => rollupPluginTerser({
|
||||
sourcemap: false,
|
||||
output: {
|
||||
comments: false,
|
||||
ecma: 5,
|
||||
},
|
||||
});
|
||||
|
||||
export const typescript = () => rollupPluginTypescript();
|
|
@ -0,0 +1,18 @@
|
|||
import { typescript } from './plugins';
|
||||
|
||||
const input = './src/index.ts';
|
||||
const name = 'shareon';
|
||||
const outputDir = './dev/';
|
||||
|
||||
|
||||
export default {
|
||||
input,
|
||||
output: {
|
||||
name,
|
||||
format: 'iife',
|
||||
file: `${outputDir}${name}.js`,
|
||||
},
|
||||
plugins: [
|
||||
typescript(),
|
||||
],
|
||||
};
|
|
@ -0,0 +1,32 @@
|
|||
import { strip, terser, typescript } from './plugins';
|
||||
|
||||
const input = './src/index.ts';
|
||||
const name = 'shareon';
|
||||
const outputDir = './dist/';
|
||||
|
||||
|
||||
export default {
|
||||
input,
|
||||
output: [
|
||||
{
|
||||
name,
|
||||
format: 'esm',
|
||||
file: `${outputDir}${name}.mjs`,
|
||||
},
|
||||
{
|
||||
name,
|
||||
format: 'cjs',
|
||||
file: `${outputDir}${name}.cjs`,
|
||||
},
|
||||
{
|
||||
name,
|
||||
format: 'iife',
|
||||
file: `${outputDir}${name}.min.js`,
|
||||
plugins: [terser()],
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
typescript(),
|
||||
strip(),
|
||||
],
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"module": "ES2020",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"target": "es5"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue