Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
67c4f0c
Initial removal of old project configurations
jafeltra May 20, 2021
871ca46
Additional clean up
jafeltra May 20, 2021
e37119e
Update Processing.ts tests
jafeltra May 20, 2021
2fe7064
Updates for ensureConfigurationFile
jafeltra May 20, 2021
79c8e67
Update addConfiguredPageContent tests. Remove addIncludeContents tests
jafeltra May 20, 2021
630135a
Update addIgIni tests
jafeltra May 21, 2021
46857b0
Update addIndex tests and remove ignoreWarnings tests
jafeltra May 21, 2021
c89b700
Remove SUSHI-GENERATED-FILES tests, update menu-xml tests, update pac…
jafeltra May 21, 2021
2401b8a
Update example config files and IGExporter.test.ts tests to reflect d…
jafeltra May 21, 2021
3726771
Update IGExporter.IG tests, remove template property from minimalConf…
jafeltra May 21, 2021
305bf76
Remove template and history from generated configuration
jafeltra May 24, 2021
4e821cc
Rename functions that only log errors/warnings and no longer add anyt…
jafeltra May 24, 2021
6530dca
Remove configuration generation if none exists
jafeltra May 24, 2021
e5902b9
Update language to say which properties are no longer supported
jafeltra May 24, 2021
a131002
Use correct path when looking for ig-data folder. Minor comment updates.
jafeltra May 26, 2021
b4a8bad
Remove unnecessary error messages
jafeltra May 27, 2021
f8706fe
Updates from PR review
jafeltra Jun 2, 2021
e02ff58
Update index page conditional logic
jafeltra Jun 3, 2021
1db4309
Merge master and resolve conflicts and update tests
jafeltra Jun 3, 2021
b2e8d06
Update comments for unsupported configuration properties
jafeltra Jun 3, 2021
b7e8ded
Merge branch 'master' into remove-deprecated-config
jafeltra Jun 3, 2021
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
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ Additional information:
If input/fsh/ subdirectory present, it is included in [path-to-fsh-defs]
-o, --out <out>
Default: "fsh-generated"
If legacy publisher mode (fsh subdirectory present), default output is parent of "fsh"
If legacy flat mode (no input/fsh or fsh subdirectories present), default output is "build"

