MCPcopy Create free account
hub / github.com/ember-cli/ember-cli / determineOutputs

Function determineOutputs

dev/update-editor-output-repos.js:56–107  ·  view source on GitHub ↗

* Returns an array of objects containing config for operations to attempt. * This allows for reduced nesting / conditionals when working with the file system and git * * This also allows for easier debugging, reproducibility, testing (if we ever add that), etc

(tag)

Source from the content-addressed store, hash-verified

54 * This also allows for easier debugging, reproducibility, testing (if we ever add that), etc
55 */
56async function determineOutputs(tag) {
57 let version = tag.replace(/^v/, '').replace(/-ember-cli$/, '');
58 let latestEC = await latestVersion('ember-cli');
59 let isLatest = version === latestEC;
60 let repo = `https://github-actions:${GITHUB_TOKEN}@github.com/${REPO}.git`;
61
62 let result = [];
63
64 for (let command of ['new', 'addon']) {
65 let isTypeScript = VARIANT === 'typescript';
66 let branchSuffix = isTypeScript ? '-typescript' : '';
67
68 /**
69 * If we're working with the latest tag, we want to update the default
70 * branch for an editor as well as the tagged version.
71 */
72 let getBranches = (onlineEditor, projectType) => {
73 let editorBranch = `${onlineEditor}-${projectType}-output${branchSuffix}`;
74
75 if (isLatest) {
76 return [editorBranch, `${editorBranch}-v${version}`];
77 }
78
79 return [`${editorBranch}-v${version}`];
80 };
81
82 let name = command === 'new' ? 'my-app' : 'my-addon';
83 let projectType = command === 'new' ? 'app' : 'addon';
84
85 for (let onlineEditor of EDITORS) {
86 let branches = getBranches(onlineEditor, projectType);
87
88 for (let editorBranch of branches) {
89 result.push({
90 variant: VARIANT,
91 isLatest,
92 isTypeScript,
93 tag,
94 version,
95 command,
96 name,
97 projectType,
98 repo,
99 onlineEditor,
100 branch: editorBranch,
101 });
102 }
103 }
104 }
105
106 return result;
107}
108
109async function push(repoPath, { branch }) {
110 console.log('pushing commit');

Callers 1

updateOnlineEditorReposFunction · 0.85

Calls 2

latestVersionFunction · 0.85
getBranchesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…