ic-mops 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +6 -18
  2. package/cli.ts +25 -6
  3. package/commands/available-updates.ts +30 -0
  4. package/commands/init.ts +197 -31
  5. package/commands/outdated.ts +22 -0
  6. package/commands/template.ts +83 -15
  7. package/commands/update.ts +22 -0
  8. package/declarations/main/main.did +34 -11
  9. package/declarations/main/main.did.d.ts +19 -8
  10. package/declarations/main/main.did.js +32 -8
  11. package/dist/cli.js +23 -6
  12. package/dist/commands/available-updates.d.ts +2 -0
  13. package/dist/commands/available-updates.js +24 -0
  14. package/dist/commands/init.d.ts +3 -1
  15. package/dist/commands/init.js +174 -29
  16. package/dist/commands/outdated.d.ts +1 -0
  17. package/dist/commands/outdated.js +19 -0
  18. package/dist/commands/template.d.ts +1 -1
  19. package/dist/commands/template.js +78 -15
  20. package/dist/commands/update.d.ts +1 -0
  21. package/dist/commands/update.js +19 -0
  22. package/dist/declarations/main/main.did +34 -11
  23. package/dist/declarations/main/main.did.d.ts +19 -8
  24. package/dist/declarations/main/main.did.js +32 -8
  25. package/dist/package.json +2 -1
  26. package/dist/templates/README.md +13 -0
  27. package/dist/templates/licenses/Apache-2.0 +202 -0
  28. package/dist/templates/licenses/Apache-2.0-NOTICE +13 -0
  29. package/dist/templates/licenses/MIT +21 -0
  30. package/dist/templates/src/lib.mo +15 -0
  31. package/dist/templates/test/lib.test.mo +4 -0
  32. package/package.json +2 -1
  33. package/templates/README.md +13 -0
  34. package/templates/licenses/Apache-2.0 +202 -0
  35. package/templates/licenses/Apache-2.0-NOTICE +13 -0
  36. package/templates/licenses/MIT +21 -0
  37. package/templates/src/lib.mo +15 -0
  38. package/templates/test/lib.test.mo +4 -0
@@ -2,27 +2,90 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import chalk from 'chalk';
4
4
  import prompts from 'prompts';
