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

Function buildFileInfo

packages/addon-blueprint/index.js:132–177  ·  view source on GitHub ↗

* @override * * This modification of buildFileInfo allows our differing * input files to output to a single file, depending on the options. * For example: * * for javascript, * _ts_eslint.config.mjs is deleted * _js_eslint.config.mjs is renamed to eslint.config.mjs

(intoDir, templateVariables, file, commandOptions)

Source from the content-addressed store, hash-verified

130 * _ts_eslint.config.mjs is renamed to eslint.config.mjs
131 */
132 buildFileInfo(intoDir, templateVariables, file, commandOptions) {
133 if (file.includes('_js_') || file.includes('_ts_')) {
134 let fileInfo = this._super.buildFileInfo.apply(this, arguments);
135
136 if (file.includes('_js_')) {
137 if (commandOptions.typescript) {
138 return null;
139 }
140
141 fileInfo.outputBasePath = fileInfo.outputPath.replace('_js_', '');
142 fileInfo.outputPath = fileInfo.outputPath.replace('_js_', '');
143 fileInfo.displayPath = fileInfo.outputPath.replace('_js_', '');
144 return fileInfo;
145 }
146
147 if (file.includes('_ts_')) {
148 if (!commandOptions.typescript) {
149 return null;
150 }
151
152 fileInfo.outputBasePath = fileInfo.outputPath.replace('_ts_', '');
153 fileInfo.outputPath = fileInfo.outputPath.replace('_ts_', '');
154 fileInfo.displayPath = fileInfo.outputPath.replace('_ts_', '');
155 return fileInfo;
156 }
157
158 return fileInfo;
159 }
160
161 let mappedPath = this.mapFile(file, templateVariables);
162 let options = {
163 action: 'write',
164 outputBasePath: path.normalize(intoDir),
165 outputPath: path.join(intoDir, mappedPath),
166 displayPath: path.normalize(mappedPath),
167 inputPath: this.srcPath(file),
168 templateVariables,
169 ui: this.ui,
170 };
171
172 if (file in replacers) {
173 options.replacer = replacers[file].bind(this);
174 }
175
176 return new FileInfo(options);
177 },
178
179 beforeInstall() {
180 const prependEmoji = require('@ember-tooling/blueprint-model/utilities/prepend-emoji');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…