Skip to content

Commit

Permalink
Naming Scheme for plugins (#286)
Browse files Browse the repository at this point in the history
* feat: change plugin naming scheme

* feat: changeset

* test: update test
  • Loading branch information
Cahllagerfeld authored Feb 5, 2023
1 parent 63eb8a8 commit 5df3a8c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/mighty-otters-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@webstone/cli": patch
"create-webstone-app": patch
---

change naming scheme for plugins
2 changes: 1 addition & 1 deletion packages/cli/src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const run = async () => {
const cli = build()
.brand("webstone")
.src(__dirname)
.plugins("./node_modules", { matching: "webstone-plugin-cli-*" })
.plugins("./node_modules", { matching: "webstone-plugin-*-cli" })
.help()
.version()
.exclude([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const renameCliPackage = (ctx: Ctx) => {
const cliPackageJson = fs.readJSONSync(
path.join(ctx.appDir, "packages", "cli", "package.json")
);
cliPackageJson.name = `webstone-plugin-cli-${getAppName(ctx.appDir)}`;
cliPackageJson.name = `webstone-plugin-${getAppName(ctx.appDir)}-cli`;
fs.writeJSONSync(
path.join(ctx.appDir, "packages", "cli", "package.json"),
cliPackageJson,
Expand Down Expand Up @@ -92,7 +92,7 @@ const setWebPackagePrivateTrue = (ctx: Ctx) => {
const createSveltekitPackage = async (ctx: Ctx) => {
fs.removeSync(path.join(ctx.appDir, "packages", "web", ".gitkeep"));
await create(path.join(ctx.appDir, "packages", "web"), {
name: `webstone-plugin-web-${getAppName(ctx.appDir)}`,
name: `webstone-plugin-${getAppName(ctx.appDir)}-web`,
template: "skeletonlib",
types: "typescript",
prettier: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "webstone-plugin-cli-template",
"name": "webstone-plugin-template-cli",
"version": "0.0.1",
"description": "",
"private": true,
"scripts": {
"clean": "rimraf build",
"copy-templates": "copyfiles ./src/templates/* ./build/templates",
"copy-templates": "copyfiles -u 2 ./src/templates/* ./src/templates/**/* build/templates",
"format": "prettier --plugin-search-dir . --write .",
"build": "npm run clean && run-s build:cli copy-templates",
"build:cli": "tsc -p tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-webstone-app/tests/helpers/setup-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test("Check if the cli package gets renamed properly", async () => {
);
assert.is(
fakeWriteJSONSync.firstCall.args[1].name,
"webstone-plugin-cli-dummy"
"webstone-plugin-dummy-cli"
);
});

Expand Down

0 comments on commit 5df3a8c

Please sign in to comment.