@_linked/cli 1.25.2 → 1.26.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 +44 -0
- package/lib/esm/cli-methods.d.ts +0 -2
- package/lib/esm/cli-methods.d.ts.map +1 -1
- package/lib/esm/cli-methods.js +0 -110
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/cli.d.ts.map +1 -1
- package/lib/esm/cli.js +13 -29
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/build-app.d.ts +5 -9
- package/lib/esm/commands/build-app.d.ts.map +1 -1
- package/lib/esm/commands/build-app.js +10 -13
- package/lib/esm/commands/build-app.js.map +1 -1
- package/lib/esm/commands/start.d.ts +1 -1
- package/lib/esm/commands/start.js +4 -4
- package/lib/esm/commands/start.js.map +1 -1
- package/lib/esm/index.d.ts +1 -5
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +0 -8
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces.d.ts +1 -40
- package/lib/esm/interfaces.d.ts.map +1 -1
- package/lib/esm/lifecycle.d.ts +1 -1
- package/lib/esm/lifecycle.js +2 -2
- package/lib/esm/lifecycle.js.map +1 -1
- package/lib/esm/utils.js +1 -1
- package/lib/esm/utils.js.map +1 -1
- package/lib/esm/vite-config.js +3 -3
- package/lib/esm/vite-config.js.map +1 -1
- package/package.json +5 -25
- package/lib/esm/config-webpack-app.d.ts +0 -112
- package/lib/esm/config-webpack-app.d.ts.map +0 -1
- package/lib/esm/config-webpack-app.js +0 -392
- package/lib/esm/config-webpack-app.js.map +0 -1
- package/lib/esm/config-webpack.d.ts +0 -55
- package/lib/esm/config-webpack.d.ts.map +0 -1
- package/lib/esm/config-webpack.js +0 -374
- package/lib/esm/config-webpack.js.map +0 -1
- package/lib/esm/plugins/check-imports.d.ts +0 -2
- package/lib/esm/plugins/check-imports.d.ts.map +0 -1
- package/lib/esm/plugins/check-imports.js +0 -65
- package/lib/esm/plugins/check-imports.js.map +0 -1
- package/lib/esm/plugins/declaration-plugin.d.ts +0 -15
- package/lib/esm/plugins/declaration-plugin.d.ts.map +0 -1
- package/lib/esm/plugins/declaration-plugin.js +0 -246
- package/lib/esm/plugins/declaration-plugin.js.map +0 -1
- package/lib/esm/plugins/externalise-modules.d.ts +0 -7
- package/lib/esm/plugins/externalise-modules.d.ts.map +0 -1
- package/lib/esm/plugins/externalise-modules.js +0 -185
- package/lib/esm/plugins/externalise-modules.js.map +0 -1
- package/lib/esm/plugins/watch-run.d.ts +0 -5
- package/lib/esm/plugins/watch-run.d.ts.map +0 -1
- package/lib/esm/plugins/watch-run.js +0 -44
- package/lib/esm/plugins/watch-run.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
**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
|
|
10
|
+
`vite.config.{ts,js,mjs}` — it now fails with a message naming the missing file and the config to
|
|
11
|
+
add. `linked start --legacy` is gone (the flag started a dev server that `@_linked/server` stopped
|
|
12
|
+
mounting webpack-dev-middleware for, so it already served no frontend).
|
|
13
|
+
|
|
14
|
+
Removed from the public API: `generateWebpackConfig`, `DeclarationPlugin`, `externaliseModules`,
|
|
15
|
+
the `LinkedWebpackConfig` type and `LinkedConfig.webpack`. `buildApp` and `buildFrontend` are gone
|
|
16
|
+
from `@_linked/cli/cli-methods`; the equivalent is `buildViteApp` from
|
|
17
|
+
`@_linked/cli/commands/build-app` (or the `linked build-app` command). `assertReleaseFlagsUnused`
|
|
18
|
+
is replaced by `assertViteApp`. The internal webpack loaders and plugins
|
|
19
|
+
(`plugins/check-imports`, `plugins/watch-run`, `plugins/declaration-plugin`,
|
|
20
|
+
`plugins/externalise-modules`, `config-webpack`, `config-webpack-app`) are deleted, along with
|
|
21
|
+
every dependency that existed only to serve them: `webpack`, `webpack-bundle-analyzer`,
|
|
22
|
+
`webpack-license-plugin`, `webpack-manifest-plugin`, `terser-webpack-plugin`,
|
|
23
|
+
`copy-webpack-plugin`, `tsconfig-paths-webpack-plugin`, `@pmmmwh/react-refresh-webpack-plugin`,
|
|
24
|
+
`babel-loader`, `css-loader`, `postcss-loader`, `mini-css-extract-plugin`, `source-map-loader`,
|
|
25
|
+
`ts-loader`, `react-refresh`, `react-refresh-typescript`, `@babel/register`,
|
|
26
|
+
`@babel/preset-react`, `@babel/plugin-proposal-decorators` and `@babel/plugin-transform-runtime`.
|
|
27
|
+
(`@babel/core`, `@babel/preset-env` and `@babel/preset-typescript` stay, moved to
|
|
28
|
+
devDependencies — they serve this package's own Jest transform via `babel-jest`.)
|
|
29
|
+
|
|
30
|
+
**What a webpack app must do:** add a `vite.config.ts` to the app root —
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import {createViteConfig} from '@_linked/cli/vite-config';
|
|
34
|
+
|
|
35
|
+
export default createViteConfig({port: 4040, cssMode: 'tailwind'});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
— and drop any `webpack`, `cacheWebpack` or `analyse` keys from `linked.config.js`, which are no
|
|
39
|
+
longer read. There is no migration path that keeps webpack; pin `@_linked/cli@^1` if you need one
|
|
40
|
+
while you move.
|
|
41
|
+
|
|
42
|
+
`major`, because the removals above are all reachable from the package's published entry points
|
|
43
|
+
and from documented command behaviour. This is the first major for this package; the alternative
|
|
44
|
+
(a deprecation cycle) would mean shipping webpack for another release train to serve consumers
|
|
45
|
+
none of which were found.
|
|
46
|
+
|
|
3
47
|
## 1.25.2
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
package/lib/esm/cli-methods.d.ts
CHANGED
|
@@ -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;
|
|
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;AAepD;;;;;;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,CAA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EACP,iBAAY,EACZ,gBAAW,qBA4CZ,CAAC;AAOF,eAAO,IAAI,cAAc,GAAa,aAAQ,EAAE,YAAO,SAMtD,CAAC;AACF,eAAO,IAAI,YAAY,GAAmB,iBAAwB,kBA8FjE,CAAC;AAEF,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
|
@@ -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';
|
|
@@ -1678,113 +1675,6 @@ export const startServer = (...args_1) => __awaiter(void 0, [...args_1], void 0,
|
|
|
1678
1675
|
return server.start();
|
|
1679
1676
|
}
|
|
1680
1677
|
});
|
|
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
1678
|
/**
|
|
1789
1679
|
* Compile the app's backend into `lib/`.
|
|
1790
1680
|
*
|