0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(core): add single-page apps as dependencies

This commit is contained in:
Gao Sun 2023-04-02 17:40:07 +08:00
parent f97ebaa3db
commit 1e5b68423a
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
8 changed files with 22 additions and 6 deletions

View file

@ -9,10 +9,7 @@
"@logto/cli", "@logto/cli",
"@logto/create" "@logto/create"
]], ]],
"linked": [[ "linked": [],
"@logto/phrases",
"@logto/phrases-ui"
]],
"//": "END OF CAUTION", "//": "END OF CAUTION",
"access": "restricted", "access": "restricted",
"baseBranch": "master", "baseBranch": "master",

View file

@ -1,5 +1,6 @@
// See https://pnpm.io/pnpmfile // See https://pnpm.io/pnpmfile
const fs = require('node:fs/promises'); const fs = require('node:fs/promises');
const path = require('node:path');
// Types are inspected and edited from https://github.com/pnpm/pnpm/blob/ef6c22e129dc3d76998cee33647b70a66d1f36bf/hooks/pnpmfile/src/requireHooks.ts // Types are inspected and edited from https://github.com/pnpm/pnpm/blob/ef6c22e129dc3d76998cee33647b70a66d1f36bf/hooks/pnpmfile/src/requireHooks.ts
/** /**
@ -27,7 +28,10 @@ const hooks = { readPackage: async (pkg) => {
} }
// Apply connector's `package.json` to the template // Apply connector's `package.json` to the template
const result = JSON.parse(await fs.readFile('packages/connectors/templates/package.json', 'utf8')); const result = JSON.parse(
// Use `__dirname` since the `pnpm i` command may be executed in nested workspace directories
await fs.readFile(path.join(__dirname, 'packages/connectors/templates/package.json'), 'utf8')
);
for (const [key, value] of Object.entries(pkg)) { for (const [key, value] of Object.entries(pkg)) {
if (key === '$schema') { if (key === '$schema') {
continue; continue;

View file

@ -7,6 +7,7 @@
"license": "MPL-2.0", "license": "MPL-2.0",
"type": "module", "type": "module",
"private": true, "private": true,
"files": ["dist"],
"scripts": { "scripts": {
"precommit": "lint-staged", "precommit": "lint-staged",
"start": "parcel src/index.html", "start": "parcel src/index.html",

View file

@ -30,12 +30,15 @@
"@logto/app-insights": "workspace:^", "@logto/app-insights": "workspace:^",
"@logto/cli": "workspace:^", "@logto/cli": "workspace:^",
"@logto/connector-kit": "workspace:^", "@logto/connector-kit": "workspace:^",
"@logto/console": "workspace:*",
"@logto/core-kit": "workspace:^", "@logto/core-kit": "workspace:^",
"@logto/demo-app": "workspace:*",
"@logto/language-kit": "workspace:^", "@logto/language-kit": "workspace:^",
"@logto/phrases": "workspace:^", "@logto/phrases": "workspace:^",
"@logto/phrases-ui": "workspace:^", "@logto/phrases-ui": "workspace:^",
"@logto/schemas": "workspace:^", "@logto/schemas": "workspace:^",
"@logto/shared": "workspace:^", "@logto/shared": "workspace:^",
"@logto/ui": "workspace:*",
"@silverhand/essentials": "^2.5.0", "@silverhand/essentials": "^2.5.0",
"aws-sdk": "^2.1329.0", "aws-sdk": "^2.1329.0",
"chalk": "^5.0.0", "chalk": "^5.0.0",

View file

@ -16,7 +16,7 @@ export default function koaSpaProxy<StateT, ContextT extends IRouterParamContext
): MiddlewareType<StateT, ContextT, ResponseBodyT> { ): MiddlewareType<StateT, ContextT, ResponseBodyT> {
type Middleware = MiddlewareType<StateT, ContextT, ResponseBodyT>; type Middleware = MiddlewareType<StateT, ContextT, ResponseBodyT>;
const distributionPath = path.join('..', packagePath, 'dist'); const distributionPath = path.join('node_modules/@logto', packagePath, 'dist');
const spaProxy: Middleware = EnvSet.values.isProduction const spaProxy: Middleware = EnvSet.values.isProduction
? serveStatic(distributionPath) ? serveStatic(distributionPath)

View file

@ -5,6 +5,7 @@
"author": "Silverhand Inc. <contact@silverhand.io>", "author": "Silverhand Inc. <contact@silverhand.io>",
"license": "MPL-2.0", "license": "MPL-2.0",
"private": true, "private": true,
"files": ["dist"],
"scripts": { "scripts": {
"precommit": "lint-staged", "precommit": "lint-staged",
"start": "parcel src/index.html", "start": "parcel src/index.html",

View file

@ -4,6 +4,7 @@
"license": "MPL-2.0", "license": "MPL-2.0",
"type": "module", "type": "module",
"private": true, "private": true,
"files": ["dist"],
"scripts": { "scripts": {
"precommit": "lint-staged", "precommit": "lint-staged",
"start": "parcel src/index.html", "start": "parcel src/index.html",

View file

@ -3008,9 +3008,15 @@ importers:
'@logto/connector-kit': '@logto/connector-kit':
specifier: workspace:^ specifier: workspace:^
version: link:../toolkit/connector-kit version: link:../toolkit/connector-kit
'@logto/console':
specifier: workspace:*
version: link:../console
'@logto/core-kit': '@logto/core-kit':
specifier: workspace:^ specifier: workspace:^
version: link:../toolkit/core-kit version: link:../toolkit/core-kit
'@logto/demo-app':
specifier: workspace:*
version: link:../demo-app
'@logto/language-kit': '@logto/language-kit':
specifier: workspace:^ specifier: workspace:^
version: link:../toolkit/language-kit version: link:../toolkit/language-kit
@ -3026,6 +3032,9 @@ importers:
'@logto/shared': '@logto/shared':
specifier: workspace:^ specifier: workspace:^
version: link:../shared version: link:../shared
'@logto/ui':
specifier: workspace:*
version: link:../ui
'@silverhand/essentials': '@silverhand/essentials':
specifier: ^2.5.0 specifier: ^2.5.0
version: 2.5.0 version: 2.5.0