Skip to content

Commit

Permalink
separate languages
Browse files Browse the repository at this point in the history
  • Loading branch information
battis committed Sep 19, 2024
1 parent 60d2b4d commit 226e137
Show file tree
Hide file tree
Showing 588 changed files with 134 additions and 176 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/split.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
name: "split"
name: 'split'
on:
push:
branches:
- main
tags:
- "*"
- '*'
jobs:
packages_split:
runs-on: ubuntu-latest
environment: "actions"
environment: 'actions'
env:
GITHUB_TOKEN: ${{ secrets.SPLIT_ACCESS_TOKEN }}
strategy:
fail-fast: false
matrix:
package:
- local_path: "appengine-client"
split_repository: "sky-api.appengine-client"
- local_path: "oauth2"
split_repository: "OAuth2-BlackbaudSKY"
- local_path: "oneroster"
split_repository: "sky-api.oneroster"
- local_path: "school"
split_repository: "sky-api.school"
- local_path: 'appengine-client'
split_repository: 'sky-api.appengine-client'
- local_path: 'oauth2'
split_repository: 'OAuth2-BlackbaudSKY'
- local_path: 'oneroster'
split_repository: 'sky-api.oneroster'
- local_path: 'school'
split_repository: 'sky-api.school'
steps:
- uses: actions/checkout@v2
# no tag
- if: "!startsWith(github.ref, 'refs/tags/')"
uses: "danharrin/monorepo-split-github-action@v2.3.0"
uses: 'danharrin/monorepo-split-github-action@v2.3.0'
with:
package_directory: "packages/${{ matrix.package.local_path }}"
repository_organization: "groton-school"
repository_name: "${{ matrix.package.split_repository }}"
user_name: "battis"
user_email: "sbattis@groton.org"
package_directory: 'packages/php/${{ matrix.package.local_path }}'
repository_organization: 'groton-school'
repository_name: '${{ matrix.package.split_repository }}'
user_name: 'battis'
user_email: 'sbattis@groton.org'
# with tag
- if: "startsWith(github.ref, 'refs/tags/')"
uses: "danharrin/monorepo-split-github-action@v2.3.0"
uses: 'danharrin/monorepo-split-github-action@v2.3.0'
with:
tag: ${GITHUB_REF#refs/tags/}
package_directory: "packages/${{ matrix.package.local_path }}"
repository_organization: "groton-school"
repository_name: "${{ matrix.package.split_repository }}"
user_name: "battis"
user_email: "sbattis@groton.org"
package_directory: 'packages/php/${{ matrix.package.local_path }}'
repository_organization: 'groton-school'
repository_name: '${{ matrix.package.split_repository }}'
user_name: 'battis'
user_email: 'sbattis@groton.org'
44 changes: 20 additions & 24 deletions bin/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const CWD = process.cwd();
templatePath: {
short: 't',
description: `Path to the template package (refer to README.md)`,
default: './packages/typescript-template'
default: './packages/ts/template'
},
prettierConfig: {
short: 'p',
Expand All @@ -48,7 +48,8 @@ const CWD = process.cwd();
spinner.start('Parsing template');
templatePath = path.join(CWD, templatePath!);
const templateFilePaths = await glob(path.join(templatePath, './**/*'), {
ignore: '**/node_modules/**'
ignore: ['**/node_modules/**', '**/dist/**', '**/.DS_Store'],
dot: true
});
spinner.succeed(`Template: ${cli.colors.url(templatePath)}`);

Expand All @@ -73,36 +74,31 @@ const CWD = process.cwd();
fs.mkdirSync(targetPath);
}
} else {
const contents = fs
let contents = fs
.readFileSync(templateFilePath)
.toString()
.replace(/__NAMESPACE__/g, map.namespace)
.replace(/__PACKAGE__/g, map.package)
.replace(/PACKAGE_NAME/g, map.package)
.replace(/__BASE_URL__/g, schema.servers[0].url);
if (path.basename(templateFilePath) == 'package.json') {
const pkg = JSON.parse(fs.readFileSync(targetPath).toString());
fs.writeFileSync(
targetPath,
await prettier.format(
JSON.stringify({
...pkg,
...JSON.parse(contents)
}),
{
...prettierOptions,
filepath: targetPath
}
)
);
} else {
fs.writeFileSync(
targetPath,
await prettier.format(contents, {
...prettierOptions,
filepath: targetPath
})
contents = JSON.stringify({
...pkg,
...JSON.parse(contents)
});
}
try {
contents = await prettier.format(contents, {
...prettierOptions,
filepath: targetPath
});
} catch (error) {
spinner.fail(
`Prettier could not format ${cli.colors.url(targetPath)}`
);
}

fs.writeFileSync(targetPath, contents);
}
spinner.succeed(cli.colors.url(targetPath));
}
Expand Down
1 change: 0 additions & 1 deletion examples/appengine-client/.env.example

This file was deleted.

23 changes: 0 additions & 23 deletions examples/appengine-client/package.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions examples/php/appengine-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scripts": {
"setup": "bin/setup.mjs",
"deploy": "bin/deploy.mjs"
},
"devDependencies": {
"@battis/partly-gcloudy": "^0.4.5",
"@battis/qui-cli": "^0.4.2",
"npm-run-all": "^4.1.5"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lerna-debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
1 notice cli v8.1.8
2 verbose packageConfigs Package manager "pnpm" detected. Resolving packages using `pnpm-workspace.yaml`.
3 verbose rootPath /Users/sbattis/Documents/GitHub/sky-api
4 error Error: Invalid package name "example/sky-api.appengine-client" of package "example/sky-api.appengine-client@file:examples/appengine-client": name can only contain URL-friendly characters.
4 error Error: Invalid package name "__PACKAGE__" of package "__PACKAGE__@file:packages/ts/typescript-template": name cannot start with an underscore.
4 error at invalidPackageName (/Users/sbattis/Documents/GitHub/sky-api/node_modules/.pnpm/npm-package-arg@11.0.2/node_modules/npm-package-arg/lib/npa.js:111:15)
4 error at Result.setName (/Users/sbattis/Documents/GitHub/sky-api/node_modules/.pnpm/npm-package-arg@11.0.2/node_modules/npm-package-arg/lib/npa.js:158:11)
4 error at new Result (/Users/sbattis/Documents/GitHub/sky-api/node_modules/.pnpm/npm-package-arg@11.0.2/node_modules/npm-package-arg/lib/npa.js:147:10)
Expand Down
4 changes: 2 additions & 2 deletions monorepo-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

return static function (MBConfig $mbConfig): void {
$mbConfig->packageDirectories([
__DIR__ . '/packages',
__DIR__ . '/examples',
__DIR__ . '/packages/php',
__DIR__ . '/examples/php',
]);

$mbConfig->workers([
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"build": "run-s build:*",
"build:openapi": "tsx ./bin/schema.ts",
"build:lerna": "lerna run build",
"build:lerna": "lerna run --ignore PACKAGE_NAME build",
"pre-changeset": "run-s pre-changeset:*",
"pre-changeset:monorepo-package-paths": "npx monorepo-package-paths -w --author --homepage --repository",
"pre-changeset:build": "run-s build",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function __construct(
$this->path = $path;
$this->accessToken = $accessToken;
$this->client = new Client([
"base_uri" => Path::join($this->sky->getBaseApiUrl(), $this->path) . "/",
]);
"base_uri" => Path::join($this->sky->getBaseApiUrl(), $this->path) . "/",
]);
}

public function send(string $method, string $url, array $options = []): mixed
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 226e137

Please sign in to comment.