-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking: Rename purge option to content
- Loading branch information
Showing
11 changed files
with
110 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.PHONY: upgrade release | ||
|
||
upgrade: | ||
COREPACK_ENABLE_AUTO_PIN=0 pnpm upgrade --latest | ||
COREPACK_ENABLE_AUTO_PIN=0 pnpm up --latest --interactive | ||
|
||
release: | ||
rm -rf node_modules | ||
COREPACK_ENABLE_AUTO_PIN=0 pnpm publish --access public --no-git-checks |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,4 @@ | ||
import path from "path"; | ||
import fs from "fs"; | ||
import { yaml, red } from "carbon-pipeline"; | ||
import { config } from "./Lib/helper.mjs"; | ||
|
||
const configFile = argv("configFile") || "pipeline.yaml"; | ||
let purge = readPurgePath(configFile); | ||
if (!purge) { | ||
purge = readPurgePath("defaults.yaml", "Build/Carbon.Pipeline"); | ||
} | ||
|
||
if (!Array.isArray(purge)) { | ||
purge = [purge]; | ||
} | ||
|
||
function readPurgePath(file, folder) { | ||
const filePath = folder ? path.join(folder, file) : file; | ||
try { | ||
const definition = yaml.load(fs.readFileSync(path.join("./", filePath), "utf8")); | ||
return definition?.buildDefaults?.purge; | ||
} catch (err) { | ||
const linebreak = () => console.log("\n"); | ||
linebreak(); | ||
console.error(red(`Error reading ${file}:`)); | ||
console.error(err); | ||
linebreak(); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
function argv(key) { | ||
// Return true if the key exists and a value is defined | ||
if (process.argv.includes(`--${key}`)) { | ||
return true; | ||
} | ||
const value = process.argv.find((element) => element.startsWith(`--${key}=`)); | ||
|
||
// Return null if the key does not exist and a value is not defined | ||
if (!value) { | ||
return null; | ||
} | ||
|
||
return value.replace(`--${key}=`, ""); | ||
} | ||
|
||
export default purge; | ||
const content = config.buildDefaults.content; | ||
export default content; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import { config } from "./Lib/helper.mjs"; | ||
import { config, argv } from "./Lib/helper.mjs"; | ||
import { prettyjson } from "carbon-pipeline"; | ||
|
||
const light = process.argv.includes("--light"); | ||
const light = argv("light"); | ||
const path = argv("path"); | ||
|
||
const options = { | ||
keysColor: light ? "blue" : "yellow", | ||
dashColor: light ? "brightMagenta" : "magenta", | ||
stringColor: light ? "black" : "white", | ||
numberColor: light ? "magenta" : "brightMagenta", | ||
multilineStringColor: light ? "black" : "white", | ||
inlineArrays: true, | ||
inlineArrays: false, | ||
}; | ||
|
||
const dump = prettyjson.render(config, options); | ||
|
||
let output = config; | ||
if (path) { | ||
const parts = path.split("."); | ||
output = parts.reduce((o, part) => o[part], output); | ||
} | ||
const dump = prettyjson.render(output, options); | ||
console.log(`\n\n${dump}\n\n`); |