ic-mops 0.14.0 → 0.15.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.
package/README.md CHANGED
@@ -50,6 +50,11 @@ You can also add packages from GitHub like this
50
50
  mops add https://github.com/dfinity/motoko-base
51
51
  ```
52
52
 
53
+ For GitHub-packages you can specify branch, tag, or commit hash by adding `#<branch/tag/hash>`
54
+ ```
55
+ mops add https://github.com/dfinity/motoko-base#moc-0.9.1
56
+ ```
57
+
53
58
  You can also add local packages like this (put source files inside `src` directory)
54
59
  ```
55
60
  mops add ./shared
package/cli.js CHANGED
@@ -20,6 +20,7 @@ import {template} from './commands/template.js';
20
20
  import {selfUpdate} from './commands/self-update.js';
21
21
  import {remove} from './commands/remove.js';
22
22
  import {getUserProp, setUserProp} from './commands/user.js';
23
+ import {bump} from './commands/bump.js';
23
24
  // import {docs} from './commands/docs.js';
24
25
 
25
26
  program.name('mops');
@@ -279,4 +280,12 @@ program
279
280
  }
280
281
  });
281
282
 
283
+ // bump
284
+ program
285
+ .command('bump [major|minor|patch]')
286
+ .description('Bump current package version')
287
+ .action(async (part) => {
288
+ bump(part);
289
+ });
290
+
282
291
  program.parse();
@@ -0,0 +1,58 @@
1
+ import prompts from 'prompts';
2
+ import chalk from 'chalk';
3
+ import {checkConfigFile, readConfig, writeConfig} from '../mops.js';
4
+
5
+ export async function bump(part) {
6
+ if (!checkConfigFile()) {
7
+ return;
8
+ }
9
+
10
+ if (part && !['major', 'minor', 'patch'].includes(part)) {
11
+ console.log(chalk.red('Unknown version part. Available parts: major, minor, patch'));
12
+ process.exit(1);
13
+ }
14
+
15
+ let config = readConfig();
16
+
17
+ if (!config.package) {
18
+ console.log(chalk.red('No [package] section found in mops.toml.'));
19
+ process.exit(1);
20
+ }
21
+
22
+ console.log(`Current version: ${chalk.yellow.bold(config.package.version)}`);
23
+
24
+ if (!part) {
25
+ let res = await prompts({
26
+ type: 'select',
27
+ name: 'part',
28
+ message: 'Select new version:',
29
+ choices: [
30
+ {title: `${updateVersion(config.package.version, 'major')} ${chalk.dim('(major, breaking changes)')}`, value: 'major'},
31
+ {title: `${updateVersion(config.package.version, 'minor')} ${chalk.dim('(minor, new features)')}`, value: 'minor'},
32
+ {title: `${updateVersion(config.package.version, 'patch')} ${chalk.dim('(patch, bug fixes)')}`, value: 'patch'},
33
+ ],
34
+ initial: 2,
35
+ });
36
+ if (!res.part) {
37
+ return;
38
+ }
39
+ part = res.part;
40
+ }
41
+
42
+ config.package.version = updateVersion(config.package.version, part);
43
+ writeConfig(config);
44
+ console.log(`Updated version: ${chalk.green.bold(config.package.version)}`);
45
+ }
46
+
47
+ function updateVersion(version, part) {
48
+ let parts = version.split('.');
49
+ let idx = ['major', 'minor', 'patch'].indexOf(part);
50
+ if (idx < 0) {
51
+ throw new Error(`Invalid version part: ${part}`);
52
+ }
53
+ parts[idx] = parseInt(parts[idx]) + 1;
54
+ for (let i = idx + 1; i < parts.length; i++) {
55
+ parts[i] = 0;
56
+ }
57
+ return parts.join('.');
58
+ }
package/mops.js CHANGED
@@ -41,14 +41,14 @@ export function getNetwork() {
41
41
  else if (network === 'staging') {
42
42
  return {
43
43
  network,
44
- host: 'https://ic0.app',
44
+ host: 'https://icp-api.io',
45
45
  canisterId: '2d2zu-vaaaa-aaaak-qb6pq-cai',
46
46
  };
47
47
  }
48
48
  else if (network === 'ic') {
49
49
  return {
50
50
  network,
51
- host: 'https://ic0.app',
51
+ host: 'https://icp-api.io',
52
52
  canisterId: 'oknww-riaaa-aaaam-qaf6a-cai',
53
53
  };
54
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "cli.js"
@@ -18,7 +18,7 @@ jobs:
18
18
  node-version: 18
19
19
  - uses: aviate-labs/setup-dfx@v0.2.3
20
20
  with:
21
- dfx-version: 0.14.0
21
+ dfx-version: 0.14.1
22
22
 
23
23
  - name: install dfx
24
24
  run: dfx cache install