Skip to content

Commit

Permalink
feat: make examples to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
syroegkin committed Nov 7, 2021
1 parent fc9b606 commit 856f4d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prepublishOnly": "npm run build",
"commit": "git-cz",
"semantic-release": "semantic-release",
"make:examples": "node ./scripts/make-examples.js",
"make:examples": "ts-node ./scripts/make-examples.ts",
"prepare": "husky install"
},
"bin": {
Expand Down
11 changes: 6 additions & 5 deletions scripts/make-examples.js → scripts/make-examples.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
import path from 'path';
import fs from 'fs';
import { execSync } from 'child_process';

const directory = path.join(__dirname, '..', 'examples');

fs.readdir(directory, (err, files) => {
if (err) {
console.log(`Unable to read directory: ${err}`);
console.error(`Unable to read directory: ${err}`);
return;
}
files.forEach((filename) => {
if (!filename.match(/\.yaml$/)) return;
console.log(`Processing ${filename}`);
execSync(`node src/index.js -i examples/${filename}`);
execSync(`node dist/index.js -i examples/${filename}`);
console.log('Done\n');
});
});

0 comments on commit 856f4d4

Please sign in to comment.