Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
try {
// npm run deploy
const PAT = process.argv[2].trim();
if ('' === PAT) {
throw new Error(`No Personal Access Token defined!`);
}
await vsce.publish({
cwd: __dirname,
pat: PAT,
useYarn: false,
});
} catch (e) {
console.error(e);
process.exit(1);
}
})();
export async function publish(options: PublishOptions = {}): Promise {
if (!options.registryUrl) {
options.registryUrl = process.env.OVSX_REGISTRY_URL;
}
if (!options.pat) {
options.pat = process.env.OVSX_PAT;
}
if (!options.extensionFile) {
options.extensionFile = await createTempFile({ postfix: '.vsix' });
await createVSIX({
cwd: options.packagePath,
packagePath: options.extensionFile,
baseContentUrl: options.baseContentUrl,
baseImagesUrl: options.baseImagesUrl,
useYarn: options.yarn
});
console.log(); // new line
}
const registry = new Registry({ url: options.registryUrl });
const extension = await registry.publish(options.extensionFile, options.pat);
if (extension.error) {
throw new Error(extension.error);
}
console.log(`\ud83d\ude80 Published ${extension.publisher}.${extension.name} v${extension.version}`);
}
gulp.task('publish:vsce', () =>
vsce.publish({
noVerify: true, // for proposed API usage
pat: process.env.MARKETPLACE_TOKEN,
useYarn: true,
cwd: distDir,
}),
);
function fromLocalWebpack(extensionPath, sourceMappingURLBase) {
const result = es.through();
const packagedDependencies = [];
const packageJsonConfig = require(path.join(extensionPath, 'package.json'));
if (packageJsonConfig.dependencies) {
const webpackRootConfig = require(path.join(extensionPath, 'extension.webpack.config.js'));
for (const key in webpackRootConfig.externals) {
if (key in packageJsonConfig.dependencies) {
packagedDependencies.push(key);
}
}
}
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn, packagedDependencies }).then(fileNames => {
const files = fileNames
.map(fileName => path.join(extensionPath, fileName))
.map(filePath => new File({
path: filePath,
stat: fs.statSync(filePath),
base: extensionPath,
contents: fs.createReadStream(filePath)
}));
const filesStream = es.readArray(files);
// check for a webpack configuration files, then invoke webpack
// and merge its output with the files stream. also rewrite the package.json
// file to a new entry point
const webpackConfigLocations = glob.sync(path.join(extensionPath, '/**/extension.webpack.config.js'), { ignore: ['**/node_modules'] });
const packageJsonFilter = filter(f => {
if (path.basename(f.path) === 'package.json') {
// only modify package.json's next to the webpack file.
function fromLocalNormal(extensionPath) {
const result = es.through();
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
.then(fileNames => {
const files = fileNames
.map(fileName => path.join(extensionPath, fileName))
.map(filePath => new File({
path: filePath,
stat: fs.statSync(filePath),
base: extensionPath,
contents: fs.createReadStream(filePath)
}));
es.readArray(files).pipe(result);
})
.catch(err => result.emit('error', err));
return result.pipe(stats_1.createStatsStream(path.basename(extensionPath)));
}
const baseHeaders = {
const vscePublishTask = function() {
return vsce.publish();
};
gulp.task('vsce-publish', () => {
return vsce.publish();
});
gulp.task('vsce-package', () => {
gulp.task("vsce:publish", function() {
return vsce.publish();
});
gulp.task('vsce:publish', function () {
return vsce.publish();
});
gulp.task('vsce-publish', function() {
return vsce.publish();
});