GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vscode-react-native/gulp_scripts/builder.js at master · microsoft/vscode-react-native

Expand file tree

/

builder.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
129 lines (113 loc) · 4.46 KB
/

builder.js

Copy path

File metadata and controls

129 lines (113 loc) · 4.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
const gulp = require("gulp");
const { series } = require("gulp");
const getFormatter = require("./formatter");
const getWebpackBundle = require("./webpackBundle");
const getCleaner = require("./cleaner");
const { runTypeScriptCompile } = require("./typescriptCli");
const nls = require("vscode-nls-dev");
const filter = require("gulp-filter");
const minimist = require("minimist");
const log = require("fancy-log");
const { createLinePreservingPreprocessor } = require("./linePreservingPreprocessor");
const es = require("event-stream");
const knownOptions = {
string: "env",
default: { env: "production" },
};
const options = minimist(process.argv.slice(2), knownOptions);
const buildTask = gulp.series(getFormatter.lint, async function runBuild() {
await build(true, true);
});
// Generates ./dist/nls.bundle.<language_id>.json from files in ./i18n/** *//<src_path>/<filename>.i18n.json
// Localized strings are read from these files at runtime.
const generateSrcLocBundle = () => {
// Transpile the TS to JS, and let vscode-nls-dev scan the files for calls to localize.
return runTypeScriptCompile().then(() =>
streamToPromise(
gulp
.src(["src/**/*.js"], { base: ".", allowEmpty: true })
.pipe(nls.createMetaDataFiles())
.pipe(nls.createAdditionalLanguageFiles(defaultLanguages, "i18n"))
.pipe(nls.bundleMetaDataFiles(fullExtensionName, "dist"))
.pipe(nls.bundleLanguageFiles())
.pipe(
filter([
"**/nls.bundle.*.json",
"**/nls.metadata.header.json",
"**/nls.metadata.json",
"!src/**",
]),
)
.pipe(gulp.dest("dist")),
),
);
};
const defaultLanguages = [
{ id: "zh-tw", folderName: "cht", transifexId: "zh-hant" },
{ id: "zh-cn", folderName: "chs", transifexId: "zh-hans" },
{ id: "ja", folderName: "jpn" },
{ id: "ko", folderName: "kor" },
{ id: "de", folderName: "deu" },
{ id: "fr", folderName: "fra" },
{ id: "es", folderName: "esn" },
{ id: "ru", folderName: "rus" },
{ id: "it", folderName: "ita" },
// These language-pack languages are included for VS but excluded from the vscode package
{ id: "cs", folderName: "csy" },
{ id: "tr", folderName: "trk" },
{ id: "pt-br", folderName: "ptb", transifexId: "pt-BR" },
{ id: "pl", folderName: "plk" },
];
/**
* Whether we're running a nightly build.
*/
const isNightly = process.argv.includes("--nightly");
const fullExtensionName = isNightly
? "msjsdiag.vscode-react-native-preview"
: "msjsdiag.vscode-react-native";
async function build(failOnError, buildNls) {
const isProd = options.env === "production";
const preprocessorContext = isProd ? { PROD: true } : { DEBUG: true };
log(`Building with preprocessor context: ${JSON.stringify(preprocessorContext)}`);
await runTypeScriptCompile();
const stream = gulp
.src(["src/**/*.js", "test/**/*.js"], { base: ".", allowEmpty: true })
.pipe(createLinePreservingPreprocessor(preprocessorContext))
.pipe(buildNls ? nls.rewriteLocalizeCalls() : es.through())
.pipe(
buildNls
? nls.createAdditionalLanguageFiles(defaultLanguages, "i18n", ".")
: es.through(),
)
.pipe(buildNls ? nls.bundleMetaDataFiles(fullExtensionName, ".") : es.through())
.pipe(buildNls ? nls.bundleLanguageFiles() : es.through())
.pipe(gulp.dest(file => file.cwd));
try {
await streamToPromise(stream);
} catch (error) {
if (failOnError) {
throw error;
}
}
}
// TODO: The file property should point to the generated source (this implementation adds an extra folder to the path)
// We should also make sure that we always generate urls in all the path properties (We shouldn"t have \\s. This seems to
// be an issue on Windows platforms)
function runBuild(done) {
build(true, true).then(() => done(), done);
}
function buildDev(done) {
build(true, false).then(() => done(), done);
}
const buildProd = series(getCleaner.clean, getWebpackBundle.webpackBundle, generateSrcLocBundle);
function streamToPromise(stream) {
return new Promise((resolve, reject) => {
stream.once("error", reject);
stream.once("finish", resolve);
});
}
module.exports = {
buildTask,
buildDev,
buildProd,
};
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.