submodule-version 2.3.2 → 3.0.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 (120) hide show
  1. package/README.md +103 -20
  2. package/dist/runner/handleErrors/handleErrors.d.ts +1 -1
  3. package/dist/runner/handleErrors/handleErrors.js +3 -10
  4. package/dist/runner/handleErrors/handleErrors.js.map +1 -1
  5. package/dist/runner/index.js +0 -0
  6. package/dist/runner/runner.d.ts +4 -0
  7. package/dist/runner/runner.js +91 -37
  8. package/dist/runner/runner.js.map +1 -1
  9. package/dist/src/PubGrub/PubGrub.d.ts +28 -0
  10. package/dist/src/PubGrub/PubGrub.js +366 -0
  11. package/dist/src/PubGrub/PubGrub.js.map +1 -0
  12. package/dist/src/PubGrub/index.d.ts +2 -0
  13. package/dist/src/PubGrub/index.js +7 -0
  14. package/dist/src/PubGrub/index.js.map +1 -0
  15. package/dist/src/PubGrub/types.d.ts +56 -0
  16. package/dist/src/PubGrub/types.js +3 -0
  17. package/dist/src/PubGrub/types.js.map +1 -0
  18. package/dist/src/entryStore.d.ts +16 -0
  19. package/dist/src/entryStore.js +152 -0
  20. package/dist/src/entryStore.js.map +1 -0
  21. package/dist/src/errors.d.ts +28 -0
  22. package/dist/src/errors.js +30 -0
  23. package/dist/src/errors.js.map +1 -0
  24. package/dist/src/git/api/GithubError.d.ts +4 -0
  25. package/dist/src/git/api/GithubError.js +11 -0
  26. package/dist/src/git/api/GithubError.js.map +1 -0
  27. package/dist/src/git/api/api.d.ts +8 -0
  28. package/dist/src/git/api/api.js +133 -0
  29. package/dist/src/git/api/api.js.map +1 -0
  30. package/dist/src/git/api/index.d.ts +3 -0
  31. package/dist/src/git/api/index.js +8 -0
  32. package/dist/src/git/api/index.js.map +1 -0
  33. package/dist/src/git/git.d.ts +30 -23
  34. package/dist/src/git/git.js +8 -258
  35. package/dist/src/git/git.js.map +1 -1
  36. package/dist/src/git/index.d.ts +1 -0
  37. package/dist/src/git/index.js +3 -1
  38. package/dist/src/git/index.js.map +1 -1
  39. package/dist/src/git/local/index.d.ts +1 -0
  40. package/dist/src/git/local/index.js +6 -0
  41. package/dist/src/git/local/index.js.map +1 -0
  42. package/dist/src/git/local/local.d.ts +26 -0
  43. package/dist/src/git/local/local.js +288 -0
  44. package/dist/src/git/local/local.js.map +1 -0
  45. package/dist/src/index.d.ts +7 -0
  46. package/dist/src/index.js +16 -1
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/printError.d.ts +1 -0
  49. package/dist/src/printError.js +158 -0
  50. package/dist/src/printError.js.map +1 -0
  51. package/dist/src/sv.d.ts +18 -8
  52. package/dist/src/sv.js +235 -131
  53. package/dist/src/sv.js.map +1 -1
  54. package/dist/src/versionUtil/index.d.ts +2 -0
  55. package/dist/src/versionUtil/index.js +6 -0
  56. package/dist/src/versionUtil/index.js.map +1 -0
  57. package/dist/src/versionUtil/versionUtil.d.ts +16 -0
  58. package/dist/src/versionUtil/versionUtil.js +70 -0
  59. package/dist/src/versionUtil/versionUtil.js.map +1 -0
  60. package/package.json +4 -2
  61. package/runner/handleErrors/handleErrors.ts +3 -10
  62. package/runner/runner.ts +128 -46
  63. package/src/PubGrub/PubGrub.ts +578 -0
  64. package/src/PubGrub/__tests__/PubGrub.test.ts +351 -0
  65. package/src/PubGrub/index.ts +12 -0
  66. package/src/PubGrub/types.ts +72 -0
  67. package/src/__tests__/entryStore.test.ts +248 -0
  68. package/src/__tests__/printError.test.ts +148 -0
  69. package/src/__tests__/sv.test.ts +441 -0
  70. package/src/entryStore.ts +212 -0
  71. package/src/errors.ts +39 -0
  72. package/src/git/api/GithubError.ts +5 -0
  73. package/src/git/api/api.ts +180 -0
  74. package/src/git/api/index.ts +3 -0
  75. package/src/git/git.ts +8 -396
  76. package/src/git/index.ts +1 -0
  77. package/src/git/local/index.ts +1 -0
  78. package/src/git/local/local.ts +430 -0
  79. package/src/index.ts +17 -0
  80. package/src/printError.ts +189 -0
  81. package/src/sv.ts +321 -134
  82. package/src/versionUtil/__tests__/versionUtil.test.ts +62 -0
  83. package/src/versionUtil/index.ts +2 -0
  84. package/src/versionUtil/versionUtil.ts +103 -0
  85. package/tsconfig.json +1 -1
  86. package/dist/runner/handleErrors/handleBuildGraphError.d.ts +0 -1
  87. package/dist/runner/handleErrors/handleBuildGraphError.js +0 -42
  88. package/dist/runner/handleErrors/handleBuildGraphError.js.map +0 -1
  89. package/dist/runner/handleErrors/handleGitError.d.ts +0 -1
  90. package/dist/runner/handleErrors/handleGitError.js +0 -27
  91. package/dist/runner/handleErrors/handleGitError.js.map +0 -1
  92. package/dist/runner/handleErrors/handleInstallError.d.ts +0 -1
  93. package/dist/runner/handleErrors/handleInstallError.js +0 -30
  94. package/dist/runner/handleErrors/handleInstallError.js.map +0 -1
  95. package/dist/src/__tests__/versionUtil.test.d.ts +0 -1
  96. package/dist/src/__tests__/versionUtil.test.js +0 -80
  97. package/dist/src/__tests__/versionUtil.test.js.map +0 -1
  98. package/dist/src/buildGraph/GraphError.d.ts +0 -11
  99. package/dist/src/buildGraph/GraphError.js +0 -11
  100. package/dist/src/buildGraph/GraphError.js.map +0 -1
  101. package/dist/src/buildGraph/buildGraph.d.ts +0 -8
  102. package/dist/src/buildGraph/buildGraph.js +0 -100
  103. package/dist/src/buildGraph/buildGraph.js.map +0 -1
  104. package/dist/src/buildGraph/index.d.ts +0 -2
  105. package/dist/src/buildGraph/index.js +0 -8
  106. package/dist/src/buildGraph/index.js.map +0 -1
  107. package/dist/src/git/__tests__/parseGitUrl.test.d.ts +0 -1
  108. package/dist/src/git/__tests__/parseGitUrl.test.js +0 -30
  109. package/dist/src/git/__tests__/parseGitUrl.test.js.map +0 -1
  110. package/dist/src/versionUtil.d.ts +0 -13
  111. package/dist/src/versionUtil.js +0 -79
  112. package/dist/src/versionUtil.js.map +0 -1
  113. package/runner/handleErrors/handleBuildGraphError.ts +0 -49
  114. package/runner/handleErrors/handleGitError.ts +0 -28
  115. package/runner/handleErrors/handleInstallError.ts +0 -26
  116. package/src/__tests__/versionUtil.test.ts +0 -96
  117. package/src/buildGraph/GraphError.ts +0 -12
  118. package/src/buildGraph/buildGraph.ts +0 -150
  119. package/src/buildGraph/index.ts +0 -2
  120. package/src/versionUtil.ts +0 -97
