delectusnon 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.prettierignore +2 -0
- package/.travis.yml +33 -0
- package/.vscode/launch.json +24 -0
- package/.vscode/settings.json +3 -0
- package/demos/ago-node-cli/README.md +29 -0
- package/demos/ago-node-cli/ago.js +32 -0
- package/demos/ago-node-cli/index.js +11 -0
- package/demos/ago-node-cli/lib/item-export-command.js +48 -0
- package/demos/ago-node-cli/lib/item-search-command.js +35 -0
- package/demos/ago-node-cli/package-lock.json +172 -0
- package/demos/ago-node-cli/package.json +30 -0
- package/demos/attachments/README.md +5 -0
- package/demos/attachments/index.html +164 -0
- package/demos/attachments/package-lock.json +182 -0
- package/demos/attachments/package.json +18 -0
- package/demos/batch-geocoder-node/NYC_Restaurant_Inspection_Results.csv +100 -0
- package/demos/batch-geocoder-node/README.md +15 -0
- package/demos/batch-geocoder-node/batch-geocode.js +118 -0
- package/demos/batch-geocoder-node/config-template.js +18 -0
- package/demos/batch-geocoder-node/package-lock.json +116 -0
- package/demos/batch-geocoder-node/package.json +39 -0
- package/demos/express/README.md +10 -0
- package/demos/express/config.json.template +3 -0
- package/demos/express/package-lock.json +473 -0
- package/demos/express/package.json +18 -0
- package/demos/express/server.js +28 -0
- package/demos/feature-service-browser/README.md +6 -0
- package/demos/feature-service-browser/index.html +122 -0
- package/demos/feature-service-browser/package-lock.json +182 -0
- package/demos/feature-service-browser/package.json +18 -0
- package/demos/geocoder-browser/README.md +10 -0
- package/demos/geocoder-browser/config.js.template +1 -0
- package/demos/geocoder-browser/index.html +131 -0
- package/demos/geocoder-browser/package-lock.json +182 -0
- package/demos/geocoder-browser/package.json +19 -0
- package/demos/geocoder-browser/post-sign-in.html +25 -0
- package/demos/jsapi-integration/README.md +8 -0
- package/demos/jsapi-integration/config.js +6 -0
- package/demos/jsapi-integration/index.html +79 -0
- package/demos/jsapi-integration/package-lock.json +184 -0
- package/demos/jsapi-integration/package.json +19 -0
- package/demos/oauth2-browser/README.md +12 -0
- package/demos/oauth2-browser/authenticate.html +32 -0
- package/demos/oauth2-browser/config.js.template +6 -0
- package/demos/oauth2-browser/index.html +202 -0
- package/demos/oauth2-browser/logo.svg +4 -0
- package/demos/oauth2-browser/package-lock.json +163 -0
- package/demos/oauth2-browser/package.json +18 -0
- package/demos/oauth2-browser/style.css +36 -0
- package/demos/oauth2-browser-retry/README.md +25 -0
- package/demos/oauth2-browser-retry/authenticate.html +21 -0
- package/demos/oauth2-browser-retry/index.html +116 -0
- package/demos/oauth2-browser-retry/logo.svg +4 -0
- package/demos/vue/.env.example +11 -0
- package/demos/vue/.eslintrc.js +17 -0
- package/demos/vue/.postcssrc.js +5 -0
- package/demos/vue/README.md +17 -0
- package/demos/vue/babel.config.js +3 -0
- package/demos/vue/package-lock.json +11323 -0
- package/demos/vue/package.json +33 -0
- package/demos/vue/public/favicon.ico +0 -0
- package/demos/vue/public/index.html +24 -0
- package/demos/vue/src/assets/logo.svg +29 -0
- package/demos/vue/src/components/App.vue +308 -0
- package/demos/vue/src/components/Authenticate.vue +65 -0
- package/demos/vue/src/components/Loader.vue +230 -0
- package/demos/vue/src/main.js +92 -0
- package/docs/FAQ.md +28 -0
- package/docs/HISTORY.md +62 -0
- package/docs/acetate.config.js +223 -0
- package/docs/build-typedoc.js +301 -0
- package/docs/src/_layout.html +82 -0
- package/docs/src/api/_declaration.html +496 -0
- package/docs/src/api/_layout.html +127 -0
- package/docs/src/api/_package.html +13 -0
- package/docs/src/api/index.html +23 -0
- package/docs/src/guides/_layout.html +24 -0
- package/docs/src/guides/amd-requirejs-dojo.md +40 -0
- package/docs/src/guides/babel-and-rollup.md +30 -0
- package/docs/src/guides/babel-and-webpack.md +30 -0
- package/docs/src/guides/browser-authentication.md +31 -0
- package/docs/src/guides/browserify.md +9 -0
- package/docs/src/guides/cli-authentication.md +9 -0
- package/docs/src/guides/client-server-authentication.md +9 -0
- package/docs/src/guides/from-a-cdn.md +36 -0
- package/docs/src/guides/index.md +52 -0
- package/docs/src/guides/node.md +70 -0
- package/docs/src/guides/package-overview.md +8 -0
- package/docs/src/guides/server-authentication.md +9 -0
- package/docs/src/guides/typescript-and-webpack.md +9 -0
- package/docs/src/img/icons.png +0 -0
- package/docs/src/img/icons@2x.png +0 -0
- package/docs/src/index.html +12 -0
- package/docs/src/js/api-search.js +112 -0
- package/docs/src/js/nav-toggle.js +41 -0
- package/docs/src/sass/_highlight.scss +96 -0
- package/docs/src/sass/_icons.scss +157 -0
- package/docs/src/sass/style.scss +169 -0
- package/jasmine.json +7 -0
- package/karma.conf.js +100 -0
- package/lerna.json +8 -0
- package/notes/README.md +88 -0
- package/package.json +88 -0
- package/packages/arcgis-rest-auth/README.md +64 -0
- package/packages/arcgis-rest-auth/package-lock.json +11 -0
- package/packages/arcgis-rest-auth/package.json +51 -0
- package/packages/arcgis-rest-auth/src/ApplicationSession.ts +109 -0
- package/packages/arcgis-rest-auth/src/UserSession.ts +873 -0
- package/packages/arcgis-rest-auth/src/authenticated-request-options.ts +24 -0
- package/packages/arcgis-rest-auth/src/fetch-token.ts +52 -0
- package/packages/arcgis-rest-auth/src/generate-token.ts +39 -0
- package/packages/arcgis-rest-auth/src/index.ts +8 -0
- package/packages/arcgis-rest-auth/test/ApplicationSession.test.ts +124 -0
- package/packages/arcgis-rest-auth/test/UserSession.test.ts +995 -0
- package/packages/arcgis-rest-auth/test/fetchToken.test.ts +112 -0
- package/packages/arcgis-rest-auth/test/generateToken.test.ts +130 -0
- package/packages/arcgis-rest-auth/test/utils.ts +14 -0
- package/packages/arcgis-rest-auth/tsconfig.json +6 -0
- package/packages/arcgis-rest-common-types/README.md +61 -0
- package/packages/arcgis-rest-common-types/package.json +38 -0
- package/packages/arcgis-rest-common-types/src/group.ts +54 -0
- package/packages/arcgis-rest-common-types/src/index.ts +467 -0
- package/packages/arcgis-rest-common-types/src/item.ts +45 -0
- package/packages/arcgis-rest-common-types/src/webmap.ts +1232 -0
- package/packages/arcgis-rest-common-types/tsconfig.json +11 -0
- package/packages/arcgis-rest-feature-service/README.md +70 -0
- package/packages/arcgis-rest-feature-service/package-lock.json +11 -0
- package/packages/arcgis-rest-feature-service/package.json +50 -0
- package/packages/arcgis-rest-feature-service/src/add.ts +81 -0
- package/packages/arcgis-rest-feature-service/src/addAttachment.ts +65 -0
- package/packages/arcgis-rest-feature-service/src/delete.ts +85 -0
- package/packages/arcgis-rest-feature-service/src/deleteAttachments.ts +68 -0
- package/packages/arcgis-rest-feature-service/src/getAttachments.ts +64 -0
- package/packages/arcgis-rest-feature-service/src/helpers.ts +80 -0
- package/packages/arcgis-rest-feature-service/src/index.ts +12 -0
- package/packages/arcgis-rest-feature-service/src/query.ts +172 -0
- package/packages/arcgis-rest-feature-service/src/queryRelated.ts +91 -0
- package/packages/arcgis-rest-feature-service/src/update.ts +81 -0
- package/packages/arcgis-rest-feature-service/src/updateAttachment.ts +74 -0
- package/packages/arcgis-rest-feature-service/test/attachments.test.ts +203 -0
- package/packages/arcgis-rest-feature-service/test/features.test.ts +252 -0
- package/packages/arcgis-rest-feature-service/test/mocks/feature.ts +279 -0
- package/packages/arcgis-rest-feature-service/test/mocks/foo.txt +1 -0
- package/packages/arcgis-rest-feature-service/tsconfig.json +6 -0
- package/packages/arcgis-rest-feature-service-admin/README.md +66 -0
- package/packages/arcgis-rest-feature-service-admin/package-lock.json +11 -0
- package/packages/arcgis-rest-feature-service-admin/package.json +53 -0
- package/packages/arcgis-rest-feature-service-admin/src/addTo.ts +70 -0
- package/packages/arcgis-rest-feature-service-admin/src/create.ts +195 -0
- package/packages/arcgis-rest-feature-service-admin/src/index.ts +2 -0
- package/packages/arcgis-rest-feature-service-admin/test/addTo.test.ts +310 -0
- package/packages/arcgis-rest-feature-service-admin/test/create.test.ts +412 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/move.ts +14 -0
- package/packages/arcgis-rest-feature-service-admin/test/mocks/service.ts +72 -0
- package/packages/arcgis-rest-feature-service-admin/tsconfig.json +6 -0
- package/packages/arcgis-rest-geocoder/README.md +79 -0
- package/packages/arcgis-rest-geocoder/package-lock.json +11 -0
- package/packages/arcgis-rest-geocoder/package.json +52 -0
- package/packages/arcgis-rest-geocoder/src/bulk.ts +102 -0
- package/packages/arcgis-rest-geocoder/src/geocode.ts +117 -0
- package/packages/arcgis-rest-geocoder/src/helpers.ts +79 -0
- package/packages/arcgis-rest-geocoder/src/index.ts +8 -0
- package/packages/arcgis-rest-geocoder/src/reverse.ts +84 -0
- package/packages/arcgis-rest-geocoder/src/suggest.ts +72 -0
- package/packages/arcgis-rest-geocoder/test/bulk.test.ts +113 -0
- package/packages/arcgis-rest-geocoder/test/geocode.test.ts +121 -0
- package/packages/arcgis-rest-geocoder/test/helpers.test.ts +113 -0
- package/packages/arcgis-rest-geocoder/test/mocks/responses.ts +591 -0
- package/packages/arcgis-rest-geocoder/test/reverse.test.ts +126 -0
- package/packages/arcgis-rest-geocoder/test/suggest.test.ts +77 -0
- package/packages/arcgis-rest-geocoder/tsconfig.json +6 -0
- package/packages/arcgis-rest-groups/README.md +64 -0
- package/packages/arcgis-rest-groups/package-lock.json +11 -0
- package/packages/arcgis-rest-groups/package.json +52 -0
- package/packages/arcgis-rest-groups/src/create.ts +34 -0
- package/packages/arcgis-rest-groups/src/get.ts +95 -0
- package/packages/arcgis-rest-groups/src/helpers.ts +26 -0
- package/packages/arcgis-rest-groups/src/index.ts +11 -0
- package/packages/arcgis-rest-groups/src/notification.ts +77 -0
- package/packages/arcgis-rest-groups/src/protect.ts +40 -0
- package/packages/arcgis-rest-groups/src/remove.ts +23 -0
- package/packages/arcgis-rest-groups/src/search.ts +64 -0
- package/packages/arcgis-rest-groups/src/update.ts +36 -0
- package/packages/arcgis-rest-groups/test/crud.test.ts +104 -0
- package/packages/arcgis-rest-groups/test/get.test.ts +101 -0
- package/packages/arcgis-rest-groups/test/mocks/responses.ts +141 -0
- package/packages/arcgis-rest-groups/test/notification.test.ts +102 -0
- package/packages/arcgis-rest-groups/test/protect.test.ts +64 -0
- package/packages/arcgis-rest-groups/test/search.test.ts +85 -0
- package/packages/arcgis-rest-groups/tsconfig.json +6 -0
- package/packages/arcgis-rest-items/README.md +66 -0
- package/packages/arcgis-rest-items/package-lock.json +11 -0
- package/packages/arcgis-rest-items/package.json +52 -0
- package/packages/arcgis-rest-items/src/add.ts +103 -0
- package/packages/arcgis-rest-items/src/create.ts +110 -0
- package/packages/arcgis-rest-items/src/get.ts +79 -0
- package/packages/arcgis-rest-items/src/helpers.ts +147 -0
- package/packages/arcgis-rest-items/src/index.ts +11 -0
- package/packages/arcgis-rest-items/src/protect.ts +38 -0
- package/packages/arcgis-rest-items/src/remove.ts +58 -0
- package/packages/arcgis-rest-items/src/search.ts +78 -0
- package/packages/arcgis-rest-items/src/update.ts +134 -0
- package/packages/arcgis-rest-items/test/add.test.ts +256 -0
- package/packages/arcgis-rest-items/test/create.test.ts +371 -0
- package/packages/arcgis-rest-items/test/get.test.ts +181 -0
- package/packages/arcgis-rest-items/test/mocks/foo.zip +0 -0
- package/packages/arcgis-rest-items/test/mocks/item.ts +33 -0
- package/packages/arcgis-rest-items/test/mocks/resources.ts +31 -0
- package/packages/arcgis-rest-items/test/mocks/search.ts +63 -0
- package/packages/arcgis-rest-items/test/protect.test.ts +122 -0
- package/packages/arcgis-rest-items/test/remove.test.ts +161 -0
- package/packages/arcgis-rest-items/test/search.test.ts +159 -0
- package/packages/arcgis-rest-items/test/update.test.ts +450 -0
- package/packages/arcgis-rest-items/tsconfig.json +6 -0
- package/packages/arcgis-rest-request/README.md +65 -0
- package/packages/arcgis-rest-request/package-lock.json +11 -0
- package/packages/arcgis-rest-request/package.json +42 -0
- package/packages/arcgis-rest-request/src/index.ts +13 -0
- package/packages/arcgis-rest-request/src/request.ts +293 -0
- package/packages/arcgis-rest-request/src/utils/ArcGISAuthError.ts +67 -0
- package/packages/arcgis-rest-request/src/utils/ArcGISRequestError.ts +76 -0
- package/packages/arcgis-rest-request/src/utils/ErrorTypes.ts +29 -0
- package/packages/arcgis-rest-request/src/utils/check-for-errors.ts +65 -0
- package/packages/arcgis-rest-request/src/utils/encode-form-data.ts +34 -0
- package/packages/arcgis-rest-request/src/utils/encode-query-string.ts +23 -0
- package/packages/arcgis-rest-request/src/utils/get-portal-url.ts +25 -0
- package/packages/arcgis-rest-request/src/utils/get-portal.ts +45 -0
- package/packages/arcgis-rest-request/src/utils/process-params.ts +99 -0
- package/packages/arcgis-rest-request/test/mocks/errors.ts +68 -0
- package/packages/arcgis-rest-request/test/mocks/geojson-feature-collection.ts +13 -0
- package/packages/arcgis-rest-request/test/mocks/portal.ts +112 -0
- package/packages/arcgis-rest-request/test/mocks/sharing-rest-info.ts +41 -0
- package/packages/arcgis-rest-request/test/mocks/webmap.ts +41 -0
- package/packages/arcgis-rest-request/test/request.test.ts +299 -0
- package/packages/arcgis-rest-request/test/utils/ArcGISAuthError.test.ts +170 -0
- package/packages/arcgis-rest-request/test/utils/ArcGISRequestError.test.ts +51 -0
- package/packages/arcgis-rest-request/test/utils/check-for-errors.test.ts +111 -0
- package/packages/arcgis-rest-request/test/utils/encode-form-data.test.ts +133 -0
- package/packages/arcgis-rest-request/test/utils/get-portal-url.test.ts +37 -0
- package/packages/arcgis-rest-request/test/utils/portal.test.ts +97 -0
- package/packages/arcgis-rest-request/test/utils/process-params.test.ts +193 -0
- package/packages/arcgis-rest-request/tsconfig.json +6 -0
- package/packages/arcgis-rest-sharing/README.md +67 -0
- package/packages/arcgis-rest-sharing/package-lock.json +11 -0
- package/packages/arcgis-rest-sharing/package.json +57 -0
- package/packages/arcgis-rest-sharing/src/access.ts +85 -0
- package/packages/arcgis-rest-sharing/src/group-sharing.ts +211 -0
- package/packages/arcgis-rest-sharing/src/helpers.ts +82 -0
- package/packages/arcgis-rest-sharing/src/index.ts +5 -0
- package/packages/arcgis-rest-sharing/test/access.test.ts +154 -0
- package/packages/arcgis-rest-sharing/test/group-sharing.test.ts +566 -0
- package/packages/arcgis-rest-sharing/test/helpers.test.ts +55 -0
- package/packages/arcgis-rest-sharing/test/mocks/sharing.ts +18 -0
- package/packages/arcgis-rest-sharing/tsconfig.json +6 -0
- package/packages/arcgis-rest-users/README.md +71 -0
- package/packages/arcgis-rest-users/package-lock.json +11 -0
- package/packages/arcgis-rest-users/package.json +51 -0
- package/packages/arcgis-rest-users/src/get.ts +69 -0
- package/packages/arcgis-rest-users/src/index.ts +6 -0
- package/packages/arcgis-rest-users/src/invitation.ts +166 -0
- package/packages/arcgis-rest-users/src/notification.ts +73 -0
- package/packages/arcgis-rest-users/test/get.test.ts +99 -0
- package/packages/arcgis-rest-users/test/invitation.test.ts +169 -0
- package/packages/arcgis-rest-users/test/mocks/invitation.ts +70 -0
- package/packages/arcgis-rest-users/test/mocks/notification.ts +34 -0
- package/packages/arcgis-rest-users/test/mocks/user.ts +173 -0
- package/packages/arcgis-rest-users/test/notification.test.ts +83 -0
- package/packages/arcgis-rest-users/tsconfig.json +6 -0
- package/support/changelog.js +394 -0
- package/support/deploy-doc-site.js +16 -0
- package/support/publish.sh +43 -0
- package/support/test-helpers.js +8 -0
- package/tsconfig.json +69 -0
- package/tslint.json +15 -0
- package/umd-base-profile.js +82 -0
- package/umd-production-profile.js +13 -0
@@ -0,0 +1,394 @@
|
|
1
|
+
const { spawn, exec, execSync } = require("child_process");
|
2
|
+
const { inspect } = require("util");
|
3
|
+
const { resolve } = require("path");
|
4
|
+
const { writeFile } = require("fs");
|
5
|
+
const { stripIndents } = require("common-tags");
|
6
|
+
const { format } = require("date-fns");
|
7
|
+
const parseChangelog = require("changelog-parser");
|
8
|
+
const parseCommit = require("conventional-commits-parser").sync;
|
9
|
+
const nunjucks = require("nunjucks");
|
10
|
+
const _ = require("lodash");
|
11
|
+
|
12
|
+
/**
|
13
|
+
* The purpose of this file is to parse all commits since the last release tag
|
14
|
+
* v*.*.* and update the contents of CHANGELOG.md to prepare for a new release.
|
15
|
+
*/
|
16
|
+
|
17
|
+
const repo = "https://github.com/Esri/arcgis-rest-js";
|
18
|
+
|
19
|
+
function getTags() {
|
20
|
+
return new Promise((resolve, reject) => {
|
21
|
+
let tags = [];
|
22
|
+
const log = spawn("git", ["tag", "-l", "v*", "--sort", "v:refname"]);
|
23
|
+
|
24
|
+
log.stdout.on("data", data => {
|
25
|
+
tags = tags.concat(data.toString().split("\n"));
|
26
|
+
});
|
27
|
+
|
28
|
+
log.on("close", code => {
|
29
|
+
resolve(_.compact(tags));
|
30
|
+
});
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
function getFirstCommit() {
|
35
|
+
return new Promise((resolve, reject) => {
|
36
|
+
let commits = [];
|
37
|
+
const log = spawn("git", [
|
38
|
+
"rev-list",
|
39
|
+
"--max-parents=0",
|
40
|
+
"HEAD",
|
41
|
+
"--reverse"
|
42
|
+
]);
|
43
|
+
|
44
|
+
log.stdout.on("data", data => {
|
45
|
+
commits = commits.concat(data.toString().split("\n"));
|
46
|
+
});
|
47
|
+
|
48
|
+
log.on("close", code => {
|
49
|
+
resolve(commits[0]);
|
50
|
+
});
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
function getCommitData(from, to) {
|
55
|
+
return new Promise((resolve, reject) => {
|
56
|
+
const hash = "%H";
|
57
|
+
const shortHash = "%h";
|
58
|
+
const authorName = "%an";
|
59
|
+
const authorEmail = "%ae";
|
60
|
+
const date = "%aI";
|
61
|
+
const subject = "%s";
|
62
|
+
const defaultFormat = {
|
63
|
+
hash,
|
64
|
+
shortHash,
|
65
|
+
date,
|
66
|
+
subject,
|
67
|
+
author: { name: authorName, email: authorEmail }
|
68
|
+
};
|
69
|
+
|
70
|
+
const cmd = `git log ${from}..${to} --pretty=format:'${JSON.stringify(
|
71
|
+
defaultFormat
|
72
|
+
)},'`;
|
73
|
+
|
74
|
+
exec(cmd, (err, stdout, stderr) => {
|
75
|
+
if (err) return reject(err);
|
76
|
+
if (stderr) return reject(stderr);
|
77
|
+
/*
|
78
|
+
order commits from most recent to least recent
|
79
|
+
|
80
|
+
graveyard
|
81
|
+
.replace(/"returns"/g, "returns")
|
82
|
+
.replace(/\\/g, "\\\\")
|
83
|
+
*/
|
84
|
+
const commits = JSON.parse("[" + stdout.slice(0, -1).replace(/"access"/g, "'access'") + "]").reverse();
|
85
|
+
const today = new Date();
|
86
|
+
resolve({
|
87
|
+
previousVersion: /v\d\.\d\.\d/.test(from)
|
88
|
+
? from.replace("v", "")
|
89
|
+
: from,
|
90
|
+
version: to === "HEAD" ? getPackageVersion() : to.replace("v", ""),
|
91
|
+
date: format(today, "MMMM Do YYYY"),
|
92
|
+
commits
|
93
|
+
});
|
94
|
+
});
|
95
|
+
});
|
96
|
+
}
|
97
|
+
|
98
|
+
function getPackageVersion() {
|
99
|
+
return require(resolve(process.cwd(), "./lerna.json")).version;
|
100
|
+
}
|
101
|
+
|
102
|
+
function pairReleases(releases) {
|
103
|
+
return Promise.all(
|
104
|
+
releases.reduce((pairs, release, idx, allReleases) => {
|
105
|
+
const nextRelease = allReleases[idx + 1];
|
106
|
+
if (nextRelease) {
|
107
|
+
pairs.push([release, nextRelease]);
|
108
|
+
}
|
109
|
+
|
110
|
+
return pairs;
|
111
|
+
}, [])
|
112
|
+
);
|
113
|
+
}
|
114
|
+
|
115
|
+
function processCommitMessages(releaseData) {
|
116
|
+
return releaseData.map(release => {
|
117
|
+
release.commits = _(release.commits)
|
118
|
+
.map(commit => {
|
119
|
+
const parsedCommit = parseCommit(
|
120
|
+
execSync(
|
121
|
+
`git log ${commit.hash} -n1 --pretty=format:'%B'`
|
122
|
+
).toString(),
|
123
|
+
{
|
124
|
+
mergePattern: /^Merge pull request #(\d+) from (.*)$/,
|
125
|
+
mergeCorrespondence: ["id", "source"],
|
126
|
+
noteKeywords: [
|
127
|
+
"BREAKING CHANGE",
|
128
|
+
"ISSUES CLOSED",
|
129
|
+
"AFFECTS PACKAGES"
|
130
|
+
]
|
131
|
+
}
|
132
|
+
);
|
133
|
+
|
134
|
+
if (!parsedCommit.type || !parsedCommit.scope) {
|
135
|
+
return;
|
136
|
+
}
|
137
|
+
|
138
|
+
Object.assign(commit, parsedCommit);
|
139
|
+
|
140
|
+
const breaking = commit.notes.findIndex(
|
141
|
+
n => n.title === "BREAKING CHANGE"
|
142
|
+
);
|
143
|
+
|
144
|
+
if (breaking >= 0) {
|
145
|
+
commit.breakingChanges = commit.notes[breaking].text;
|
146
|
+
}
|
147
|
+
|
148
|
+
const issues = commit.notes.findIndex(n => n.title === "ISSUES CLOSED");
|
149
|
+
|
150
|
+
if (issues >= 0) {
|
151
|
+
const issuesClosed = commit.notes[issues].text
|
152
|
+
.replace(/\n.*/gm, "")
|
153
|
+
.replace(/\s/g, "")
|
154
|
+
.split(",")
|
155
|
+
.map(i => i.replace("#", ""));
|
156
|
+
|
157
|
+
const issuesReferenced = commit.references.map(r => r.issue);
|
158
|
+
|
159
|
+
commit.relatedIssues = _.uniq(
|
160
|
+
issuesClosed.concat(issuesReferenced)
|
161
|
+
).map(i => {
|
162
|
+
return {
|
163
|
+
issue: i,
|
164
|
+
url: `${repo}/issues/${i}`
|
165
|
+
};
|
166
|
+
});
|
167
|
+
}
|
168
|
+
return commit;
|
169
|
+
})
|
170
|
+
.compact()
|
171
|
+
.sortBy("type")
|
172
|
+
.value();
|
173
|
+
|
174
|
+
return release;
|
175
|
+
});
|
176
|
+
}
|
177
|
+
|
178
|
+
function getPackagesForCommit(commit) {
|
179
|
+
const idx = commit.notes.findIndex(note => note.title === "AFFECTS PACKAGES");
|
180
|
+
if (idx >= 0) {
|
181
|
+
const affectedPackages = commit.notes[idx].text.split("\n");
|
182
|
+
return affectedPackages;
|
183
|
+
}
|
184
|
+
return ["Other Changes"];
|
185
|
+
}
|
186
|
+
|
187
|
+
function findReleasedPackages(releases) {
|
188
|
+
return releases.map(release => {
|
189
|
+
release.packages = release.commits.reduce((packages, commit) => {
|
190
|
+
packages = packages.concat(getPackagesForCommit(commit));
|
191
|
+
return _(packages).compact().uniq().sortBy(p => p).value();
|
192
|
+
}, []);
|
193
|
+
return release;
|
194
|
+
});
|
195
|
+
}
|
196
|
+
|
197
|
+
function hasBreakingChanges(commit) {
|
198
|
+
return commit.notes.find(n => n.title === "BREAKING CHANGE");
|
199
|
+
}
|
200
|
+
|
201
|
+
function groupCommitsByPackage(releases) {
|
202
|
+
return releases.map(release => {
|
203
|
+
release.groups = release.packages.reduce((groups, package) => {
|
204
|
+
const commitsForPackage = release.commits.filter(commit => {
|
205
|
+
return getPackagesForCommit(commit).some(
|
206
|
+
commitPackage => commitPackage === package
|
207
|
+
);
|
208
|
+
});
|
209
|
+
|
210
|
+
const [breaking, nonBreaking] = _.partition(
|
211
|
+
commitsForPackage,
|
212
|
+
hasBreakingChanges
|
213
|
+
);
|
214
|
+
|
215
|
+
if (breaking.length === 0) {
|
216
|
+
groups[package] = Object.assign(
|
217
|
+
{},
|
218
|
+
_.groupBy(_.sortBy(nonBreaking, "type"), "type")
|
219
|
+
);
|
220
|
+
} else {
|
221
|
+
groups[package] = Object.assign(
|
222
|
+
{ breaking },
|
223
|
+
_.groupBy(nonBreaking, "type")
|
224
|
+
);
|
225
|
+
}
|
226
|
+
|
227
|
+
return groups;
|
228
|
+
}, {});
|
229
|
+
delete release.commits;
|
230
|
+
return release;
|
231
|
+
});
|
232
|
+
}
|
233
|
+
|
234
|
+
function getTypeName(type) {
|
235
|
+
switch (type) {
|
236
|
+
case "feat":
|
237
|
+
return "New Features";
|
238
|
+
case "fix":
|
239
|
+
return "Bug Fixes";
|
240
|
+
case "docs":
|
241
|
+
return "Documentation";
|
242
|
+
case "style":
|
243
|
+
return "Code Style";
|
244
|
+
case "Refactor":
|
245
|
+
return "Refactoring";
|
246
|
+
case "perf":
|
247
|
+
return "Performance";
|
248
|
+
case "test":
|
249
|
+
return "Tests";
|
250
|
+
case "chore":
|
251
|
+
return "Chores";
|
252
|
+
case "revert":
|
253
|
+
return "Reverts";
|
254
|
+
case "breaking":
|
255
|
+
return "Breaking Changes";
|
256
|
+
case "WIP":
|
257
|
+
return "Work In Progress";
|
258
|
+
default:
|
259
|
+
return "Misc.";
|
260
|
+
}
|
261
|
+
}
|
262
|
+
|
263
|
+
const template = stripIndents`
|
264
|
+
{%- macro link(repo, shortHash, hash) -%}
|
265
|
+
[\`{{ shortHash }}\`]({{repo}}/commit/{{ hash }})
|
266
|
+
{%- endmacro %}
|
267
|
+
|
268
|
+
{%- macro relatedIssues(issues) -%}
|
269
|
+
{%- for i in issues -%}
|
270
|
+
{{" "}}[#{{i.issue}}]({{i.url}})
|
271
|
+
{%- endfor -%}
|
272
|
+
{%- endmacro %}
|
273
|
+
|
274
|
+
{%- for release in releases %}
|
275
|
+
## [{{ release.version }}] - {{ release.date }}
|
276
|
+
{% for package, groups in release.groups %}
|
277
|
+
### {{ package }}
|
278
|
+
|
279
|
+
{% for type, commits in groups -%}
|
280
|
+
* {{ getTypeName(type) }}
|
281
|
+
{% for c in commits -%}
|
282
|
+
{{" "}}* **{{ c.scope }}**: {{ c.subject }} {{link(repo, c.shortHash, c.hash)}}{{relatedIssues(c.relatedIssues)}}
|
283
|
+
{% endfor %}
|
284
|
+
{%- endfor %}
|
285
|
+
{%- endfor %}
|
286
|
+
{%- endfor %}
|
287
|
+
`;
|
288
|
+
|
289
|
+
function buildMarkdown(releases) {
|
290
|
+
return nunjucks.renderString(template, { releases, getTypeName, repo });
|
291
|
+
}
|
292
|
+
|
293
|
+
logStep = v => {
|
294
|
+
console.log(inspect(v, { depth: 7 }));
|
295
|
+
return v;
|
296
|
+
};
|
297
|
+
|
298
|
+
const changeLogTemplate = stripIndents`
|
299
|
+
# {{title}}
|
300
|
+
|
301
|
+
{{description}}
|
302
|
+
{{newVersion}}
|
303
|
+
|
304
|
+
{%- for version in oldVersions %}
|
305
|
+
## {{version.title}}
|
306
|
+
|
307
|
+
{{version.body}}
|
308
|
+
{% endfor %}
|
309
|
+
{% for link in links -%}
|
310
|
+
[{{link.ref}}]: {{link.href}} "{{link.title}}"
|
311
|
+
{% endfor -%}
|
312
|
+
`;
|
313
|
+
|
314
|
+
function getReleases() {
|
315
|
+
return Promise.all([
|
316
|
+
getTags(),
|
317
|
+
getFirstCommit()
|
318
|
+
]).then(([releases, firstCommit]) => {
|
319
|
+
if (releases.length === 0) {
|
320
|
+
return [];
|
321
|
+
}
|
322
|
+
|
323
|
+
releases.unshift(firstCommit);
|
324
|
+
releases.push("HEAD");
|
325
|
+
return releases;
|
326
|
+
});
|
327
|
+
}
|
328
|
+
|
329
|
+
function getChangelogData() {
|
330
|
+
return new Promise((resolve, reject) => {
|
331
|
+
parseChangelog("CHANGELOG.md", function(error, changelog) {
|
332
|
+
if (error) {
|
333
|
+
reject(error);
|
334
|
+
return;
|
335
|
+
}
|
336
|
+
|
337
|
+
resolve(changelog);
|
338
|
+
});
|
339
|
+
});
|
340
|
+
}
|
341
|
+
|
342
|
+
function filterReleases(releases) {
|
343
|
+
return releases.slice(-2);
|
344
|
+
}
|
345
|
+
|
346
|
+
getReleases()
|
347
|
+
.then(releases => filterReleases(releases))
|
348
|
+
.then(releases => pairReleases(releases))
|
349
|
+
.then(pairs =>
|
350
|
+
Promise.all(pairs.map(([from, to]) => getCommitData(from, to)))
|
351
|
+
)
|
352
|
+
.then(releaseData => processCommitMessages(releaseData))
|
353
|
+
.then(releaseData => findReleasedPackages(releaseData))
|
354
|
+
.then(releaseData => groupCommitsByPackage(releaseData))
|
355
|
+
.then(releaseData => buildMarkdown(releaseData))
|
356
|
+
.then(newVersion => {
|
357
|
+
return Promise.all([
|
358
|
+
getReleases().then(pairReleases),
|
359
|
+
getChangelogData(),
|
360
|
+
Promise.resolve(newVersion)
|
361
|
+
]);
|
362
|
+
})
|
363
|
+
.then(([pairs, changelog, newVersion]) => {
|
364
|
+
const links = pairs.map(([from, to]) => {
|
365
|
+
to = to === "HEAD" ? "v" + getPackageVersion() : to;
|
366
|
+
return {
|
367
|
+
ref: to.replace("v", ""),
|
368
|
+
title: to,
|
369
|
+
href: `${repo}/compare/${from}...${to}`
|
370
|
+
};
|
371
|
+
});
|
372
|
+
|
373
|
+
if (links.length) {
|
374
|
+
links.push({
|
375
|
+
ref: "HEAD",
|
376
|
+
title: "Unreleased Changes",
|
377
|
+
href: `${repo}/compare/${_.last(links).title}...HEAD`
|
378
|
+
});
|
379
|
+
}
|
380
|
+
|
381
|
+
const rendered = nunjucks.renderString(changeLogTemplate, {
|
382
|
+
title: changelog.title,
|
383
|
+
description: changelog.description,
|
384
|
+
oldVersions: changelog.versions,
|
385
|
+
newVersion: newVersion,
|
386
|
+
links,
|
387
|
+
repo
|
388
|
+
});
|
389
|
+
|
390
|
+
writeFile("CHANGELOG.md", rendered, function(e) {});
|
391
|
+
})
|
392
|
+
.catch(error => {
|
393
|
+
console.error(error.stack);
|
394
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
const ghpages = require("gh-pages");
|
2
|
+
|
3
|
+
ghpages.publish(
|
4
|
+
"docs/build",
|
5
|
+
{
|
6
|
+
branch: "gh-pages",
|
7
|
+
repo: "https://github.com/Esri/arcgis-rest-js.git"
|
8
|
+
},
|
9
|
+
function(err) {
|
10
|
+
if (err) {
|
11
|
+
console.log("uh oh", err);
|
12
|
+
} else {
|
13
|
+
console.log("Deployed docs site!");
|
14
|
+
}
|
15
|
+
}
|
16
|
+
);
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Make sure user is logged in to npm
|
4
|
+
npm whoami || exit 1
|
5
|
+
|
6
|
+
# Extract the version from lerna.json (this was updated by `npm run release:prepare`)
|
7
|
+
VERSION=$(node --eval "console.log(require('./lerna.json').version);")
|
8
|
+
|
9
|
+
# commit the changes from `npm run release:prepare`
|
10
|
+
git add --all
|
11
|
+
git commit -am "v$VERSION" --no-verify
|
12
|
+
|
13
|
+
# increment the package.json version to the lerna version so gh-release works
|
14
|
+
npm version $VERSION --allow-same-version --no-git-tag-version
|
15
|
+
|
16
|
+
# amend the changes from `npm version` to the release commit
|
17
|
+
git add --all
|
18
|
+
git commit -am "v$VERSION" --no-verify --amend
|
19
|
+
|
20
|
+
# tag this version
|
21
|
+
git tag v$VERSION
|
22
|
+
|
23
|
+
# push everything up to this point to master
|
24
|
+
git push https://github.com/Esri/arcgis-rest-js.git master
|
25
|
+
|
26
|
+
# push the new tag, not the old tags
|
27
|
+
git push https://github.com/Esri/arcgis-rest-js.git v$VERSION
|
28
|
+
|
29
|
+
# publish each package on npm
|
30
|
+
lerna publish --skip-git --yes --repo-version $VERSION --force-publish=*
|
31
|
+
|
32
|
+
# create a ZIP archive of the dist files
|
33
|
+
TEMP_FOLDER=arcgis-rest-js-v$VERSION;
|
34
|
+
mkdir $TEMP_FOLDER
|
35
|
+
cp packages/*/dist/umd/* $TEMP_FOLDER
|
36
|
+
zip -r $TEMP_FOLDER.zip $TEMP_FOLDER
|
37
|
+
rm -rf $TEMP_FOLDER
|
38
|
+
|
39
|
+
# Run gh-release to create a new release with our changelog changes and ZIP archive
|
40
|
+
gh-release --t v$VERSION --repo arcgis-rest-js --owner Esri -a $TEMP_FOLDER.zip
|
41
|
+
|
42
|
+
# Delete the ZIP archive
|
43
|
+
rm $TEMP_FOLDER.zip
|
package/tsconfig.json
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
/* Basic Options */
|
4
|
+
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
|
5
|
+
"module": "es2015", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
6
|
+
"lib": [
|
7
|
+
"dom",
|
8
|
+
"es2015"
|
9
|
+
], /* Specify library files to be included in the compilation: */
|
10
|
+
// "allowJs": true, /* Allow javascript files to be compiled. */
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
12
|
+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
13
|
+
"declaration": false, /* Generates corresponding '.d.ts' file. */
|
14
|
+
"sourceMap": true, /* Generates corresponding '.map' file. */
|
15
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
16
|
+
// "outDir": "./", /* Redirect output structure to the directory. */
|
17
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
18
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
19
|
+
// "noEmit": true, /* Do not emit outputs. */
|
20
|
+
"importHelpers": true, /* Import emit helpers from 'tslib'. */
|
21
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
22
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
23
|
+
|
24
|
+
/* Strict Type-Checking Options */
|
25
|
+
"strict": true, /* Enable all strict type-checking options. */
|
26
|
+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
27
|
+
"strictNullChecks": false, /* Enable strict null checks. */
|
28
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
29
|
+
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
30
|
+
|
31
|
+
/* Additional Checks */
|
32
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
33
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
34
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
35
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
36
|
+
|
37
|
+
/* Module Resolution Options */
|
38
|
+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
39
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
40
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
41
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
42
|
+
"typeRoots": [
|
43
|
+
"./node_modules/@types"
|
44
|
+
], /* List of folders to include type definitions from. */
|
45
|
+
"types": [
|
46
|
+
"node",
|
47
|
+
"jasmine"
|
48
|
+
] /* Type declaration files to be included in compilation. */
|
49
|
+
// "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
50
|
+
|
51
|
+
/* Source Map Options */
|
52
|
+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
53
|
+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
54
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
55
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
56
|
+
|
57
|
+
/* Experimental Options */
|
58
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
59
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
60
|
+
},
|
61
|
+
"exclude": [
|
62
|
+
"node_modules"
|
63
|
+
],
|
64
|
+
"include": [
|
65
|
+
"./node_modules/@types",
|
66
|
+
"packages",
|
67
|
+
"support"
|
68
|
+
]
|
69
|
+
}
|
package/tslint.json
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"extends": [
|
3
|
+
"tslint:recommended",
|
4
|
+
"tslint-config-standard",
|
5
|
+
"tslint-config-prettier"
|
6
|
+
],
|
7
|
+
"rules": {
|
8
|
+
"strict-type-predicates": false,
|
9
|
+
"ordered-imports": ["any"],
|
10
|
+
"only-arrow-functions": [false],
|
11
|
+
"object-literal-sort-keys": false,
|
12
|
+
"interface-name": [true, "always-prefix"],
|
13
|
+
"no-string-literal": false
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import typescript from "rollup-plugin-typescript2";
|
2
|
+
import resolve from "rollup-plugin-node-resolve";
|
3
|
+
import commonjs from "rollup-plugin-commonjs";
|
4
|
+
import json from "rollup-plugin-json";
|
5
|
+
|
6
|
+
const path = require("path");
|
7
|
+
const fs = require("fs");
|
8
|
+
const _ = require("lodash");
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Since Rollup runs inside each package we can just get the current
|
12
|
+
* package we are bundling.
|
13
|
+
*/
|
14
|
+
const pkg = require(path.join(process.cwd(), "package.json"));
|
15
|
+
|
16
|
+
/**
|
17
|
+
* and dig out its name.
|
18
|
+
*/
|
19
|
+
const { name } = pkg;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* to construct a copyright banner
|
23
|
+
*/
|
24
|
+
|
25
|
+
const copyright = `/* @preserve
|
26
|
+
* ${pkg.name} - v${pkg.version} - ${pkg.license}
|
27
|
+
* Copyright (c) 2017-${new Date().getFullYear()} Esri, Inc.
|
28
|
+
* ${new Date().toString()}
|
29
|
+
*/`;
|
30
|
+
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The module name will be the name of the global variable used in UMD builds.
|
34
|
+
* All exported members of each package will be attached to this global.
|
35
|
+
*/
|
36
|
+
const moduleName = "arcgisRest";
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Now we need to discover all the `@esri/arcgis-rest-*` package names so we can create
|
40
|
+
* the `globals` and `externals` to pass to Rollup.
|
41
|
+
*/
|
42
|
+
const packageNames = fs
|
43
|
+
.readdirSync(path.join(__dirname, "packages"))
|
44
|
+
.filter(p => p[0] !== ".")
|
45
|
+
.map(p => {
|
46
|
+
return require(path.join(__dirname, "packages", p, "package.json")).name;
|
47
|
+
}, {});
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Rollup will use this map to determine where to lookup modules on the global
|
51
|
+
* window object when neither AMD or CommonJS is being used. This configuration
|
52
|
+
* will cause Rollup to lookup all imports from our packages on a single global
|
53
|
+
* `arcgisRest` object.
|
54
|
+
*/
|
55
|
+
const globals = packageNames.reduce((globals, p) => {
|
56
|
+
globals[p] = moduleName;
|
57
|
+
return globals;
|
58
|
+
}, {});
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Now we can export the Rollup config!
|
62
|
+
*/
|
63
|
+
export default {
|
64
|
+
input: "./src/index.ts",
|
65
|
+
output: {
|
66
|
+
file: `./dist/umd/${name.replace("@esri/arcgis-rest-", "")}.umd.js`,
|
67
|
+
sourcemap: true,
|
68
|
+
banner: copyright,
|
69
|
+
format: "umd",
|
70
|
+
name: moduleName,
|
71
|
+
globals,
|
72
|
+
extend: true // causes this module to extend the global specified by `moduleName`
|
73
|
+
},
|
74
|
+
context: "window",
|
75
|
+
external: packageNames,
|
76
|
+
plugins: [
|
77
|
+
typescript(),
|
78
|
+
json(),
|
79
|
+
resolve(),
|
80
|
+
commonjs()
|
81
|
+
]
|
82
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import config from './umd-base-profile.js';
|
2
|
+
import uglify from "rollup-plugin-uglify";
|
3
|
+
import filesize from "rollup-plugin-filesize";
|
4
|
+
|
5
|
+
// use umd.min.js
|
6
|
+
config.output.file = config.output.file.replace(".umd.", ".umd.min.");
|
7
|
+
|
8
|
+
config.plugins.push(filesize())
|
9
|
+
config.plugins.push(uglify({
|
10
|
+
output: { comments: /@preserve/ }
|
11
|
+
}))
|
12
|
+
|
13
|
+
export default config;
|