@_linked/cli 1.25.2 → 1.27.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 (54) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/lib/esm/cli-methods.d.ts +2 -4
  3. package/lib/esm/cli-methods.d.ts.map +1 -1
  4. package/lib/esm/cli-methods.js +24 -180
  5. package/lib/esm/cli-methods.js.map +1 -1
  6. package/lib/esm/cli.d.ts.map +1 -1
  7. package/lib/esm/cli.js +14 -30
  8. package/lib/esm/cli.js.map +1 -1
  9. package/lib/esm/commands/build-app.d.ts +5 -9
  10. package/lib/esm/commands/build-app.d.ts.map +1 -1
  11. package/lib/esm/commands/build-app.js +10 -13
  12. package/lib/esm/commands/build-app.js.map +1 -1
  13. package/lib/esm/commands/start.d.ts +1 -1
  14. package/lib/esm/commands/start.js +4 -4
  15. package/lib/esm/commands/start.js.map +1 -1
  16. package/lib/esm/index.d.ts +1 -5
  17. package/lib/esm/index.d.ts.map +1 -1
  18. package/lib/esm/index.js +0 -8
  19. package/lib/esm/index.js.map +1 -1
  20. package/lib/esm/interfaces.d.ts +1 -40
  21. package/lib/esm/interfaces.d.ts.map +1 -1
  22. package/lib/esm/lifecycle.d.ts +77 -1
  23. package/lib/esm/lifecycle.d.ts.map +1 -1
  24. package/lib/esm/lifecycle.js +191 -10
  25. package/lib/esm/lifecycle.js.map +1 -1
  26. package/lib/esm/utils.js +1 -1
  27. package/lib/esm/utils.js.map +1 -1
  28. package/lib/esm/vite-config.js +3 -3
  29. package/lib/esm/vite-config.js.map +1 -1
  30. package/package.json +5 -25
  31. package/lib/esm/config-webpack-app.d.ts +0 -112
  32. package/lib/esm/config-webpack-app.d.ts.map +0 -1
  33. package/lib/esm/config-webpack-app.js +0 -392
  34. package/lib/esm/config-webpack-app.js.map +0 -1
  35. package/lib/esm/config-webpack.d.ts +0 -55
  36. package/lib/esm/config-webpack.d.ts.map +0 -1
  37. package/lib/esm/config-webpack.js +0 -374
  38. package/lib/esm/config-webpack.js.map +0 -1
  39. package/lib/esm/plugins/check-imports.d.ts +0 -2
  40. package/lib/esm/plugins/check-imports.d.ts.map +0 -1
  41. package/lib/esm/plugins/check-imports.js +0 -65
  42. package/lib/esm/plugins/check-imports.js.map +0 -1
  43. package/lib/esm/plugins/declaration-plugin.d.ts +0 -15
  44. package/lib/esm/plugins/declaration-plugin.d.ts.map +0 -1
  45. package/lib/esm/plugins/declaration-plugin.js +0 -246
  46. package/lib/esm/plugins/declaration-plugin.js.map +0 -1
  47. package/lib/esm/plugins/externalise-modules.d.ts +0 -7
  48. package/lib/esm/plugins/externalise-modules.d.ts.map +0 -1
  49. package/lib/esm/plugins/externalise-modules.js +0 -185
  50. package/lib/esm/plugins/externalise-modules.js.map +0 -1
  51. package/lib/esm/plugins/watch-run.d.ts +0 -5
  52. package/lib/esm/plugins/watch-run.d.ts.map +0 -1
  53. package/lib/esm/plugins/watch-run.js +0 -44
  54. package/lib/esm/plugins/watch-run.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,83 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#154](https://github.com/linked-fw/cli/pull/154) [`4a1d419`](https://github.com/linked-fw/cli/commit/4a1d419decdd3c4247b0e0c723f94897838dbd67) Thanks [@flyon](https://github.com/flyon)! - `build-all`: find every local package, and never skip one silently
8
+
9
+ `build-all` discovered only packages declaring `linkedPackage: true`, only inside the
10
+ `workspaces` globs, and printed nothing about anything it passed over. Measured against
11
+ Create Now, that meant `Found 3 total LINCD packages in use by this app` and `exit 0` for a
12
+ workspace of six tracked members plus 25 localized checkouts — with `@_linked/maps`, a shipped
13
+ dependency that had simply never been given the flag, dropped from a green build in silence.
14
+
15
+ Three changes:
16
+
17
+ - **Discovery is by capability, not by declaration.** `build-all` invokes each package's own
18
+ `build` script, so any package with one is now built, flag or no flag. The flag still governs
19
+ `linked build` and the dev resolver, and is unchanged there.
20
+ - **`packages-local/` is scanned** alongside the workspace globs. That directory is deliberately
21
+ in no glob (`semantu localize` keeps npm from learning about the checkouts), so a walk of
22
+ `workspaces` alone could never see it.
23
+ - **Every package found but not built is named, with the reason** — no build script, is a linked
24
+ app, outside the repository, or not in this app's dependency tree. This alone would have
25
+ surfaced `@_linked/maps`.
26
+
27
+ New exports from `@_linked/cli`: `discoverLocalPackages()`, which returns every local package
28
+ with the facts callers filter on (`source`, `isLinkedPackage`, `isApp`, `hasBuildScript`), and
29
+ `planBuildAll()`, which returns what would be built and what would be skipped with reasons.
30
+ `getLincdPackages()` keeps its narrow meaning — flagged packages, workspace globs only — so the
31
+ dev resolver and the runtime are unaffected; it now also honours the legacy `lincd: true`
32
+ spelling of the flag, matching `linked build-package`.
33
+
34
+ Also: user-facing output saying "LINCD packages" or suggesting `lincd build-all --from=` now says
35
+ "linked" and `linked build-all --from=`.
36
+
37
+ ## 1.26.0
38
+
39
+ ### Minor Changes
40
+
41
+ - [#152](https://github.com/linked-fw/cli/pull/152) [`212ebfd`](https://github.com/linked-fw/cli/commit/212ebfd6e59afdddadfaeb1c74db6084818a3ce4) Thanks [@flyon](https://github.com/flyon)! - Remove webpack. Vite is now the only frontend build and dev server this CLI has.
42
+
43
+ **Behaviour change.** Released as a minor by the maintainer's decision -- the org does not cut majors at present, and no consumer was on the removed path. `linked build-app` no longer falls back to webpack when an app has no
44
+ `vite.config.{ts,js,mjs}` — it now fails with a message naming the missing file and the config to
45
+ add. `linked start --legacy` is gone (the flag started a dev server that `@_linked/server` stopped
46
+ mounting webpack-dev-middleware for, so it already served no frontend).
47
+
48
+ Removed from the public API: `generateWebpackConfig`, `DeclarationPlugin`, `externaliseModules`,
49
+ the `LinkedWebpackConfig` type and `LinkedConfig.webpack`. `buildApp` and `buildFrontend` are gone
50
+ from `@_linked/cli/cli-methods`; the equivalent is `buildViteApp` from
51
+ `@_linked/cli/commands/build-app` (or the `linked build-app` command). `assertReleaseFlagsUnused`
52
+ is replaced by `assertViteApp`. The internal webpack loaders and plugins
53
+ (`plugins/check-imports`, `plugins/watch-run`, `plugins/declaration-plugin`,
54
+ `plugins/externalise-modules`, `config-webpack`, `config-webpack-app`) are deleted, along with
55
+ every dependency that existed only to serve them: `webpack`, `webpack-bundle-analyzer`,
56
+ `webpack-license-plugin`, `webpack-manifest-plugin`, `terser-webpack-plugin`,
57
+ `copy-webpack-plugin`, `tsconfig-paths-webpack-plugin`, `@pmmmwh/react-refresh-webpack-plugin`,
58
+ `babel-loader`, `css-loader`, `postcss-loader`, `mini-css-extract-plugin`, `source-map-loader`,
59
+ `ts-loader`, `react-refresh`, `react-refresh-typescript`, `@babel/register`,
60
+ `@babel/preset-react`, `@babel/plugin-proposal-decorators` and `@babel/plugin-transform-runtime`.
61
+ (`@babel/core`, `@babel/preset-env` and `@babel/preset-typescript` stay, moved to
62
+ devDependencies — they serve this package's own Jest transform via `babel-jest`.)
63
+
64
+ **What a webpack app must do:** add a `vite.config.ts` to the app root —
65
+
66
+ ```ts
67
+ import {createViteConfig} from '@_linked/cli/vite-config';
68
+
69
+ export default createViteConfig({port: 4040, cssMode: 'tailwind'});
70
+ ```
71
+
72
+ — and drop any `webpack`, `cacheWebpack` or `analyse` keys from `linked.config.js`, which are no
73
+ longer read. There is no migration path that keeps webpack; pin `@_linked/cli@^1` if you need one
74
+ while you move.
75
+
76
+ `major`, because the removals above are all reachable from the package's published entry points
77
+ and from documented command behaviour. This is the first major for this package; the alternative
78
+ (a deprecation cycle) would mean shipping webpack for another release train to serve consumers
79
+ none of which were found.
80
+
3
81
  ## 1.25.2
4
82
 
5
83
  ### Patch Changes
@@ -6,8 +6,8 @@ import type { PackageDetails } from './interfaces.js';
6
6
  * `scripts/storage-config.js` (pre-rename). The fallback chain lets older
7
7
  * app clones keep booting through the rename.
8
8
  */
9
- import { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages } from './lifecycle.js';
10
- export { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages };
9
+ import { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages, discoverLocalPackages, planBuildAll } from './lifecycle.js';
10
+ export { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages, discoverLocalPackages, planBuildAll, };
11
11
  export type AppTemplate = 'web' | 'react-native';
12
12
  type AppIdentity = {
13
13
  appName: string;
@@ -115,8 +115,6 @@ export declare const runMethod: (packageName: string, method: string, options: {
115
115
  spawn: boolean;
116
116
  }) => Promise<void>;
117
117
  export declare const startServer: (initOnly?: boolean, ServerClass?: any) => Promise<any>;
118
- export declare const buildApp: () => Promise<never>;
119
- export declare const buildFrontend: () => Promise<void>;
120
118
  /**
121
119
  * Compile the app's backend into `lib/`.
122
120
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cli-methods.d.ts","sourceRoot":"","sources":["../../src/cli-methods.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAiBpD;;;;;;GAMG;AAKH,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,uBAAuB,EAAE,wBAAwB,EAAE,gBAAgB,EAAC,CAAC;AAoB7E,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,kB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M,cAAc,GAAU,gBAAW,qBA8B/C,CAAC"}
@@ -22,12 +22,9 @@ import { rewriteExtensionlessImports } from './utils/esmSpecifiers.js';
22
22
  import { spawn as spawnChild } from 'child_process';
23
23
  import { findNearestPackageJson } from 'find-nearest-package-json';
24
24
  import { statSync } from 'fs';
25
- import { LinkedFileStorage } from '@_linked/core/utils/LinkedFileStorage';
26
25
  // import pkg from 'lincd/utils/LinkedFileStorage';
27
26
  // const { LinkedFileStorage } = pkg;
28
- // const config = require('@_linked/server/site.webpack.config');
29
27
  import { glob } from 'glob';
30
- import webpack from 'webpack';
31
28
  import ora from 'ora';
32
29
  import stagedGitFiles from 'staged-git-files';
33
30
  import { packagePublishesCjs } from './package-manifest.js';
@@ -46,8 +43,8 @@ let dirname__ = typeof __dirname !== 'undefined'
46
43
  // have to graph-walk the rest of cli-methods.ts (which contains many
47
44
  // dynamic imports Vite can't analyze). We import for internal callers
48
45
  // AND re-export so external consumers can keep importing from here.
49
- import { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages, } from './lifecycle.js';
50
- export { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages };
46
+ import { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages, discoverLocalPackages, planBuildAll, } from './lifecycle.js';
47
+ export { ensureEnvironmentLoaded, loadBackendStorageConfig, getLincdPackages, discoverLocalPackages, planBuildAll, };
51
48
  var variables = {};
52
49
  /**
53
50
  * Prompt user for input
@@ -721,73 +718,27 @@ function findAppRoot(startPath = process.cwd()) {
721
718
  return appRoot;
722
719
  }
723
720
  /**
724
- * Filters packages to only include those in the dependency tree of the app root
721
+ * Print the discovery result in full: what will be built, and every package
722
+ * that was found and will not be. Nothing is discovered silently.
725
723
  */
726
- function filterPackagesByDependencyTree(allPackages, appRootPath) {
727
- const appPackageJson = getPackageJSON(appRootPath);
728
- if (!appPackageJson) {
729
- return allPackages;
730
- }
731
- const relevantPackages = new Map();
732
- const packagesToCheck = new Set();
733
- // Start with direct dependencies from app root
734
- if (appPackageJson.dependencies) {
735
- Object.keys(appPackageJson.dependencies).forEach((dep) => {
736
- if (allPackages.has(dep)) {
737
- packagesToCheck.add(dep);
738
- }
739
- });
740
- }
741
- // Recursively add dependencies
742
- const processedPackages = new Set();
743
- while (packagesToCheck.size > 0) {
744
- const packageName = Array.from(packagesToCheck)[0];
745
- packagesToCheck.delete(packageName);
746
- if (processedPackages.has(packageName)) {
747
- continue;
748
- }
749
- processedPackages.add(packageName);
750
- const packageDetails = allPackages.get(packageName);
751
- if (packageDetails) {
752
- relevantPackages.set(packageName, packageDetails);
753
- // Get this package's dependencies
754
- const packageJson = getPackageJSON(packageDetails.path);
755
- if (packageJson && packageJson.dependencies) {
756
- Object.keys(packageJson.dependencies).forEach((dep) => {
757
- if (allPackages.has(dep) && !processedPackages.has(dep)) {
758
- packagesToCheck.add(dep);
759
- }
760
- });
761
- }
762
- }
724
+ function printBuildAllPlan(plan) {
725
+ console.log(chalk.magenta(`Found ${plan.build.size} linked package${plan.build.size === 1 ? '' : 's'} to build: ` +
726
+ Array.from(plan.build.keys()).join(', ')));
727
+ if (plan.skipped.length === 0)
728
+ return;
729
+ console.log(chalk.yellow(`Skipping ${plan.skipped.length} package${plan.skipped.length === 1 ? '' : 's'} found but not built:`));
730
+ for (const skip of [...plan.skipped].sort((a, b) => a.packageName.localeCompare(b.packageName))) {
731
+ console.log(chalk.yellow(` - ${skip.packageName}: ${skip.reason}`));
763
732
  }
764
- return relevantPackages;
765
733
  }
766
734
  export function buildAll(options) {
767
- console.log('Building all LINCD packages of this repository in order of dependencies');
768
- let lincdPackages = getLocalLincdPackageMap();
769
- const originalPackageCount = lincdPackages.size;
770
- // Check if we're in an app context and filter packages accordingly
771
- const appRoot = findAppRoot();
772
- if (appRoot) {
773
- const appPackageJson = getPackageJSON(appRoot);
774
- // Check if this is an app (not a lincd package itself) with lincd dependencies
775
- const isAppWithLincdDeps = appPackageJson &&
776
- appPackageJson.lincd !== true &&
777
- appPackageJson.dependencies &&
778
- Object.keys(appPackageJson.dependencies).some((dep) => lincdPackages.has(dep));
779
- if (isAppWithLincdDeps) {
780
- debugInfo(chalk.blue(`Found app root at: ${appRoot}`));
781
- const filteredPackages = filterPackagesByDependencyTree(lincdPackages, appRoot);
782
- console.log(chalk.magenta(`Found ${filteredPackages.size} total LINCD packages in use by this app`));
783
- lincdPackages = filteredPackages;
784
- }
785
- else {
786
- debugInfo(chalk.blue(`Building all ${originalPackageCount} packages from workspace`));
787
- }
788
- }
789
- else {
790
- debugInfo(chalk.blue(`No workspace root found, building all ${originalPackageCount} packages`));
735
+ console.log('Building all linked packages of this repository in order of dependencies');
736
+ const plan = planBuildAll('./', findAppRoot() || undefined);
737
+ printBuildAllPlan(plan);
738
+ let lincdPackages = plan.build;
739
+ if (lincdPackages.size === 0) {
740
+ console.log(chalk.yellow('Nothing to build.'));
741
+ return;
791
742
  }
792
743
  let startFrom;
793
744
  //by default start building
@@ -895,7 +846,7 @@ export function buildAll(options) {
895
846
  dependentModules.length +
896
847
  ' other packages depend on.'); //"+dependentModules.map(d => d.packageName).join(", ")));
897
848
  log('Run ' +
898
- chalk.greenBright(`lincd build-all --from=${pkg.packageName}`) +
849
+ chalk.greenBright(`linked build-all --from=${pkg.packageName}`) +
899
850
  ' to build only the remaining packages'); //"+dependentModules.map(d => d.packageName).join(", ")));
900
851
  process.exit(1);
901
852
  }
@@ -945,7 +896,7 @@ export function buildAll(options) {
945
896
  ); //"+dependentModules.map(d => d.packageName).join(", ")));
946
897
  log(
947
898
  'Run ' +
948
- chalk.greenBright(`lincd build-all --from=${pkg.packageName}`) +
899
+ chalk.greenBright(`linked build-all --from=${pkg.packageName}`) +
949
900
  ' to build only the remaining packages',
950
901
  ); //"+dependentModules.map(d => d.packageName).join(", ")));
951
902
  process.exit(1);
@@ -1477,7 +1428,7 @@ export const depCheck = (...args_1) => __awaiter(void 0, [...args_1], void 0, fu
1477
1428
  //currently just missing LINCD packages cause a hard failure exit code
1478
1429
  if (missingLincdPackages.length > 0) {
1479
1430
  reject(chalk.red(packagePath.split('/').pop() +
1480
- '\n[ERROR] These LINCD packages are imported but they are not listed in package.json:\n- ' +
1431
+ '\n[ERROR] These linked packages are imported but they are not listed in package.json:\n- ' +
1481
1432
  missingLincdPackages
1482
1433
  .map((missedKey) => {
1483
1434
  const files = results.missing[missedKey];
@@ -1678,113 +1629,6 @@ export const startServer = (...args_1) => __awaiter(void 0, [...args_1], void 0,
1678
1629
  return server.start();
1679
1630
  }
1680
1631
  });
1681
- export const buildApp = () => __awaiter(void 0, void 0, void 0, function* () {
1682
- yield buildFrontend();
1683
- yield buildBackend();
1684
- console.log(chalk.magenta(`✅ ${process.env.NODE_ENV} app build finished`));
1685
- process.exit(0);
1686
- });
1687
- export const buildFrontend = () => __awaiter(void 0, void 0, void 0, function* () {
1688
- yield ensureEnvironmentLoaded();
1689
- // @vite-ignore — the webpack build path is legacy code, only reached
1690
- // by `linked build-frontend` which is not part of the Vite dev/SSR
1691
- // flow. Tell Vite not to graph-walk into it so we don't emit
1692
- // import-analysis warnings for a file we never load via SSR.
1693
- const webpackAppConfig = yield (yield import(/* @vite-ignore */ './config-webpack-app.js')).getWebpackAppConfig();
1694
- console.log(chalk.magenta(`🛠 Building ${process.env.NODE_ENV} frontend bundles`));
1695
- yield new Promise((resolve, reject) => {
1696
- webpack(webpackAppConfig, (err, stats) => __awaiter(void 0, void 0, void 0, function* () {
1697
- if (err) {
1698
- console.error(err.stack || err);
1699
- process.exit(1);
1700
- }
1701
- const info = stats.toJson();
1702
- if (stats.hasErrors()) {
1703
- console.log('Finished running webpack with errors.');
1704
- info.errors.forEach((e) => console.error(e));
1705
- // process.exit(1);
1706
- reject();
1707
- }
1708
- else {
1709
- console.log(stats.toString({
1710
- chunks: false,
1711
- assets: true,
1712
- entrypoints: false,
1713
- modules: false,
1714
- moduleAssets: false,
1715
- colors: true,
1716
- }));
1717
- console.log('App build process finished');
1718
- resolve(true);
1719
- // console.log(
1720
- // chalk.green('\t'+Object.keys(stats.compilation.assets).join('\n\t')),
1721
- // );
1722
- //build metadata (JSON-LD files containing metadata about the lincd components, shapes & ontologies in this app or its packages)
1723
- // let updatedPaths = await buildMetadata();
1724
- // console.log(chalk.green("Updated metadata:\n")+" - "+updatedPaths.map(p => chalk.magenta(p.replace(process.cwd(),''))).join("\n - "));
1725
- }
1726
- // process.exit();
1727
- }));
1728
- }).then(() => __awaiter(void 0, void 0, void 0, function* () {
1729
- // make sure environment is not development for storage config
1730
- // and if we want to upload to storage, we need set S3_BUCKET_ENDPOINT
1731
- if (process.env.NODE_ENV === 'development' ||
1732
- !process.env.S3_BUCKET_ENDPOINT) {
1733
- console.warn('Upload build to storage skip in development environment or S3_BUCKET_ENDPOINT is not set');
1734
- return;
1735
- // process.exit();
1736
- }
1737
- if (process.env.APP_ENV) {
1738
- console.warn('Not uploading to CDN for app builds');
1739
- return;
1740
- // process.exit();
1741
- }
1742
- // load the storage config
1743
- const storageConfig = yield loadBackendStorageConfig();
1744
- // check if LinkedFileStorage has a default FileStore
1745
- // if yes: copy all the files in the build folder over with LinkedFileStorage
1746
- if (LinkedFileStorage.getDefaultStore()) {
1747
- // get public directory
1748
- const rootDirectory = 'public';
1749
- const pathDir = path.join(process.cwd(), rootDirectory);
1750
- if (!fs.existsSync(pathDir)) {
1751
- console.warn('No public directory found. Please create a public directory in the root of your project');
1752
- return;
1753
- }
1754
- // get all files in the web directory and then upload them to the storage
1755
- const files = yield getFiles(pathDir);
1756
- console.log(chalk.magenta(`🕊 Publishing ${files.length} public files to linked file storage`));
1757
- const clearSpinner = ora({
1758
- discardStdin: true,
1759
- text: `Publishing ${files.length} public files`,
1760
- }).start();
1761
- let counter = 0;
1762
- const uploads = files.map((filePath) => __awaiter(void 0, void 0, void 0, function* () {
1763
- // read file content
1764
- const fileContent = yield fs.promises.readFile(filePath);
1765
- // replace pathDir with rootDirectory in filePath to get pathname
1766
- // example: /Users/username/project/www/index.html -> /project/www/index.html
1767
- const pathname = filePath.replace(pathDir, `/${rootDirectory}`);
1768
- // upload file to storage.
1769
- //
1770
- // preventDuplicates: false because this publishes a public/ folder to a
1771
- // CDN, where the key is the address: `main-hwqwrAvA.css` has to land as
1772
- // `main-hwqwrAvA.css` or the name baked into the HTML does not resolve,
1773
- // and republishing an unchanged build has to overwrite in place rather
1774
- // than accumulate a second copy under a new key.
1775
- yield LinkedFileStorage.saveFile(pathname, fileContent, {
1776
- preventDuplicates: false,
1777
- })
1778
- .then(() => {
1779
- clearSpinner.text = `${counter++}/${files.length}: - Published ${pathname} `;
1780
- })
1781
- .catch(console.error);
1782
- }));
1783
- const urls = yield Promise.all(uploads);
1784
- clearSpinner.succeed(`${urls.length} files uploaded to storage`);
1785
- }
1786
- }));
1787
- });
1788
1632
  /**
1789
1633
  * Compile the app's backend into `lib/`.
1790
1634
  *
@@ -2009,7 +1853,7 @@ export const createPackage = (name_1, uriBase_1, ...args_1) => __awaiter(void 0,
2009
1853
  //extra variable for clarity (will be same as 'name')
2010
1854
  setVariable('output_file_name', name);
2011
1855
  let { hyphenName, camelCaseName, underscoreName } = setNameVariables(cleanPackageName);
2012
- log("Creating new LINCD package '" + name + "'");
1856
+ log("Creating new linked package '" + name + "'");
2013
1857
  fs.copySync(path.join(getScriptDir(), '..', '..', 'defaults', 'package'), targetFolder);
2014
1858
  renameShippedDotfiles(targetFolder);
2015
1859
  //replace variables in some of the copied files
@@ -2067,7 +1911,7 @@ export const createPackage = (name_1, uriBase_1, ...args_1) => __awaiter(void 0,
2067
1911
  process.exitCode = 1;
2068
1912
  });
2069
1913
  }
2070
- log(`Prepared a new LINCD package in ${chalk.magenta(targetFolder)}`, `Run ${chalk.blueBright(runScriptCommand(setup.packageManager, 'build'))} from this directory to build once`, `Or ${chalk.blueBright(runScriptCommand(setup.packageManager, 'start'))} to continuously rebuild on file changes`);
1914
+ log(`Prepared a new linked package in ${chalk.magenta(targetFolder)}`, `Run ${chalk.blueBright(runScriptCommand(setup.packageManager, 'build'))} from this directory to build once`, `Or ${chalk.blueBright(runScriptCommand(setup.packageManager, 'start'))} to continuously rebuild on file changes`);
2071
1915
  });
2072
1916
  var getNextVersion = function (version) {
2073
1917
  let parts = version.split('.');