-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Abstract aborter into its own library #2373
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
dc5f0d8
Move aborter to its own library
bterlson 2ef4d4d
Make consistent versions for rollup plugins and typescript
bterlson 2ea1034
Tests for aborter
bterlson e2b77ec
Update readme
bterlson 568eeb7
Unify @types/node version to ^8.0.0
jeremymeng 91f3e2d
Add Aborter tests
jeremymeng 5e44428
Enable browser
jeremymeng 81359a4
Fix file paths
jeremymeng 8573582
Run "format" script
jeremymeng 944b2e0
Apply Brandon's pnpm fix
jeremymeng 1bce4c3
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-js in…
jeremymeng 9dbb68c
Fix types file path
jeremymeng c388512
Update file and queue to use the @azure/core-aborter dependency
jeremymeng 757a231
Remove aborter tests in blob/file/queue
jeremymeng 3325839
[Storage-Blob] Rename clients from *URL => *Client (#2874)
jeremymeng 7cad284
[Storage-file] Rename *URL to *Client (#2877)
jeremymeng 4562d8e
Merge remote-tracking branch 'upstream/feature/storage' into feature-…
jeremymeng f59ecdd
[Storage-queue] Rename *URL to *Client (#2911)
jeremymeng 0186e89
Follow up rename: ServiceClient to BlobServiceClient (#2917)
jeremymeng 63b7643
Merge remote-tracking branch 'upstream/feature/storage' into rush_abs…
jeremymeng 24a09a2
Fix errors and warnings
jeremymeng 41ee2f6
Fix merging errors
jeremymeng 738e3d2
Improve package.json
jeremymeng d3c2844
Make npm scripts to follow convention
jeremymeng 2c922b5
Add LICENSE file
jeremymeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "tabWidth": 2, | ||
| "singleQuote": false, | ||
| "arrowParens": "always", | ||
| "printWidth": 100 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "name": "@azure/core-aborter", | ||
| "version": "1.0.0", | ||
| "description": "", | ||
| "main": "./dist/index.js", | ||
| "scripts": { | ||
| "build": "tsc -p . && rollup -c ./rollup.config.js", | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "types": "./typings/Aborter.d.ts", | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@azure/ms-rest-js": "^1.2.6" | ||
| }, | ||
| "devDependencies": { | ||
| "rollup": "^1.0.0", | ||
| "rollup-plugin-commonjs": "^9.2.0", | ||
| "rollup-plugin-json": "^3.1.0", | ||
| "rollup-plugin-multi-entry": "^2.1.0", | ||
| "rollup-plugin-node-resolve": "^4.0.0", | ||
| "rollup-plugin-replace": "^2.1.0", | ||
| "rollup-plugin-sourcemaps": "^0.4.2", | ||
| "rollup-plugin-uglify": "^6.0.0", | ||
| "typescript": "^3.2.2" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import nodeResolve from "rollup-plugin-node-resolve"; | ||
| import multiEntry from "rollup-plugin-multi-entry"; | ||
| import cjs from "rollup-plugin-commonjs"; | ||
| import json from "rollup-plugin-json"; | ||
| import replace from "rollup-plugin-replace"; | ||
| import { uglify } from "rollup-plugin-uglify"; | ||
| import sourcemaps from "rollup-plugin-sourcemaps"; | ||
|
|
||
| import path from "path"; | ||
|
|
||
| const pkg = require("./package.json"); | ||
| const depNames = Object.keys(pkg.dependencies); | ||
| const input = "./dist-esm/Aborter.js"; | ||
| const production = process.env.NODE_ENV === "production"; | ||
|
|
||
| export function nodeConfig(test = false) { | ||
| const externalNodeBuiltins = ["events", "util", "os"]; | ||
| const baseConfig = { | ||
| input: input, | ||
| external: depNames.concat(externalNodeBuiltins), | ||
| output: { file: "dist/index.js", format: "cjs", sourcemap: true }, | ||
| plugins: [ | ||
| sourcemaps(), | ||
| replace({ | ||
| delimiters: ["", ""], | ||
| values: { | ||
| // replace dynamic checks with if (true) since this is for node only. | ||
| // Allows rollup's dead code elimination to be more aggressive. | ||
| "if (isNode)": "if (true)" | ||
| } | ||
| }), | ||
| nodeResolve({ preferBuiltins: true, main: false }), | ||
| cjs(), | ||
| json() | ||
| ] | ||
| }; | ||
|
|
||
| if (test) { | ||
| // entry point is every test file | ||
| baseConfig.input = "dist-esm/test/**/*.spec.js"; | ||
| baseConfig.plugins.unshift(multiEntry({ exports: false })); | ||
|
|
||
| // different output file | ||
| baseConfig.output.file = "test-dist/index.js"; | ||
|
|
||
| // mark assert as external | ||
| baseConfig.external.push( | ||
| "assert", | ||
| "fs", | ||
| "path", | ||
| "@azure/arm-servicebus", | ||
| "@azure/ms-rest-nodeauth" | ||
| ); | ||
|
|
||
| baseConfig.onwarn = (warning) => { | ||
| if (warning.code === "THIS_IS_UNDEFINED") { | ||
| // This error happens frequently due to TypeScript emitting `this` at the | ||
| // top-level of a module. In this case its fine if it gets rewritten to | ||
| // undefined, so ignore this error. | ||
| return; | ||
| } | ||
|
|
||
| if ( | ||
| warning.code === "CIRCULAR_DEPENDENCY" && | ||
| warning.importer.indexOf(path.normalize("node_modules/chai/lib") === 0) | ||
| ) { | ||
| // Chai contains circular references, but they are not fatal and can be ignored. | ||
| return; | ||
| } | ||
|
|
||
| console.error(`(!) ${warning.message}`); | ||
| }; | ||
| } else if (production) { | ||
| baseConfig.plugins.push(uglify()); | ||
| } | ||
|
|
||
| return baseConfig; | ||
| } | ||
|
|
||
| export function browserConfig(test = false) { | ||
| const baseConfig = { | ||
| input: input, | ||
| external: ["ms-rest-js"], | ||
| output: { | ||
| file: "browser/index.js", | ||
| format: "umd", | ||
| name: "Aborter", | ||
| sourcemap: true, | ||
| globals: { "ms-rest-js": "msRest" } | ||
| }, | ||
| plugins: [ | ||
| sourcemaps(), | ||
| replace( | ||
| // ms-rest-js is externalized so users must include it prior to using this bundle. | ||
| { | ||
| delimiters: ["", ""], | ||
| values: { | ||
| // replace dynamic checks with if (false) since this is for | ||
| // browser only. Rollup's dead code elimination will remove | ||
| // any code guarded by if (isNode) { ... } | ||
| "if (isNode)": "if (false)" | ||
| } | ||
| } | ||
| ), | ||
| nodeResolve({ | ||
| preferBuiltins: false, | ||
| browser: true | ||
| }), | ||
| cjs({ | ||
| namedExports: { events: ["EventEmitter"] } | ||
| }), | ||
| json() | ||
| ] | ||
| }; | ||
|
|
||
| if (test) { | ||
| baseConfig.input = "dist-esm/test/**/*.spec.js"; | ||
| baseConfig.plugins.unshift(multiEntry({ exports: false })); | ||
| baseConfig.output.file = "test-browser/index.js"; | ||
| } else if (production) { | ||
| baseConfig.plugins.push(uglify()); | ||
| } | ||
|
|
||
| return baseConfig; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import * as base from "./rollup.base.config"; | ||
|
|
||
| const inputs = []; | ||
|
|
||
| if (!process.env.ONLY_BROWSER) { | ||
| inputs.push(base.nodeConfig()); | ||
| } | ||
|
|
||
| // Disable this until we are ready to run rollup for the browser. | ||
| // if (!process.env.ONLY_NODE) { | ||
| // inputs.push(base.browserConfig()); | ||
| // } | ||
|
|
||
| export default inputs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import * as base from "./rollup.base.config"; | ||
|
|
||
| export default [base.nodeConfig(true)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| { | ||
| "name": "@azure/service-bus", | ||
| "author": "Microsoft Corporation", | ||
| "version": "1.0.0-preview.2", | ||
| "license": "MIT", | ||
| "description": "Azure Service Bus SDK for Node.js", | ||
| "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/servicebus/service-bus", | ||
| "repository": "github:Azure/azure-sdk-for-js", | ||
| "keywords": [ | ||
| "azure", | ||
| "cloud", | ||
| "service bus", | ||
| "AMQP" | ||
| ], | ||
| "bugs": { | ||
| "url": "https://github.com/azure/azure-sdk-for-js/issues" | ||
| }, | ||
| "main": "./dist/index.js", | ||
| "module": "dist-esm/src/index.js", | ||
| "types": "./typings/src/index.d.ts", | ||
| "engine": { | ||
| "node": ">=6.0.0" | ||
| }, | ||
| "dependencies": { | ||
| "@azure/amqp-common": "^1.0.0-preview.2", | ||
| "@azure/ms-rest-nodeauth": "^0.9.2", | ||
| "@types/long": "^4.0.0", | ||
| "debug": "^3.1.0", | ||
| "is-buffer": "^2.0.3", | ||
| "long": "^4.0.0", | ||
| "rhea": "^1.0.4", | ||
| "rhea-promise": "^0.1.15", | ||
| "tslib": "^1.9.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@azure/arm-servicebus": "^0.1.0", | ||
| "@microsoft/api-extractor": "^6.3.0", | ||
| "@types/async-lock": "^1.1.0", | ||
| "@types/chai": "^4.1.6", | ||
| "@types/chai-as-promised": "^7.1.0", | ||
| "@types/debug": "^0.0.31", | ||
| "@types/dotenv": "^6.1.0", | ||
| "@types/mocha": "^5.2.5", | ||
| "@types/node": "^8.0.0", | ||
| "chai": "^4.2.0", | ||
| "chai-as-promised": "^7.1.1", | ||
| "cross-env": "^5.2.0", | ||
| "dotenv": "^7.0.0", | ||
| "mocha": "^5.2.0", | ||
| "mocha-junit-reporter": "^1.18.0", | ||
| "mocha-multi": "^1.0.1", | ||
| "nyc": "^14.0.0", | ||
| "prettier": "^1.16.4", | ||
| "rimraf": "^2.6.2", | ||
| "rollup": "^1.0.0", | ||
| "rollup-plugin-commonjs": "^9.2.0", | ||
| "rollup-plugin-json": "^3.1.0", | ||
| "rollup-plugin-multi-entry": "^2.1.0", | ||
| "rollup-plugin-node-resolve": "^4.0.0", | ||
| "rollup-plugin-replace": "^2.1.0", | ||
| "rollup-plugin-sourcemaps": "^0.4.2", | ||
| "rollup-plugin-uglify": "^6.0.0", | ||
| "ts-node": "^7.0.1", | ||
| "tslint": "^5.15.0", | ||
| "typescript": "^3.2.2" | ||
| }, | ||
| "files": [ | ||
| "LICENSE", | ||
| "changelog.md", | ||
| "Readme.md", | ||
| "dist/", | ||
| "dist-esm/src/", | ||
| "src/", | ||
| "typings/" | ||
| ], | ||
| "scripts": { | ||
| "build-browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1", | ||
| "build-node": "tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1", | ||
| "build-samples": "node .scripts/prepSamples.js && cd samples && tsc -p .", | ||
| "build-test": "tsc -p . && cross-env ONLY_NODE=true rollup -c rollup.test.config.js 2>&1", | ||
| "build": "tsc -p . && rollup -c 2>&1", | ||
| "check-format": "prettier --list-different --config .prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
| "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log", | ||
| "coverage": "npm run build-test && nyc --reporter=lcov mocha -t 120000 test-dist/index.js", | ||
| "extract-api": "tsc -p . && api-extractor run --local", | ||
| "format": "prettier --write --config .prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
| "lint": "tslint -p . -c tslint.json", | ||
| "pack": "npm pack 2>&1", | ||
| "prebuild": "npm run clean", | ||
| "pretest": "npm run build-test", | ||
| "test": "npm run build", | ||
| "tsc": "tsc", | ||
| "unit-node": "npm run build-test && mocha -t 120000 test-dist/index.js" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "compilerOptions": { | ||
| /* Basic Options */ | ||
| "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, | ||
| "module": "es6" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, | ||
| "lib": [] /* lib dependencies are triple-slash directives in lib/index.ts */, | ||
| "declaration": true /* Generates corresponding '.d.ts' file. */, | ||
| "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, | ||
| "sourceMap": true /* Generates corresponding '.map' file. */, | ||
|
|
||
| "outDir": "./dist-esm" /* Redirect output structure to the directory. */, | ||
| "stripInternal": true /* Do not emit declarations for code with @internal annotation*/, | ||
| "declarationDir": "./typings" /* Output directory for generated declaration files.*/, | ||
| "importHelpers": true /* Import emit helpers from 'tslib'. */, | ||
|
|
||
| /* Strict Type-Checking Options */ | ||
| "strict": true /* Enable all strict type-checking options. */, | ||
| "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, | ||
|
|
||
| /* Additional Checks */ | ||
| "noUnusedLocals": true /* Report errors on unused locals. */, | ||
|
|
||
| /* Module Resolution Options */ | ||
| "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, | ||
| "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, | ||
| "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, | ||
|
|
||
| /* Experimental Options */ | ||
| "forceConsistentCasingInFileNames": true, | ||
|
|
||
| /* Other options */ | ||
| "newLine": "LF" /* Use the specified end of line sequence to be used when emitting files: "crlf" (windows) or "lf" (unix).”*/, | ||
| "allowJs": false /* Don't allow JavaScript files to be compiled.*/ | ||
| }, | ||
| "compileOnSave": true, | ||
| "exclude": ["node_modules", "typings/**", "./samples/**/*.ts"], | ||
| "include": ["./src/**/*.ts", "./test/**/*.ts"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is from
npm initand we useMIT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, also need LICENSE file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed