Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
chore(workflows): change to npm publish (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh authored Oct 8, 2023
1 parent cd0ab10 commit 3a0ed20
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

- run: npm config set "//registry.npmjs.org/:_authToken" "\${NPM_AUTH_TOKEN}" --location=project

- run: pnpm -r publish --access public --tag latest --no-git-checks
- run: pnpm -r exec npm publish --access public --tag latest --no-git-checks
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion packages/create-levain-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": {
"@levain-examples/examples": "workspace:*",
"@types/pacote": "^11.1.6",
"execa": "^8.0.1",
"execa": "^5.1.1",
"pacote": "^17.0.4",
"picocolors": "^1.0.0",
"prompts": "^2.4.2",
Expand Down
18 changes: 14 additions & 4 deletions packages/create-levain-app/src/TemplateProgram.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { writeFileSync } from 'node:fs';
import { readFile, writeFile } from 'node:fs/promises';
import { join } from 'node:path';

import { execa } from 'execa';
import execa from 'execa';
import pacote from 'pacote';
import { blue } from 'picocolors';

Expand All @@ -15,6 +15,7 @@ export class TemplateProgram {
await pacote.extract(packageSpec, installDir);

await overridePackageJson(installDir, projectConfig);
// await removeFiles(installDir);

console.log(` Installing dependencies...`);
await execa('npm', ['install'], { cwd: installDir });
Expand All @@ -28,9 +29,18 @@ export class TemplateProgram {

async function overridePackageJson(installDir: string, projectConfig: ProjectConfig): Promise<void> {
const packageJsonPath = join(installDir, 'package.json');
const packageJson = await import(packageJsonPath);
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
packageJson.name = projectConfig.path;
packageJson.private = true;
packageJson.version = '0.0.0';
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
}

// async function removeFiles(installDir: string): Promise<void> {
// for (const file of [
// '.npmignore',
// 'LICENSE',
// ]) {
// await rm(join(installDir, file));
// }
// }
53 changes: 13 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 3a0ed20

@vercel
Copy link

@vercel vercel bot commented on 3a0ed20 Oct 8, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.