Skip to content

Commit

Permalink
New deploy script for basis
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellourbani committed Feb 13, 2025
1 parent 8618c7f commit 4136ed9
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 22 deletions.
24 changes: 16 additions & 8 deletions READMEBASIS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,27 @@ npm login --registry https://npm.bti.local

To publish the extension in the basis technologies repository:

1) bump the version in package.json, both in files and verison keys:
1) bump the version in package.json:

Can be done with CLI:

````bash
npm version patch
```

...or manually:

```json
{
"version": "4.0.5"
}
```

```json
{
"version": "4.0.2",
"files": [ "atlascode-4.0.2.vsix" ]
}
```

2) publish it:

```bash
npm publish
ts-node publish.ts
```

Keep in mind basis version is fake: 4.0 is based on 3.0.11
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
"builds",
"pull requests"
],
"version": "4.0.3",
"files": [
"atlascode-4.0.3.vsix"
],
"version": "4.0.4",
"publisher": "atlassian",
"license": "SEE LICENSE IN LICENSE",
"homepage": "https://github.com/atlassian/atlascode/blob/main/HOMEPAGE.md",
Expand All @@ -25,9 +22,6 @@
"url": "https://github.com/atlassian/atlascode/issues",
"email": "[email protected]"
},
"publishConfig": {
"registry": "https://npm.bti.local"
},
"icon": "images/atlascode-icon.png",
"preview": false,
"galleryBanner": {
Expand All @@ -50,6 +44,7 @@
"extensionKind": [
"workspace"
],
"private": true,
"main": "./build/extension/extension",
"scripts": {
"precommit": "pretty-quick --staged",
Expand Down
26 changes: 26 additions & 0 deletions publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { readFileSync, statSync, writeFileSync, mkdirSync } = require('fs');
const { execSync } = require('child_process');
try {
mkdirSync('out');
} catch (error) {
/*ignore*/
}
try {
const cert = readFileSync('root_ca.crt').toString();
writeFileSync('out/root_ca.crt', cert);
const pkg = JSON.parse(readFileSync('package.json').toString());
const binary = `atlascode-${pkg.version}.vsix`;
if (!statSync(binary)) throw new Error(`File not found:${binary}`);
pkg.files = [binary];
delete pkg.private;
delete pkg.scripts;
pkg.publishConfig = { registry: 'https://npm.bti.local' };
writeFileSync('out/package.json', JSON.stringify(pkg, null, 1));
execSync(`cp ${binary} README.md out/`).toString();
process.chdir('out');
const res = execSync('npm publish').toString();
console.log(res);
} catch (error) {
console.error(error.message);
process.exit(1);
}
4 changes: 0 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ export enum CommandContext {
IsBBAuthenticated = 'atlascode:isBBAuthenticated',
IsNormalizerEnabled = 'atlascode:IsNormalizerEnabled',
}

export function setCommandContext(key: CommandContext | string, value: any) {
return commands.executeCommand('setContext', key, value);
}
5 changes: 4 additions & 1 deletion src/normalize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { commands, TabInputTextDiff, TextEditor, Uri, window } from 'vscode';
import { CommandContext, setCommandContext } from './constants';
import { CommandContext } from './constants';
import { Container } from './container';

interface CodeNormalizer {
Expand All @@ -9,6 +9,9 @@ interface CodeNormalizer {

const normalizers: CodeNormalizer[] = [];

function setCommandContext(key: CommandContext | string, value: any) {
return commands.executeCommand('setContext', key, value);
}
const registerCodeNormalizer = (normalizer: CodeNormalizer) => {
if (normalizers.indexOf(normalizer) < 0) {
normalizers.push(normalizer);
Expand Down

0 comments on commit 4136ed9

Please sign in to comment.