```

Expand Down
36 changes: 2 additions & 34 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@
"@types/ini": "^1.3.30",
"@types/jest": "^26.0.21",
"@types/lodash": "^4.14.149",
"@types/markdown-table": "^2.0.0",
"@types/node": "^12.12.34",
"@types/opener": "^1.4.0",
"@types/readline-sync": "^1.4.3",
"@types/sax": "^1.2.1",
"@types/tar": "^4.0.3",
"@types/temp": "^0.8.34",
"@types/valid-url": "^1.0.3",
"@types/wordwrap": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"acorn": "^7.1.1",
Expand Down Expand Up @@ -90,16 +88,13 @@
"ini": "^1.3.8",
"junk": "^3.1.0",
"lodash": "^4.17.21",
"markdown-table": "^2.0.0",
"readline-sync": "^1.4.10",
"sax": "^1.2.4",
"tar": "^5.0.5",
"temp": "^0.9.1",
"title-case": "^3.0.2",
"valid-url": "^1.0.9",
"winston": "^3.3.3",
"wordwrap": "^1.0.0",
"xml-js": "^1.6.11",
"yaml": "^1.9.2"
}
}
57 changes: 20 additions & 37 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ async function app() {
console.log(' If input/fsh/ subdirectory present, it is included in [path-to-fsh-defs]');
console.log(' -o, --out <out>');
console.log(' Default: "fsh-generated"');
console.log(
' If legacy publisher mode (fsh subdirectory present), default output is parent of "fsh"'
);
console.log(
' If legacy flat mode (no input/fsh or fsh subdirectories present), default output is "build"'
);
})
.arguments('[path-to-fsh-defs]')
.action(function (pathToFshDefs) {
Expand Down Expand Up @@ -107,39 +101,36 @@ async function app() {
// If an input/fsh subdirectory is used, we are in an IG Publisher context
const fshFolder = path.basename(input) === 'fsh';
const inputFshFolder = fshFolder && path.basename(path.dirname(input)) === 'input';
const isIgPubContext = inputFshFolder;
// TODO: Legacy support for top level fsh/ subdirectory. Remove when no longer supported.
const isLegacyIgPubContext = fshFolder && !inputFshFolder;
const outDir = ensureOutputDir(input, program.out, isIgPubContext, isLegacyIgPubContext);
if (!inputFshFolder) {
// Since current supported tank configuration requires input/fsh folder,
// both legacy IG publisher mode and legacy flat tank cases occur when
// there is no input/fsh/ folder.
// If we detect this case, things are about to go very wrong, so exit immediately.
logger.error(
'Migration to current SUSHI project structure is required. See above error message for details. Exiting.'
);
process.exit(1);
}
const outDir = ensureOutputDir(input, program.out);

let tank: FSHTank;
let config: Configuration;

try {
let rawFSH: RawFSH[];
if (
path.basename(path.dirname(input)) === 'input' &&
path.basename(input) === 'fsh' &&
!fs.existsSync(input)
) {
if (!fs.existsSync(input)) {
// If we have a path that ends with input/fsh but that folder does not exist,
// we are in a sushi-config.yaml-only case (new tank configuration with no FSH files)
// we are in a sushi-config.yaml-only case (current tank configuration with no FSH files)
// so we can safely say there are no FSH files and therefore rawFSH is empty.
rawFSH = [];
} else {
rawFSH = getRawFSHes(input);
}
if (
rawFSH.length === 0 &&
!fs.existsSync(path.join(originalInput, 'config.yaml')) &&
!fs.existsSync(path.join(originalInput, 'sushi-config.yaml')) &&
!fs.existsSync(path.join(originalInput, 'fsh', 'config.yaml')) &&
!fs.existsSync(path.join(originalInput, 'fsh', 'sushi-config.yaml'))
) {
if (rawFSH.length === 0 && !fs.existsSync(path.join(originalInput, 'sushi-config.yaml'))) {
logger.info('No FSH files or sushi-config.yaml present.');
process.exit(0);
}
config = readConfig(isIgPubContext ? originalInput : input, isLegacyIgPubContext);
config = readConfig(originalInput);
tank = fillTank(rawFSH, config);
} catch {
program.outputHelp();
Expand All @@ -150,14 +141,8 @@ async function app() {
const defs = new FHIRDefinitions();
await loadExternalDependencies(defs, config);

// Load custom resources
if (!isIgPubContext) {
// In legacy configuration (both IG publisher context and any other tank), resources are in ig-data/input/
loadCustomResources(path.join(input, 'ig-data', 'input'), defs);
} else {
// In current tank configuration (input/fsh), resources will be in input/
loadCustomResources(path.join(input, '..'), defs);
}
// Load custom resources. In current tank configuration (input/fsh), resources will be in input/
loadCustomResources(path.join(input, '..'), defs);

// Check for StructureDefinition
const structDef = defs.fishForFHIR('StructureDefinition', Type.Resource);
Expand All @@ -172,7 +157,7 @@ async function app() {

logger.info('Converting FSH to FHIR resources...');
const outPackage = exportFHIR(tank, defs);
writeFHIRResources(outDir, outPackage, defs, program.snapshot, isIgPubContext);
writeFHIRResources(outDir, outPackage, defs, program.snapshot);

if (program.preprocessed) {
logger.info('Writing preprocessed FSH...');
Expand All @@ -183,11 +168,9 @@ async function app() {
if (config.FSHOnly) {
logger.info('Exporting FSH definitions only. No IG related content will be exported.');
} else {
const igDataPath = isIgPubContext
? path.resolve(input, '..', '..')
: path.resolve(input, 'ig-data');
const igFilesPath = path.resolve(input, '..', '..');
logger.info('Assembling Implementation Guide sources...');
const igExporter = new IGExporter(outPackage, defs, igDataPath, isIgPubContext);
const igExporter = new IGExporter(outPackage, defs, igFilesPath);
igExporter.export(outDir);
logger.info('Assembled Implementation Guide sources; ready for IG Publisher.');
if (
Expand Down
2 changes: 1 addition & 1 deletion src/fhirdefs/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export function cleanCachedPackage(packageDirectory: string): void {
}

/**
* Loads custom resources defined in ig-data into FHIRDefs
* Loads custom resources defined in resourceDir into FHIRDefs
* @param {string} resourceDir - The path to the directory containing the resource subdirs
* @param {FHIRDefinitions} defs - The FHIRDefinitions object to load definitions into
*/
Expand Down
25 changes: 8 additions & 17 deletions src/fshtypes/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export type Configuration = {
// refers to the IG.definiton.template definitions; not the publisher template in ig.ini.
templates?: ImplementationGuideDefinitionTemplate[];

// DEPRECATED: Use of the template property is no longer recommended. Authors should manage the
// ig.ini file themselves. Support for the template property will be removed in a future release.
// The template property will be used to generate an ig.ini file.
// To provide a custom ig.ini file, do not include this property and include an `ig.ini` file in ig-data.
// NO LONGER SUPPORTED: Use of the template property is no longer supported. Authors should manage the
// ig.ini file themselves.
// NOTE: This property is kept in the type so we can log more useful error messages in IGExporter.
// If those errors are removed, the property should be removed entirely.
template?: string;

// The menu property will be used to generate the input/menu.xml file. The menu is represented as
Expand All @@ -112,19 +112,10 @@ export type Configuration = {
// file, do not include this property and include a `menu.xml` file in input/includes.
menu?: ConfigurationMenuItem[];

// The history property corresponds to package-list.json. SUSHI will use the existing top-level
// properties in its config to populate the top-level package-list.json properties: package-id,
// canonical, title, and introduction. Authors that wish to provide different values can supply
// them as properties under history. All other properties under history are assumed to be
// versions. To provide a custom package-list.json file, remove this property and include a
// package-list.json file in ig-data.
//
// The current version is special. If the author provides only a single string value, it is
// assumed to be the URL path to the current build. The following default values will then be
// used:
// * desc: Continuous Integration Build (latest in version control)
// * status: ci-build
// * current: true
// NO LONGER SUPPORTED: Use of the history property is no longer supported. Authors should manage
// the package-list.json file directly.
// NOTE: This property is kept in the type so we can log more useful error messages in IGExporter.
// If those errors are removed, the property should be removed entirely.
history?: ConfigurationHistory;

// The indexPageContent property is used to generate a basic index.md file. To provide a
Expand Down
28 changes: 0 additions & 28 deletions src/fshtypes/PackageJSON.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/fshtypes/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './FshCodeSystem';
export * from './PackageJSON';
export * from './Extension';
export * from './Instance';
export * from './FshCanonical';
Expand Down
Loading