Skip to content

Instantly share code, notes, and snippets.

@JiteBot
Last active January 16, 2020 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiteBot/fe9a847ef01239f86df00f337b8bc63e to your computer and use it in GitHub Desktop.
Save JiteBot/fe9a847ef01239f86df00f337b8bc63e to your computer and use it in GitHub Desktop.
NPM Boilerplate templates.
include:
- https://gitlab.com/jitesoft/gitlab-ci-lib/raw/master/dependency_scanning.yml
- https://gitlab.com/jitesoft/gitlab-ci-lib/raw/master/js_common.yml
-
stages:
- test
- scan
- deploy
test:
extends: .npm:test
scan:
extends: .scan:npm
deploy:
extends: .npm:build:deploy
{
"name": "my-package",
"description": "Just another npm package.",
"main": "dist/index.js",
"module": "src/index.js",
"keywords": [],
"author": "",
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {},
"devDependencies": {
"@babel/core": "^7",
"@jitesoft/babel-preset-main": "^2",
"@jitesoft/eslint-config": "^1",
"babel-eslint": "^10",
"babel-jest": "^24",
"babel-loader": "^8",
"core-js": "^3",
"cross-env": "^6",
"eslint": "^6",
"jest": "^24",
"webpack": "^4",
"webpack-cli": "^3"
},
"scripts": {
"test": "eslint src && jest && npm audit",
"build:prod": "cross-env NODE_ENV=production webpack -p",
"build:dev": "cross-env NODE_ENV=develop webpack"
}
}
const Path = require('path');
const packageName = require('./package').name;
module.exports = {
mode: 'production',
target: 'web',
entry: {
'index': [
Path.join(__dirname, 'src', 'index.js')
]
},
output: {
filename: '[name].js',
libraryTarget: 'umd',
library: packageName,
globalObject: "typeof self !== 'undefined' ? self : this"
},
optimization: {
minimize: true
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
loader: 'babel-loader'
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment