diff --git a/.gitignore b/.gitignore index c30d36c..9883f5c 100644 --- a/.gitignore +++ b/.gitignore @@ -58,8 +58,14 @@ jspm_packages/ *.user .ntvs_analysis.dat obj/* -typings/ -dist/ -output/ -typedoc +# Typescript output +dist/ +*.d.ts +*.d.ts.map +*.js +*.js.map + +# Rollup +!rollup.config.js +*stats.html diff --git a/.npmignore b/.npmignore deleted file mode 100644 index b326766..0000000 --- a/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -.vscode/ -node_modules/ -samples/ -test/ -.travis.yml -gulpfile.js -.gitignore -dist/test -*.ts diff --git a/package.json b/package.json index 059cd69..262c87d 100644 --- a/package.json +++ b/package.json @@ -21,21 +21,32 @@ "environment", "endpoint" ], - "main": "./dist/lib/azureEnvironment.js", - "types": "./typings/lib/azureEnvironment.d.ts", + "main": "./dist/msRestAzureEnv.js", + "module": "./es/lib/azureEnvironment.js", + "types": "./es/lib/azureEnvironment.d.ts", + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "es/lib/**/*.js", + "es/lib/**/*.js.map", + "es/lib/**/*.d.ts", + "es/lib/**/*.d.ts.map", + "lib/**/*.ts", + "LICENSE", + "README.md" + ], "license": "MIT", "devDependencies": { "@types/mocha": "^2.2.40", "@types/should": "^8.1.30", - "@types/webpack": "^4.1.3", "mocha": "^5.2.0", + "npm-run-all": "^4.1.3", + "rollup": "^0.66.4", "should": "5.2.0", "ts-loader": "^4.5.0", "ts-node": "^7.0.1", "tslint": "^5.11.0", - "typescript": "^3.0.1", - "webpack": "^4.17.1", - "webpack-cli": "^3.1.0" + "typescript": "^3.1.1" }, "homepage": "https://github.com/Azure/ms-rest-azure-env", "repository": { @@ -46,11 +57,14 @@ "url": "http://github.com/Azure/ms-rest-azure-env/issues" }, "scripts": { - "tsc": "tsc -p tsconfig.json", - "test": "npm -s run-script tslint && npm -s run-script unit", - "unit": "mocha -t 50000 dist/test", - "build": "npm -s run-script tsc && webpack", - "tslint": "tslint -p . -c tslint.json --exclude test/**/*.ts", + "build": "run-s build:tsc build:rollup build:minify", + "build:tsc": "tsc -p tsconfig.es.json", + "build:rollup": "rollup -c rollup.config.js", + "build:minify": "uglifyjs -c -m --comments --source-map \"content='./dist/msRestAzureEnv.js.map'\" -o ./dist/msRestAzureEnv.min.js ./dist/msRestAzureEnv.js", + "test": "run-p test:tslint test:unit", + "test:tslint": "tslint -p . -c tslint.json --exclude test/**/*.ts", + "test:unit": "mocha dist/test", "prepare": "npm run build" - } + }, + "sideEffects": false } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..ac452b1 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,22 @@ +const banner = `/** @license ms-rest-azure-env + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + */`; + +/** + * @type {import('rollup').RollupFileOptions} + */ +const config = { + input: './es/lib/azureEnvironment.js', + external: [], + output: { + file: "./dist/msRestAzureEnv.js", + format: "umd", + name: "Azure", + sourcemap: true, + banner + }, + plugins: [] +} + +export default config; diff --git a/tsconfig.es.json b/tsconfig.es.json new file mode 100644 index 0000000..6535594 --- /dev/null +++ b/tsconfig.es.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "module": "es6", + "outDir": "es" + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 9201fff..036c045 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "preserveConstEnums": true, "sourceMap": true, "newLine": "LF", - "target": "es2015", + "target": "es5", "moduleResolution": "node", "noImplicitReturns": true, "noImplicitThis": true, @@ -14,7 +14,7 @@ "noUnusedParameters": true, "outDir": "dist", "declaration": true, - "declarationDir": "typings", + "declarationMap": true, "allowJs": false, "strict": true, "strictNullChecks": true, diff --git a/webpack.config.ts b/webpack.config.ts deleted file mode 100644 index c8561a0..0000000 --- a/webpack.config.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as webpack from 'webpack'; - -const config: webpack.Configuration = { - mode: "production", - entry: './lib/azureEnvironment.ts', - devtool: 'source-map', - output: { - filename: 'azureEnvironmentBundle.js', - path: __dirname, - libraryTarget: 'var', - library: 'azureEnvironment' - }, - module: { - rules: [ - { - test: /\.tsx?$/, - loader: 'ts-loader', - exclude: /(node_modules|test)/ - } - ] - }, - resolve: { - extensions: [".tsx", ".ts", ".js"] - }, - node: { - fs: false, - net: false, - path: false, - dns: false, - tls: false, - tty: false, - v8: false, - Buffer: false, - process: false, - stream: false - } -}; - -export = config; \ No newline at end of file