MCPcopy Create free account
hub / github.com/plotly/plotly.js / syncLocalesPkg

Function syncLocalesPkg

tasks/sync_packages.js:167–288  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

165}
166
167function syncLocalesPkg(d) {
168 var pkgPath = path.join(constants.pathToBuild, d.name);
169
170 var initDirectory = _initDirectory(d, pkgPath);
171
172 var localeFiles;
173 function listLocalFiles(cb) {
174 var localeGlob = path.join(constants.pathToLib, 'locales', '*.js');
175 glob(localeGlob).then(function(_localeFiles) {
176 localeFiles = _localeFiles;
177 cb();
178 }).catch(function(err) {
179 cb(null);
180 });
181 }
182
183 function writePackageJSON(cb) {
184 var cnt = {
185 name: d.name,
186 version: pkg.version,
187 description: d.desc,
188 license: pkg.license,
189 main: d.main,
190 repository: pkg.repository,
191 bugs: pkg.bugs,
192 author: pkg.author,
193 keywords: pkg.keywords,
194 files: [
195 'LICENSE',
196 'README.md',
197 d.main
198 ].concat(localeFiles.map(function(f) { return path.basename(f); }))
199 };
200
201 fs.writeFile(
202 path.join(pkgPath, 'package.json'),
203 JSON.stringify(cnt, null, 2) + '\n',
204 cb
205 );
206 }
207
208 function writeREADME(cb) {
209 var cnt = [
210 '# ' + d.name,
211 '',
212 d.desc,
213 '',
214 'For more info on plotly.js, go to https://github.com/plotly/plotly.js#readme',
215 '',
216 '## Installation',
217 '',
218 '```',
219 'npm install ' + d.name,
220 '```',
221 '## Usage',
222 '',
223 'For example to setup the `fr` locale:',
224 '',

Callers 1

sync_packages.jsFile · 0.85

Calls 3

_initDirectoryFunction · 0.85
_copyLicenseFunction · 0.85
_publishToNPMFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…