mirror of
https://github.com/Swetrix/swetrix-js.git
synced 2025-03-15 09:23:24 +00:00
Added build script
This commit is contained in:
26
package.json
26
package.json
@ -2,9 +2,17 @@
|
|||||||
"name": "analytics_script",
|
"name": "analytics_script",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "dist/analytics.cjs.js",
|
||||||
|
"module": "dist/analytics.es5.js",
|
||||||
|
"browser": "dist/analytics.umd.js",
|
||||||
|
"esnext": "dist/esnext/index.js",
|
||||||
|
"typings": "dist/esnext/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"prebuild": "rimraf dist",
|
||||||
|
"prepublish": "npm run build",
|
||||||
|
"build": "rollup -c && tsc -p tsconfig.esnext.json",
|
||||||
|
"start": "rollup -c -w",
|
||||||
|
"tsc": "tsc -p tsconfig.esnext.json"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -17,7 +25,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/Blaumaus/analytics_script#readme",
|
"homepage": "https://github.com/Blaumaus/analytics_script#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^14.14.41",
|
"@types/node": "^14.14.41"
|
||||||
"typescript": "^4.2.4"
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"rollup": "^2.53.0",
|
||||||
|
"rollup-plugin-commonjs": "^10.1.0",
|
||||||
|
"rollup-plugin-json": "^4.0.0",
|
||||||
|
"rollup-plugin-node-resolve": "^5.2.0",
|
||||||
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||||
|
"rollup-plugin-typescript2": "^0.30.0",
|
||||||
|
"rollup-plugin-uglify": "^6.0.4",
|
||||||
|
"typescript": "^4.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
rollup.config.js
Normal file
29
rollup.config.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import resolve from 'rollup-plugin-node-resolve'
|
||||||
|
import commonjs from 'rollup-plugin-commonjs'
|
||||||
|
import sourceMaps from 'rollup-plugin-sourcemaps'
|
||||||
|
import typescript from 'rollup-plugin-typescript2'
|
||||||
|
import { uglify } from 'rollup-plugin-uglify'
|
||||||
|
import pkg from './package.json'
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
input: 'src/index.ts',
|
||||||
|
output: [
|
||||||
|
{ file: pkg.browser, format: 'umd', name: 'analytics' },
|
||||||
|
{ file: pkg.main, format: 'cjs' },
|
||||||
|
{ file: pkg.module, format: 'es' },
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
typescript(), resolve(), commonjs(), sourceMaps(),
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: 'src/index.ts',
|
||||||
|
output: [
|
||||||
|
{ file: 'dist/analytics.umd.min.js', format: 'umd', name: 'analytics' },
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
typescript(), resolve(), commonjs(), uglify(),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
17
tsconfig.esnext.json
Normal file
17
tsconfig.esnext.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"target": "es2020",
|
||||||
|
"module": "es2015",
|
||||||
|
"lib": ["dom"],
|
||||||
|
"strict": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"declaration": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"outDir": "dist/esnext",
|
||||||
|
"typeRoots": ["node_modules/@types"]
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
@ -14,4 +14,4 @@
|
|||||||
"typeRoots": ["node_modules/@types"]
|
"typeRoots": ["node_modules/@types"]
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user