submodule-version 2.4.1 → 3.1.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 (124) hide show
  1. package/README.md +117 -39
  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 +29 -0
  22. package/dist/src/errors.js +31 -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/npm.d.ts +3 -0
  49. package/dist/src/npm.js +25 -0
  50. package/dist/src/npm.js.map +1 -0
  51. package/dist/src/printError.d.ts +1 -0
  52. package/dist/src/printError.js +162 -0
  53. package/dist/src/printError.js.map +1 -0
  54. package/dist/src/sv.d.ts +16 -8
  55. package/dist/src/sv.js +242 -142
  56. package/dist/src/sv.js.map +1 -1
  57. package/dist/src/versionUtil/index.d.ts +2 -0
  58. package/dist/src/versionUtil/index.js +6 -0
  59. package/dist/src/versionUtil/index.js.map +1 -0
  60. package/dist/src/versionUtil/versionUtil.d.ts +16 -0
  61. package/dist/src/versionUtil/versionUtil.js +70 -0
  62. package/dist/src/versionUtil/versionUtil.js.map +1 -0
  63. package/package.json +4 -2
  64. package/runner/handleErrors/handleErrors.ts +3 -10
  65. package/runner/runner.ts +128 -46
  66. package/src/PubGrub/PubGrub.ts +578 -0
  67. package/src/PubGrub/__tests__/PubGrub.test.ts +351 -0
  68. package/src/PubGrub/index.ts +12 -0
  69. package/src/PubGrub/types.ts +72 -0
  70. package/src/__tests__/entryStore.test.ts +248 -0
  71. package/src/__tests__/printError.test.ts +148 -0
  72. package/src/__tests__/sv.test.ts +497 -0
  73. package/src/entryStore.ts +212 -0
  74. package/src/errors.ts +40 -0
  75. package/src/git/api/GithubError.ts +5 -0
  76. package/src/git/api/api.ts +180 -0
  77. package/src/git/api/index.ts +3 -0
  78. package/src/git/git.ts +8 -396
  79. package/src/git/index.ts +1 -0
  80. package/src/git/local/index.ts +1 -0
  81. package/src/git/local/local.ts +430 -0
  82. package/src/index.ts +17 -0
  83. package/src/npm.ts +25 -0
  84. package/src/printError.ts +193 -0
  85. package/src/sv.ts +327 -145
  86. package/src/versionUtil/__tests__/versionUtil.test.ts +62 -0
  87. package/src/versionUtil/index.ts +2 -0
  88. package/src/versionUtil/versionUtil.ts +103 -0
  89. package/tsconfig.json +1 -1
  90. package/dist/runner/handleErrors/handleBuildGraphError.d.ts +0 -1
  91. package/dist/runner/handleErrors/handleBuildGraphError.js +0 -42
  92. package/dist/runner/handleErrors/handleBuildGraphError.js.map +0 -1
  93. package/dist/runner/handleErrors/handleGitError.d.ts +0 -1
  94. package/dist/runner/handleErrors/handleGitError.js +0 -27
  95. package/dist/runner/handleErrors/handleGitError.js.map +0 -1
  96. package/dist/runner/handleErrors/handleInstallError.d.ts +0 -1
  97. package/dist/runner/handleErrors/handleInstallError.js +0 -30
  98. package/dist/runner/handleErrors/handleInstallError.js.map +0 -1
  99. package/dist/src/__tests__/versionUtil.test.d.ts +0 -1
  100. package/dist/src/__tests__/versionUtil.test.js +0 -80
  101. package/dist/src/__tests__/versionUtil.test.js.map +0 -1
  102. package/dist/src/buildGraph/GraphError.d.ts +0 -11
  103. package/dist/src/buildGraph/GraphError.js +0 -11
  104. package/dist/src/buildGraph/GraphError.js.map +0 -1
  105. package/dist/src/buildGraph/buildGraph.d.ts +0 -8
  106. package/dist/src/buildGraph/buildGraph.js +0 -100
  107. package/dist/src/buildGraph/buildGraph.js.map +0 -1
  108. package/dist/src/buildGraph/index.d.ts +0 -2
  109. package/dist/src/buildGraph/index.js +0 -8
  110. package/dist/src/buildGraph/index.js.map +0 -1
  111. package/dist/src/git/__tests__/parseGitUrl.test.d.ts +0 -1
  112. package/dist/src/git/__tests__/parseGitUrl.test.js +0 -30
  113. package/dist/src/git/__tests__/parseGitUrl.test.js.map +0 -1
  114. package/dist/src/versionUtil.d.ts +0 -13
  115. package/dist/src/versionUtil.js +0 -79
  116. package/dist/src/versionUtil.js.map +0 -1
  117. package/runner/handleErrors/handleBuildGraphError.ts +0 -49
  118. package/runner/handleErrors/handleGitError.ts +0 -28
  119. package/runner/handleErrors/handleInstallError.ts +0 -26
  120. package/src/__tests__/versionUtil.test.ts +0 -96
  121. package/src/buildGraph/GraphError.ts +0 -12
  122. package/src/buildGraph/buildGraph.ts +0 -150
  123. package/src/buildGraph/index.ts +0 -2
  124. package/src/versionUtil.ts +0 -97
package/README.md CHANGED
@@ -6,90 +6,149 @@
6
6
 
7
7
  `Submodule version` is a tool to manage git submodules as versioned packages.
8
8
 
