Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*.swo
node_modules
npm-debug.log
yarn.lock
package-lock.json
artifacts/
.nyc_output/
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# Change history for stripes-cli

## 4.1.0 IN PROGRESS
* Populate module descriptor's `name` field with module-name if `description` is missing. Refs STCLI-272.
* Use node-native glob functionality in `translate compile`. Refs STCLI-273.
* Populate module descriptor's `metadata` field with remaining `stripes` properties. Refs STCLI-274.
* Supply `webpack` `^5.103` to provide `webpack.ManifestPlugin` for STRWEB-144. Refs STCLI-275.
* Expose the `--federate` flag on `build` and `serve` command. Refs STRIPES-861.
* Build static federated ui-bundles, host app. Refs STRIPES-861.
* Upgrade fast-xml-parser from 4 (EOL) to 5.5.8. Refs STCLI-278.
* Bump @octokit/rest to ^22.0.1. Refs STCLI-280.
* Commit `yarn.lock` to avoid future supply chain attacks. Refs STCLI-281.
* fix - OctoKit `import()` compat for node v20.

## [4.0.1](https://github.com/folio-org/stripes-cli/tree/v4.0.1) (2025-03-12)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v4.0.0...v4.0.1)

* Bump `@folio/stripes-webpack` to `v6.0.1`.


## [4.0.0](https://github.com/folio-org/stripes-cli/tree/v4.0.0) (2025-02-24)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v3.2.0...v4.0.0)

Expand All @@ -15,12 +28,27 @@
* *BREAKING* bump `@folio/eslint-config-stripes` to `8.0.0`.
* Loosen GA workflow dependency to `@1` for `^1.0.0` compatibility. Refs STCLI-266.

## [3.2.2](https://github.com/folio-org/stripes-cli/tree/v3.2.2) (2025-02-18)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v3.2.1...v3.2.2)

* Bump `@folio/stripes-webpack` to `^5.2.1`. Refs STCLI-263.

## [3.2.1](https://github.com/folio-org/stripes-cli/tree/v3.2.1) (2024-11-25)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v3.2.0...v3.2.1)

* Turn off `<StrictMode>` when running tests. Refs STCLI-256.

## [3.2.0](https://github.com/folio-org/stripes-cli/tree/v3.2.0) (2024-10-09)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v3.1.0...v3.2.0)

* Add a proxy server to overcome issues with cookies SameSite policy. Refs STCLI-246.
* Bug fix: don't pass unused arguments to `okToPull()`. Refs STCLI-250.

## [3.1.1](https://github.com/folio-org/stripes-cli/tree/v3.1.1) (2025-02-18)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v3.1.0...v3.1.1)

* Bump `@folio/stripes-webpack` to `5.1.1`. Refs STCLI-264.

