@_linked/cli 1.45.4 → 1.45.6
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 +14 -0
- package/defaults/app-react-native/apps/mobile/package.json +1 -1
- 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/lib/esm/localize/ensure.d.ts +7 -0
- package/lib/esm/localize/ensure.d.ts.map +1 -1
- package/lib/esm/localize/ensure.js +8 -1
- package/lib/esm/localize/ensure.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.45.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
- [#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.
|
|
10
|
+
|
|
11
|
+
## 1.45.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#243](https://github.com/linked-fw/cli/pull/243) [`8b31574`](https://github.com/linked-fw/cli/commit/8b315745bd10a8ff6be43103756fd12e664ff59a) Thanks [@flyon](https://github.com/flyon)! - A localized checkout's install (`linked localize`, `--relink`, `--reinstall`) now passes `--include=dev`. It runs from the app's npm lifecycle hooks, which inherit the outer command's config as `npm_config_*`, so `npm install --omit=dev` at the app root used to make the checkout skip its devDependencies and stop building.
|
|
16
|
+
|
|
3
17
|
## 1.45.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -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,EA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EF,eAAO,IAAI,wBAAwB,GAAa,gBAAW,EAAE,YAAO,SAsCnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAU,gBAAW,qBA8B/C,CAAC"}
|
package/lib/esm/cli-methods.js
CHANGED
|
@@ -802,25 +802,46 @@ 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 ../ )
|