Skip to content

Commit

Permalink
Release v0.0.70
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 13, 2024
1 parent 8a8e119 commit 0e8d2e5
Show file tree
Hide file tree
Showing 301 changed files with 106,729 additions and 22 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ azdataGraph is a derivative of mxGraph, which is a fully client side JavaScript

This is a graph diagraming component developed for use in Azure Data Studio.

For more information on mxGraph please see https://github.com/jgraph/mxgraph.
For more information on mxGraph please see [mxgraph](https://github.com/jgraph/mxgraph)

Typings for the mxGraph library are included in this package. The typings are forked from [typed-mxgraph](https://github.com/typed-mxgraph/typed-mxgraph)

## How to publish a new version of azdataGraph

Expand All @@ -17,12 +19,13 @@ For more information on mxGraph please see https://github.com/jgraph/mxgraph.

## To manually publish a new version of azdataGraph
1. Clone the azdataGraph repository
2. Make your changes
3. Update the version number in the `package.json` file
4. Run `npm install` to install the dependencies
5. Run `npm pack` to create a tarball of the package
6. Push the contents of the tarball to the release branch
7. Create a new release in the Github UI
8. Create a new tag with the version number and set the release branch as the target
9. Publish the release
1. Make your changes
1. Update the version number in the `package.json` file
1. Run `yarn` to install the dependencies
1. Run `yarn build` to build the package
1. Run `yarn pack` to create a tarball of the package
1. Push the contents of the tarball to the release branch
1. Create a new release in the Github UI
1. Create a new tag with the version number and set the release branch as the target
1. Publish the release

102 changes: 102 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
const { typecheckPlugin } = require("@jgoz/esbuild-plugin-typecheck");
const esbuild = require("esbuild");
const fs = require("fs");
const path = require("path");

const config = {
entryPoints: ['./src/ts/index.ts'],
outfile: './dist/index.js',
bundle: true,
format: 'esm',
target: 'esnext',
sourcemap: true,
loader: {
".ts": "ts",
".css": "css",
".gif": "dataurl",
},
plugins: [{
name: 'rebuild-notify',
setup(build) {
build.onEnd(result => {
console.log(`build ended with ${result.errors.length} errors`);
// HERE: somehow restart the server from here, e.g., by sending a signal that you trap and react to inside the server.
})
},
},
typecheckPlugin({
watch: process.argv.includes('--watch')
}),
],
};

// check if watch is provided as an argument

const run = async () => {
const ctx = await esbuild.context(config);
if (process.argv.includes('--watch')) {
console.log('Watching code');
await ctx.watch();
} else {
console.log('Building code');
await ctx.rebuild();
ctx.dispose();
}
};

run();

function copyFilesRecursively(sourceDir, destDir) {
if (!fs.existsSync(sourceDir)) {
console.error(`Source directory "${sourceDir}" does not exist.`);
return;
}

// Ensure the destination directory exists
fs.mkdirSync(destDir, { recursive: true });

// Read all files and directories in the source directory
const items = fs.readdirSync(sourceDir);

items.forEach((item) => {
const sourcePath = path.join(sourceDir, item);
const destPath = path.join(destDir, item);

if (fs.statSync(sourcePath).isDirectory()) {
// If it's a directory, recursively copy its contents
copyFilesRecursively(sourcePath, destPath);
} else {
// If it's a file, copy it to the destination
fs.copyFileSync(sourcePath, destPath);
console.log(`Copied: ${sourcePath} -> ${destPath}`);
}
});
}


// Example usage
const sourceFolder = path.resolve("src/ts/mxtypings");
const destinationFolder = path.resolve("dist/src/ts/mxtypings");

copyFilesRecursively(sourceFolder, destinationFolder);
console.log("Copying complete!");

// append text to top of a file

const prependText = (filePath, text) => {
console.log(`Prepending ${text} to ${filePath}`);
const data = fs.readFileSync(filePath, 'utf8');
const fd = fs.openSync(filePath
, 'w+');
const insert = Buffer.from(text +
data);
fs.writeSync(fd, insert, 0, insert.length, 0);
fs.close(fd, (err) => {
if (err) {
console.error(err);
return;
}
});
}

prependText('./dist/src/ts/index.d.ts', `/// <reference path="./mxtypings/index.d.ts" />\n`);
Loading

0 comments on commit 0e8d2e5

Please sign in to comment.