Skip to content
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
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,24 @@ jobs:
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8
Comment on lines -21 to -22

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Awesome! Good catch ❤️.

For everybody else's benefit, this changes our pnpm version to the one listed in the package.json file.

thought: Side-note, we probably want to upgrade the pnpm/action-setup action soon, since v2 is supposed to be broken and fails to download newer versions of pnpm, see pnpm/action-setup#135


- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ matrix.node }}

- name: Install dependencies for ${{ matrix.pkg }}
- name: Install dependencies
run: |
pnpm install --frozen-lockfile --filter='...${{ matrix.pkg }}'

- name: Lint (if present) ${{ matrix.pkg }}
run: pnpm --if-present --filter='${{ matrix.pkg }}' lint
pnpm install --frozen-lockfile
Comment thread
aloisklink marked this conversation as resolved.

- name: Test ${{ matrix.pkg }}
run: |
pnpm --filter='${{ matrix.pkg }}' test

- name: Lint (if present) ${{ matrix.pkg }}
run: pnpm --if-present --filter='${{ matrix.pkg }}' lint

- name: E2E tests (if present) for ${{ matrix.pkg }}
env:
TEST_MERMAIDCHART_API_TOKEN: ${{ secrets.TEST_MERMAIDCHART_API_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@inquirer/confirm": "^2.0.15",
"@inquirer/input": "^1.2.14",
"@inquirer/select": "^1.3.1",
"@mermaidchart/sdk": "^0.2.1-alpha.0",
"@mermaidchart/sdk": "workspace:^",
"commander": "^11.1.0",
"remark": "^15.0.1",
"remark-frontmatter": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* - The config file exists, but is not a valid TOML file.
* - The config file does not exist, and `ignoreENONET` is `false`.
*/
async function readConfigFromConfigArg(configPath: string, ignoreENONET: boolean = false) {
async function readConfigFromConfigArg(configPath: string, ignoreENONET = false) {
try {
return await readConfig(configPath);
} catch (error) {
Expand Down Expand Up @@ -91,7 +91,7 @@

const user = await client.getUser();

console.log(user.emailAddress);

Check warning on line 94 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 94 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 94 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 94 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 94 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 94 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
});
}

Expand Down Expand Up @@ -131,7 +131,7 @@

await writeConfig(optsWithGlobals['config'], { ...config, auth_token: answer });

console.log(`API token for ${user.emailAddress} saved to ${optsWithGlobals['config']}`);

Check warning on line 134 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 134 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 134 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 134 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 134 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 134 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
});
}

Expand All @@ -143,17 +143,17 @@
const { auth_token, ...config } = await readConfig(optsWithGlobals['config']);

if (auth_token === undefined) {
console.log(`Nothing to do, there's no auth_token in ${optsWithGlobals['config']}`);

Check warning on line 146 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 146 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 146 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 146 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 146 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 146 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
}

await writeConfig(optsWithGlobals['config'], config);

try {
const user = await (await createClient(optsWithGlobals)).getUser();
console.log(`API token for ${user.emailAddress} removed from ${optsWithGlobals['config']}`);

Check warning on line 153 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 153 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 153 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 153 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 153 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 153 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
} catch (error) {
// API token might have been expired
console.log(`API token removed from ${optsWithGlobals['config']}`);

Check warning on line 156 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 156 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 156 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 156 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 156 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 156 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
}
});
}
Expand Down Expand Up @@ -247,14 +247,14 @@
const newFile = await pull(text, client, { title: path });

if (text === newFile) {
console.log(`✅ - ${path} is up to date`);

Check warning on line 250 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 250 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 250 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 250 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 250 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 250 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
} else {
if (options['check']) {
console.log(`❌ - ${path} would be updated`);

Check warning on line 253 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 253 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 253 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 253 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 253 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 253 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
process.exitCode = 1;
} else {
await writeFile(path, newFile, { encoding: 'utf8' });
console.log(`✅ - ${path} was updated`);

Check warning on line 257 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 257 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 257 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 257 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 257 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 257 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
}
}
}),
Expand Down Expand Up @@ -319,7 +319,7 @@
const config = await readConfigFromConfigArg(configPath, ignoreENONET);
for (const key in config) {
if (!(key in optionNameMap)) {
console.warn(`Warning: Ignoring unrecognized config key: ${key} in ${configPath}`);

Check warning on line 322 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 322 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 322 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 322 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 322 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 322 in packages/cli/src/commander.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
continue;
}
const optionCommanderName = optionNameMap[key as keyof typeof optionNameMap];
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

if (frontmatter.metadata.id) {
if (ignoreAlreadyLinked) {
console.log(`○ - ${title} is already linked`);

Check warning on line 68 in packages/cli/src/methods.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 68 in packages/cli/src/methods.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, ubuntu-latest)

Unexpected console statement

Check warning on line 68 in packages/cli/src/methods.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 68 in packages/cli/src/methods.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, macos-latest)

Unexpected console statement

Check warning on line 68 in packages/cli/src/methods.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement

Check warning on line 68 in packages/cli/src/methods.ts

View workflow job for this annotation

GitHub Actions / test (18.18.x, cli, windows-latest)

Unexpected console statement
return diagram; // no change required
} else {
throw new CommanderError(
Expand Down Expand Up @@ -94,7 +94,7 @@
return diagramWithId;
}

interface PullOptions extends CommonOptions {}
type PullOptions = CommonOptions;

/**
* Pulls down a diagram from MermaidChart.com
Expand Down Expand Up @@ -123,7 +123,7 @@
return newFile;
}

interface PushOptions extends CommonOptions {}
type PushOptions = CommonOptions;

/**
* Push the given diagram to MermaidChart.com
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class MermaidChart {
utm_source: string;
utm_medium: string;
utm_campaign: string;
}
};
} = {}): Promise<AuthorizationData> {
if (!this.redirectURI) {
throw new Error('redirectURI is not set');
Expand All @@ -107,7 +107,7 @@ export class MermaidChart {
utm_source: trackingParams.utm_source,
utm_medium: trackingParams.utm_medium,
utm_campaign: trackingParams.utm_campaign,
}
},
}),
});

Expand Down Expand Up @@ -266,4 +266,4 @@ export class MermaidChart {
const raw = await this.axios.get<string>(URLS.raw(document, theme).svg);
return raw.data;
}
}
}
Loading