@_linked/cli 1.45.5 → 1.46.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/CHANGELOG.md +20 -0
- package/defaults/app-react-native/README.md +6 -3
- package/defaults/app-react-native/apps/mobile/__tests__/nativeDefaults.test.tsx +4 -2
- package/defaults/app-react-native/apps/mobile/package.json +6 -5
- package/defaults/app-react-native/apps/mobile/src/components/PersonOverview.tsx +2 -1
- package/defaults/app-react-native/apps/mobile/src/components/PersonPreview.tsx +5 -3
- package/defaults/app-react-native/package.json +4 -1
- package/defaults/app-react-native/packages/app-shapes/package.json +2 -2
- package/defaults/app-react-native/scripts/check-react.mjs +2 -2
- package/defaults/app-react-native/services/api/README.md +3 -3
- package/defaults/app-react-native/services/api/package.json +9 -8
- package/defaults/package/package.json +2 -6
- package/lib/esm/cli-methods.d.ts +1 -1
- package/lib/esm/cli-methods.d.ts.map +1 -1
- package/lib/esm/cli-methods.js +91 -154
- package/lib/esm/cli-methods.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.46.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#250](https://github.com/linked-fw/cli/pull/250) [`293c265`](https://github.com/linked-fw/cli/commit/293c265b166a99ca5ebf3ed6d5cc966cd35ca4e0) Thanks [@flyon](https://github.com/flyon)! - `linked create-app --template react-native` now scaffolds an app on `@_linked/react` 2 and the framework releases built on it: `@_linked/react` 2.0.1 (was 1.6.4), `@_linked/schema` 1.5.0 (was 1.4.0), `@_linked/core` 2.28.1 (was 2.26.0; React 2 needs `^2.27.0`), `@_linked/server` 2.24.8, `@_linked/server-utils` 1.12.3, `@_linked/fuseki` 3.4.2, `@_linked/s3` 1.6.2 and `@_linked/cli` 1.45.6. The pins stay exact. `npm ls @_linked/react --all` in a new app shows only 2.0.1; before, `@_linked/primitives` 1.8.0 (through `@_linked/schema`) installed a second copy, 2.0.1, next to the app's 1.6.4.
|
|
8
|
+
|
|
9
|
+
A new app also has one React again. `@_linked/server` 2.24.5 and later take `react` and `react-dom` as peers, and npm resolved the peers of hoisted packages to the newest React (19.3.0) at the root, nesting the app's 19.2.3 under `apps/mobile`, so `npm run check:react` failed and `@_linked/react` loaded a different React from the app. The root `package.json` now pins `react` 19.2.3, `services/api` pins `react` next to its `react-dom`, and `apps/mobile` pins `react-dom` 19.2.3 (without it, `npm install` failed with `ERESOLVE`: `react-dom@19.3.0` wants `react@^19.3.0`).
|
|
10
|
+
|
|
11
|
+
With React 2, mounted components refetch after a mutation and identical queries share one request. The template's `nativeDefaults` test gives its loading and error cases a subject each, because the error case otherwise joined the loading case's request, which never settles. Existing apps are not changed.
|
|
12
|
+
|
|
13
|
+
Minor rather than patch: the CLI's commands do not change, but a newly generated app runs on a new major of `@_linked/react`, with its reactive refetching.
|
|
14
|
+
|
|
15
|
+
## 1.45.6
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#245](https://github.com/linked-fw/cli/pull/245) [`85edc51`](https://github.com/linked-fw/cli/commit/85edc51e0a47b23d5c785ff4e2a16b2018b0ae4a) Thanks [@flyon](https://github.com/flyon)! - `linked build-all` keeps building after a failure. A package whose build fails no longer stops the run when other packages depend on it: its dependents (direct and transitive) are skipped and reported as "not built because <package> failed", every package that does not depend on it is still built, and the run ends with one summary listing what was built, what failed and what was not built, then exits 1. A run where everything builds still exits 0. A dependency cycle that leaves packages unbuilt now also exits 1.
|
|
20
|
+
|
|
21
|
+
- [#245](https://github.com/linked-fw/cli/pull/245) [`a7a6a29`](https://github.com/linked-fw/cli/commit/a7a6a291dda37f66659265e72b42334e25a72937) Thanks [@flyon](https://github.com/flyon)! - `linked create-package` now scaffolds `"build": "linked build"`, so a new package builds with the CLI's own pipeline (ESM compile, asset copy, import specifier rewrite and shape checks) instead of a hand-written `tsc` and copy chain. The template drops the `build-esm` and `copy-to-lib` scripts and the `rimraf` and `copyfiles` devDependencies, and requires `@_linked/cli` `^1.45.0`. Existing packages are not changed.
|
|
22
|
+
|
|
3
23
|
## 1.45.5
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -60,9 +60,12 @@ cd apps/mobile && npx expo export --platform ios --output-dir /tmp/export
|
|
|
60
60
|
|
|
61
61
|
## React Native specifics
|
|
62
62
|
|
|
63
|
-
- **One React.**
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
- **One React.** React is a peer of the `@_linked/*` packages, and npm resolves the peers of hoisted packages
|
|
64
|
+
at the repo root. Without a pin there, npm puts the newest React at the root and nests the app's 19.2.3
|
|
65
|
+
under `apps/mobile`, so `@_linked/react` and `react-native` would load a different React from the app.
|
|
66
|
+
The root `package.json` therefore pins `react` to the same version as `apps/mobile`, and every workspace
|
|
67
|
+
that depends on `@_linked/server` pins `react-dom` with it. `npm run check:react` verifies the result. Do
|
|
68
|
+
not use `--legacy-peer-deps`: it would hide a duplicate React.
|
|
66
69
|
- **Workspaces are enumerated**, never globbed, so foreign repositories checked out under `packages/` are not
|
|
67
70
|
adopted. `.gitignore` uses `packages/*` plus a negation per workspace package (`packages/` cannot be negated).
|
|
68
71
|
- **Metro** (`apps/mobile/metro.config.js`) watches the workspace root and searches both `node_modules`
|
|
@@ -45,7 +45,7 @@ const flush = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
|
45
45
|
describe('@_linked/react/native render defaults', () => {
|
|
46
46
|
test('a loading component renders only React Native elements', async () => {
|
|
47
47
|
mode = 'loading';
|
|
48
|
-
await render(<ExampleLabel of={{ id: 'urn:example:
|
|
48
|
+
await render(<ExampleLabel of={{ id: 'urn:example:loading' }} />);
|
|
49
49
|
|
|
50
50
|
expect(lowercaseHostTypes(screen.toJSON() as any)).toEqual([]);
|
|
51
51
|
expect(screen.getByTestId('linked-loader')).toBeTruthy();
|
|
@@ -53,7 +53,9 @@ describe('@_linked/react/native render defaults', () => {
|
|
|
53
53
|
|
|
54
54
|
test('a failed component renders only React Native elements', async () => {
|
|
55
55
|
mode = 'error';
|
|
56
|
-
|
|
56
|
+
// A subject of its own: @_linked/react shares one request per query and subject, so reusing the loading
|
|
57
|
+
// test's subject would join its request, which never settles, and never reach the error state.
|
|
58
|
+
await render(<ExampleLabel of={{ id: 'urn:example:error' }} />);
|
|
57
59
|
// Let the rejected query settle and the component re-render into its error state.
|
|
58
60
|
await act(flush);
|
|
59
61
|
|
|
@@ -11,15 +11,16 @@
|
|
|
11
11
|
"test:integration": "jest -c jest.integration.config.js --runInBand"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@_linked/core": "2.
|
|
15
|
-
"@_linked/react": "
|
|
16
|
-
"@_linked/schema": "1.
|
|
17
|
-
"@_linked/server": "2.24.
|
|
14
|
+
"@_linked/core": "2.28.1",
|
|
15
|
+
"@_linked/react": "2.0.1",
|
|
16
|
+
"@_linked/schema": "1.5.0",
|
|
17
|
+
"@_linked/server": "2.24.8",
|
|
18
18
|
"app-shapes": "*",
|
|
19
19
|
"expo": "57.0.25",
|
|
20
20
|
"expo-constants": "57.0.19",
|
|
21
21
|
"expo-dev-client": "57.0.19",
|
|
22
22
|
"react": "19.2.3",
|
|
23
|
+
"react-dom": "19.2.3",
|
|
23
24
|
"react-native": "0.86.3"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"@types/react": "19.2.18",
|
|
30
31
|
"jest": "29.7.0",
|
|
31
32
|
"jest-expo": "57.0.5",
|
|
32
|
-
"test-renderer": "1.
|
|
33
|
+
"test-renderer": "1.3.0",
|
|
33
34
|
"typescript": "6.0.3"
|
|
34
35
|
},
|
|
35
36
|
"jest": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Example PersonOverview — demonstrates @_linked/react's data binding:
|
|
2
2
|
// linkedSetComponent for the list (auto-runs the query, injects results and
|
|
3
3
|
// an injected _refresh); linkedComponent for each row (see PersonPreview).
|
|
4
|
-
//
|
|
4
|
+
// The list refetches by itself after Person.create; the form also calls the
|
|
5
|
+
// list's _refresh() through context, to show how to re-run a query by hand.
|
|
5
6
|
// A React Native port of the web app-template's example (linked-fw/app-template).
|
|
6
7
|
//
|
|
7
8
|
// `linkedSetComponent` checks LinkedStorage when this module loads, so storage is imported first.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Example PersonPreview — single-Person row. Demonstrates @_linked/react's
|
|
2
2
|
// linkedComponent: the wrapper runs the per-row query and injects query
|
|
3
|
-
// result keys + `source` + `_refresh` into the render function.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// result keys + `source` + `_refresh` into the render function. After a
|
|
4
|
+
// mutation, every mounted component whose query can read the changed data
|
|
5
|
+
// refetches by itself; _refresh patches the shared cached result first, for
|
|
6
|
+
// optimistic UI, and on delete the PersonListRefresh context re-runs the list
|
|
7
|
+
// explicitly.
|
|
6
8
|
// A React Native port of the web app-template's example (linked-fw/app-template).
|
|
7
9
|
// Storage is imported first, so the row's queries go to the API store however this module is reached.
|
|
8
10
|
import '../shell/storage';
|
|
@@ -16,9 +16,12 @@
|
|
|
16
16
|
"test": "npm test -w apps/mobile && npm test -w services/api",
|
|
17
17
|
"test:integration": "npm run test:integration -w apps/mobile"
|
|
18
18
|
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"react": "19.2.3"
|
|
21
|
+
},
|
|
19
22
|
"devDependencies": {
|
|
20
23
|
"eslint": "9.39.5",
|
|
21
24
|
"eslint-config-expo": "57.0.2",
|
|
22
|
-
"typescript-eslint": "8.
|
|
25
|
+
"typescript-eslint": "8.71.0"
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// One React for the app: `react` resolved from apps/mobile, from the installed @_linked/react and from react-native
|
|
3
|
-
// must be the same file. `npm ls react
|
|
4
|
-
//
|
|
3
|
+
// must be the same file. It checks resolution rather than `npm ls react`, because what matters is the file each
|
|
4
|
+
// of them loads: a second copy nested under apps/mobile (see the README) passes `npm ls` and still splits React.
|
|
5
5
|
import { existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
7
|
import { dirname, join, resolve } from 'node:path';
|
|
@@ -39,9 +39,9 @@ that port is the one Docker Compose publishes for this repo's `fuseki` service.
|
|
|
39
39
|
|
|
40
40
|
## Dependencies
|
|
41
41
|
|
|
42
|
-
`react-dom`
|
|
43
|
-
at load time, and
|
|
44
|
-
|
|
42
|
+
`react` and `react-dom` are direct dependencies although the API renders no pages: `LinkedServer` imports
|
|
43
|
+
`react-dom/server` at load time, and `@_linked/server` takes both as peers. They are pinned to the React that
|
|
44
|
+
`apps/mobile` uses (19.2.3), so npm installs one copy of each at the root instead of the newest release.
|
|
45
45
|
|
|
46
46
|
`linked start` finds the hoisted `app-shapes` workspace and runs in workspace mode: Vite loads `app-shapes` from
|
|
47
47
|
`src` through its `development` export condition, while published packages such as `@_linked/core` and
|
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
"test": "node --experimental-strip-types --no-warnings=ExperimentalWarning --test test/*.test.mjs"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@_linked/core": "2.
|
|
18
|
-
"@_linked/fuseki": "3.4.
|
|
19
|
-
"@_linked/s3": "1.6.
|
|
20
|
-
"@_linked/schema": "1.
|
|
21
|
-
"@_linked/server": "2.24.
|
|
22
|
-
"@_linked/server-utils": "1.12.
|
|
17
|
+
"@_linked/core": "2.28.1",
|
|
18
|
+
"@_linked/fuseki": "3.4.2",
|
|
19
|
+
"@_linked/s3": "1.6.2",
|
|
20
|
+
"@_linked/schema": "1.5.0",
|
|
21
|
+
"@_linked/server": "2.24.8",
|
|
22
|
+
"@_linked/server-utils": "1.12.3",
|
|
23
23
|
"app-shapes": "*",
|
|
24
|
+
"react": "19.2.3",
|
|
24
25
|
"react-dom": "19.2.3"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@_linked/cli": "1.
|
|
28
|
-
"@types/node": "22.20.
|
|
28
|
+
"@_linked/cli": "1.45.6",
|
|
29
|
+
"@types/node": "22.20.5",
|
|
29
30
|
"typescript": "6.0.3"
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -24,9 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"start": "linked dev",
|
|
27
|
-
"build": "
|
|
28
|
-
"build-esm": "echo \"compiling ESM\" && rimraf ./lib/esm && tsc -p tsconfig-esm.json",
|
|
29
|
-
"copy-to-lib": "echo 'copying CSS + JSON assets to lib folder' && copyfiles -u 1 'src/**/*.css' 'src/**/*.json' lib/esm"
|
|
27
|
+
"build": "linked build"
|
|
30
28
|
},
|
|
31
29
|
"keywords": [
|
|
32
30
|
"linked",
|
|
@@ -60,9 +58,7 @@
|
|
|
60
58
|
},
|
|
61
59
|
"devDependencies": {
|
|
62
60
|
"@types/node": "^22.13.14",
|
|
63
|
-
"@_linked/cli": "^1.
|
|
64
|
-
"copyfiles": "^2.4.1",
|
|
65
|
-
"rimraf": "^5.0.7",
|
|
61
|
+
"@_linked/cli": "^1.45.0",
|
|
66
62
|
"typescript": "^5.7.3"
|
|
67
63
|
}
|
|
68
64
|
}
|
package/lib/esm/cli-methods.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export declare function warn(...messages: any[]): void;
|
|
|
84
84
|
export declare function logError(...errors: any[]): void;
|
|
85
85
|
export declare function developPackage(target: any, mode: any): void;
|
|
86
86
|
export declare function runOnPackagesGroupedByDependencies(lincdPackages: any, onBuildStack: (packageGroup: any, dependencies: any) => (pkg: PackageDetails) => Promise<any>, onStackEnd: any, sync?: boolean): Promise<void>;
|
|
87
|
-
export declare function buildAll(options: any): void
|
|
87
|
+
export declare function buildAll(options: any): Promise<void>;
|
|
88
88
|
export declare const createOntology: (prefix: any, uriBase?: any, basePath?: string) => Promise<void>;
|
|
89
89
|
export declare const addShapeToBarrel: (shapeHyphenName: string, root?: string) => string;
|
|
90
90
|
export declare const addLineToIndex: (line: any, insertMatchString: string, root?: string, insertAtStart?: boolean) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-methods.d.ts","sourceRoot":"","sources":["../../src/cli-methods.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,kCAAkC,CAAC;AAmB1C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAuDpD;;;;;;GAMG;AAKH,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,GACb,CAAC;AAoBF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,cAAc,CAAC;AAEjD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,SAAI,EAAE,iBAAwB,EAAE,UAAS;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,WAAW,CAAA;CAAM,kBA4LtL,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAcR;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QA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@ export function buildAll(options) {
|
|
|
802
802
|
//
|
|
803
803
|
// // return async (pkg) => {};
|
|
804
804
|
// }
|
|
805
|
+
// Successfully built (or deliberately passed over by --from).
|
|
805
806
|
let done = new Set();
|
|
806
|
-
|
|
807
|
+
// Packages whose own build script failed.
|
|
808
|
+
let failed = new Set();
|
|
809
|
+
// Packages not built because a dependency failed or was itself not built,
|
|
810
|
+
// mapped to the failed package(s) at the root of that chain.
|
|
811
|
+
let notBuilt = new Map();
|
|
807
812
|
progressUpdate(lincdPackages.size + ' packages left');
|
|
808
813
|
let packagesLeft = lincdPackages.size;
|
|
809
|
-
|
|
810
|
-
runOnPackagesGroupedByDependencies(lincdPackages, (packageGroup, dependencies) => {
|
|
814
|
+
const finished = runOnPackagesGroupedByDependencies(lincdPackages, (packageGroup, dependencies) => {
|
|
811
815
|
if (done.size > 0) {
|
|
812
816
|
debugInfo(chalk.magenta('\n-------\nThese packages are next, since all their dependencies have now been build:'));
|
|
813
|
-
// log(stack);
|
|
814
817
|
}
|
|
815
818
|
debugInfo('Now building: ' + chalk.blue(packageGroup.map((i) => i.packageName)));
|
|
816
819
|
return (pkg) => __awaiter(this, void 0, void 0, function* () {
|
|
817
|
-
var _a;
|
|
820
|
+
var _a, _b;
|
|
821
|
+
// A package whose dependency failed (directly or further down the
|
|
822
|
+
// chain) cannot be built against it. Report it instead of building it,
|
|
823
|
+
// and keep building everything else.
|
|
824
|
+
const causes = new Set();
|
|
825
|
+
for (const dep of dependencies.get(pkg) || []) {
|
|
826
|
+
if (typeof dep === 'string')
|
|
827
|
+
continue;
|
|
828
|
+
if (failed.has(dep))
|
|
829
|
+
causes.add(dep.packageName);
|
|
830
|
+
(_a = notBuilt.get(dep)) === null || _a === void 0 ? void 0 : _a.forEach((c) => causes.add(c));
|
|
831
|
+
}
|
|
832
|
+
if (causes.size > 0) {
|
|
833
|
+
const roots = [...causes];
|
|
834
|
+
notBuilt.set(pkg, roots);
|
|
835
|
+
packagesLeft--;
|
|
836
|
+
console.log(chalk.yellow(`Not building ${pkg.packageName} because ${roots.join(', ')} failed`));
|
|
837
|
+
return undefined;
|
|
838
|
+
}
|
|
818
839
|
let command;
|
|
819
840
|
let skipping = false;
|
|
820
841
|
//if we're skipping builds until a certain package
|
|
821
842
|
if (!building) {
|
|
822
843
|
//if the package name matches the package we're supposed to start from then start building packages
|
|
823
|
-
if (pkg.packageName == startFrom
|
|
844
|
+
if (pkg.packageName == startFrom) {
|
|
824
845
|
building = true;
|
|
825
846
|
}
|
|
826
847
|
//else still waiting for the package
|
|
@@ -841,7 +862,7 @@ export function buildAll(options) {
|
|
|
841
862
|
// packages inside an existing yarn workspace still build with yarn.
|
|
842
863
|
const pkgDir = path.join(process.cwd(), pkg.path);
|
|
843
864
|
const pkgJson = getPackageJSON(pkgDir);
|
|
844
|
-
const hasBuildScript = !!((
|
|
865
|
+
const hasBuildScript = !!((_b = pkgJson === null || pkgJson === void 0 ? void 0 : pkgJson.scripts) === null || _b === void 0 ? void 0 : _b.build);
|
|
845
866
|
if (!hasBuildScript) {
|
|
846
867
|
// No build script — skip gracefully (e.g. a pure-assets package).
|
|
847
868
|
command = Promise.resolve(true);
|
|
@@ -867,164 +888,80 @@ export function buildAll(options) {
|
|
|
867
888
|
log(chalk.cyan('Building ' + pkg.packageName));
|
|
868
889
|
process.stdout.write(packagesLeft + ' packages left\r');
|
|
869
890
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
// if (res !== '' && res !== true && res !== false) {
|
|
877
|
-
if (typeof res === 'undefined') {
|
|
878
|
-
failedModules.push(pkg.packageName);
|
|
879
|
-
let dependentModules = getDependentPackages(dependencies, pkg);
|
|
880
|
-
if (dependentModules.length > 0) {
|
|
881
|
-
printBuildResults(failedModules, done);
|
|
882
|
-
console.log('Stopping build process because an error occurred whilst building ' +
|
|
883
|
-
pkg.packageName +
|
|
884
|
-
', which ' +
|
|
885
|
-
dependentModules.length +
|
|
886
|
-
' other packages depend on.'); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
887
|
-
log('Run ' +
|
|
888
|
-
chalk.greenBright(`linked build-all --from=${pkg.packageName}`) +
|
|
889
|
-
' to build only the remaining packages'); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
890
|
-
process.exit(1);
|
|
891
|
-
}
|
|
892
|
-
// A failed package with no dependents still counts towards the
|
|
893
|
-
// total, or the summary and exit code are never reached.
|
|
894
|
-
packagesLeft--;
|
|
895
|
-
if (packagesLeft == 0) {
|
|
896
|
-
printBuildResults(failedModules, done);
|
|
897
|
-
process.exit(1);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
else {
|
|
901
|
-
if (!skipping) {
|
|
902
|
-
log(chalk.green('Built ' + pkg.packageName) +
|
|
903
|
-
(res === false ? chalk.redBright(' (with warnings)') : ''));
|
|
904
|
-
}
|
|
905
|
-
done.add(pkg);
|
|
906
|
-
packagesLeft--;
|
|
907
|
-
// log(chalk.magenta(packagesLeft + ' packages left'));
|
|
908
|
-
process.stdout.write(packagesLeft + ' packages left\r');
|
|
909
|
-
if (packagesLeft == 0) {
|
|
910
|
-
printBuildResults(failedModules, done);
|
|
911
|
-
if (failedModules.length > 0) {
|
|
912
|
-
process.exit(1);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
return res;
|
|
916
|
-
}
|
|
917
|
-
})
|
|
918
|
-
.catch(({ error, stdout, stderr }) => {
|
|
919
|
-
logError(chalk.red('Failed to build ' + pkg.packageName));
|
|
920
|
-
console.log(stdout);
|
|
921
|
-
process.exit(1);
|
|
922
|
-
// let dependentModules = getDependentP
|
|
923
|
-
});
|
|
924
|
-
//undefined result means it failed
|
|
925
|
-
/*if (typeof res === 'undefined')
|
|
926
|
-
{
|
|
927
|
-
// .catch(({ error,stdout,stderr }) => {
|
|
928
|
-
//this prints out the webpack output, including the build errors
|
|
929
|
-
// warn('Failed to build ' + pkg.packageName);
|
|
930
|
-
// console.log(stdout);
|
|
931
|
-
failedModules.push(pkg.packageName);
|
|
932
|
-
let dependentModules = getDependentPackages(dependencies,pkg);
|
|
933
|
-
if (dependentModules.length > 0)
|
|
934
|
-
{
|
|
935
|
-
printBuildResults(failedModules,done);
|
|
936
|
-
console.log(
|
|
937
|
-
'Stopping build process because an error occurred whilst building ' +
|
|
938
|
-
pkg.packageName +
|
|
939
|
-
', which ' +
|
|
940
|
-
dependentModules.length +
|
|
941
|
-
' other packages depend on.',
|
|
942
|
-
); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
943
|
-
log(
|
|
944
|
-
'Run ' +
|
|
945
|
-
chalk.greenBright(`linked build-all --from=${pkg.packageName}`) +
|
|
946
|
-
' to build only the remaining packages',
|
|
947
|
-
); //"+dependentModules.map(d => d.packageName).join(", ")));
|
|
948
|
-
process.exit(1);
|
|
949
|
-
}
|
|
891
|
+
const res = yield command;
|
|
892
|
+
packagesLeft--;
|
|
893
|
+
//true is success, false is success with warnings, undefined is failure
|
|
894
|
+
if (typeof res === 'undefined') {
|
|
895
|
+
failed.add(pkg);
|
|
896
|
+
return undefined;
|
|
950
897
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
log(chalk.green('Built ' + pkg.packageName)+(res === false ? chalk.redBright(' (with warnings)') : ''));
|
|
959
|
-
}
|
|
960
|
-
done.add(pkg);
|
|
961
|
-
|
|
962
|
-
packagesLeft--;
|
|
963
|
-
// log(chalk.magenta(packagesLeft + ' packages left'));
|
|
964
|
-
process.stdout.write(packagesLeft + ' packages left\r');
|
|
965
|
-
if (packagesLeft == 0)
|
|
966
|
-
{
|
|
967
|
-
printBuildResults(failedModules,done);
|
|
968
|
-
if (failedModules.length > 0)
|
|
969
|
-
{
|
|
970
|
-
process.exit(1);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
return res;
|
|
975
|
-
}*/
|
|
976
|
-
// }).catch(err => {
|
|
977
|
-
// console.log(err);
|
|
978
|
-
// })
|
|
898
|
+
if (!skipping) {
|
|
899
|
+
log(chalk.green('Built ' + pkg.packageName) +
|
|
900
|
+
(res === false ? chalk.redBright(' (with warnings)') : ''));
|
|
901
|
+
}
|
|
902
|
+
done.add(pkg);
|
|
903
|
+
process.stdout.write(packagesLeft + ' packages left\r');
|
|
904
|
+
return res;
|
|
979
905
|
});
|
|
980
906
|
}, (dependencies) => {
|
|
981
907
|
//if no more packages to build but we never started building...
|
|
982
908
|
if (!building) {
|
|
983
909
|
console.log(chalk.red('Could not find the package to start from. Please provide a correct package name or package name to build from'));
|
|
910
|
+
process.exit(1);
|
|
911
|
+
return;
|
|
984
912
|
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
: chalk.red(d.packageName);
|
|
1006
|
-
})
|
|
1007
|
-
.join(', '));
|
|
1008
|
-
//also print some information why these packages have not been moved into the stack
|
|
1009
|
-
let stringDependencies = deps.filter((d) => typeof d === 'string');
|
|
1010
|
-
if (stringDependencies.length > 0) {
|
|
1011
|
-
console.log(chalk.red('And it depends on these package(s) - which seem not to be proper packages :' +
|
|
1012
|
-
stringDependencies.join(', ')));
|
|
1013
|
-
console.log(chalk.red('Could you remove this from dependencies? Should it be a devDependency?'));
|
|
1014
|
-
}
|
|
913
|
+
// Anything neither built, failed nor held back by a failure was never
|
|
914
|
+
// scheduled: its dependencies could not all be met, which points to a
|
|
915
|
+
// dependency cycle.
|
|
916
|
+
const unscheduled = Array.from(lincdPackages.values()).filter((pkg) => !done.has(pkg) && !failed.has(pkg) && !notBuilt.has(pkg));
|
|
917
|
+
if (unscheduled.length > 0) {
|
|
918
|
+
console.log(chalk.red('CYCLICAL DEPENDENCIES? - could not build some packages because they depend on each other.'));
|
|
919
|
+
for (const pkg of unscheduled) {
|
|
920
|
+
const deps = dependencies.get(pkg) || [];
|
|
921
|
+
console.log(chalk.red(pkg.packageName) +
|
|
922
|
+
' depends on ' +
|
|
923
|
+
deps
|
|
924
|
+
.filter((dependency) => typeof dependency !== 'string')
|
|
925
|
+
.map((d) => done.has(d) ? d.packageName : chalk.red(d.packageName))
|
|
926
|
+
.join(', '));
|
|
927
|
+
//also print some information why these packages have not been moved into the stack
|
|
928
|
+
const stringDependencies = deps.filter((d) => typeof d === 'string');
|
|
929
|
+
if (stringDependencies.length > 0) {
|
|
930
|
+
console.log(chalk.red('And it depends on these package(s) - which seem not to be proper packages :' +
|
|
931
|
+
stringDependencies.join(', ')));
|
|
932
|
+
console.log(chalk.red('Could you remove this from dependencies? Should it be a devDependency?'));
|
|
1015
933
|
}
|
|
1016
|
-
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
printBuildAllSummary(done, failed, notBuilt, unscheduled);
|
|
937
|
+
if (failed.size > 0 || notBuilt.size > 0 || unscheduled.length > 0) {
|
|
938
|
+
process.exit(1);
|
|
1017
939
|
}
|
|
1018
940
|
}, sync);
|
|
941
|
+
return finished;
|
|
1019
942
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
943
|
+
/**
|
|
944
|
+
* The end-of-run report of `build-all`: what was built, every package whose
|
|
945
|
+
* build failed, and every package that was not built because of one.
|
|
946
|
+
*/
|
|
947
|
+
function printBuildAllSummary(done, failed, notBuilt, unscheduled) {
|
|
948
|
+
printBuildResults([...failed].map((p) => p.packageName), done);
|
|
949
|
+
if (notBuilt.size > 0) {
|
|
950
|
+
warn(`Not built (${notBuilt.size}) because a dependency failed:\n` +
|
|
951
|
+
[...notBuilt]
|
|
952
|
+
.map(([pkg, roots]) => ` - ${chalk.red(pkg.packageName)}: not built because ${roots.join(', ')} failed`)
|
|
953
|
+
.join('\n') +
|
|
954
|
+
'\n');
|
|
955
|
+
}
|
|
956
|
+
if (unscheduled.length > 0) {
|
|
957
|
+
warn('Not built (dependency cycle): ' +
|
|
958
|
+
chalk.red(unscheduled.map((p) => p.packageName).join(', ')) +
|
|
959
|
+
'\n');
|
|
960
|
+
}
|
|
961
|
+
const problems = failed.size + notBuilt.size + unscheduled.length;
|
|
962
|
+
if (problems > 0) {
|
|
963
|
+
warn(chalk.red(`build-all finished with ${failed.size} failed and ${notBuilt.size + unscheduled.length} not built, out of ${done.size + problems} packages.`));
|
|
964
|
+
}
|
|
1028
965
|
}
|
|
1029
966
|
/**
|
|
1030
967
|
* Returns a map of the packages that this repository manages (so no packages found through the workspaces who's path contains ../ )
|