Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add copy frontend app dir folder when bump version #416

Merged
merged 28 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
18175c2
feat: Add copy frontend app dir folder when bump version
aXenDeveloper Jul 14, 2024
8303c8e
ci: version bump to v0.0.7-canary.9
gh-action-bump-version Jul 14, 2024
1b8990e
perf: Improve copy files from frontend to package when bump version
aXenDeveloper Jul 14, 2024
7793f4c
ci: version bump to v0.0.7-canary.10
gh-action-bump-version Jul 14, 2024
d0d5873
perf: Create folders when copy files from frontend while bump version
aXenDeveloper Jul 14, 2024
e8ce6a6
ci: version bump to v0.0.7-canary.11
gh-action-bump-version Jul 14, 2024
b4feac7
chore: Clean up
aXenDeveloper Jul 14, 2024
9f76f90
ci: version bump to v0.0.7-canary.12
gh-action-bump-version Jul 14, 2024
f789551
feat(frontend): Add script to copy files from package to frontend
aXenDeveloper Jul 14, 2024
8fa3be5
ci: version bump to v0.0.7-canary.13
gh-action-bump-version Jul 14, 2024
4078ecb
feat(frontend): Add copy langs & plugins when bump package
aXenDeveloper Jul 14, 2024
4624c07
ci: version bump to v0.0.7-canary.14
gh-action-bump-version Jul 14, 2024
ee24b6e
chore: Add warning comments for files to not touch file
aXenDeveloper Jul 14, 2024
738594c
ci: version bump to v0.0.7-canary.15
gh-action-bump-version Jul 14, 2024
6ade35f
chore: Clean up
aXenDeveloper Jul 14, 2024
b57ddc4
ci: version bump to v0.0.7-canary.16
gh-action-bump-version Jul 14, 2024
da56b2f
chore: Add layout admin auth to bump version script
aXenDeveloper Jul 14, 2024
ab925e3
ci: version bump to v0.0.7-canary.17
gh-action-bump-version Jul 14, 2024
a93b91a
perf: Fix copy files from package
aXenDeveloper Jul 15, 2024
4dce7d6
chore: Clean up
aXenDeveloper Jul 15, 2024
8e1b5ac
ci: version bump to v0.0.7-canary.18
gh-action-bump-version Jul 15, 2024
f869e61
chore: Add console log to debug package
aXenDeveloper Jul 15, 2024
8382172
ci: version bump to v0.0.7-canary.19
gh-action-bump-version Jul 15, 2024
a8f8f41
chore: Add withFileTypes
aXenDeveloper Jul 15, 2024
91ff584
Merge branch 'packages/generate_files_app_dir' of https://github.com/…
aXenDeveloper Jul 15, 2024
865faf3
ci: version bump to v0.0.7-canary.20
gh-action-bump-version Jul 15, 2024
cd9ec0b
fix: Iterators recursively files in setup frontend script
aXenDeveloper Jul 15, 2024
3ca082b
ci: version bump to v0.0.7-canary.21
gh-action-bump-version Jul 15, 2024
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
9 changes: 6 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,21 @@ jobs:

- name: Publish canary
if: github.event.inputs.release == 'canary'
run: pnpm publish --provenance --access public --filter vitnode-backend --filter vitnode-frontend --filter vitnode-shared --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag canary --no-git-checks
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-frontend --filter vitnode-shared --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag canary --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Publish release candidate
if: github.event.inputs.release == 'release-candidate'
run: pnpm publish --provenance --access public --filter vitnode-backend --filter vitnode-frontend --filter vitnode-shared --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag rc --no-git-checks
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-frontend --filter vitnode-shared --filter create-vitnode-app --filter eslint-config-typescript-vitnode --tag rc --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Publish stable
if: github.event.inputs.release == 'stable'
run: pnpm publish --provenance --access public --filter vitnode-backend --filter vitnode-frontend --filter vitnode-shared --filter create-vitnode-app --filter eslint-config-typescript-vitnode --no-git-checks
run: pnpm publish --access public --filter vitnode-backend --filter vitnode-frontend --filter vitnode-shared --filter create-vitnode-app --filter eslint-config-typescript-vitnode --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
2 changes: 1 addition & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "0.0.7-canary.8",
"version": "0.0.7-canary.21",
"license": "MIT",
"scripts": {
"config:init": "vitnode-backend init",
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/database.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI

import tableCore from '@/plugins/core/admin/database/index';
import tableWelcome from '@/plugins/welcome/admin/database/index';
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/plugins/plugins.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI

import { Module } from '@nestjs/common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import { defineConfig } from 'drizzle-kit';

import { DATABASE_ENVS } from '@/database';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import { default as tables } from './index';

export const getTables = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.0.7-canary.8",
"version": "0.0.7-canary.21",
"private": true,
"scripts": {
"dev:docs": "next dev --port 3030",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import { notFound } from 'next/navigation';

export default function CatchAllPage() {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/app/[locale]/(main)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI

import React from 'react';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
FilesAdvancedCoreAdminView,
FilesAdvancedCoreAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import { DashboardCoreAdminView } from 'vitnode-frontend/admin/core/dashboard/dashboard-core-admin-view';

export default function Page() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
LangsCoreAdminView,
LangsCoreAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
FilesDevPluginAdminView,
FilesDevPluginAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
DevPluginAdminLayout,
generateMetadataDevPluginAdminLayout,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
NavDevPluginAdminView,
NavDevPluginAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
OverviewDevPluginAdminView,
OverviewDevPluginAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
PluginsAdminView,
PluginsAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
EmailSettingsAdminView,
generateMetadataEmailSettingsAdmin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
MainSettingsCoreAdminView,
generateMetadataMainSettingsCoreAdmin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
ManifestMetadataCoreAdminView,
generateMetadataManifestMetadataCoreAdmin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
CaptchaSecurityAdminView,
generateMetadataCaptchaSecurityAdmin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
EditorAdminView,
generateMetadataEditorAdmin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
NavAdminView,
generateMetadataNavAdmin,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
GroupsMembersAdminView,
GroupsMembersAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
AdministratorsStaffAdminView,
AdministratorsStaffAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
ModeratorsStaffAdminView,
ModeratorsStaffAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
UsersMembersAdminView,
UsersMembersAdminViewProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import React from 'react';
import {
AdminLayout,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import {
generateMetadataInstallConfigs,
InstallConfigsView,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import { SignInAdminView } from 'vitnode-frontend/admin/sign-in/sign-in-admin-view';

export default function Page() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import React from 'react';
import 'vitnode-frontend/admin/css';

Expand Down
1 change: 1 addition & 0 deletions apps/frontend/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
import React from 'react';
import { GeistSans } from 'geist/font/sans';
import {
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
'use client';

import { NotFoundView } from 'vitnode-frontend/views/theme/views/not-found';
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
// ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI

type IntlMessages = typeof import('@/plugins/core/langs/en.json') &
typeof import('@/plugins/welcome/langs/en.json') &
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "frontend",
"version": "0.0.7-canary.8",
"version": "0.0.7-canary.21",
"author": "Maciej Piotr (aXenDev) Balcerzak",
"license": "GPL-3.0 license",
"scripts": {
"config:init": "vitnode-frontend init",
"dev": "next dev --turbo",
"dev:turbo": "next dev --turbo",
"build": "next build",
Expand Down
70 changes: 69 additions & 1 deletion bump-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { execSync, spawn } from 'child_process';
import { existsSync, readFileSync } from 'fs';
import { EOL } from 'os';
import path from 'path';
import path, { join } from 'path';
import * as fs from 'fs';

const ALLOWED_VERSION_TYPES = ['major', 'minor', 'patch'];
const GIT_USER_NAME = process.env.GITHUB_USER || 'Automated Version Bump';
Expand Down Expand Up @@ -271,6 +272,73 @@ function logError(error) {

const remoteRepo = `https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git`;
await runInWorkspace('git', ['push', remoteRepo]);

// Copy frontend files from app dir
const frontendPackagePath = path.join(
WORKSPACE,
'packages',
'frontend',
'folders_to_copy',
);
const frontendAppPath = path.join(WORKSPACE, 'apps', 'frontend');
const pathsToFoldersForce = [
join('app', '[locale]', 'admin', '(vitnode)'),
join('app', '[locale]', 'admin', '(auth)', '(vitnode)'),
join('app', '[locale]', '(main)', '(vitnode)'),
];
const pathsToFiles = [
{
folder: 'app',
file: 'not-found.tsx',
},
{
folder: join('app', `[locale]`),
file: 'layout.tsx',
},
{
folder: join('app', `[locale]`, 'admin'),
file: 'layout.tsx',
},
{
folder: join('app', `[locale]`, '(main)'),
file: 'page.tsx',
},
{
folder: join('app', `[locale]`, 'admin', '(auth)'),
file: 'layout.tsx',
},
{
folder: join('plugins', 'core', 'langs'),
file: 'en.json',
},
];

// Create folder for apps in frontend package
if (!fs.existsSync(frontendPackagePath)) {
fs.mkdirSync(frontendPackagePath, { recursive: true });
}

// Copy folders
pathsToFoldersForce.forEach(folder => {
const appPath = join(frontendAppPath, folder);
const packagePath = join(frontendPackagePath, folder);
if (!fs.existsSync(packagePath)) {
fs.mkdirSync(packagePath, { recursive: true });
}

fs.cpSync(appPath, packagePath, { recursive: true });
});

// Copy files
pathsToFiles.forEach(file => {
const appPath = join(frontendAppPath, file.folder, file.file);
const packagePath = join(frontendPackagePath, file.folder, file.file);

fs.cpSync(appPath, packagePath, {
recursive: true,
});
});

exitSuccess('Version bumped!');
} catch (e) {
logError(e);
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vitnode-backend",
"version": "0.0.7-canary.8",
"version": "0.0.7-canary.21",
"description": "Backend wrapper for VitNode projects",
"author": "VitNode Team",
"license": "MIT",
Expand Down
39 changes: 12 additions & 27 deletions packages/backend/scripts/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import { generateConfig } from './generate-config';

import { createClientDatabase, DATABASE_ENVS } from '@/utils/database/client';

const initConsole = '\x1b[34m[VitNode]\x1b[0m \x1b[33m[Backend]\x1b[0m';

const init = async () => {
let skipDatabase = false;
if (process.argv[3] === '--skip-database') {
console.log(
'\x1b[34m%s\x1b[0m',
'[VitNode]',
'`--skip-database` flag detected. Skipping database setup...',
);
const skipDatabaseMessage = `${initConsole} '--skip-database' flag detected. Skipping database setup...`;
console.log(skipDatabaseMessage);
skipDatabase = true;
}

Expand All @@ -34,36 +33,24 @@ const init = async () => {
}

console.log(
'\x1b[34m%s\x1b[0m',
'[VitNode]',
`[1/${skipDatabase ? 2 : 6}] Setup the project. Generating the config file...`,
`${initConsole} [1/${skipDatabase ? 2 : 6}] Setup the project. Generating the config file...`,
);
generateConfig({ pluginsPath });

console.log(
'\x1b[34m%s\x1b[0m',
'[VitNode]',
`[2/${skipDatabase ? 2 : 6}] Copying files into backend...`,
`${initConsole} [2/${skipDatabase ? 2 : 6}] Copying files into backend...`,
);
copyFiles({ pluginsPath });

if (skipDatabase) {
console.log('\x1b[34m%s\x1b[0m', '[VitNode]', '✅ Project setup complete.');
console.log(`${initConsole} ✅ Project setup complete.`);
process.exit(0);
}

console.log(
'\x1b[34m%s\x1b[0m',
'[VitNode]',
'[3/6] Generating database migrations...',
);
console.log(`${initConsole} [3/6] Generating database migrations...`);
await generateDatabaseMigrations({ pluginsPath });

console.log(
'\x1b[34m%s\x1b[0m',
'[VitNode]',
'[4/6] Generating the manifest files...',
);
console.log(`${initConsole} [4/6] Generating the manifest files...`);
generateManifest();

const database = createClientDatabase({
Expand All @@ -72,17 +59,15 @@ const init = async () => {
});

console.log(
'\x1b[34m%s\x1b[0m',
'[VitNode]',
'[5/6] Create tables in database using migrations...',
`${initConsole} [5/6] Create tables in database using migrations...`,
);
await createTablesDatabaseUsingMigrations({ pluginsPath, db: database.db });

console.log('\x1b[34m%s\x1b[0m', '[VitNode]', '[6/6] Updating plugins...');
console.log(`${initConsole} [6/6] Updating plugins...`);
await updatePlugins({ pluginsPath, db: database.db });

await database.poolDB.end();
console.log('\x1b[34m%s\x1b[0m', '[VitNode]', '✅ Project setup complete.');
console.log(`${initConsole} ✅ Project setup complete.`);
process.exit(0);
};

Expand Down
Loading