package/README.md CHANGED
@@ -10,6 +10,8 @@ This tool designed to split projects in-to submodules *without npm-packages head
10
10
 
11
11
  With `submodule version` code can be organized like a *single monorepo*, but each submodule can be *easily reused* in another projects like npm-package.
12
12
 
13
+ Each module — the project itself and every submodule — declares its dependencies in the `sv` field of its `package.json`, and each release is just a semver git tag. When modules are installed, updated or deleted, `sv` resolves the newest mutually compatible version set across the whole dependency tree with the **PubGrub** algorithm (the one behind Dart's `pub` package manager), reading tags and their `package.json` files straight from the GitHub API without cloning. The resolved set is then applied to the working tree: missing submodules are added, versions are switched to the selected tags and the corresponding `package.json` files are updated — and if no compatible set exists, nothing is touched and a descriptive conflict error is reported.
14
+
13
15
  ## Problem to solve
14
16
 
15
17
  Take a look on the next situation:
@@ -33,16 +35,26 @@ Submodule version helps to
33
35
  ## Installation
34
36
 
35
37
  - Install sv tool `npm i -D submodule-version`
36
- - Add `workspaces` section in `package.json`
37
- ```
38
- "workspaces": [
39
- "modules/*"
40
- ],
41
- ```
42
- - Install first submodule `npx sv i <git_repo>`
38
+ - Set up a GitHub token (see below) — `sv` reads module versions through the GitHub API
39
+ - Install first submodule `npx sv i <git_repo>` — the `workspaces` section in `package.json` is added automatically on `init`
43
40
  - Install npm dependencies `npm i`. Submodule will be linked in node_modules and its dependencies will be installed
44
41
  - Use your submodule in code `import submodule from 'submodule-name'` 🔥
45
42
 
43
+ ### GitHub token
44
+
45
+ `sv` lists module versions through the GitHub GraphQL API, which does not work anonymously — a token is required:
46
+
47
+ 1. Create a personal access token at [github.com/settings/tokens](https://github.com/settings/tokens). A **classic** token with the `repo` scope works for both public and private repos; for a **fine-grained** token, grant read-only access to *Contents* and *Metadata* on the repositories you use as submodules.
48
+ 2. Export it before running `sv`:
49
+
50
+ ```
51
+ export GITHUB_TOKEN=<your_token>
52
+ ```
53
+
54
+ or pass it via the JS API: `new SV(process.cwd(), 'modules', { githubToken: '<your_token>' })`.
55
+
56
+ By default submodules live in `modules/` — unless existing submodules in `.gitmodules` point elsewhere, then their directory is used. To use another directory pass the `--modules-dir` flag (`npx sv --modules-dir libs i <git_repo>`) or the constructor argument in the JS API (`new SV(process.cwd(), 'libs')`). The directory is stored in `package.json` as `sv-dir`, so every later call reuses it automatically — no need to pass the flag again. The matching `workspaces` entry is added to `package.json` automatically as well.
57
+
46
58
  ## How it works
47
59
 
48
60
  - Each submodule and main project has own `package.json` with `sv` object inside. `sv` object will be generated automatically and will contain every dependency version
@@ -53,7 +65,7 @@ Submodule version helps to
53
65
  ```
54
66
  - Each submodule has a [version](#versioning) tags, and `sv` use list of this tags to resolve dependencies
55
67
  - The installed version of a submodule is the version tag git `HEAD` points at
56
- - `Submodule version` creates a graph of whole project and install only possible and actual versions
68
+ - `Submodule version` resolves the newest compatible set with PubGrub and loads nested repositories only when a selected version requires them
57
69
  - `sv` never switches a submodule version if it has uncommitted changes or unpushed commits — your local work is always kept intact 🧯
58
70
 
59
71
  ## Versioning
@@ -69,27 +81,74 @@ Or use the [`publish`](#programmatic-api) API, which bumps the version, commits,
69
81
 
70
82
  ## Commands
71
83
 
72
- - `npx sv validate` - Validate all dependencis and install missing modules
73
- - `npx sv install <git_url> [target_submodule]` - Install new dependency
74
- - `npx sv update` - Update all dependencies to the latest possible versions
75
- - `npx sv publish [module] [--bump release|minor|major] [-m message] [--repo-url git_url]` - Commit, tag and push a new version of a module (or the project itself when `module` is omitted). `--repo-url` is required for the first publish of a module without a git remote
84
+ - `npx sv` - Resolve, validate and install/sync all modules (default command)
85
+ - `npx sv put <url> [target] [--ver 1.2.0]` - Install a submodule or change its version (`install`, `i`). Without `target` the module is installed in the project root; `target` is a parent module name. Without `--ver` the highest possible version is selected (as if `'*'` was passed)
86
+ - `npx sv delete <path>` - Delete a submodule from its parent (project root when the path is a plain name) by path (`remove`, `r`)
87
+ - `npx sv list-versions [name] [--installed]` - List available versions of one module, or of every resolved module when `name` is omitted (`ls`). With `--installed` shows the versions actually checked out in the submodules
88
+ - `npx sv update [path]` - Update modules to the latest allowed versions, all of them or a single one by path (`u`)
89
+ - `npx sv publish [module] [--bump release|minor|major] [-m message] [--repo-url git_url]` - Commit, tag and push a new version of a module (or the project itself when `module` is omitted). `--repo-url` is required for the first publish of a module without a git remote (`p`)
76
90
  - `npx sv help` - Description of all commands
77
91
 
92
+ All commands accept the global `--modules-dir <dir>` option to use another submodule directory instead of `modules/`. The chosen directory is recorded in `package.json` as `sv-dir` and reused by later commands automatically.
93
+
78
94
  ## Programmatic API
79
95
 
80
96
  The `SV` class can be used directly from code:
81
97
 
82
98
  ```ts
83
- import { SV, versionUtil } from 'submodule-version';
99
+ import { PubGrub, SV, versionUtil } from 'submodule-version';
100
+
101
+ const sv = new SV(process.cwd(), 'modules', { githubToken: '…' });
102
+ await sv.init();
84
103
 
85
- const sv = new SV(process.cwd(), 'modules');
104
+ await sv.put('git@github.com:org/render-engine.git', '^1.2.0');
105
+ const resolution = sv.getResolution();
86
106
  ```
87
107
 
88
- ### Switching versions
108
+ The constructor accepts `(projectDir, modulesDir?, { githubToken? })`. The modules directory is resolved as: explicit `modulesDir` argument → `sv-dir` recorded in `package.json` → the common directory of existing submodules in `.gitmodules` → `modules`. The GitHub GraphQL API is used to list module versions without cloning, so a token is required: pass `githubToken` or set the `GITHUB_TOKEN` environment variable.
109
+
110
+ ### Dependency resolution
111
+
112
+ - `sv.init()` resolves `package.json#sv` with PubGrub and installs/syncs submodules to the resolved versions. It also adds the modules dir to `workspaces` in `package.json` when it is missing.
113
+ - `sv.getResolution()` returns the selected version and selected-version dependencies for every resolved module.
114
+ - `new PubGrub(source).resolve(rootDeps)` runs the resolver with a custom entry source, which is useful for tests and non-GitHub registries.
115
+
116
+ ### Installing, updating and deleting modules
89
117
 
90
- - `sv.setVersion(name, version, constraint?)` - Checkout the submodule to a specific version tag and pin the version constraint in the project `package.json`. By default the constraint is an exact pin of the selected version; pass `^<version>` as `constraint` to keep receiving newer versions on update. If the submodule has local changes that cannot be carried over, the switch is aborted without touching the working tree (`GIT_DIRTY_SWITCH_CONFLICT` error)
91
- - `sv.getConstraint(name)` - Read the current version constraint of a submodule from the project `package.json`
92
- - `sv.setConstraint(name, constraint)` - Change the version constraint of a submodule without switching the checked-out version
118
+ All mutations first run a check resolve and touch the working tree and `package.json` files only when the resolution succeeds.
119
+
120
+ - `sv.put(url, version?, parentName?)` - Install a module or change its version. Instead of `url` you can pass the name of an already installed module. All argument forms are supported: `put(url)`, `put(url, version)`, `put(url, parentName)`, `put(url, version, parentName)`.
121
+ - Without `parentName` the module is installed/updated in the project root and the range is written to the root `package.json#sv`.
122
+ - With `parentName` the module is added to (or updated in) the parent module and the range is written to the parent's own `package.json#sv`, so the change survives publishing the parent.
123
+ - Without `version` the highest possible version is selected, as if `'*'` was passed.
124
+ - `sv.delete(name, parentName?)` - Delete a module from its parent (the project root when `parentName` is omitted); the dependency is removed from the corresponding `package.json#sv` and the submodule is uninstalled.
125
+ - `sv.listVersions(name?)` - With `name` returns the available versions of one package (`string[]`); without it returns `{ [pkgName]: string[] }` for every resolved package.
126
+
127
+ ### Simulating changes
128
+
129
+ `EntryStore.simulate(overrides, rootDeps, callback)` runs the callback against a hypothetically changed dependency tree — every fetch inside the callback sees the overridden modules, and the overrides cease to exist once the callback finishes (also on error):
130
+
131
+ ```ts
132
+ import { EntryStore, PubGrub } from 'submodule-version';
133
+
134
+ const store = new EntryStore();
135
+
136
+ // the three override forms:
137
+ const overrides = [
138
+ // add B to the root
139
+ { add: 'git@github.com:org/b.git', version: '^1.2.3' },
140
+ // add B to any version of the installed module A
141
+ { parent: 'A', add: 'git@github.com:org/b.git', version: '*' },
142
+ // delete B
143
+ { delete: 'B' },
144
+ ];
145
+
146
+ const resolution = await store.simulate(overrides, rootDeps, deps => (
147
+ new PubGrub(store).resolve(deps)
148
+ ));
149
+ ```
150
+
151
+ Root-level overrides (without `parent`) are applied to a copy of `rootDeps` that is passed to the callback; `parent` overrides rewrite every version of the parent module. `version` defaults to `'*'`.
93
152
 
94
153
  ### Inspecting changes and versions
95
154
 
@@ -100,6 +159,11 @@ const sv = new SV(process.cwd(), 'modules');
100
159
  - `sv.getRemote(module?)` - The `origin` remote URL, or `null`
101
160
  - `sv.isPublished(module?)` - `true` if the module is a git repo with a configured remote
102
161
 
162
+ ### Syncing with the remote
163
+
164
+ - `sv.isRemoteAhead(module?)` - `true` if the remote branch has commits the local one does not (fetches from `origin` first)
165
+ - `sv.pullRebaseAutostash(module?)` - Catch up with the remote via `pull --rebase --autostash`. On conflict everything is restored to the previous state (`rebase --abort` + `stash pop`) and a `GIT_SYNC_CONFLICT` error is thrown — further sync is only possible with a manual rebase
166
+
103
167
  ### Publishing
104
168
 
105
169
  - `sv.publish({ module?, repoUrl?, message?, bump })` - Commit, tag and push a new version of a module (or the project itself). Returns the published version.
@@ -111,10 +175,29 @@ const sv = new SV(process.cwd(), 'modules');
111
175
 
112
176
  ### Version utilities
113
177
 
114
- `versionUtil` is also exported and now includes `versionUtil.bump(version, 'release' | 'minor' | 'major')` alongside `compare`, `pick`, `validate` and `latest`.
178
+ `versionUtil` exposes standard SemVer validation, comparison, filtering and finite-set operations used by PubGrub: `validate`, `satisfies`, `compare`, `sort`, `select`, `latest`, `intersection`, `union`, `difference`, `intersects`, `isSubset` and `bump`.
179
+
180
+ ### Error handling
181
+
182
+ `printError(error)` turns any error thrown by the resolver or the `SV` methods into a human-readable string — version conflicts with the requiring parents and the dependency chain, circular dependencies, unknown versions, git layer failures and GitHub API errors. The CLI prints all its errors through it:
183
+
184
+ ```ts
185
+ import { printError, SV } from 'submodule-version';
186
+
187
+ try {
188
+ await sv.put('git@github.com:org/b.git', '^2.0.0');
189
+ } catch (error) {
190
+ console.error(printError(error as Error));
191
+ // Version conflict for C:
192
+ // - ^1.3.2 required by my-project
193
+ // - not ^1.4.2 required by B@2.0.0
194
+ // chain: A -> B -> C
195
+ // available versions: 1.4.2, 1.3.2
196
+ }
197
+ ```
115
198
 
116
199
  ## Submodule dependencies
117
200
 
118
201
  Sumbodules can contains their own dependencies specified in `package.json` as `sv` object.
119
202
 
120
- To install submodule in submodule run `npx install <git_url> [target_submodule]`
203
+ To install submodule in submodule run `npx sv put <git_url> <target_submodule>`
@@ -1 +1 @@
1
- export declare const handleErrors: (error: Error, gitUrl: string) => Promise<void>;
1
+ export declare const handleErrors: (error: Error) => Promise<void>;
@@ -1,17 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleErrors = void 0;
4
- const handleBuildGraphError_1 = require("./handleBuildGraphError");
5
- const handleInstallError_1 = require("./handleInstallError");
6
- const handleGitError_1 = require("./handleGitError");
4
+ const src_1 = require("../../src");
7
5
  const log_1 = require("../log");
8
- const handleErrors = async (error, gitUrl) => {
9
- await Promise.all([
10
- (0, handleBuildGraphError_1.handleBuildGraphError)(error),
11
- (0, handleInstallError_1.handleInstallError)(error, gitUrl),
12
- (0, handleGitError_1.handleGitError)(error),
13
- ]);
14
- log_1.log.error('unhandled error', error.message);
6
+ const handleErrors = async (error) => {
7
+ log_1.log.error((0, src_1.printError)(error));
15
8
  };
16
9
  exports.handleErrors = handleErrors;
17
10
  //# sourceMappingURL=handleErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleErrors.js","sourceRoot":"","sources":["../../../runner/handleErrors/handleErrors.ts"],"names":[],"mappings":";;;AAAA,mEAAgE;AAChE,6DAA0D;AAC1D,qDAAkD;AAClD,gCAA6B;AAEtB,MAAM,YAAY,GAAG,KAAK,EAAE,KAAY,EAAE,MAAc,EAAE,EAAE;IACjE,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,6CAAqB,EAAC,KAAK,CAAC;QAC5B,IAAA,uCAAkB,EAAC,KAAK,EAAE,MAAM,CAAC;QACjC,IAAA,+BAAc,EAAC,KAAK,CAAC;KACtB,CAAC,CAAC;IACH,SAAG,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAC;AAPW,QAAA,YAAY,gBAOvB"}
1
+ {"version":3,"file":"handleErrors.js","sourceRoot":"","sources":["../../../runner/handleErrors/handleErrors.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AACvC,gCAA6B;AAEtB,MAAM,YAAY,GAAG,KAAK,EAAE,KAAY,EAAE,EAAE;IACjD,SAAG,CAAC,KAAK,CAAC,IAAA,gBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB"}
File without changes
@@ -1,9 +1,13 @@
1
1
  export declare const s: {
2
2
  [x: string]: unknown;
3
+ "modules-dir": string | undefined;
4
+ modulesDir: string | undefined;
3
5
  _: (string | number)[];
4
6
  $0: string;
5
7
  } | Promise<{
6
8
  [x: string]: unknown;
9
+ "modules-dir": string | undefined;
10
+ modulesDir: string | undefined;
7
11
  _: (string | number)[];
8
12
  $0: string;
9
13
  }>;
@@ -9,60 +9,114 @@ const yargs_1 = __importDefault(require("yargs"));
9
9
  const src_1 = require("../src");
10
10
  const log_1 = require("./log");
11
11
  const handleErrors_1 = require("./handleErrors");
12
- const BASE_DIR = 'modules';
13
- const makeEvent = (event) => {
14
- const sv = new src_1.SV(process.cwd(), BASE_DIR);
15
- return async (arg) => {
16
- const { url: gitUrl } = arg;
17
- try {
18
- await event(sv, arg);
19
- }
20
- catch (e) {
21
- (0, handleErrors_1.handleErrors)(e, gitUrl);
12
+ /* 'A.B.C' { name: 'C', parent: 'B' } (parent — непосредственный родитель) */
13
+ const splitPath = (modulePath) => {
14
+ const parts = modulePath.split('.');
15
+ const name = parts.pop();
16
+ return { name, parent: parts.pop() };
17
+ };
18
+ const makeEvent = (event, { skipInit = false } = {}) => async (arg) => {
19
+ const sv = new src_1.SV(process.cwd(), arg.modulesDir);
20
+ try {
21
+ /* publish умеет работать с ещё не git/npm-инициализированным проектом */
22
+ if (!skipInit) {
23
+ await sv.init();
22
24
  }
23
- };
25
+ await event(sv, arg);
26
+ }
27
+ catch (e) {
28
+ (0, handleErrors_1.handleErrors)(e);
29
+ }
24
30
  };
25
- const install = makeEvent(async (sv, arg) => {
26
- const { url: gitUrl, target } = arg;
27
- await sv.install(gitUrl, target);
31
+ const put = makeEvent(async (sv, arg) => {
32
+ const { url: gitUrl, target, ver } = arg;
33
+ await sv.put(gitUrl, ver || target, ver ? target : undefined);
34
+ });
35
+ const update = makeEvent(async (sv, arg) => {
36
+ const { path: modulePath } = arg;
37
+ if (!modulePath) {
38
+ /* init внутри makeEvent уже пересобрал модули на максимально разрешённые */
39
+ log_1.log.message(chalk_1.default.green.bold('Modules are up to date!'));
40
+ return;
41
+ }
42
+ const { name, parent } = splitPath(modulePath);
43
+ const entry = sv.getResolution()[name];
44
+ if (!entry)
45
+ throw new src_1.SVError('ADDON_NOT_FOUND', { name });
46
+ await sv.put(entry.url, '*', parent);
28
47
  });
29
- const update = makeEvent(async (sv) => {
30
- await sv.update();
48
+ const del = makeEvent(async (sv, arg) => {
49
+ const { path: modulePath } = arg;
50
+ const { name, parent } = splitPath(modulePath);
51
+ await sv.delete(name, parent);
31
52
  });
32
- const remove = makeEvent(async (sv, arg) => {
33
- const { name } = arg;
34
- await sv.remove(name);
53
+ const listVersions = makeEvent(async (sv, arg) => {
54
+ const { name, installed } = arg;
55
+ if (installed) {
56
+ const resolution = sv.getResolution();
57
+ if (name && !resolution[name]) {
58
+ throw new src_1.SVError('ADDON_NOT_FOUND', { name });
59
+ }
60
+ const names = name ? [name] : Object.keys(resolution);
61
+ await Promise.all(names.map(async (moduleName) => {
62
+ const version = await sv.currentVersion(moduleName);
63
+ log_1.log.message(chalk_1.default.bold(moduleName), version || chalk_1.default.red('no version tag'));
64
+ }));
65
+ return;
66
+ }
67
+ const versions = sv.listVersions(name);
68
+ if (name) {
69
+ log_1.log.message(chalk_1.default.bold(name), versions.join(', '));
70
+ return;
71
+ }
72
+ Object.entries(versions)
73
+ .forEach(([moduleName, moduleVersions]) => {
74
+ log_1.log.message(chalk_1.default.bold(moduleName), moduleVersions.join(', '));
75
+ });
35
76
  });
36
77
  const publish = makeEvent(async (sv, arg) => {
37
78
  const { module, bump, message, repoUrl } = arg;
38
79
  const version = await sv.publish({ module, bump, message, repoUrl });
39
80
  log_1.log.message(chalk_1.default.green.bold('Published'), chalk_1.default.bgGreen.black(` ${module || 'project'} `), chalk_1.default.green.bold('version'), chalk_1.default.bgGreen.black(` ${version} `));
40
- });
81
+ }, { skipInit: true });
41
82
  const validate = makeEvent(async (sv) => {
42
- const result = await sv.buildGraph();
43
- Object.entries(result).forEach(([name, entry]) => {
44
- if (!entry.used.includes(entry.version) && entry.versions.length === 0) {
45
- log_1.log.message(chalk_1.default.yellow('⚠️ WARN: Module'), chalk_1.default.bgYellow.black(` ${name} `), chalk_1.default.yellow('does not contain any version tag!'));
46
- }
47
- });
83
+ sv.getResolution();
48
84
  log_1.log.message(chalk_1.default.green.bold('Everything is up to date!🔥'));
49
85
  });
50
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
51
86
  exports.s = yargs_1.default.scriptName('sv')
52
- .usage('$0 <cmd> [args]')
53
- .command(['validate', '$0', 'v'], 'Validate and install modules', () => { }, validate)
54
- .command(['update', 'u'], 'Update git modules to actual versions', () => { }, update)
55
- .command(['install <url> [target]', 'i'], 'Install new submodule', y => y.positional('url', {
87
+ .usage('$0 [cmd] [args]')
88
+ .option('modules-dir', {
89
+ type: 'string',
90
+ describe: 'Directory where submodules live'
91
+ + ' (stored in package.json as sv-dir)',
92
+ })
93
+ .command(['$0'], 'Validate and install modules', () => { }, validate)
94
+ .command(['update [path]', 'u'], 'Update modules to the latest allowed versions', y => y.positional('path', {
56
95
  type: 'string',
57
- describe: 'Git submodule url',
96
+ describe: 'Module path (A.B.C), all modules when omitted',
97
+ }), update)
98
+ .command(['put <url> [target]', 'install', 'i'], 'Install a submodule or change its version', y => y.positional('url', {
99
+ type: 'string',
100
+ describe: 'Git submodule url or installed module name',
58
101
  }).positional('target', {
59
102
  type: 'string',
60
- describe: 'Target module name',
61
- }), install)
62
- .command(['remove <name>', 'r'], 'Remove submodule by name', y => y.positional('name', {
103
+ describe: 'Parent module name',
104
+ }).option('ver', {
105
+ type: 'string',
106
+ alias: 'v',
107
+ describe: 'Version to install',
108
+ }), put)
109
+ .command(['delete <path>', 'remove', 'r'], 'Delete submodule by path', y => y.positional('path', {
110
+ type: 'string',
111
+ describe: 'Submodule path (A.B.C)',
112
+ }), del)
113
+ .command(['list-versions [name]', 'ls'], 'List available versions of all modules or one', y => y.positional('name', {
63
114
  type: 'string',
64
- describe: 'Submodule name',
65
- }), remove)
115
+ describe: 'Module name',
116
+ }).option('installed', {
117
+ type: 'boolean',
118
+ describe: 'Show installed versions instead of available',
119
+ }), listVersions)
66
120
  .command(['publish [module]', 'p'], 'Commit, tag and push a new version', y => y.positional('module', {
67
121
  type: 'string',
68
122
  describe: 'Module name (project itself when omitted)',
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../runner/runner.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAC1B,gCAA4B;AAC5B,+BAA4B;AAC5B,iDAA8C;AAE9C,MAAM,QAAQ,GAAG,SAAS,CAAC;AAE3B,MAAM,SAAS,GAAG,CAAC,KAA0C,EAAE,EAAE;IAC/D,MAAM,EAAE,GAAG,IAAI,QAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAE3C,OAAO,KAAK,EAAE,GAAQ,EAAE,EAAE;QACxB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAoB,CAAC;QAE7C,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX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,CAAC,SAAS,EAAE;IACnB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,gBAAgB;CAC3B,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE;IACpB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,+CAA+C;CAC1D,CAAC,EACF,OAAO,CACR;KACA,IAAI,EAAE;KACN,IAAI,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { IEntrySource, TDependencies, TPubGrubResult } from './types';
2
+ export declare class PubGrub {
3
+ private source;
4
+ private entries;
5
+ private incompatibilities;
6
+ private incompatibilityKeys;
7
+ constructor(source?: IEntrySource);
8
+ resolve: (rootDependencies: TDependencies) => Promise<TPubGrubResult>;
9
+ private search;
10
+ private propagate;
11
+ private relation;
12
+ private candidates;
13
+ private addDependencies;
14
+ private load;
15
+ private addIncompatibility;
16
+ private learn;
17
+ private conflictFrom;
18
+ private derivedRequirement;
19
+ private requirement;
20
+ private addRequirement;
21
+ private findSelectedConflict;
22
+ private versionConflict;
23
+ private assertConstraint;
24
+ private toError;
25
+ }
26
+ export declare const pubGrub: {
27
+ resolve: (rootDependencies: TDependencies) => Promise<TPubGrubResult>;
28
+ };