Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vanillajs instead of ts for build scripts #9366

Merged
merged 3 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions build/ci/postInstall.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
exports.__esModule = true;
var colors = require("colors/safe");
var fs = require("fs");
var path = require("path");
var constants_1 = require("../constants");

var colors = require('colors/safe');
var fs = require('fs');
var path = require('path');
var constants_1 = require('../constants');
/**
* In order to compile the extension in strict mode, one of the dependencies (@jupyterlab) has some files that
* just won't compile in strict mode.
Expand All @@ -22,21 +22,20 @@ function fixJupyterLabDTSFiles() {
var fileContents = fs.readFileSync(filePath, { encoding: 'utf8' });
if (fileContents.indexOf('[key: string]: ISchema | undefined;') > 0) {
// tslint:disable-next-line:no-console
console.log(colors.blue(relativePath + " file already updated (by Python VSC)"));
console.log(colors.blue(relativePath + ' file already updated (by Python VSC)'));
return;
}
if (fileContents.indexOf('[key: string]: ISchema;') > 0) {
var replacedText = fileContents.replace('[key: string]: ISchema;', '[key: string]: ISchema | undefined;');
if (fileContents === replacedText) {
throw new Error('Fix for JupyterLabl file \'settingregistry.d.ts\' failed (pvsc post install script)');
throw new Error("Fix for JupyterLabl file 'settingregistry.d.ts' failed (pvsc post install script)");
}
fs.writeFileSync(filePath, replacedText);
// tslint:disable-next-line:no-console
console.log(colors.green(relativePath + " file updated (by Python VSC)"));
}
else {
console.log(colors.green(relativePath + ' file updated (by Python VSC)'));
} else {
// tslint:disable-next-line:no-console
console.log(colors.red(relativePath + " file does not need updating."));
console.log(colors.red(relativePath + ' file does not need updating.'));
}
}
fixJupyterLabDTSFiles();
56 changes: 0 additions & 56 deletions build/ci/postInstall.ts

This file was deleted.

4 changes: 4 additions & 0 deletions build/ci/templates/jobs/build_compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ jobs:
- bash: npx prettier "src/**/*.ts*" --check
displayName: "Code Format"
workingDirectory: $(Build.SourcesDirectory)

- bash: npx prettier "build/**/*.js" --check
displayName: "Code Format"
workingDirectory: $(Build.SourcesDirectory)
4 changes: 2 additions & 2 deletions build/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const util = require("./util");

const util = require('./util');
exports.ExtensionRootDir = util.ExtensionRootDir;
// This is a list of files that existed before MS got the extension.
exports.existingFiles = util.getListOfFiles('existingFiles.json');
Expand Down
14 changes: 0 additions & 14 deletions build/constants.ts

This file was deleted.

3 changes: 1 addition & 2 deletions build/contributedFiles.json
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
[
]
[]
29 changes: 0 additions & 29 deletions build/tsconfig.json

This file was deleted.

8 changes: 4 additions & 4 deletions build/tslint-rules/baseRuleWalker.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const Lint = require("tslint");
const util = require("../util");

const path = require('path');
const Lint = require('tslint');
const util = require('../util');
class BaseRuleWalker extends Lint.RuleWalker {
shouldIgnoreCurrentFile(node, filesToIgnore) {
const sourceFile = node.getSourceFile();
Expand Down
22 changes: 0 additions & 22 deletions build/tslint-rules/baseRuleWalker.ts

This file was deleted.

27 changes: 15 additions & 12 deletions build/tslint-rules/messagesMustBeLocalizedRule.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const Lint = require("tslint");
const ts = require("typescript");
const util = require("../util");
const baseRuleWalker_1 = require("./baseRuleWalker");

const path = require('path');
const Lint = require('tslint');
const ts = require('typescript');
const util = require('../util');
const baseRuleWalker = require('./baseRuleWalker');
const methodNames = [
// From IApplicationShell (vscode.window):
'showErrorMessage', 'showInformationMessage',
'showWarningMessage', 'setStatusBarMessage',
'showErrorMessage',
'showInformationMessage',
'showWarningMessage',
'setStatusBarMessage',
// From IOutputChannel (vscode.OutputChannel):
'appendLine', 'appendLine'
'appendLine',
'appendLine'
];
// tslint:ignore-next-line:no-suspicious-comments
// TODO: Ideally we would not ignore any files.
const ignoredFiles = util.getListOfFiles('unlocalizedFiles.json');
const ignoredPrefix = path.normalize('src/test');
const failureMessage = 'Messages must be localized in the Python Extension (use src/client/common/utils/localize.ts)';
class NoStringLiteralsInMessages extends baseRuleWalker_1.BaseRuleWalker {
class NoStringLiteralsInMessages extends baseRuleWalker.BaseRuleWalker {
visitCallExpression(node) {
if (!this.shouldIgnoreNode(node)) {
node.arguments
.filter(arg => ts.isStringLiteral(arg) || ts.isTemplateLiteral(arg))
.forEach(arg => {
this.addFailureAtNode(arg, failureMessage);
});
this.addFailureAtNode(arg, failureMessage);
});
}
super.visitCallExpression(node);
}
Expand Down
72 changes: 0 additions & 72 deletions build/tslint-rules/messagesMustBeLocalizedRule.ts

This file was deleted.

9 changes: 4 additions & 5 deletions build/util.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");

const fs = require('fs');
const path = require('path');
exports.ExtensionRootDir = path.dirname(__dirname);
function getListOfFiles(filename) {
filename = path.normalize(filename);
Expand All @@ -12,8 +12,7 @@ function getListOfFiles(filename) {
}
const data = fs.readFileSync(filename).toString();
const files = JSON.parse(data);
return files
.map(file => {
return files.map(file => {
return path.join(exports.ExtensionRootDir, file.replace(/\//g, path.sep));
});
}
Expand Down
23 changes: 0 additions & 23 deletions build/util.ts

This file was deleted.

Loading