mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge remote-tracking branch 'atmire/w2p-93219_Consolidate-all-initialization-in-a-single-Service_PR' into w2p-92900_Admin_options_dont_appear_after_Shibboleth_authentication_PR
This commit is contained in:
36
scripts/base-href.ts
Normal file
36
scripts/base-href.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as fs from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
import { AppConfig } from '../src/config/app-config.interface';
|
||||
import { buildAppConfig } from '../src/config/config.server';
|
||||
|
||||
/**
|
||||
* Script to set baseHref as `ui.nameSpace` for development mode. Adds `baseHref` to angular.json build options.
|
||||
*
|
||||
* Usage (see package.json):
|
||||
*
|
||||
* yarn base-href
|
||||
*/
|
||||
|
||||
const appConfig: AppConfig = buildAppConfig();
|
||||
|
||||
const angularJsonPath = join(process.cwd(), 'angular.json');
|
||||
|
||||
if (!fs.existsSync(angularJsonPath)) {
|
||||
console.error(`Error:\n${angularJsonPath} does not exist\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
const angularJson = require(angularJsonPath);
|
||||
|
||||
const baseHref = `${appConfig.ui.nameSpace}${appConfig.ui.nameSpace.endsWith('/') ? '' : '/'}`;
|
||||
|
||||
console.log(`Setting baseHref to ${baseHref} in angular.json`);
|
||||
|
||||
angularJson.projects['dspace-angular'].architect.build.options.baseHref = baseHref;
|
||||
|
||||
fs.writeFileSync(angularJsonPath, JSON.stringify(angularJson, null, 2) + '\n');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
@@ -24,7 +24,7 @@ if (!fs.existsSync(envFullPath)) {
|
||||
}
|
||||
|
||||
try {
|
||||
const env = require(envFullPath);
|
||||
const env = require(envFullPath).environment;
|
||||
|
||||
const config = yaml.dump(env);
|
||||
if (args[1]) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { projectRoot} from '../webpack/helpers';
|
||||
import { projectRoot } from '../webpack/helpers';
|
||||
|
||||
const commander = require('commander');
|
||||
const fs = require('fs');
|
||||
const JSON5 = require('json5');
|
||||
@@ -119,7 +120,7 @@ function syncFileWithSource(pathToTargetFile, pathToOutputFile) {
|
||||
outputChunks.forEach(function (chunk) {
|
||||
progressBar.increment();
|
||||
chunk.split("\n").forEach(function (line) {
|
||||
file.write(" " + line + "\n");
|
||||
file.write((line === '' ? '' : ` ${line}`) + "\n");
|
||||
});
|
||||
});
|
||||
file.write("\n}");
|
||||
@@ -192,7 +193,10 @@ function createNewChunkComparingSourceAndTarget(correspondingTargetChunk, source
|
||||
|
||||
const targetList = correspondingTargetChunk.split("\n");
|
||||
const oldKeyValueInTargetComments = getSubStringWithRegex(correspondingTargetChunk, "\\s*\\/\\/\\s*\".*");
|
||||
const keyValueTarget = targetList[targetList.length - 1];
|
||||
let keyValueTarget = targetList[targetList.length - 1];
|
||||
if (!keyValueTarget.endsWith(",")) {
|
||||
keyValueTarget = keyValueTarget + ",";
|
||||
}
|
||||
|
||||
if (oldKeyValueInTargetComments != null) {
|
||||
const oldKeyValueUncommented = getSubStringWithRegex(oldKeyValueInTargetComments[0], "\".*")[0];
|
||||
|
@@ -3,7 +3,7 @@ import * as https from 'https';
|
||||
|
||||
import { AppConfig } from '../src/config/app-config.interface';
|
||||
import { buildAppConfig } from '../src/config/config.server';
|
||||
|
||||
|
||||
const appConfig: AppConfig = buildAppConfig();
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user