5
- import { getRootDir } from '../mops.js';
6
- export async function template() {
7
- let res = await prompts({
8
- type: 'select',
9
- name: 'value',
10
- message: 'Select template:',
11
- choices: [
12
- { title: 'GitHub Workflow to run \'mops test\'', value: 'github-workflow:mops-test' },
13
- { title: '× Cancel', value: '' },
14
- ],
15
- initial: 0,
16
- });
17
- if (res.value === 'github-workflow:mops-test') {
5
+ import camelCase from 'camelcase';
6
+ import { getRootDir, readConfig } from '../mops.js';
7
+ export async function template(templateName, options = {}) {
8
+ if (!templateName) {
9
+ let res = await prompts({
10
+ type: 'select',
11
+ name: 'value',
12
+ message: 'Select template:',
13
+ choices: [
14
+ { title: 'README.md', value: 'readme' },
15
+ { title: 'src/lib.mo', value: 'lib.mo' },
16
+ { title: 'test/lib.test.mo', value: 'lib.test.mo' },
17
+ { title: 'License MIT', value: 'license:MIT' },
18
+ { title: 'License Apache-2.0', value: 'license:Apache-2.0' },
19
+ { title: 'GitHub Workflow to run \'mops test\'', value: 'github-workflow:mops-test' },
20
+ { title: '× Cancel', value: '' },
21
+ ],
22
+ initial: 0,
23
+ });
24
+ templateName = res.value;
25
+ }
26
+ if (templateName === 'github-workflow:mops-test') {
18
27
  let dest = path.resolve(getRootDir(), '.github/workflows/mops-test.yml');
19
28
  if (fs.existsSync(dest)) {
20
- console.log(chalk.yellow('Workflow already exists:'), dest);
29
+ console.log(chalk.yellow('Workflow already exists:'), path.relative(getRootDir(), dest));
21
30
  return;
22
31
  }
23
32
  let mopsTestYml = new URL('../templates/mops-test.yml', import.meta.url);
24
33
  fs.mkdirSync(path.resolve(getRootDir(), '.github/workflows'), { recursive: true });
25
34
  fs.copyFileSync(mopsTestYml, dest);
26
- console.log(chalk.green('Workflow created:'), dest);
35
+ console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
36
+ }
37
+ else if (templateName?.startsWith('license:')) {
38
+ let dest = path.resolve(getRootDir(), 'LICENSE');
39
+ if (fs.existsSync(dest)) {
40
+ console.log(chalk.yellow('LICENSE already exists'));
41
+ return;
42
+ }
43
+ let setYearAndOwner = (file) => {
44
+ let license = fs.readFileSync(file).toString();
45
+ license = license.replace(/<year>/g, new Date().getFullYear().toString());
46
+ if (options.copyrightOwner) {
47
+ license = license.replace(/<copyright-owner>/g, options.copyrightOwner);
48
+ }
49
+ fs.writeFileSync(file, license);
50
+ };
51
+ if (templateName === 'license:MIT') {
52
+ fs.copyFileSync(new URL('../templates/licenses/MIT', import.meta.url), path.resolve(getRootDir(), 'LICENSE'));
53
+ setYearAndOwner(path.resolve(getRootDir(), 'LICENSE'));
54
+ console.log(chalk.green('Created'), path.relative(getRootDir(), 'LICENSE'));
55
+ }
56
+ else if (templateName === 'license:Apache-2.0') {
57
+ fs.copyFileSync(new URL('../templates/licenses/Apache-2.0', import.meta.url), path.resolve(getRootDir(), 'LICENSE'));
58
+ fs.copyFileSync(new URL('../templates/licenses/Apache-2.0-NOTICE', import.meta.url), path.resolve(getRootDir(), 'NOTICE'));
59
+ setYearAndOwner(path.resolve(getRootDir(), 'NOTICE'));
60
+ console.log(chalk.green('Created'), path.relative(getRootDir(), 'LICENSE'));
61
+ console.log(chalk.green('Created'), path.relative(getRootDir(), 'NOTICE'));
62
+ }
63
+ }
64
+ else if (templateName === 'lib.mo') {
65
+ fs.mkdirSync(path.join(getRootDir(), 'src'), { recursive: true });
66
+ fs.copyFileSync(new URL('../templates/src/lib.mo', import.meta.url), path.resolve(getRootDir(), 'src/lib.mo'));
67
+ console.log(chalk.green('Created'), path.relative(getRootDir(), 'src/lib.mo'));
68
+ }
69
+ else if (templateName === 'lib.test.mo') {
70
+ fs.mkdirSync(path.join(getRootDir(), 'test'), { recursive: true });
71
+ fs.copyFileSync(new URL('../templates/test/lib.test.mo', import.meta.url), path.resolve(getRootDir(), 'test/lib.test.mo'));
72
+ console.log(chalk.green('Created'), path.relative(getRootDir(), 'test/lib.test.mo'));
73
+ }
74
+ else if (templateName === 'readme') {
75
+ let dest = path.resolve(getRootDir(), 'README.md');
76
+ if (fs.existsSync(dest)) {
77
+ console.log(chalk.yellow('README.md already exists'));
78
+ return;
79
+ }
80
+ fs.copyFileSync(new URL('../templates/README.md', import.meta.url), dest);
81
+ let config = readConfig();
82
+ let data = fs.readFileSync(dest).toString();
83
+ data = data.replace(/<year>/g, new Date().getFullYear().toString());
84
+ if (config.package?.name) {
85
+ data = data.replace(/<name>/g, config.package.name);
86
+ data = data.replace(/<import-name>/g, camelCase(config.package.name, { pascalCase: true }));
87
+ }
88
+ fs.writeFileSync(dest, data);
89
+ console.log(chalk.green('Created'), path.relative(getRootDir(), 'README.md'));
27
90
  }
28
91
  }
@@ -0,0 +1 @@
1
+ export declare function update(pkg?: string): Promise<void>;
@@ -0,0 +1,19 @@
1
+ import chalk from 'chalk';
2
+ import { checkConfigFile, readConfig } from '../mops.js';
3
+ import { add } from './add.js';
4
+ import { getAvailableUpdates } from './available-updates.js';
5
+ export async function update(pkg) {
6
+ if (!checkConfigFile()) {
7
+ return;
8
+ }
9
+ let config = readConfig();
10
+ let available = await getAvailableUpdates(config, pkg);
11
+ if (available.length === 0) {
12
+ console.log(chalk.green('All dependencies are up to date!'));
13
+ }
14
+ else {
15
+ for (let dep of available) {
16
+ await add(`${dep[0]}@${dep[2]}`);
17
+ }
18
+ }
19
+ }
@@ -1,5 +1,3 @@
1
- type Version = text;
2
- type Ver = text;
3
1
  type User__1 =
4
2
  record {
5
3
  displayName: text;
@@ -35,20 +33,34 @@ type StorageStats =
35
33
  memorySize: nat;
36
34
  };
37
35
  type StorageId = principal;
36
+ type SemverPart =
37
+ variant {
38
+ major;
39
+ minor;
40
+ patch;
41
+ };
38
42
  type Script =
39
43
  record {
40
44
  name: text;
41
45
  value: text;
42
46
  };
43
- type Result_6 =
47
+ type Result_7 =
44
48
  variant {
45
49
  err: Err;
46
50
  ok: vec FileId;
47
51
  };
52
+ type Result_6 =
53
+ variant {
54
+ err: Err;
55
+ ok: vec record {
56
+ PackageName__1;
57
+ PackageVersion;
58
+ };
59
+ };
48
60
  type Result_5 =
49
61
  variant {
50
62
  err: Err;
51
- ok: Ver;
63
+ ok: PackageVersion;
52
64
  };
53
65
  type Result_4 =
54
66
  variant {
@@ -78,6 +90,7 @@ type Result =
78
90
  type PublishingId = text;
79
91
  type PublishingErr = text;
80
92
  type PageCount = nat;
93
+ type PackageVersion = text;
81
94
  type PackageSummary__1 =
82
95
  record {
83
96
  config: PackageConfigV2__1;
@@ -181,25 +194,34 @@ type DependencyV2 =
181
194
  version: text;
182
195
  };
183
196
  service : {
197
+ backup: () -> ();
184
198
  claimAirdrop: (principal) -> (text);
185
199
  finishPublish: (PublishingId) -> (Result);
186
200
  getAirdropAmount: () -> (nat) query;
187
201
  getAirdropAmountAll: () -> (nat) query;
188
202
  getApiVersion: () -> (Text) query;
189
- getDefaultPackages: (text) -> (vec record {
190
- PackageName__1;
191
- Version;
192
- }) query;
203
+ getBackupCanisterId: () -> (principal) query;
204
+ getDefaultPackages: (text) ->
205
+ (vec record {
206
+ PackageName__1;
207
+ PackageVersion;
208
+ }) query;
193
209
  getDownloadTrendByPackageId: (PackageId) ->
194
210
  (vec DownloadsSnapshot__1) query;
195
211
  getDownloadTrendByPackageName: (PackageName__1) ->
196
212
  (vec DownloadsSnapshot__1) query;
197
- getFileIds: (PackageName__1, Ver) -> (Result_6) query;
213
+ getFileIds: (PackageName__1, PackageVersion) -> (Result_7) query;
214
+ getHighestSemverBatch:
215
+ (vec record {
216
+ PackageName__1;
217
+ PackageVersion;
218
+ SemverPart;
219
+ }) -> (Result_6) query;
198
220
  getHighestVersion: (PackageName__1) -> (Result_5) query;
199
221
  getMostDownloadedPackages: () -> (vec PackageSummary) query;
200
222
  getMostDownloadedPackagesIn7Days: () -> (vec PackageSummary) query;
201
223
  getNewPackages: () -> (vec PackageSummary) query;
202
- getPackageDetails: (PackageName__1, Ver) -> (Result_4) query;
224
+ getPackageDetails: (PackageName__1, PackageVersion) -> (Result_4) query;
203
225
  getPackagesByCategory: () -> (vec record {
204
226
  text;
205
227
  vec PackageSummary;
@@ -212,7 +234,8 @@ service : {
212
234
  getTotalDownloads: () -> (nat) query;
213
235
  getTotalPackages: () -> (nat) query;
214
236
  getUser: (principal) -> (opt User__1) query;
215
- notifyInstall: (PackageName__1, Ver) -> () oneway;
237
+ notifyInstall: (PackageName__1, PackageVersion) -> () oneway;
238
+ restore: (nat, nat) -> ();
216
239
  search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
217
240
  setUserProp: (text, text) -> (Result_3);
218
241
  startFileUpload: (PublishingId, Text, nat, blob) -> (Result_2);
@@ -94,6 +94,7 @@ export interface PackageSummary__1 {
94
94
  'config' : PackageConfigV2__1,
95
95
  'publication' : PackagePublication,
96
96
  }
97
+ export type PackageVersion = string;
97
98
  export type PageCount = bigint;
98
99
  export type PublishingErr = string;
99
100
  export type PublishingId = string;
@@ -107,11 +108,16 @@ export type Result_3 = { 'ok' : null } |
107
108
  { 'err' : string };
108
109
  export type Result_4 = { 'ok' : PackageDetails } |
109
110
  { 'err' : Err };
110
- export type Result_5 = { 'ok' : Ver } |
111
+ export type Result_5 = { 'ok' : PackageVersion } |
111
112
  { 'err' : Err };
112
- export type Result_6 = { 'ok' : Array<FileId> } |
113
+ export type Result_6 = { 'ok' : Array<[PackageName__1, PackageVersion]> } |
114
+ { 'err' : Err };
115
+ export type Result_7 = { 'ok' : Array<FileId> } |
113
116
  { 'err' : Err };
114
117
  export interface Script { 'value' : string, 'name' : string }
118
+ export type SemverPart = { 'major' : null } |
119
+ { 'minor' : null } |
120
+ { 'patch' : null };
115
121
  export type StorageId = Principal;
116
122
  export interface StorageStats {
117
123
  'fileCount' : bigint,
@@ -144,17 +150,17 @@ export interface User__1 {
144
150
  'githubVerified' : boolean,
145
151
  'github' : string,
146
152
  }
147
- export type Ver = string;
148
- export type Version = string;
149
153
  export interface _SERVICE {
154
+ 'backup' : ActorMethod<[], undefined>,
150
155
  'claimAirdrop' : ActorMethod<[Principal], string>,
151
156
  'finishPublish' : ActorMethod<[PublishingId], Result>,
152
157
  'getAirdropAmount' : ActorMethod<[], bigint>,
153
158
  'getAirdropAmountAll' : ActorMethod<[], bigint>,
154
159
  'getApiVersion' : ActorMethod<[], Text>,
160
+ 'getBackupCanisterId' : ActorMethod<[], Principal>,
155
161
  'getDefaultPackages' : ActorMethod<
156
162
  [string],
157
- Array<[PackageName__1, Version]>
163
+ Array<[PackageName__1, PackageVersion]>
158
164
  >,
159
165
  'getDownloadTrendByPackageId' : ActorMethod<
160
166
  [PackageId],
@@ -164,12 +170,16 @@ export interface _SERVICE {
164
170
  [PackageName__1],
165
171
  Array<DownloadsSnapshot__1>
166
172
  >,
167
- 'getFileIds' : ActorMethod<[PackageName__1, Ver], Result_6>,
173
+ 'getFileIds' : ActorMethod<[PackageName__1, PackageVersion], Result_7>,
174
+ 'getHighestSemverBatch' : ActorMethod<
175
+ [Array<[PackageName__1, PackageVersion, SemverPart]>],
176
+ Result_6
177
+ >,
168
178
  'getHighestVersion' : ActorMethod<[PackageName__1], Result_5>,
169
179
  'getMostDownloadedPackages' : ActorMethod<[], Array<PackageSummary>>,
170
180
  'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<PackageSummary>>,
171
181
  'getNewPackages' : ActorMethod<[], Array<PackageSummary>>,
172
- 'getPackageDetails' : ActorMethod<[PackageName__1, Ver], Result_4>,
182
+ 'getPackageDetails' : ActorMethod<[PackageName__1, PackageVersion], Result_4>,
173
183
  'getPackagesByCategory' : ActorMethod<
174
184
  [],
175
185
  Array<[string, Array<PackageSummary>]>
@@ -179,7 +189,8 @@ export interface _SERVICE {
179
189
  'getTotalDownloads' : ActorMethod<[], bigint>,
180
190
  'getTotalPackages' : ActorMethod<[], bigint>,
181
191
  'getUser' : ActorMethod<[Principal], [] | [User__1]>,
182
- 'notifyInstall' : ActorMethod<[PackageName__1, Ver], undefined>,
192
+ 'notifyInstall' : ActorMethod<[PackageName__1, PackageVersion], undefined>,
193
+ 'restore' : ActorMethod<[bigint, bigint], undefined>,
183
194
  'search' : ActorMethod<
184
195
  [Text, [] | [bigint], [] | [bigint]],
185
196
  [Array<PackageSummary>, PageCount]
@@ -4,7 +4,7 @@ export const idlFactory = ({ IDL }) => {
4
4
  const Result = IDL.Variant({ 'ok' : IDL.Null, 'err' : Err });
5
5
  const Text = IDL.Text;
6
6
  const PackageName__1 = IDL.Text;
7
- const Version = IDL.Text;
7
+ const PackageVersion = IDL.Text;
8
8
  const PackageId = IDL.Text;
9
9
  const Time = IDL.Int;
10
10
  const DownloadsSnapshot__1 = IDL.Record({
@@ -12,10 +12,18 @@ export const idlFactory = ({ IDL }) => {
12
12
  'endTime' : Time,
13
13
  'downloads' : IDL.Nat,
14
14
  });
15
- const Ver = IDL.Text;
16
15
  const FileId = IDL.Text;
17
- const Result_6 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
18
- const Result_5 = IDL.Variant({ 'ok' : Ver, 'err' : Err });
16
+ const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
17
+ const SemverPart = IDL.Variant({
18
+ 'major' : IDL.Null,
19
+ 'minor' : IDL.Null,
20
+ 'patch' : IDL.Null,
21
+ });
22
+ const Result_6 = IDL.Variant({
23
+ 'ok' : IDL.Vec(IDL.Tuple(PackageName__1, PackageVersion)),
24
+ 'err' : Err,
25
+ });
26
+ const Result_5 = IDL.Variant({ 'ok' : PackageVersion, 'err' : Err });
19
27
  const User = IDL.Record({
20
28
  'id' : IDL.Principal,
21
29
  'emailVerified' : IDL.Bool,
@@ -138,14 +146,16 @@ export const idlFactory = ({ IDL }) => {
138
146
  const PublishingErr = IDL.Text;
139
147
  const Result_1 = IDL.Variant({ 'ok' : PublishingId, 'err' : PublishingErr });
140
148
  return IDL.Service({
149
+ 'backup' : IDL.Func([], [], []),
141
150
  'claimAirdrop' : IDL.Func([IDL.Principal], [IDL.Text], []),
142
151
  'finishPublish' : IDL.Func([PublishingId], [Result], []),
143
152
  'getAirdropAmount' : IDL.Func([], [IDL.Nat], ['query']),
144
153
  'getAirdropAmountAll' : IDL.Func([], [IDL.Nat], ['query']),
145
154
  'getApiVersion' : IDL.Func([], [Text], ['query']),
155
+ 'getBackupCanisterId' : IDL.Func([], [IDL.Principal], ['query']),
146
156
  'getDefaultPackages' : IDL.Func(
147
157
  [IDL.Text],
148
- [IDL.Vec(IDL.Tuple(PackageName__1, Version))],
158
+ [IDL.Vec(IDL.Tuple(PackageName__1, PackageVersion))],
149
159
  ['query'],
150
160
  ),
151
161
  'getDownloadTrendByPackageId' : IDL.Func(
@@ -158,7 +168,16 @@ export const idlFactory = ({ IDL }) => {
158
168
  [IDL.Vec(DownloadsSnapshot__1)],
159
169
  ['query'],
160
170
  ),
161
- 'getFileIds' : IDL.Func([PackageName__1, Ver], [Result_6], ['query']),
171
+ 'getFileIds' : IDL.Func(
172
+ [PackageName__1, PackageVersion],
173
+ [Result_7],
174
+ ['query'],
175
+ ),
176
+ 'getHighestSemverBatch' : IDL.Func(
177
+ [IDL.Vec(IDL.Tuple(PackageName__1, PackageVersion, SemverPart))],
178
+ [Result_6],
179
+ ['query'],
180
+ ),
162
181
  'getHighestVersion' : IDL.Func([PackageName__1], [Result_5], ['query']),
163
182
  'getMostDownloadedPackages' : IDL.Func(
164
183
  [],
@@ -172,7 +191,7 @@ export const idlFactory = ({ IDL }) => {
172
191
  ),
173
192
  'getNewPackages' : IDL.Func([], [IDL.Vec(PackageSummary)], ['query']),
174
193
  'getPackageDetails' : IDL.Func(
175
- [PackageName__1, Ver],
194
+ [PackageName__1, PackageVersion],
176
195
  [Result_4],
177
196
  ['query'],
178
197
  ),
@@ -194,7 +213,12 @@ export const idlFactory = ({ IDL }) => {
194
213
  'getTotalDownloads' : IDL.Func([], [IDL.Nat], ['query']),
195
214
  'getTotalPackages' : IDL.Func([], [IDL.Nat], ['query']),
196
215
  'getUser' : IDL.Func([IDL.Principal], [IDL.Opt(User__1)], ['query']),
197
- 'notifyInstall' : IDL.Func([PackageName__1, Ver], [], ['oneway']),
216
+ 'notifyInstall' : IDL.Func(
217
+ [PackageName__1, PackageVersion],
218
+ [],
219
+ ['oneway'],
220
+ ),
221
+ 'restore' : IDL.Func([IDL.Nat, IDL.Nat], [], []),
198
222
  'search' : IDL.Func(
199
223
  [Text, IDL.Opt(IDL.Nat), IDL.Opt(IDL.Nat)],
200
224
  [IDL.Vec(PackageSummary), PageCount],
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
@@ -40,6 +40,7 @@
40
40
  "@iarna/toml": "^2.2.5",
41
41
  "as-table": "^1.0.55",
42
42
  "cacheable-request": "10.2.12",
43
+ "camelcase": "^7.0.1",
43
44
  "chalk": "^5.3.0",
44
45
  "chokidar": "^3.5.3",
45
46
  "commander": "^11.0.0",
@@ -0,0 +1,13 @@
1
+ # <name>
2
+
3
+ ## Install
4
+ ```
5
+ mops add <name>
6
+ ```
7
+
8
+ ## Usage
9
+ ```motoko
10
+ import <import-name> "mo:<name>";
11
+
12
+ // example...
13
+ ```
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,13 @@
1
+ Copyright <year> <copyright-owner>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright-owner>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.