9
- This tool designed to split projects in-to submodules *without npm-packages headache*.
9
+ This tool is designed to split projects into submodules *without npm-packages headache*.
10
10
 
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.
11
+ With `submodule version` code can be organized like a *single monorepo*, but each submodule can be *easily reused* in other projects like an npm package.
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.
12
14
 
13
15
  ## Problem to solve
14
16
 
15
- Take a look on the next situation:
17
+ Take a look at the following situation:
16
18
 
17
19
  - Project has 2 submodules `ui-button-element` and `render-engine`
18
- - Package `ui-button-element` dependents on the `render-engine`
19
- - Third repo `ui-slider-element` dependets on newest version of the `render-engine` and not included in the project
20
+ - Package `ui-button-element` depends on the `render-engine`
21
+ - Third repo `ui-slider-element` depends on the newest version of the `render-engine` and is not included in the project
20
22
 
21
- This cause next problems:
23
+ This causes the following problems:
22
24
 
23
- - Add submodule `ui-slider-element` cause difficulties with handle different `render-engine` versions
24
- - Manual swithing branches in submodules with big codebase can confuse
25
- - Updated `ui-button-element` with new version of `render-engine` should be used in another project with the same version
25
+ - Adding the submodule `ui-slider-element` causes difficulties handling different `render-engine` versions
26
+ - Manually switching branches in submodules with a big codebase is confusing
27
+ - An updated `ui-button-element` with a new version of `render-engine` should be used in another project with the same version
26
28
 
27
29
  Submodule version helps to
28
30
 
29
31
  - Handle which project should be updated and which version should be installed
30
- - Help update submodules and theirs dependencies
32
+ - Help update submodules and their dependencies
31
33
  - Install new submodules
32
34
 
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>`
43
- - Install npm dependencies `npm i`. Submodule will be linked in node_modules and its dependencies will be installed
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`, and `npm install` runs automatically, so the submodule is linked in node_modules and its dependencies are installed
44
40
  - Use your submodule in code `import submodule from 'submodule-name'` 🔥
45
41
 
42
+ ### GitHub token
43
+
44
+ `sv` lists module versions through the GitHub GraphQL API, which does not work anonymously — a token is required:
45
+
46
+ 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.
47
+ 2. Export it before running `sv`:
48
+
49
+ ```
50
+ export GITHUB_TOKEN=<your_token>
51
+ ```
52
+
53
+ or pass it via the JS API: `new SV(process.cwd(), 'modules', { githubToken: '<your_token>' })`.
54
+
55
+ 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.
56
+
46
57
  ## How it works
47
58
 
48
- - 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
59
+ - Each submodule and the main project has its own `package.json` with `sv` object inside. `sv` object will be generated automatically and will contain every dependency version
49
60
  ```
50
61
  "sv": {
51
62
  "git@github.com:guljeny/submodule-version.git": "^1.0.0"
52
63
  }
53
64
  ```
54
- - Each submodule has a [version](#versioning) tags, and `sv` use list of this tags to resolve dependencies
65
+ - Each submodule has [version](#versioning) tags, and `sv` uses the list of these tags to resolve dependencies
55
66
  - 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
67
+ - `Submodule version` resolves the newest compatible set with PubGrub and loads nested repositories only when a selected version requires them
57
68
  - `sv` never switches a submodule version if it has uncommitted changes or unpushed commits — your local work is always kept intact 🧯
69
+ - After modules are installed, switched or removed, `sv` runs `npm install` automatically — no manual `npm i` is needed (on plain `npx sv` it runs only when something actually changed)
58
70
 
59
71
  ## Versioning
60
72
 
61
- Sumodules without specified version tags will be installed with ref to the latest commit. You should manage them manually.
73
+ Submodules without specified version tags will be installed with a ref to the latest commit. You should manage them manually.
62
74
 
63
- To add new version in submodule:
64
- - Specify version in `package.json`
65
- - Add and push git tag with the same version (`git tag 1.0.1`)
75
+ To add a new version to a submodule:
76
+ - Specify the version in `package.json`
77
+ - Add and push a git tag with the same version (`git tag 1.0.1`)
66
78
 
67
79
  Or use the [`publish`](#programmatic-api) API, which bumps the version, commits, tags and pushes in one call.
68
80
 
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';
84
100
 
85
- const sv = new SV(process.cwd(), 'modules');
101
+ const sv = new SV(process.cwd(), 'modules', { githubToken: '…' });
102
+ await sv.init();
103
+
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, and runs `npm install` when anything changed. All mutations (`put`, `delete`, updates) run `npm install` automatically after applying.
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.
89
115
 
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
116
+ ### Installing, updating and deleting modules
117
+
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
 
@@ -116,10 +175,29 @@ const sv = new SV(process.cwd(), 'modules');
116
175
 
117
176
  ### Version utilities
118
177
 
119
- `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
+ ```
120
198
 
121
- ## Submodule dependencies
199
+ ## Submodule dependencies
122
200
 
123
- Sumbodules can contains their own dependencies specified in `package.json` as `sv` object.
201
+ Submodules can contain their own dependencies specified in `package.json` as `sv` object.
124
202
 
125
- To install submodule in submodule run `npx install <git_url> [target_submodule]`
203
+ To install a submodule into a 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,IAAA,2BAAY,EAAC,CAAU,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;IAC1C,MAAM,EAAE,GA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AAC,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
+ };