## [3.1.0](https://github.com/folio-org/stripes-cli/tree/v3.1.0) (2024-03-12)
[Full Changelog](https://github.com/folio-org/stripes-cli/compare/v3.0.0...v3.1.0)

Expand Down
9 changes: 6 additions & 3 deletions lib/cli/generate-module-descriptor.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
// Logic borrowed from stripes-core's package2md.js excluding file load and console output
// $ node ../stripes-core/util/package2md.js package.json > MD.json
const { omit } = require('lodash');

module.exports = function generateModuleDescriptor(packageJson, isStrict) {
const stripes = packageJson.stripes || {};
const moduleDescriptor = {
id: `${packageJson.name.replace(/^@/, '').replace('/', '_')}-${packageJson.version}`,
name: packageJson.description,
name: packageJson.description || packageJson.name,
permissionSets: stripes.permissionSets || [],
};
if (isStrict) {
const interfaces = stripes.okapiInterfaces || [];
moduleDescriptor.requires = Object.keys(interfaces).map(key => ({ id: key, version: interfaces[key] }));
const optional = stripes.optionalOkapiInterfaces || [];
moduleDescriptor.optional = Object.keys(optional).map(key => ({ id: key, version: optional[key] }));
moduleDescriptor.metadata = {
stripes: omit(stripes, ['okapiInterfaces', 'optionalOkapiInterfaces', 'permissionSets']),
};
}
return moduleDescriptor;
};
7 changes: 6 additions & 1 deletion lib/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function buildCommand(argv) {
return;
}

if (context.isPlatform && !argv.stripesConfig && !argv.createDll) {
if (!argv.federate && (context.isPlatform && !argv.stripesConfig && !argv.createDll)) {
console.warn('Warning: Building a platform without a stripes configuration. Did you forget to include "stripes.config.js"?');
}

Expand Down Expand Up @@ -92,6 +92,11 @@ module.exports = {
implies: 'createDll',
requiresArg: true
})
.option('federate', {
describe: 'Enables module-federation in build process',
type: 'boolean',
default: false
})
.option('skipStripesBuild', {
describe: 'Bypass Stripes-specific steps in build (useful when building third-party Webpack DLLs).',
type: 'boolean',
Expand Down
8 changes: 7 additions & 1 deletion lib/commands/mod/descriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function moduleDescriptorCommand(argv) {
DescriptorService.writeModuleDescriptorsToDirectory(descriptors, argv.output);
console.log(`${descriptors.length} module descriptors written to ${argv.output}`);
} else if (argv.full) {
console.log(JSON.stringify(descriptors, null, 2));
const output = argv.single && descriptors.length === 1 ? descriptors[0] : descriptors;
console.log(JSON.stringify(output, null, 2));
} else {
descriptors.forEach(descriptor => console.log(descriptor.id));
}
Expand All @@ -40,6 +41,11 @@ module.exports = {
type: 'boolean',
default: false,
})
.option('single', {
describe: 'Full JSON descriptor for a single module in the current working directory',
type: 'boolean',
default: false,
})
.option('output', {
describe: 'Directory to write descriptors to as JSON files',
type: 'string',
Expand Down
11 changes: 9 additions & 2 deletions lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ function serveCommand(argv) {
return;
}

if (!(context.isUiModule || context.isStripesModule || context.isPlatform)) {
if (!argv.federate && !(context.isUiModule || context.isStripesModule || context.isPlatform)) {
console.warn('Please check that you are in the correct directory!\n"serve" should be run from an app or platform context.\n');
} else if (argv.federate) {
const logString = context.isUiModule ? 'remote ui-module' : 'FOLIO host app';
console.log(`Executing 'serve' command for a ${logString}...`);
}

if (context.isPlatform && !argv.stripesConfig) {
if (context.isPlatform && !argv.stripesConfig && !argv.federate) {
console.warn('Warning: Serving a platform without a stripes configuration. Did you forget to include "stripes.config.js"?');
}

Expand Down Expand Up @@ -103,6 +106,10 @@ module.exports = {
stripesConfigMiddleware(),
])
.positional('configFile', stripesConfigFile.configFile)
.option('federate', {
describe: 'At platform level, serves an empty host platform, using configured entitlementUrl to procure a list or remote apps. At the module level, this registers/serves the app as a locally federated remote.',
type: 'boolean',
})
.option('existing-build', {
describe: 'Serve an existing build from the supplied directory',
type: 'string',
Expand Down
4 changes: 3 additions & 1 deletion lib/environment/inventory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const fs = require('fs-extra');
const path = require('path');
const { Octokit } = require('@octokit/rest');

const MODULE_CACHE_FILE = '/inventory.json';

Expand Down Expand Up @@ -32,7 +31,10 @@ function readModules() {
}

async function fetchAndStoreModules() {
const { Octokit } = await import('@octokit/rest');

const octokit = new Octokit();

const repos = { apps: [], libs: [], other: [], platforms: [], plugins: [] };
const options = octokit.repos.listForOrg.endpoint.merge({ org: 'folio-org', type: 'public' });
const data = await octokit.paginate(options);
Expand Down
3 changes: 3 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');
const fs = require('fs');
const http = require('http');
const express = require('express');
const cors = require('cors');
const logger = require('morgan');
const debug = require('debug');

Expand Down Expand Up @@ -48,6 +49,8 @@ function onListening(server) {

function start(dir, options) {
const app = express();
app.use(express.json());
app.use(cors());
app.use(express.static(dir, {}));
app.use(logger('tiny'));

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@folio/stripes-cli",
"version": "4.0.1",
"version": "4.1.0",
"description": "Stripes Command Line Interface",
"repository": "https://github.com/folio-org/stripes-cli",
"publishConfig": {
Expand All @@ -26,13 +26,13 @@
"@folio/stripes-webpack": "^6.0.1",
"@formatjs/cli": "^6.1.3",
"@formatjs/cli-lib": "^6.1.3",
"@octokit/rest": "^19.0.7",
"@octokit/rest": "^22.0.1",
"babel-plugin-istanbul": "^6.0.0",
"configstore": "^3.1.1",
"debug": "^4.0.1",
"express": "^4.17.1",
"fast-glob": "^3.3.1",
"fast-xml-parser": "^4.2.4",
"fast-xml-parser": "^5.5.8",
"find-up": "^2.1.0",
"fs-extra": "^11.1.1",
"get-stdin": "^6.0.0",
Expand Down Expand Up @@ -69,7 +69,7 @@
"supports-color": "^4.5.0",
"tough-cookie": "^4.1.3",
"update-notifier": "^6.0.2",
"webpack": "^5.80.0",
"webpack": "^5.104.1",
"webpack-bundle-analyzer": "^4.4.2",
"yargs": "^17.3.1"
},
Expand All @@ -81,4 +81,4 @@
"sinon": "^15.0.4",
"sinon-chai": "^3.7.0"
}
}
}
6 changes: 4 additions & 2 deletions test/okapi/descriptor-service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ describe('The descriptor-service', function () {
id: 'backend2',
version: '3.1'
}
]
],
metadata: { stripes: { type: packageJsonStub.stripes.type } }
}];

const output = this.sut.getUiModuleDescriptor(true);
Expand Down Expand Up @@ -189,7 +190,8 @@ describe('The descriptor-service', function () {
id: 'backend2',
version: '3.1'
}
]
],
metadata: { stripes: { type: packageJsonStub.stripes.type } }
};
});

Expand Down
Loading
Loading